\");\n\n list.popup = new ui.Popup(list.list.parent(), extend({}, list.options.popup, {\n anchor: list.wrapper,\n open: list._openHandler.bind(list),\n close: list._closeHandler.bind(list),\n animation: list.options.animation,\n isRtl: support.isRtl(list.wrapper),\n autosize: list.options.autoWidth,\n activate: () => {\n this._refreshFloatingLabel();\n },\n deactivate: () => {\n this._refreshFloatingLabel();\n }\n }));\n\n list.popup.element.prepend(list.header)\n .on(MOUSEDOWN + this.ns, this._listMousedown.bind(this));\n },\n\n _toggleHover: function(e) {\n $(e.currentTarget).toggleClass(HOVER, e.type === MOUSEENTER);\n },\n\n _toggle: function(open, preventFocus) {\n var that = this;\n var touchEnabled = support.mobileOS && (support.touch || support.MSPointers || support.pointers);\n\n open = open !== undefined$1 ? open : !that.popup.visible();\n\n if (!preventFocus && !touchEnabled && that._focused[0] !== activeElement()) {\n that._prevent = true;\n that._focused.trigger(FOCUS);\n that._prevent = false;\n }\n\n that[open ? OPEN : CLOSE]();\n },\n\n _triggerCascade: function() {\n var that = this;\n\n if (!that._cascadeTriggered || that.value() !== unifyType(that._cascadedValue, typeof that.value())) {\n that._cascadedValue = that.value();\n that._cascadeTriggered = true;\n that.trigger(CASCADE, { userTriggered: that._userTriggered });\n }\n },\n\n _triggerChange: function() {\n if (this._valueBeforeCascade !== this.value()) {\n this.trigger(CHANGE);\n }\n },\n\n _unbindDataSource: function() {\n var that = this;\n\n that.dataSource.unbind(REQUESTSTART, that._requestStartHandler)\n .unbind(REQUESTEND, that._requestEndHandler)\n .unbind(\"error\", that._errorHandler);\n },\n\n requireValueMapper: function(options, value) {\n var hasValue = (options.value instanceof Array ? options.value.length : options.value) || (value instanceof Array ? value.length : value);\n if (hasValue && options.virtual && typeof options.virtual.valueMapper !== \"function\") {\n throw new Error(\"ValueMapper is not provided while the value is being set. See http://docs.telerik.com/kendo-ui/controls/editors/combobox/virtualization#the-valuemapper-function\");\n }\n }\n });\n\n function unifyType(value, type) {\n if (value !== undefined$1 && value !== \"\" && value !== null) {\n if (type === \"boolean\") {\n if (typeof value !== \"boolean\") {\n value = value.toString().toLowerCase() === \"true\";\n }\n value = Boolean(value);\n } else if (type === \"number\") {\n value = Number(value);\n } else if (type === \"string\") {\n value = value.toString();\n }\n }\n\n return value;\n }\n\n extend(List, {\n inArray: function(node, parentNode) {\n var idx, length, siblings = parentNode.children;\n\n if (!node || node.parentNode !== parentNode) {\n return -1;\n }\n\n for (idx = 0, length = siblings.length; idx < length; idx++) {\n if (node === siblings[idx]) {\n return idx;\n }\n }\n\n return -1;\n },\n unifyType: unifyType\n });\n\n kendo.ui.List = List;\n\n ui.Select = List.extend({\n init: function(element, options) {\n List.fn.init.call(this, element, options);\n this._initial = this.element.val();\n },\n\n setDataSource: function(dataSource) {\n var that = this;\n var parent;\n\n that.options.dataSource = dataSource;\n\n that._dataSource();\n\n if (that.listView.bound()) {\n that._initialIndex = null;\n that.listView._current = null;\n }\n\n that.listView.setDataSource(that.dataSource);\n\n if (that.options.autoBind) {\n that.dataSource.fetch();\n }\n\n parent = that._parentWidget();\n\n if (parent) {\n that._cascadeSelect(parent);\n }\n },\n\n close: function() {\n this.popup.close();\n },\n\n select: function(candidate) {\n var that = this;\n\n if (candidate === undefined$1) {\n return that.selectedIndex;\n } else {\n return that._select(candidate).done(function() {\n that._cascadeValue = that._old = that._accessor();\n that._oldIndex = that.selectedIndex;\n\n that._refreshFloatingLabel();\n });\n }\n },\n\n _accessor: function(value, idx) {\n return this[this._isSelect ? \"_accessorSelect\" : \"_accessorInput\"](value, idx);\n },\n\n _accessorInput: function(value) {\n var element = this.element[0];\n\n if (value === undefined$1) {\n return element.value;\n } else {\n if (value === null) {\n value = \"\";\n }\n element.value = value;\n }\n },\n\n _accessorSelect: function(value, idx) {\n var element = this.element[0];\n var hasValue;\n\n if (value === undefined$1) {\n return getSelectedOption(element).value || \"\";\n }\n\n getSelectedOption(element).selected = false;\n\n if (idx === undefined$1) {\n idx = -1;\n }\n\n hasValue = (value !== null && value !== \"\");\n\n if (hasValue && idx == -1) {\n this._custom(value);\n } else {\n if (value) {\n element.value = value;\n } else {\n element.selectedIndex = idx;\n }\n }\n },\n\n _syncValueAndText: function() {\n return true;\n },\n\n _custom: function(value) {\n var that = this;\n var element = that.element;\n var custom = that._customOption;\n\n if (!custom) {\n custom = $(\"
\");\n that._customOption = custom;\n\n element.append(custom);\n }\n\n custom.text(value);\n custom[0].selected = true;\n },\n\n _hideBusy: function() {\n var that = this;\n clearTimeout(that._busy);\n that._arrowIcon.removeClass(LOADING);\n that._focused.attr(ARIA_BUSY, false);\n that._busy = null;\n that._showClear();\n },\n\n _showBusy: function(e) {\n var that = this;\n\n if (e.isDefaultPrevented()) {\n return;\n }\n\n that._request = true;\n\n if (that._busy) {\n return;\n }\n\n that._busy = setTimeout(function() {\n if (that._arrowIcon) { //destroyed after request start\n that._focused.attr(ARIA_BUSY, true);\n that._arrowIcon.addClass(LOADING);\n that._hideClear();\n }\n }, 100);\n },\n\n _requestEnd: function() {\n this._request = false;\n this._hideBusy();\n },\n\n _dataSource: function() {\n var that = this,\n element = that.element,\n options = that.options,\n dataSource = options.dataSource || {},\n idx;\n\n dataSource = Array.isArray(dataSource) ? { data: dataSource } : dataSource;\n\n if (that._isSelect) {\n idx = element[0].selectedIndex;\n if (idx > -1) {\n options.index = idx;\n }\n\n dataSource.select = element;\n dataSource.fields = [{ field: options.dataTextField },\n { field: options.dataValueField }];\n }\n\n if (that.dataSource) {\n that._unbindDataSource();\n } else {\n that._requestStartHandler = that._showBusy.bind(that);\n that._requestEndHandler = that._requestEnd.bind(that);\n that._errorHandler = that._hideBusy.bind(that);\n }\n\n that.dataSource = kendo.data.DataSource.create(dataSource)\n .bind(REQUESTSTART, that._requestStartHandler)\n .bind(REQUESTEND, that._requestEndHandler)\n .bind(\"error\", that._errorHandler);\n },\n\n _firstItem: function() {\n this.listView.focusFirst();\n },\n\n _lastItem: function() {\n this.listView.focusLast();\n },\n\n _nextItem: function() {\n return this.listView.focusNext();\n },\n\n _prevItem: function() {\n return this.listView.focusPrev();\n },\n\n _getNormalizedDataItem: function(candidate) {\n var that = this,\n listView = that.listView,\n isIndex = typeof candidate === \"number\",\n hasOptionLabel = that.optionLabel && that.optionLabel.length,\n index;\n\n if (isIndex) {\n index = hasOptionLabel ? --candidate : candidate;\n } else {\n index = listView.getElementIndex(candidate);\n }\n\n return listView.dataItemByIndex(index);\n },\n\n _getNormalizedSelectCandidate: function(candidate) {\n var that = this,\n hasOptionLabel = that.optionLabel && that.optionLabel.length,\n isIndex = typeof candidate === \"number\",\n normalizedCandidate = candidate;\n\n if (hasOptionLabel && isIndex) {\n normalizedCandidate++;\n }\n\n return normalizedCandidate;\n },\n\n _move: function(e) {\n var that = this;\n var listView = that.listView;\n var key = e.keyCode;\n var down = key === keys.DOWN;\n var isVirtual = that.options.virtual;\n var dataItem;\n var pressed;\n var current;\n var moveIndex;\n var selectCandidate;\n\n if (key === keys.UP || down) {\n if (e.altKey) {\n that.toggle(down);\n } else {\n if (!listView.bound() && !that.ul[0].firstChild) {\n if (!that._fetch) {\n that.dataSource.one(CHANGE, function() {\n that._fetch = false;\n that._move(e);\n });\n\n that._fetch = true;\n that._filterSource();\n }\n\n e.preventDefault();\n\n return true; //pressed\n }\n\n current = that._focus();\n\n if (!that._fetch && (!current || current.hasClass(KSELECTED))) {\n if (down) {\n moveIndex = that._nextItem();\n\n if ((isVirtual && moveIndex <= 0) || (!that._focus() && !moveIndex) ) {\n that._lastItem();\n }\n } else {\n moveIndex = that._prevItem();\n\n if ((isVirtual && moveIndex >= listView.dataSource.total() - 1) || (!that._focus() && !moveIndex)) {\n that._firstItem();\n }\n }\n }\n\n selectCandidate = that._getNormalizedSelectCandidate(that._get(that._focus()) || moveIndex || 0);\n\n that._select(selectCandidate, true).done(function() {\n var done = function() {\n if (!that.popup.visible()) {\n that._blur();\n }\n\n if (that._cascadedValue === null) {\n that._cascadedValue = that.value();\n } else {\n that._cascadedValue = that.dataItem() ? that.dataItem()[that.options.dataValueField] || that.dataItem() : null;\n }\n };\n\n if (that.trigger(SELECT, { dataItem: that._getNormalizedDataItem(selectCandidate), item: that._focus() })) {\n that._select(current).done(done);\n } else {\n done();\n }\n });\n }\n\n e.preventDefault();\n pressed = true;\n } else if (key === keys.ENTER || key === keys.TAB) {\n if (that.popup.visible()) {\n e.preventDefault();\n }\n\n current = that._focus();\n dataItem = that.dataItem();\n\n if (!that.popup.visible() && (!dataItem || that.text() !== that._text(dataItem))) {\n current = null;\n }\n\n var activeFilter = that.filterInput && that.filterInput[0] === activeElement();\n var selection;\n\n if (current) {\n dataItem = listView.dataItemByIndex(listView.getElementIndex(current));\n var shouldTrigger = true;\n\n if (dataItem) {\n shouldTrigger = that._value(dataItem) !== List.unifyType(that.value(), typeof that._value(dataItem));\n }\n\n if (shouldTrigger && that.trigger(SELECT, { dataItem: dataItem, item: current })) {\n return;\n }\n\n selection = that._select(current);\n } else if (that.input) {\n if (that._syncValueAndText() || that._isSelect) {\n that._accessor(that.input.val());\n }\n that.listView.value(that.input.val());\n }\n\n if (that._focusElement) {\n that._focusElement(that.wrapper);\n }\n\n if (activeFilter && key === keys.TAB) {\n that.wrapper.focusout();\n } else {\n if (selection && typeof selection.done === \"function\") {\n selection.done(function() {\n that._blur();\n });\n } else {\n that._blur();\n }\n }\n\n that.close();\n pressed = true;\n } else if (key === keys.ESC) {\n if (that.popup.visible()) {\n e.preventDefault();\n }\n that.close();\n pressed = true;\n } else if (that.popup.visible() && (key === keys.PAGEDOWN || key === keys.PAGEUP)) {\n e.preventDefault();\n\n var direction = key === keys.PAGEDOWN ? 1 : -1;\n listView.scrollWith(direction * listView.screenHeight());\n\n pressed = true;\n }\n\n return pressed;\n },\n\n _fetchData: function() {\n var that = this;\n var hasItems = !!that.dataSource.view().length;\n\n if (that._request || that.options.cascadeFrom) {\n return;\n }\n\n if (!that.listView.bound() && !that._fetch && !hasItems) {\n that._fetch = true;\n that.dataSource.fetch().done(function() {\n that._fetch = false;\n });\n }\n },\n\n _options: function(data, optionLabel, value) {\n var that = this,\n element = that.element,\n htmlElement = element[0],\n length = data.length,\n options = \"\",\n option,\n dataItem,\n dataText,\n dataValue,\n idx = 0;\n\n if (optionLabel) {\n options = optionLabel;\n }\n\n for (; idx < length; idx++) {\n option = \"
\";\n options += option;\n }\n\n element.html(options);\n\n if (value !== undefined$1) {\n htmlElement.value = value;\n if (htmlElement.value && !value) {\n htmlElement.selectedIndex = -1;\n }\n }\n\n if (htmlElement.selectedIndex !== -1) {\n option = getSelectedOption(htmlElement);\n\n if (option) {\n option.setAttribute(SELECTED, SELECTED);\n }\n }\n },\n\n _reset: function() {\n var that = this,\n element = that.element,\n formId = element.attr(\"form\"),\n form = formId ? $(\"#\" + formId) : element.closest(\"form\");\n\n if (form[0]) {\n that._resetHandler = function() {\n setTimeout(function() {\n that.value(that._initial);\n });\n };\n\n that._form = form.on(\"reset\", that._resetHandler);\n }\n },\n\n _parentWidget: function() {\n var name = this.options.name;\n\n if (!this.options.cascadeFrom) {\n return;\n }\n\n var parentElement = $(\"#\" + this.options.cascadeFrom);\n var parent = parentElement.data(\"kendo\" + name);\n\n if (!parent) {\n for (var i = 0; i < alternativeNames[name].length; i += 1) {\n parent = parentElement.data(\"kendo\" + alternativeNames[name][i]);\n\n if (!!parent) {\n break;\n }\n }\n }\n\n return parent;\n },\n\n _cascade: function() {\n var that = this;\n var options = that.options;\n var cascade = options.cascadeFrom;\n var parent;\n\n if (cascade) {\n parent = that._parentWidget();\n\n if (!parent) {\n return;\n }\n\n that._cascadeHandlerProxy = that._cascadeHandler.bind(that);\n that._cascadeFilterRequests = [];\n\n options.autoBind = false;\n\n parent.bind(\"set\", function() { //will cascade\n that.one(\"set\", function(e) { //get your value\n that._selectedValue = e.value || that._accessor();\n });\n });\n\n parent.first(CASCADE, that._cascadeHandlerProxy);\n\n //refresh was called\n if (parent.listView.bound()) {\n that._toggleCascadeOnFocus();\n that._cascadeSelect(parent);\n } else {\n parent.one(DATA_BOUND, function() {\n that._toggleCascadeOnFocus();\n if (parent.popup.visible()) {\n parent._focused.trigger(FOCUS);\n }\n });\n\n if (!parent.value()) {\n that.enable(false);\n }\n }\n }\n },\n\n _toggleCascadeOnFocus: function() {\n var that = this;\n var parent = that._parentWidget();\n var focusout = isIE && parent instanceof ui.DropDownList ? BLUR : FOCUSOUT;\n\n parent._focused.add(parent.filterInput).on(FOCUS, function() {\n parent.unbind(CASCADE, that._cascadeHandlerProxy);\n parent.unbind(CHANGE, that._cascadeHandlerProxy);\n parent.first(CHANGE, that._cascadeHandlerProxy);\n });\n\n parent._focused.add(parent.filterInput).on(focusout, function() {\n parent.unbind(CHANGE, that._cascadeHandlerProxy);\n parent.unbind(CASCADE, that._cascadeHandlerProxy);\n parent.first(CASCADE, that._cascadeHandlerProxy);\n });\n },\n\n _cascadeHandler: function(e) {\n var parent = this._parentWidget();\n var valueBeforeCascade = this.value();\n\n this._userTriggered = e.userTriggered || parent._userTriggered;\n\n if (this.listView.bound()) {\n this._clearSelection(parent, true);\n }\n\n this._cascadeSelect(parent, valueBeforeCascade);\n },\n\n _cascadeChange: function(parent) {\n var that = this;\n var value = that._accessor() || that._selectedValue;\n\n if (!that._cascadeFilterRequests.length) {\n that._selectedValue = null;\n }\n\n if (that._userTriggered) {\n that._clearSelection(parent, true);\n } else if (value) {\n if (value !== unifyType(that.listView.value()[0], typeof value)) {\n that.value(value);\n }\n\n if (!that.dataSource.view()[0] || that.selectedIndex === -1) {\n that._clearSelection(parent, true);\n }\n } else if (that.dataSource.flatView().length) {\n that.select(that.options.index);\n }\n\n that.enable();\n that._triggerCascade();\n that._triggerChange();\n that._userTriggered = false;\n },\n\n _cascadeSelect: function(parent, valueBeforeCascade) {\n var that = this;\n var dataItem = parent.dataItem();\n var filterValue = dataItem ? dataItem[that.options.cascadeFromParentField] || parent._value(dataItem) : null;\n var valueField = that.options.cascadeFromField || parent.options.dataValueField;\n var expressions;\n\n // Applicable only when parent is ComboBox or MultiColumnComboBox\n if (parent.options.cascadeOnCustomValue &&\n filterValue === null &&\n (!that.options.cascadeFromParentField || that.options.cascadeFromParentField === parent.options.dataValueField)) {\n filterValue = parent.value();\n }\n\n that._valueBeforeCascade = valueBeforeCascade !== undefined$1 ? valueBeforeCascade : that.value();\n\n if (filterValue || filterValue === 0) {\n expressions = that.dataSource.filter() || {};\n removeFiltersForField(expressions, valueField);\n\n var handler = function() {\n var currentHandler = that._cascadeFilterRequests.shift();\n if (currentHandler) {\n that.unbind('dataBound', currentHandler);\n }\n\n currentHandler = that._cascadeFilterRequests[0];\n if (currentHandler) {\n that.first('dataBound', currentHandler);\n }\n\n that._cascadeChange(parent);\n };\n\n that._cascadeFilterRequests.push(handler);\n\n if (that._cascadeFilterRequests.length === 1) {\n that.first('dataBound', handler);\n }\n\n that._cascading = true;\n that._filterSource({\n field: valueField,\n operator: \"eq\",\n value: filterValue\n });\n that._cascading = false;\n } else {\n that.enable(false);\n that._clearSelection(parent);\n that._triggerCascade();\n that._triggerChange();\n that._userTriggered = false;\n }\n\n that._refreshFloatingLabel();\n }\n });\n\n var STATIC_LIST_NS = \".StaticList\";\n\n var StaticList = kendo.ui.DataBoundWidget.extend({\n init: function(element, options) {\n Widget.fn.init.call(this, element, options);\n\n this.element.attr(\"role\", \"listbox\")\n .on(CLICK + STATIC_LIST_NS, \"li\", this._click.bind(this))\n .on(MOUSEENTER + STATIC_LIST_NS, \"li\", function() { $(this).addClass(HOVER); })\n .on(MOUSELEAVE + STATIC_LIST_NS, \"li\", function() { $(this).removeClass(HOVER); });\n\n if (options && options.ariaLabel) {\n this.element.attr(ARIA_LABEL, options.ariaLabel);\n } else if (options && options.ariaLabelledBy) {\n this.element.attr(ARIA_LABELLEDBY, options.ariaLabelledBy);\n }\n\n if (support.touch) {\n this._touchHandlers();\n }\n\n if (this.options.selectable === \"multiple\") {\n this.element.attr(ARIA_MULTISELECTABLE, true);\n }\n\n if (this.options.columns && this.options.columns.length) {\n var thead = this.element.parent().find('.k-table-thead');\n var row = $('
' +\n ' | ' +\n '
');\n\n thead.append(row);\n\n this.header = row.find(\".k-table-th\");\n\n this.content = this.element.wrap(\"
\").parent();\n\n this.element.addClass(TABLE_LIST);\n } else {\n this.content = this.element.wrap(\"
\").parent();\n this.header = this.content.before('').prev();\n this.element.addClass(LIST_UL);\n }\n\n this.bound(false);\n\n this._optionID = kendo.guid();\n\n this._selectedIndices = [];\n\n this._view = [];\n this._dataItems = [];\n this._values = [];\n\n var value = this.options.value;\n\n if (value) {\n this._values = Array.isArray(value) ? value.slice(0) : [value];\n }\n\n this._getter();\n this._templates();\n\n this.setDataSource(this.options.dataSource);\n\n this._createOnScrollProxy();\n },\n\n options: {\n name: \"StaticList\",\n dataValueField: null,\n valuePrimitive: false,\n selectable: true,\n template: null,\n groupTemplate: null,\n fixedGroupTemplate: null,\n ariaLabel: null,\n ariaLabelledBy: null\n },\n\n events: [\n CLICK,\n CHANGE,\n ACTIVATE,\n DEACTIVATE,\n DATA_BINDING,\n DATA_BOUND,\n SELECTED_ITEM_CHANGE\n ],\n\n setDataSource: function(source) {\n var that = this;\n var dataSource = source || {};\n var value;\n\n dataSource = Array.isArray(dataSource) ? { data: dataSource } : dataSource;\n dataSource = kendo.data.DataSource.create(dataSource);\n\n if (that.dataSource) {\n that.dataSource.unbind(CHANGE, that._refreshHandler);\n\n value = that.value();\n\n that.value([]);\n that.bound(false);\n\n that.value(value);\n } else {\n that._refreshHandler = that.refresh.bind(that);\n }\n\n that.setDSFilter(dataSource.filter());\n\n that.dataSource = dataSource.bind(CHANGE, that._refreshHandler);\n that._fixedHeader();\n },\n\n _touchHandlers: function() {\n var that = this,\n itemSelector = this.options.columns && this.options.columns.length ? ITEMSELECTORTABLE : ITEMSELECTOR,\n startY, endY,\n tapPosition = function(event) {\n return (event.originalEvent || event).changedTouches[0].pageY;\n };\n\n that.element.on(\"touchstart\" + STATIC_LIST_NS, function(e) {\n startY = tapPosition(e);\n });\n\n that.element.on(\"touchend\" + STATIC_LIST_NS, function(e) {\n if (e.isDefaultPrevented()) {\n return;\n }\n\n endY = tapPosition(e);\n\n if (Math.abs(endY - startY) < 10) {\n that._touchTriggered = true;\n that._triggerClick($(e.target).closest(itemSelector).get(0));\n }\n });\n },\n\n skip: function() {\n return this.dataSource.skip();\n },\n\n setOptions: function(options) {\n Widget.fn.setOptions.call(this, options);\n\n this._getter();\n this._templates();\n this._render();\n\n if (options.label) {\n this.label.setOptions(options.label);\n } else if (options.label === false) {\n this.label._unwrapFloating();\n this._inputLabel.remove();\n delete this._inputLabel;\n }\n },\n\n destroy: function() {\n this.element.off(STATIC_LIST_NS);\n\n if (this._refreshHandler) {\n this.dataSource.unbind(CHANGE, this._refreshHandler);\n }\n\n clearTimeout(this._scrollId);\n\n Widget.fn.destroy.call(this);\n },\n\n dataItemByIndex: function(index) {\n return this.dataSource.flatView()[index];\n },\n\n screenHeight: function() {\n return this.content[0].clientHeight;\n },\n\n scrollToIndex: function(index) {\n var item = this.element[0].children[index];\n\n if (item) {\n this.scroll(item);\n }\n },\n\n scrollWith: function(value) {\n this.content.scrollTop(this.content.scrollTop() + value);\n },\n\n scroll: function(item) {\n if (!item) {\n return;\n }\n\n if (item[0]) {\n item = item[0];\n }\n\n var content = this.content[0],\n itemOffsetTop = item.offsetTop,\n itemOffsetHeight = item.offsetHeight,\n contentScrollTop = content.scrollTop,\n contentOffsetHeight = content.clientHeight,\n bottomDistance = itemOffsetTop + itemOffsetHeight;\n\n if (contentScrollTop > itemOffsetTop) {\n contentScrollTop = itemOffsetTop;\n } else if (bottomDistance > (contentScrollTop + contentOffsetHeight)) {\n contentScrollTop = (bottomDistance - contentOffsetHeight);\n }\n\n content.scrollTop = contentScrollTop;\n },\n\n selectedDataItems: function(dataItems) {\n if (dataItems === undefined$1) {\n return this._dataItems.slice();\n }\n\n this._dataItems = dataItems;\n this._values = this._getValues(dataItems);\n },\n\n _getValues: function(dataItems) {\n var getter = this._valueGetter;\n\n return $.map(dataItems, function(dataItem) {\n return getter(dataItem);\n });\n },\n\n focusNext: function() {\n var current = this.focus();\n\n if (!current) {\n current = 0;\n } else {\n current = current.next();\n }\n\n this.focus(current);\n },\n\n focusPrev: function() {\n var current = this.focus();\n\n if (!current) {\n current = this.element[0].children.length - 1;\n } else {\n current = current.prev();\n }\n\n this.focus(current);\n },\n\n focusFirst: function() {\n this.focus(this.element[0].children[0]);\n },\n\n focusLast: function() {\n this.focus(last(this.element[0].children));\n },\n\n focus: function(candidate) {\n var that = this;\n var id = that._optionID;\n var hasCandidate;\n\n if (candidate === undefined$1) {\n return that._current;\n }\n\n candidate = last(that._get(candidate));\n candidate = $(this.element[0].children[candidate]);\n\n if (that._current) {\n that._current\n .removeClass(FOCUSED)\n .removeAttr(ID);\n\n that.trigger(DEACTIVATE);\n }\n\n hasCandidate = !!candidate[0];\n\n if (hasCandidate) {\n candidate.addClass(FOCUSED);\n that.scroll(candidate);\n\n candidate.attr(\"id\", id);\n }\n\n that._current = hasCandidate ? candidate : null;\n that.trigger(ACTIVATE);\n },\n\n focusIndex: function() {\n return this.focus() ? this.focus().index() : undefined$1;\n },\n\n skipUpdate: function(skipUpdate) {\n this._skipUpdate = skipUpdate;\n },\n\n select: function(indices) {\n var that = this;\n var selectable = that.options.selectable;\n var singleSelection = selectable !== \"multiple\" && selectable !== false;\n var selectedIndices = that._selectedIndices;\n var uiSelectedIndices = [this.element.find(\".k-selected\").index()];\n\n var added = [];\n var removed = [];\n var result;\n\n if (indices === undefined$1) {\n return selectedIndices.slice();\n }\n\n indices = that._get(indices);\n\n if (indices.length === 1 && indices[0] === -1) {\n indices = [];\n }\n\n var deferred = $.Deferred().resolve();\n var filtered = that.isFiltered();\n\n if (filtered && !singleSelection && that._deselectFiltered(indices)) {\n return deferred;\n }\n\n if (singleSelection && !filtered &&\n $.inArray(last(indices), selectedIndices) !== -1 && $.inArray(last(indices), uiSelectedIndices) !== -1) {\n\n if (that._dataItems.length && that._view.length) {\n that._dataItems = [that._view[selectedIndices[0]].item];\n }\n\n return deferred;\n }\n\n result = that._deselect(indices);\n\n removed = result.removed;\n indices = result.indices;\n\n if (indices.length) {\n if (singleSelection) {\n indices = [last(indices)];\n }\n\n added = that._select(indices);\n }\n\n if (added.length || removed.length) {\n that._valueComparer = null;\n that.trigger(CHANGE, {\n added: added,\n removed: removed\n });\n }\n\n return deferred;\n },\n\n removeAt: function(position) {\n this._selectedIndices.splice(position, 1);\n this._values.splice(position, 1);\n this._valueComparer = null;\n\n return {\n position: position,\n dataItem: this._dataItems.splice(position, 1)[0]\n };\n },\n\n setValue: function(value) {\n value = Array.isArray(value) || value instanceof ObservableArray ? value.slice(0) : [value];\n\n this._values = value;\n\n this._valueComparer = null;\n },\n\n value: function(value) {\n var that = this;\n var deferred = that._valueDeferred;\n var indices;\n\n if (value === undefined$1) {\n return that._values.slice();\n }\n\n that.setValue(value);\n\n if (!deferred || deferred.state() === \"resolved\") {\n that._valueDeferred = deferred = $.Deferred();\n }\n\n if (that.bound()) {\n indices = that._valueIndices(that._values);\n\n if (that.options.selectable === \"multiple\") {\n that.select(-1);\n }\n\n that.select(indices);\n\n deferred.resolve();\n }\n\n that._skipUpdate = false;\n\n return deferred;\n },\n\n items: function() {\n return this.element.children(ITEMSELECTOR);\n },\n\n _click: function(e) {\n if (this._touchTriggered)\n {\n this._touchTriggered = false;\n return;\n }\n\n if (!e.isDefaultPrevented()) {\n this._triggerClick(e.currentTarget);\n }\n },\n\n _createOnScrollProxy: function() {\n var onScrollProxy = function() {\n var that = this;\n clearTimeout(that._scrollId);\n\n that._scrollId = setTimeout(function() {\n that._renderHeader();\n }, 50);\n };\n\n this._onScroll = onScrollProxy.bind(this);\n },\n\n _triggerClick: function(item) {\n if (!this.trigger(CLICK, { item: $(item) })) {\n this.select(item);\n }\n },\n\n _valueExpr: function(type, values) {\n var that = this;\n var idx = 0;\n var comparer;\n var normalized = [];\n\n if (!that._valueComparer || that._valueType !== type) {\n that._valueType = type;\n\n for (; idx < values.length; idx++) {\n normalized.push(unifyType(values[idx], type));\n }\n\n comparer = (current, values) => {\n for (var idx = 0; idx < normalized.length; idx++) {\n if (current === values[idx]) {\n return idx;\n }\n }\n return -1;\n };\n\n that._valueComparer = function(current) {\n return comparer(current, normalized);\n };\n }\n\n return that._valueComparer;\n },\n\n _dataItemPosition: function(dataItem, values) {\n var value = this._valueGetter(dataItem);\n\n var valueExpr = this._valueExpr(typeof value, values);\n\n return valueExpr(value);\n },\n\n _getter: function() {\n this._valueGetter = kendo.getter(this.options.dataValueField);\n },\n\n _deselect: function(indices) {\n var that = this;\n var children = that.element[0].children;\n var selectable = that.options.selectable;\n var selectedIndices = that._selectedIndices;\n var dataItems = that._dataItems;\n var values = that._values;\n var removed = [];\n var i = 0;\n var j;\n\n var index, selectedIndex;\n var removedIndices = 0;\n\n indices = indices.slice();\n\n if (selectable === true || !indices.length) {\n for (; i < selectedIndices.length; i++) {\n $(children[selectedIndices[i]]).removeClass(KSELECTED).attr(ARIA_SELECTED, false);\n\n removed.push({\n position: i,\n dataItem: dataItems[i]\n });\n }\n\n that._values = [];\n that._dataItems = [];\n that._selectedIndices = [];\n } else if (selectable === \"multiple\") {\n for (; i < indices.length; i++) {\n index = indices[i];\n\n if (!$(children[index]).hasClass(KSELECTED)) {\n continue;\n }\n\n for (j = 0; j < selectedIndices.length; j++) {\n selectedIndex = selectedIndices[j];\n\n if (selectedIndex === index) {\n $(children[selectedIndex]).removeClass(KSELECTED).attr(ARIA_SELECTED, false);\n var dataItem = this._view[index].item;\n var position = this._dataItemPosition(dataItem, this._values);\n\n removed.push({\n position: position,\n dataItem: dataItem\n });\n\n dataItems.splice(j, 1);\n selectedIndices.splice(j, 1);\n indices.splice(i, 1);\n values.splice(j, 1);\n\n removedIndices += 1;\n i -= 1;\n j -= 1;\n break;\n }\n }\n }\n }\n\n return {\n indices: indices,\n removed: removed\n };\n },\n\n _deselectFiltered: function(indices) {\n var children = this.element[0].children;\n var dataItem, index, position;\n var removed = [];\n var idx = 0;\n\n for (; idx < indices.length; idx++) {\n index = indices[idx];\n\n dataItem = this._view[index].item;\n position = this._dataItemPosition(dataItem, this._values);\n\n if (position > -1) {\n removed.push(this.removeAt(position));\n $(children[index]).removeClass(KSELECTED);\n }\n }\n\n if (removed.length) {\n this.trigger(CHANGE, {\n added: [],\n removed: removed\n });\n\n return true;\n }\n\n return false;\n },\n\n _select: function(indices) {\n var that = this;\n var children = that.element[0].children;\n var data = that._view;\n var dataItem, index;\n var added = [];\n var idx = 0;\n\n if (last(indices) !== -1) {\n that.focus(indices);\n }\n\n for (; idx < indices.length; idx++) {\n index = indices[idx];\n dataItem = data[index];\n\n if (index === -1 || !dataItem) {\n continue;\n }\n\n dataItem = dataItem.item;\n\n that._selectedIndices.push(index);\n that._dataItems.push(dataItem);\n that._values.push(that._valueGetter(dataItem));\n\n $(children[index]).addClass(KSELECTED).attr(ARIA_SELECTED, true);\n\n added.push({\n dataItem: dataItem\n });\n }\n\n return added;\n },\n\n getElementIndex: function(element) {\n return $(element).data(\"offset-index\");\n },\n\n _get: function(candidate) {\n if (typeof candidate === \"number\") {\n candidate = [candidate];\n } else if (!isArray(candidate)) {\n candidate = this.getElementIndex(candidate);\n candidate = [candidate !== undefined$1 ? candidate : -1];\n }\n\n return candidate;\n },\n\n _templates: function() {\n var template;\n var options = this.options;\n var templates = {\n template: options.template,\n groupTemplate: options.groupTemplate,\n fixedGroupTemplate: options.fixedGroupTemplate\n };\n\n if (options.columns) {\n options.columns.forEach((column, i) => {\n var templateText = column.field ? column.field.toString() : TEXT;\n var templateFunc = data => htmlEncode(kendo.getter(templateText)(data));\n\n templates[\"column\" + i] = column.template || templateFunc;\n });\n }\n\n for (var key in templates) {\n template = templates[key];\n if (template && typeof template !== \"function\") {\n templates[key] = kendo.template(template);\n }\n }\n\n this.templates = templates;\n },\n\n _normalizeIndices: function(indices) {\n var newIndices = [];\n var idx = 0;\n\n for (; idx < indices.length; idx++) {\n if (indices[idx] !== undefined$1) {\n newIndices.push(indices[idx]);\n }\n }\n\n return newIndices;\n },\n\n _valueIndices: function(values, indices) {\n var data = this._view;\n var idx = 0;\n var index;\n\n indices = indices ? indices.slice() : [];\n\n if (!values.length) {\n return [];\n }\n\n for (; idx < data.length; idx++) {\n index = this._dataItemPosition(data[idx].item, values);\n\n if (index !== -1) {\n indices[index] = idx;\n }\n }\n\n return this._normalizeIndices(indices);\n },\n\n _firstVisibleItem: function() {\n var element = this.element[0];\n var content = this.content[0];\n var scrollTop = content.scrollTop;\n var itemHeight = $(element.children[0]).height();\n var itemIndex = Math.floor(scrollTop / itemHeight) || 0;\n var item = element.children[itemIndex] || element.lastChild;\n var forward = item.offsetTop < scrollTop;\n\n while (item) {\n if (forward) {\n if ((item.offsetTop + itemHeight) > scrollTop || !item.nextSibling) {\n break;\n }\n\n item = item.nextSibling;\n } else {\n if (item.offsetTop <= scrollTop || !item.previousSibling) {\n break;\n }\n\n item = item.previousSibling;\n }\n }\n\n return this._view[$(item).data(\"offset-index\")];\n },\n\n _fixedHeader: function() {\n if (this.isGrouped() && this.templates.fixedGroupTemplate) {\n if (this.header.closest(GROUP_ROW_SEL).length) {\n this.header.closest(GROUP_ROW_SEL).show();\n } else {\n this.header.show();\n }\n\n this.content.scroll(this._onScroll);\n } else {\n if (this.header.closest(GROUP_ROW_SEL).length) {\n this.header.closest(GROUP_ROW_SEL).hide();\n } else {\n this.header.hide();\n }\n\n this.content.off(\"scroll\", this._onScroll);\n }\n },\n\n _renderHeader: function() {\n var template = this.templates.fixedGroupTemplate;\n if (!template) {\n return;\n }\n\n var visibleItem = this._firstVisibleItem();\n\n if (visibleItem && visibleItem.group.toString().length) {\n this.header.html(template(visibleItem.group));\n }\n },\n\n _renderItem: function(context) {\n var item = '
';\n if (hasColumns) {\n item += this._renderColumns(dataItem);\n } else {\n item += '';\n item += this.templates.template(dataItem);\n item += '';\n }\n\n if (notFirstItem && context.newGroup) {\n if (hasColumns) {\n item += '' + this.templates.groupTemplate(context.group) + '';\n } else {\n item += '' + this.templates.groupTemplate(context.group) + '
';\n }\n } else if (isGrouped && hasColumns) {\n item += '';\n }\n\n return item + \"\";\n },\n\n _renderColumns: function(dataItem) {\n var item = \"\";\n\n for (var i = 0; i < this.options.columns.length; i++) {\n var currentWidth = this.options.columns[i].width;\n var currentWidthInt = parseInt(currentWidth, 10);\n var widthStyle = '';\n\n if (currentWidth && !isNaN(currentWidthInt)) {\n widthStyle += \"style='width:\";\n widthStyle += currentWidthInt;\n widthStyle += percentageUnitsRegex.test(currentWidth) ? \"%\" : \"px\";\n widthStyle += \";'\";\n }\n item += \"
\";\n item += this.templates[\"column\" + i](dataItem);\n item += \"\";\n }\n\n return item;\n },\n\n _render: function() {\n var html = \"\";\n\n var i = 0;\n var idx = 0;\n var context;\n var dataContext = [];\n var view = this.dataSource.view();\n var values = this.value();\n\n var group, newGroup, j;\n var isGrouped = this.isGrouped();\n\n if (isGrouped) {\n for (i = 0; i < view.length; i++) {\n group = view[i];\n newGroup = true;\n\n for (j = 0; j < group.items.length; j++) {\n context = {\n selected: this._selected(group.items[j], values),\n item: group.items[j],\n group: group.value,\n newGroup: newGroup,\n isLastGroupedItem: j === group.items.length - 1,\n index: idx };\n dataContext[idx] = context;\n idx += 1;\n\n html += this._renderItem(context);\n newGroup = false;\n }\n }\n } else {\n for (i = 0; i < view.length; i++) {\n context = { selected: this._selected(view[i], values), item: view[i], index: i };\n\n dataContext[i] = context;\n\n html += this._renderItem(context);\n }\n }\n\n this._view = dataContext;\n\n this.element[0].innerHTML = html;\n\n if (isGrouped && dataContext.length) {\n this._renderHeader();\n }\n },\n\n _selected: function(dataItem, values) {\n var select = !this.isFiltered() || this.options.selectable === \"multiple\";\n return select && this._dataItemPosition(dataItem, values) !== -1;\n },\n\n setDSFilter: function(filter) {\n this._lastDSFilter = extend({}, filter);\n },\n\n isFiltered: function() {\n if (!this._lastDSFilter) {\n this.setDSFilter(this.dataSource.filter());\n }\n\n return !kendo.data.Query.compareFilters(this.dataSource.filter(), this._lastDSFilter);\n },\n\n refresh: function(e) {\n var that = this;\n var action = e && e.action;\n var skipUpdateOnBind = that.options.skipUpdateOnBind;\n var isItemChange = action === \"itemchange\";\n var result;\n\n that.trigger(DATA_BINDING);\n that._angularItems(\"cleanup\");\n\n that._fixedHeader();\n\n that._render();\n\n that.bound(true);\n\n if (isItemChange || action === \"remove\") {\n result = mapChangedItems(that._dataItems, e.items);\n\n if (result.changed.length) {\n if (isItemChange) {\n that.trigger(SELECTED_ITEM_CHANGE, {\n items: result.changed\n });\n } else {\n that.value(that._getValues(result.unchanged));\n }\n }\n } else if (that.isFiltered() || that._skipUpdate || that._emptySearch) {\n that.focus(0);\n if (that._skipUpdate) {\n that._skipUpdate = false;\n that._selectedIndices = that._valueIndices(that._values, that._selectedIndices);\n }\n } else if (!skipUpdateOnBind && (!action || action === \"add\")) {\n that.value(that._values);\n }\n\n if (that._valueDeferred) {\n that._valueDeferred.resolve();\n }\n\n that._angularItems(\"compile\");\n that.trigger(DATA_BOUND);\n },\n\n bound: function(bound) {\n if (bound === undefined$1) {\n return this._bound;\n }\n\n this._bound = bound;\n },\n\n isGrouped: function() {\n return (this.dataSource.group() || []).length;\n }\n });\n\n ui.plugin(StaticList);\n\n function last(list) {\n return list[list.length - 1];\n }\n\n function getSelectedOption(select) {\n var index = select.selectedIndex;\n return index > -1 ? select.options[index] : {};\n }\n\n function mapChangedItems(selected, itemsToMatch) {\n var itemsLength = itemsToMatch.length;\n var selectedLength = selected.length;\n var dataItem;\n var found;\n var i, j;\n\n var changed = [];\n var unchanged = [];\n\n if (selectedLength) {\n for (i = 0; i < selectedLength; i++) {\n dataItem = selected[i];\n found = false;\n\n for (j = 0; j < itemsLength; j++) {\n if (dataItem === itemsToMatch[j]) {\n found = true;\n changed.push({ index: i, item: dataItem });\n break;\n }\n }\n\n if (!found) {\n unchanged.push(dataItem);\n }\n }\n }\n\n return {\n changed: changed,\n unchanged: unchanged\n };\n }\n\n function isValidFilterExpr(expression) {\n if (!expression || $.isEmptyObject(expression)) {\n return false;\n }\n\n if (expression.filters && !expression.filters.length) {\n return false;\n }\n\n return true;\n }\n\n function removeFiltersForField(expression, field) {\n var filters;\n var found = false;\n\n if (expression.filters) {\n filters = $.grep(expression.filters, function(filter) {\n found = removeFiltersForField(filter, field);\n if (filter.filters) {\n return filter.filters.length;\n } else {\n return filter.field != field;\n }\n });\n\n if (!found && expression.filters.length !== filters.length) {\n found = true;\n }\n\n expression.filters = filters;\n }\n\n return found;\n }\n\n kendo.cssProperties.registerPrefix(\"List\", \"k-list-\");\n\n})(window.kendo.jQuery);\n","import './kendo.core.js';\n\nvar __meta__ = {\n id: \"fx\",\n name: \"Effects\",\n category: \"framework\",\n description: \"Required for animation effects in all Kendo UI widgets.\",\n depends: [ \"core\" ]\n};\n\n(function($, undefined$1) {\n var kendo = window.kendo,\n fx = kendo.effects,\n each = $.each,\n extend = $.extend,\n support = kendo.support,\n browser = support.browser,\n transforms = support.transforms,\n transitions = support.transitions,\n scaleProperties = { scale: 0, scalex: 0, scaley: 0, scale3d: 0 },\n translateProperties = { translate: 0, translatex: 0, translatey: 0, translate3d: 0 },\n hasZoom = (typeof document.documentElement.style.zoom !== \"undefined\") && !transforms,\n matrix3dRegExp = /matrix3?d?\\s*\\(.*,\\s*([\\d\\.\\-]+)\\w*?,\\s*([\\d\\.\\-]+)\\w*?,\\s*([\\d\\.\\-]+)\\w*?,\\s*([\\d\\.\\-]+)\\w*?/i,\n cssParamsRegExp = /^(-?[\\d\\.\\-]+)?[\\w\\s]*,?\\s*(-?[\\d\\.\\-]+)?[\\w\\s]*/i,\n translateXRegExp = /translatex?$/i,\n oldEffectsRegExp = /(zoom|fade|expand)(\\w+)/,\n singleEffectRegExp = /(zoom|fade|expand)/,\n unitRegExp = /[xy]$/i,\n transformProps = [\"perspective\", \"rotate\", \"rotatex\", \"rotatey\", \"rotatez\", \"rotate3d\", \"scale\", \"scalex\", \"scaley\", \"scalez\", \"scale3d\", \"skew\", \"skewx\", \"skewy\", \"translate\", \"translatex\", \"translatey\", \"translatez\", \"translate3d\", \"matrix\", \"matrix3d\"],\n transform2d = [\"rotate\", \"scale\", \"scalex\", \"scaley\", \"skew\", \"skewx\", \"skewy\", \"translate\", \"translatex\", \"translatey\", \"matrix\"],\n transform2units = { \"rotate\": \"deg\", scale: \"\", skew: \"px\", translate: \"px\" },\n cssPrefix = transforms.css,\n round = Math.round,\n BLANK = \"\",\n PX = \"px\",\n NONE = \"none\",\n AUTO = \"auto\",\n WIDTH = \"width\",\n HEIGHT = \"height\",\n HIDDEN = \"hidden\",\n ORIGIN = \"origin\",\n ABORT_ID = \"abortId\",\n OVERFLOW = \"overflow\",\n TRANSLATE = \"translate\",\n POSITION = \"position\",\n COMPLETE_CALLBACK = \"completeCallback\",\n TRANSITION = cssPrefix + \"transition\",\n TRANSFORM = cssPrefix + \"transform\",\n BACKFACE = cssPrefix + \"backface-visibility\",\n PERSPECTIVE = cssPrefix + \"perspective\",\n DEFAULT_PERSPECTIVE = \"1500px\",\n TRANSFORM_PERSPECTIVE = \"perspective(\" + DEFAULT_PERSPECTIVE + \")\",\n directions = {\n left: {\n reverse: \"right\",\n property: \"left\",\n transition: \"translatex\",\n vertical: false,\n modifier: -1\n },\n right: {\n reverse: \"left\",\n property: \"left\",\n transition: \"translatex\",\n vertical: false,\n modifier: 1\n },\n down: {\n reverse: \"up\",\n property: \"top\",\n transition: \"translatey\",\n vertical: true,\n modifier: 1\n },\n up: {\n reverse: \"down\",\n property: \"top\",\n transition: \"translatey\",\n vertical: true,\n modifier: -1\n },\n top: {\n reverse: \"bottom\"\n },\n bottom: {\n reverse: \"top\"\n },\n \"in\": {\n reverse: \"out\",\n modifier: -1\n },\n out: {\n reverse: \"in\",\n modifier: 1\n },\n\n vertical: {\n reverse: \"vertical\"\n },\n\n horizontal: {\n reverse: \"horizontal\"\n }\n };\n\n kendo.directions = directions;\n\n extend($.fn, {\n kendoStop: function(clearQueue, gotoEnd) {\n if (transitions) {\n return fx.stopQueue(this, clearQueue || false, gotoEnd || false);\n } else {\n return this.stop(clearQueue, gotoEnd);\n }\n }\n });\n\n /* jQuery support for all transform animations (FF 3.5/3.6, Opera 10.x, IE9 */\n\n if (transforms && !transitions) {\n each(transform2d, function(idx, value) {\n $.fn[value] = function(val) {\n if (typeof val == \"undefined\") {\n return animationProperty(this, value);\n } else {\n var that = $(this)[0],\n transformValue = value + \"(\" + val + transform2units[value.replace(unitRegExp, \"\")] + \")\";\n\n if (that.style.cssText.indexOf(TRANSFORM) == -1) {\n $(this).css(TRANSFORM, transformValue);\n } else {\n that.style.cssText = that.style.cssText.replace(new RegExp(value + \"\\\\(.*?\\\\)\", \"i\"), transformValue);\n }\n }\n return this;\n };\n\n $.fx.step[value] = function(fx) {\n $(fx.elem)[value](fx.now);\n };\n });\n\n var curProxy = $.fx.prototype.cur;\n $.fx.prototype.cur = function() {\n if (transform2d.indexOf(this.prop) != -1) {\n return parseFloat($(this.elem)[this.prop]());\n }\n\n return curProxy.apply(this, arguments);\n };\n }\n\n kendo.toggleClass = function(element, classes, options, add) {\n if (classes) {\n classes = classes.split(\" \");\n\n if (transitions) {\n options = extend({\n exclusive: \"all\",\n duration: 400,\n ease: \"ease-out\"\n }, options);\n\n element.css(TRANSITION, options.exclusive + \" \" + options.duration + \"ms \" + options.ease);\n setTimeout(function() {\n element.css(TRANSITION, \"\").css(HEIGHT);\n }, options.duration); // TODO: this should fire a kendoAnimate session instead.\n }\n\n each(classes, function(idx, value) {\n element.toggleClass(value, add);\n });\n }\n\n return element;\n };\n\n kendo.parseEffects = function(input, mirror) {\n var effects = {};\n\n if (typeof input === \"string\") {\n each(input.split(\" \"), function(idx, value) {\n var redirectedEffect = !singleEffectRegExp.test(value),\n resolved = value.replace(oldEffectsRegExp, function(match, $1, $2) {\n return $1 + \":\" + $2.toLowerCase();\n }), // Support for old zoomIn/fadeOut style, now deprecated.\n effect = resolved.split(\":\"),\n direction = effect[1],\n effectBody = {};\n\n if (effect.length > 1) {\n effectBody.direction = (mirror && redirectedEffect ? directions[direction].reverse : direction);\n }\n\n effects[effect[0]] = effectBody;\n });\n } else {\n each(input, function(idx) {\n var direction = this.direction;\n\n if (direction && mirror && !singleEffectRegExp.test(idx)) {\n this.direction = directions[direction].reverse;\n }\n\n effects[idx] = this;\n });\n }\n\n return effects;\n };\n\n function parseInteger(value) {\n return parseInt(value, 10);\n }\n\n function parseCSS(element, property) {\n return parseInteger(element.css(property));\n }\n\n function keys(obj) {\n var acc = [];\n for (var propertyName in obj) {\n acc.push(propertyName);\n }\n return acc;\n }\n\n function strip3DTransforms(properties) {\n for (var key in properties) {\n if (transformProps.indexOf(key) != -1 && transform2d.indexOf(key) == -1) {\n delete properties[key];\n }\n }\n\n return properties;\n }\n\n function normalizeCSS(element, properties) {\n var transformation = [], cssValues = {}, lowerKey, key, value, isTransformed;\n\n for (key in properties) {\n lowerKey = key.toLowerCase();\n isTransformed = transforms && transformProps.indexOf(lowerKey) != -1;\n\n if (!support.hasHW3D && isTransformed && transform2d.indexOf(lowerKey) == -1) {\n delete properties[key];\n } else {\n value = properties[key];\n\n if (isTransformed) {\n transformation.push(key + \"(\" + value + \")\");\n } else {\n cssValues[key] = value;\n }\n }\n }\n\n if (transformation.length) {\n cssValues[TRANSFORM] = transformation.join(\" \");\n }\n\n return cssValues;\n }\n\n if (transitions) {\n extend(fx, {\n transition: function(element, properties, options) {\n var css,\n delay = 0,\n oldKeys = element.data(\"keys\") || [],\n timeoutID;\n\n options = extend({\n duration: 200,\n ease: \"ease-out\",\n complete: null,\n exclusive: \"all\"\n },\n options\n );\n\n var stopTransitionCalled = false;\n\n var stopTransition = function() {\n if (!stopTransitionCalled) {\n stopTransitionCalled = true;\n\n if (timeoutID) {\n clearTimeout(timeoutID);\n timeoutID = null;\n }\n\n element\n .removeData(ABORT_ID)\n .dequeue()\n .css(TRANSITION, \"\")\n .css(TRANSITION);\n\n options.complete.call(element);\n }\n };\n\n options.duration = $.fx ? $.fx.speeds[options.duration] || options.duration : options.duration;\n\n css = normalizeCSS(element, properties);\n\n $.merge(oldKeys, keys(css));\n\n if ($.hasOwnProperty(\"uniqueSort\")) {\n element\n .data(\"keys\", $.uniqueSort(oldKeys))\n .height();\n } else {\n element\n .data(\"keys\", $.unique(oldKeys))\n .height();\n }\n\n element.css(TRANSITION, options.exclusive + \" \" + options.duration + \"ms \" + options.ease).css(TRANSITION);\n element.css(css).css(TRANSFORM);\n\n /**\n * Use transitionEnd event for browsers who support it - but duplicate it with setTimeout, as the transitionEnd event will not be triggered if no CSS properties change.\n * This should be cleaned up at some point (widget by widget), and refactored to widgets not relying on the complete callback if no transition occurs.\n *\n * For IE9 and below, resort to setTimeout.\n */\n if (transitions.event) {\n element.one(transitions.event, stopTransition);\n if (options.duration !== 0) {\n delay = 500;\n }\n }\n\n timeoutID = setTimeout(stopTransition, options.duration + delay);\n element.data(ABORT_ID, timeoutID);\n element.data(COMPLETE_CALLBACK, stopTransition);\n },\n\n stopQueue: function(element, clearQueue, gotoEnd) {\n var cssValues,\n taskKeys = element.data(\"keys\"),\n retainPosition = (!gotoEnd && taskKeys),\n completeCallback = element.data(COMPLETE_CALLBACK);\n\n if (retainPosition) {\n cssValues = kendo.getComputedStyles(element[0], taskKeys);\n }\n\n if (completeCallback) {\n completeCallback();\n }\n\n if (retainPosition) {\n element.css(cssValues);\n }\n\n return element\n .removeData(\"keys\")\n .stop(clearQueue);\n }\n });\n }\n\n function animationProperty(element, property) {\n if (transforms) {\n var transform = element.css(TRANSFORM);\n if (transform == NONE) {\n return property == \"scale\" ? 1 : 0;\n }\n\n var match = transform.match(new RegExp(property + \"\\\\s*\\\\(([\\\\d\\\\w\\\\.]+)\")),\n computed = 0;\n\n if (match) {\n computed = parseInteger(match[1]);\n } else {\n match = transform.match(matrix3dRegExp) || [0, 0, 0, 0, 0];\n property = property.toLowerCase();\n\n if (translateXRegExp.test(property)) {\n computed = parseFloat(match[3] / match[2]);\n } else if (property == \"translatey\") {\n computed = parseFloat(match[4] / match[2]);\n } else if (property == \"scale\") {\n computed = parseFloat(match[2]);\n } else if (property == \"rotate\") {\n computed = parseFloat(Math.atan2(match[2], match[1]));\n }\n }\n\n return computed;\n } else {\n return parseFloat(element.css(property));\n }\n }\n\n var EffectSet = kendo.Class.extend({\n init: function(element, options) {\n var that = this;\n\n that.element = element;\n that.effects = [];\n that.options = options;\n that.restore = [];\n },\n\n run: function(effects) {\n var that = this,\n effect,\n idx, jdx,\n length = effects.length,\n element = that.element,\n options = that.options,\n deferred = $.Deferred(),\n start = {},\n end = {},\n target,\n children,\n childrenLength;\n\n that.effects = effects;\n\n deferred.done(that.complete.bind(that));\n\n element.data(\"animating\", true);\n\n for (idx = 0; idx < length; idx ++) {\n effect = effects[idx];\n\n effect.setReverse(options.reverse);\n effect.setOptions(options);\n\n that.addRestoreProperties(effect.restore);\n\n effect.prepare(start, end);\n\n children = effect.children();\n\n for (jdx = 0, childrenLength = children.length; jdx < childrenLength; jdx ++) {\n children[jdx].duration(options.duration).run();\n }\n }\n\n // legacy support for options.properties\n for (var effectName in options.effects) {\n extend(end, options.effects[effectName].properties);\n }\n\n // Show the element initially\n if (!element.is(\":visible\")) {\n extend(start, { display: element.data(\"olddisplay\") || \"block\" });\n }\n\n if (transforms && !options.reset) {\n target = element.data(\"targetTransform\");\n\n if (target) {\n start = extend(target, start);\n }\n }\n\n start = normalizeCSS(element, start);\n\n if (transforms && !transitions) {\n start = strip3DTransforms(start);\n }\n\n element.css(start)\n .css(TRANSFORM); // Nudge\n\n for (idx = 0; idx < length; idx ++) {\n effects[idx].setup();\n }\n\n if (options.init) {\n options.init();\n }\n\n element.data(\"targetTransform\", end);\n fx.animate(element, end, extend({}, options, { complete: deferred.resolve }));\n\n return deferred.promise();\n },\n\n stop: function() {\n $(this.element).kendoStop(true, true);\n },\n\n addRestoreProperties: function(restore) {\n var element = this.element,\n value,\n i = 0,\n length = restore.length;\n\n for (; i < length; i ++) {\n value = restore[i];\n\n this.restore.push(value);\n\n if (!element.data(value)) {\n element.data(value, element.css(value));\n }\n }\n },\n\n restoreCallback: function() {\n var element = this.element;\n\n for (var i = 0, length = this.restore.length; i < length; i ++) {\n var value = this.restore[i];\n element.css(value, element.data(value));\n }\n },\n\n complete: function() {\n var that = this,\n idx = 0,\n element = that.element,\n options = that.options,\n effects = that.effects,\n length = effects.length;\n\n element\n .removeData(\"animating\")\n .dequeue(); // call next animation from the queue\n\n if (options.hide) {\n element.data(\"olddisplay\", element.css(\"display\")).hide();\n }\n\n this.restoreCallback();\n\n if (hasZoom && !transforms) {\n setTimeout(this.restoreCallback.bind(this), 0); // Again jQuery callback in IE8-\n }\n\n for (; idx < length; idx ++) {\n effects[idx].teardown();\n }\n\n if (options.completeCallback) {\n options.completeCallback(element);\n }\n }\n });\n\n fx.promise = function(element, options) {\n var effects = [],\n effectClass,\n effectSet = new EffectSet(element, options),\n parsedEffects = kendo.parseEffects(options.effects),\n effect;\n\n options.effects = parsedEffects;\n\n for (var effectName in parsedEffects) {\n effectClass = fx[capitalize(effectName)];\n\n if (effectClass) {\n effect = new effectClass(element, parsedEffects[effectName].direction);\n effects.push(effect);\n }\n }\n\n if (effects[0]) {\n effectSet.run(effects);\n } else { // Not sure how would an fx promise reach this state - means that you call kendoAnimate with no valid effects? Why?\n if (!element.is(\":visible\")) {\n element.css({ display: element.data(\"olddisplay\") || \"block\" }).css(\"display\");\n }\n\n if (options.init) {\n options.init();\n }\n\n element.dequeue();\n effectSet.complete();\n }\n };\n\n extend(fx, {\n animate: function(elements, properties, options) {\n var useTransition = options.transition !== false;\n delete options.transition;\n\n if (transitions && \"transition\" in fx && useTransition) {\n fx.transition(elements, properties, options);\n } else {\n if (transforms) {\n elements.animate(strip3DTransforms(properties), { queue: false, show: false, hide: false, duration: options.duration, complete: options.complete }); // Stop animate from showing/hiding the element to be able to hide it later on.\n } else {\n elements.each(function() {\n var element = $(this),\n multiple = {};\n\n each(transformProps, function(idx, value) { // remove transforms to avoid IE and older browsers confusion\n var params,\n currentValue = properties ? properties[value] + \" \" : null; // We need to match\n\n if (currentValue) {\n var single = properties;\n\n if (value in scaleProperties && properties[value] !== undefined$1) {\n params = currentValue.match(cssParamsRegExp);\n if (transforms) {\n extend(single, { scale: +params[0] });\n }\n } else {\n if (value in translateProperties && properties[value] !== undefined$1) {\n var position = element.css(POSITION),\n isFixed = (position == \"absolute\" || position == \"fixed\");\n\n if (!element.data(TRANSLATE)) {\n if (isFixed) {\n element.data(TRANSLATE, {\n top: parseCSS(element, \"top\") || 0,\n left: parseCSS(element, \"left\") || 0,\n bottom: parseCSS(element, \"bottom\"),\n right: parseCSS(element, \"right\")\n });\n } else {\n element.data(TRANSLATE, {\n top: parseCSS(element, \"marginTop\") || 0,\n left: parseCSS(element, \"marginLeft\") || 0\n });\n }\n }\n\n var originalPosition = element.data(TRANSLATE);\n\n params = currentValue.match(cssParamsRegExp);\n if (params) {\n\n var dX = value == TRANSLATE + \"y\" ? +null : +params[1],\n dY = value == TRANSLATE + \"y\" ? +params[1] : +params[2];\n\n if (isFixed) {\n if (!isNaN(originalPosition.right)) {\n if (!isNaN(dX)) { extend(single, { right: originalPosition.right - dX }); }\n } else {\n if (!isNaN(dX)) { extend(single, { left: originalPosition.left + dX }); }\n }\n\n if (!isNaN(originalPosition.bottom)) {\n if (!isNaN(dY)) { extend(single, { bottom: originalPosition.bottom - dY }); }\n } else {\n if (!isNaN(dY)) { extend(single, { top: originalPosition.top + dY }); }\n }\n } else {\n if (!isNaN(dX)) { extend(single, { marginLeft: originalPosition.left + dX }); }\n if (!isNaN(dY)) { extend(single, { marginTop: originalPosition.top + dY }); }\n }\n }\n }\n }\n\n if (!transforms && value != \"scale\" && value in single) {\n delete single[value];\n }\n\n if (single) {\n extend(multiple, single);\n }\n }\n });\n\n if (browser.msie) {\n delete multiple.scale;\n }\n\n element.animate(multiple, { queue: false, show: false, hide: false, duration: options.duration, complete: options.complete }); // Stop animate from showing/hiding the element to be able to hide it later on.\n });\n }\n }\n }\n });\n\n fx.animatedPromise = fx.promise;\n\n var Effect = kendo.Class.extend({\n init: function(element, direction) {\n var that = this;\n that.element = element;\n that._direction = direction;\n that.options = {};\n that._additionalEffects = [];\n\n if (!that.restore) {\n that.restore = [];\n }\n },\n\n// Public API\n reverse: function() {\n this._reverse = true;\n return this.run();\n },\n\n play: function() {\n this._reverse = false;\n return this.run();\n },\n\n add: function(additional) {\n this._additionalEffects.push(additional);\n return this;\n },\n\n direction: function(value) {\n this._direction = value;\n return this;\n },\n\n duration: function(duration) {\n this._duration = duration;\n return this;\n },\n\n compositeRun: function() {\n var that = this,\n effectSet = new EffectSet(that.element, { reverse: that._reverse, duration: that._duration }),\n effects = that._additionalEffects.concat([ that ]);\n\n return effectSet.run(effects);\n },\n\n run: function() {\n if (this._additionalEffects && this._additionalEffects[0]) {\n return this.compositeRun();\n }\n\n var that = this,\n element = that.element,\n idx = 0,\n restore = that.restore,\n length = restore.length,\n value,\n deferred = $.Deferred(),\n start = {},\n end = {},\n target,\n children = that.children(),\n childrenLength = children.length;\n\n deferred.done(that._complete.bind(that));\n\n element.data(\"animating\", true);\n\n for (idx = 0; idx < length; idx ++) {\n value = restore[idx];\n\n if (!element.data(value)) {\n element.data(value, element.css(value));\n }\n }\n\n for (idx = 0; idx < childrenLength; idx ++) {\n children[idx].duration(that._duration).run();\n }\n\n that.prepare(start, end);\n\n if (!element.is(\":visible\")) {\n extend(start, { display: element.data(\"olddisplay\") || \"block\" });\n }\n\n if (transforms) {\n target = element.data(\"targetTransform\");\n\n if (target) {\n start = extend(target, start);\n }\n }\n\n start = normalizeCSS(element, start);\n\n if (transforms && !transitions) {\n start = strip3DTransforms(start);\n }\n\n element.css(start).css(TRANSFORM); // Trick webkit into re-rendering\n\n that.setup();\n\n element.data(\"targetTransform\", end);\n fx.animate(element, end, { duration: that._duration, complete: deferred.resolve });\n\n return deferred.promise();\n },\n\n stop: function() {\n var idx = 0,\n children = this.children(),\n childrenLength = children.length;\n\n for (idx = 0; idx < childrenLength; idx ++) {\n children[idx].stop();\n }\n\n $(this.element).kendoStop(true, true);\n return this;\n },\n\n restoreCallback: function() {\n var element = this.element;\n\n for (var i = 0, length = this.restore.length; i < length; i ++) {\n var value = this.restore[i];\n element.css(value, element.data(value));\n }\n },\n\n _complete: function() {\n var that = this,\n element = that.element;\n\n element\n .removeData(\"animating\")\n .dequeue(); // call next animation from the queue\n\n that.restoreCallback();\n\n if (that.shouldHide()) {\n element.data(\"olddisplay\", element.css(\"display\")).hide();\n }\n\n if (hasZoom && !transforms) {\n setTimeout(that.restoreCallback.bind(that), 0); // Again jQuery callback in IE8-\n }\n\n that.teardown();\n },\n\n /////////////////////////// Support for kendo.animate;\n setOptions: function(options) {\n extend(true, this.options, options);\n },\n\n children: function() {\n return [];\n },\n\n shouldHide: $.noop,\n\n setup: $.noop,\n prepare: $.noop,\n teardown: $.noop,\n directions: [],\n\n setReverse: function(reverse) {\n this._reverse = reverse;\n return this;\n }\n });\n\n function capitalize(word) {\n return word.charAt(0).toUpperCase() + word.substring(1);\n }\n\n function createEffect(name, definition) {\n var effectClass = Effect.extend(definition),\n directions = effectClass.prototype.directions;\n\n fx[capitalize(name)] = effectClass;\n\n fx.Element.prototype[name] = function(direction, opt1, opt2, opt3) {\n return new effectClass(this.element, direction, opt1, opt2, opt3);\n };\n\n each(directions, function(idx, theDirection) {\n fx.Element.prototype[name + capitalize(theDirection)] = function(opt1, opt2, opt3) {\n return new effectClass(this.element, theDirection, opt1, opt2, opt3);\n };\n });\n }\n\n var FOUR_DIRECTIONS = [\"left\", \"right\", \"up\", \"down\"],\n IN_OUT = [\"in\", \"out\"];\n\n createEffect(\"slideIn\", {\n directions: FOUR_DIRECTIONS,\n\n divisor: function(value) {\n this.options.divisor = value;\n return this;\n },\n\n prepare: function(start, end) {\n var that = this,\n tmp,\n element = that.element,\n outerWidth = kendo._outerWidth,\n outerHeight = kendo._outerHeight,\n direction = directions[that._direction],\n offset = -direction.modifier * (direction.vertical ? outerHeight(element) : outerWidth(element)),\n startValue = offset / (that.options && that.options.divisor || 1) + PX,\n endValue = \"0px\";\n\n if (that._reverse) {\n tmp = start;\n start = end;\n end = tmp;\n }\n\n if (transforms) {\n start[direction.transition] = startValue;\n end[direction.transition] = endValue;\n } else {\n start[direction.property] = startValue;\n end[direction.property] = endValue;\n }\n }\n });\n\n createEffect(\"tile\", {\n directions: FOUR_DIRECTIONS,\n\n init: function(element, direction, previous) {\n Effect.prototype.init.call(this, element, direction);\n this.options = { previous: previous };\n },\n\n previousDivisor: function(value) {\n this.options.previousDivisor = value;\n return this;\n },\n\n children: function() {\n var that = this,\n reverse = that._reverse,\n previous = that.options.previous,\n divisor = that.options.previousDivisor || 1,\n dir = that._direction;\n\n var children = [ kendo.fx(that.element).slideIn(dir).setReverse(reverse) ];\n\n if (previous) {\n children.push( kendo.fx(previous).slideIn(directions[dir].reverse).divisor(divisor).setReverse(!reverse) );\n }\n\n return children;\n }\n });\n\n function createToggleEffect(name, property, defaultStart, defaultEnd) {\n createEffect(name, {\n directions: IN_OUT,\n\n startValue: function(value) {\n this._startValue = value;\n return this;\n },\n\n endValue: function(value) {\n this._endValue = value;\n return this;\n },\n\n shouldHide: function() {\n return this._shouldHide;\n },\n\n prepare: function(start, end) {\n var that = this,\n startValue,\n endValue,\n out = this._direction === \"out\",\n startDataValue = that.element.data(property),\n startDataValueIsSet = !(isNaN(startDataValue) || startDataValue == defaultStart);\n\n if (startDataValueIsSet) {\n startValue = startDataValue;\n } else if (typeof this._startValue !== \"undefined\") {\n startValue = this._startValue;\n } else {\n startValue = out ? defaultStart : defaultEnd;\n }\n\n if (typeof this._endValue !== \"undefined\") {\n endValue = this._endValue;\n } else {\n endValue = out ? defaultEnd : defaultStart;\n }\n\n if (this._reverse) {\n start[property] = endValue;\n end[property] = startValue;\n } else {\n start[property] = startValue;\n end[property] = endValue;\n }\n\n that._shouldHide = end[property] === defaultEnd;\n }\n });\n }\n\n createToggleEffect(\"fade\", \"opacity\", 1, 0);\n createToggleEffect(\"zoom\", \"scale\", 1, 0.01);\n\n createEffect(\"slideMargin\", {\n prepare: function(start, end) {\n var that = this,\n element = that.element,\n options = that.options,\n origin = element.data(ORIGIN),\n offset = options.offset,\n margin,\n reverse = that._reverse;\n\n if (!reverse && origin === null) {\n element.data(ORIGIN, parseFloat(element.css(\"margin-\" + options.axis)));\n }\n\n margin = (element.data(ORIGIN) || 0);\n end[\"margin-\" + options.axis] = !reverse ? margin + offset : margin;\n }\n });\n\n createEffect(\"slideTo\", {\n prepare: function(start, end) {\n var that = this,\n element = that.element,\n options = that.options,\n offset = options.offset.split(\",\"),\n reverse = that._reverse;\n\n if (transforms) {\n end.translatex = !reverse ? offset[0] : 0;\n end.translatey = !reverse ? offset[1] : 0;\n } else {\n end.left = !reverse ? offset[0] : 0;\n end.top = !reverse ? offset[1] : 0;\n }\n element.css(\"left\");\n }\n });\n\n createEffect(\"expand\", {\n directions: [\"horizontal\", \"vertical\"],\n\n restore: [ OVERFLOW ],\n\n prepare: function(start, end) {\n var that = this,\n element = that.element,\n options = that.options,\n reverse = that._reverse,\n property = that._direction === \"vertical\" ? HEIGHT : WIDTH,\n setLength = element[0].style[property],\n oldLength = element.data(property),\n length = parseFloat(oldLength || setLength),\n realLength = round(element.css(property, AUTO)[property]());\n\n start.overflow = HIDDEN;\n\n length = (options && options.reset) ? realLength || length : length || realLength;\n\n end[property] = (reverse ? 0 : length) + PX;\n start[property] = (reverse ? length : 0) + PX;\n\n if (oldLength === undefined$1) {\n element.data(property, setLength);\n }\n },\n\n shouldHide: function() {\n return this._reverse;\n },\n\n teardown: function() {\n var that = this,\n element = that.element,\n property = that._direction === \"vertical\" ? HEIGHT : WIDTH,\n length = element.data(property);\n\n if (length == AUTO || length === BLANK) {\n setTimeout(function() { element.css(property, AUTO).css(property); }, 0); // jQuery animate complete callback in IE is called before the last animation step!\n }\n }\n });\n\n var TRANSFER_START_STATE = { position: \"absolute\", marginLeft: 0, marginTop: 0, scale: 1 };\n /**\n * Intersection point formulas are taken from here - http://zonalandeducation.com/mmts/intersections/intersectionOfTwoLines1/intersectionOfTwoLines1.html\n * Formula for a linear function from two points from here - http://demo.activemath.org/ActiveMath2/search/show.cmd?id=mbase://AC_UK_calculus/functions/ex_linear_equation_two_points\n * The transform origin point is the intersection point of the two lines from the top left corners/top right corners of the element and target.\n * The math and variables below MAY BE SIMPLIFIED (zeroes removed), but this would make the formula too cryptic.\n */\n createEffect(\"transfer\", {\n init: function(element, target) {\n this.element = element;\n this.options = { target: target };\n this.restore = [];\n },\n\n setup: function() {\n this.element.appendTo(document.body);\n },\n\n prepare: function(start, end) {\n var that = this,\n element = that.element,\n outerBox = fx.box(element),\n innerBox = fx.box(that.options.target),\n currentScale = animationProperty(element, \"scale\"),\n scale = fx.fillScale(innerBox, outerBox),\n transformOrigin = fx.transformOrigin(innerBox, outerBox);\n\n extend(start, TRANSFER_START_STATE);\n end.scale = 1;\n\n element.css(TRANSFORM, \"scale(1)\").css(TRANSFORM);\n element.css(TRANSFORM, \"scale(\" + currentScale + \")\");\n\n start.top = outerBox.top;\n start.left = outerBox.left;\n start.transformOrigin = transformOrigin.x + PX + \" \" + transformOrigin.y + PX;\n\n if (that._reverse) {\n start.scale = scale;\n } else {\n end.scale = scale;\n }\n }\n });\n\n\n var CLIPS = {\n top: \"rect(auto auto $size auto)\",\n bottom: \"rect($size auto auto auto)\",\n left: \"rect(auto $size auto auto)\",\n right: \"rect(auto auto auto $size)\"\n };\n\n var ROTATIONS = {\n top: { start: \"rotatex(0deg)\", end: \"rotatex(180deg)\" },\n bottom: { start: \"rotatex(-180deg)\", end: \"rotatex(0deg)\" },\n left: { start: \"rotatey(0deg)\", end: \"rotatey(-180deg)\" },\n right: { start: \"rotatey(180deg)\", end: \"rotatey(0deg)\" }\n };\n\n function clipInHalf(container, direction) {\n var vertical = kendo.directions[direction].vertical,\n size = (container[vertical ? HEIGHT : WIDTH]() / 2) + \"px\";\n\n return CLIPS[direction].replace(\"$size\", size);\n }\n\n createEffect(\"turningPage\", {\n directions: FOUR_DIRECTIONS,\n\n init: function(element, direction, container) {\n Effect.prototype.init.call(this, element, direction);\n this._container = container;\n },\n\n prepare: function(start, end) {\n var that = this,\n reverse = that._reverse,\n direction = reverse ? directions[that._direction].reverse : that._direction,\n rotation = ROTATIONS[direction];\n\n start.zIndex = 1;\n\n if (that._clipInHalf) {\n start.clip = clipInHalf(that._container, kendo.directions[direction].reverse);\n }\n\n start[BACKFACE] = HIDDEN;\n\n end[TRANSFORM] = TRANSFORM_PERSPECTIVE + (reverse ? rotation.start : rotation.end);\n start[TRANSFORM] = TRANSFORM_PERSPECTIVE + (reverse ? rotation.end : rotation.start);\n },\n\n setup: function() {\n this._container.append(this.element);\n },\n\n face: function(value) {\n this._face = value;\n return this;\n },\n\n shouldHide: function() {\n var that = this,\n reverse = that._reverse,\n face = that._face;\n\n return (reverse && !face) || (!reverse && face);\n },\n\n clipInHalf: function(value) {\n this._clipInHalf = value;\n return this;\n },\n\n temporary: function() {\n this.element.addClass('temp-page');\n return this;\n }\n });\n\n createEffect(\"staticPage\", {\n directions: FOUR_DIRECTIONS,\n\n init: function(element, direction, container) {\n Effect.prototype.init.call(this, element, direction);\n this._container = container;\n },\n\n restore: [\"clip\"],\n\n prepare: function(start, end) {\n var that = this,\n direction = that._reverse ? directions[that._direction].reverse : that._direction;\n\n start.clip = clipInHalf(that._container, direction);\n start.opacity = 0.999;\n end.opacity = 1;\n },\n\n shouldHide: function() {\n var that = this,\n reverse = that._reverse,\n face = that._face;\n\n return (reverse && !face) || (!reverse && face);\n },\n\n face: function(value) {\n this._face = value;\n return this;\n }\n });\n\n createEffect(\"pageturn\", {\n directions: [\"horizontal\", \"vertical\"],\n\n init: function(element, direction, face, back) {\n Effect.prototype.init.call(this, element, direction);\n this.options = {};\n this.options.face = face;\n this.options.back = back;\n },\n\n children: function() {\n var that = this,\n options = that.options,\n direction = that._direction === \"horizontal\" ? \"left\" : \"top\",\n reverseDirection = kendo.directions[direction].reverse,\n reverse = that._reverse,\n temp,\n faceClone = options.face.clone(true).removeAttr(\"id\"),\n backClone = options.back.clone(true).removeAttr(\"id\"),\n element = that.element;\n\n if (reverse) {\n temp = direction;\n direction = reverseDirection;\n reverseDirection = temp;\n }\n\n return [\n kendo.fx(options.face).staticPage(direction, element).face(true).setReverse(reverse),\n kendo.fx(options.back).staticPage(reverseDirection, element).setReverse(reverse),\n kendo.fx(faceClone).turningPage(direction, element).face(true).clipInHalf(true).temporary().setReverse(reverse),\n kendo.fx(backClone).turningPage(reverseDirection, element).clipInHalf(true).temporary().setReverse(reverse)\n ];\n },\n\n prepare: function(start, end) {\n start[PERSPECTIVE] = DEFAULT_PERSPECTIVE;\n start.transformStyle = \"preserve-3d\";\n // hack to trigger transition end.\n start.opacity = 0.999;\n end.opacity = 1;\n },\n\n teardown: function() {\n this.element.find(\".temp-page\").remove();\n }\n });\n\n createEffect(\"flip\", {\n directions: [\"horizontal\", \"vertical\"],\n\n init: function(element, direction, face, back) {\n Effect.prototype.init.call(this, element, direction);\n this.options = {};\n this.options.face = face;\n this.options.back = back;\n },\n\n children: function() {\n var that = this,\n options = that.options,\n direction = that._direction === \"horizontal\" ? \"left\" : \"top\",\n reverseDirection = kendo.directions[direction].reverse,\n reverse = that._reverse,\n temp,\n element = that.element;\n\n if (reverse) {\n temp = direction;\n direction = reverseDirection;\n reverseDirection = temp;\n }\n\n return [\n kendo.fx(options.face).turningPage(direction, element).face(true).setReverse(reverse),\n kendo.fx(options.back).turningPage(reverseDirection, element).setReverse(reverse)\n ];\n },\n\n prepare: function(start) {\n start[PERSPECTIVE] = DEFAULT_PERSPECTIVE;\n start.transformStyle = \"preserve-3d\";\n }\n });\n\n var RESTORE_OVERFLOW = !support.mobileOS.android;\n var IGNORE_TRANSITION_EVENT_SELECTOR = \".km-touch-scrollbar, .km-actionsheet-wrapper\";\n\n createEffect(\"replace\", {\n _before: $.noop,\n _after: $.noop,\n init: function(element, previous, transitionClass) {\n Effect.prototype.init.call(this, element);\n this._previous = $(previous);\n this._transitionClass = transitionClass;\n },\n\n duration: function() {\n throw new Error(\"The replace effect does not support duration setting; the effect duration may be customized through the transition class rule\");\n },\n\n beforeTransition: function(callback) {\n this._before = callback;\n return this;\n },\n\n afterTransition: function(callback) {\n this._after = callback;\n return this;\n },\n\n _both: function() {\n return $().add(this._element).add(this._previous);\n },\n\n _containerClass: function() {\n var direction = this._direction,\n containerClass = \"k-fx k-fx-start k-fx-\" + this._transitionClass;\n\n if (direction) {\n containerClass += \" k-fx-\" + direction;\n }\n\n if (this._reverse) {\n containerClass += \" k-fx-reverse\";\n }\n\n return containerClass;\n },\n\n complete: function(e) {\n if (!this.deferred || (e && $(e.target).is(IGNORE_TRANSITION_EVENT_SELECTOR))) {\n return;\n }\n\n var container = this.container;\n\n container\n .removeClass(\"k-fx-end\")\n .removeClass(this._containerClass())\n .off(transitions.event, this.completeProxy);\n\n this._previous.hide().removeClass(\"k-fx-current\");\n this.element.removeClass(\"k-fx-next\");\n\n if (RESTORE_OVERFLOW) {\n container.css(OVERFLOW, \"\");\n }\n\n if (!this.isAbsolute) {\n this._both().css(POSITION, \"\");\n }\n\n this.deferred.resolve();\n delete this.deferred;\n },\n\n run: function() {\n if (this._additionalEffects && this._additionalEffects[0]) {\n return this.compositeRun();\n }\n\n var that = this,\n element = that.element,\n previous = that._previous,\n container = element.parents().filter(previous.parents()).first(),\n both = that._both(),\n deferred = $.Deferred(),\n originalPosition = element.css(POSITION),\n originalOverflow;\n\n // edge case for grid/scheduler, where the previous is already destroyed.\n if (!container.length) {\n container = element.parent();\n }\n\n this.container = container;\n this.deferred = deferred;\n this.isAbsolute = originalPosition == \"absolute\";\n\n if (!this.isAbsolute) {\n both.css(POSITION, \"absolute\");\n }\n\n if (RESTORE_OVERFLOW) {\n originalOverflow = container.css(OVERFLOW);\n container.css(OVERFLOW, \"hidden\");\n }\n\n if (!transitions) {\n this.complete();\n } else {\n element.addClass(\"k-fx-hidden\");\n\n container.addClass(this._containerClass());\n\n this.completeProxy = this.complete.bind(this);\n container.on(transitions.event, this.completeProxy);\n\n kendo.animationFrame(function() {\n element.removeClass(\"k-fx-hidden\").addClass(\"k-fx-next\");\n previous.css(\"display\", \"\").addClass(\"k-fx-current\");\n that._before(previous, element);\n kendo.animationFrame(function() {\n container.removeClass(\"k-fx-start\").addClass(\"k-fx-end\");\n that._after(previous, element);\n });\n });\n }\n\n return deferred.promise();\n },\n\n stop: function() {\n this.complete();\n }\n });\n\n var Animation = kendo.Class.extend({\n init: function() {\n var that = this;\n that._tickProxy = that._tick.bind(that);\n that._started = false;\n },\n\n tick: $.noop,\n done: $.noop,\n onEnd: $.noop,\n onCancel: $.noop,\n\n start: function() {\n if (!this.enabled()) {\n return;\n }\n\n if (!this.done()) {\n this._started = true;\n kendo.animationFrame(this._tickProxy);\n } else {\n this.onEnd();\n }\n },\n\n enabled: function() {\n return true;\n },\n\n cancel: function() {\n this._started = false;\n this.onCancel();\n },\n\n _tick: function() {\n var that = this;\n if (!that._started) { return; }\n\n that.tick();\n\n if (!that.done()) {\n kendo.animationFrame(that._tickProxy);\n } else {\n that._started = false;\n that.onEnd();\n }\n }\n });\n\n var Transition = Animation.extend({\n init: function(options) {\n var that = this;\n extend(that, options);\n Animation.fn.init.call(that);\n },\n\n done: function() {\n return this.timePassed() >= this.duration;\n },\n\n timePassed: function() {\n return Math.min(this.duration, (new Date()) - this.startDate);\n },\n\n moveTo: function(options) {\n var that = this,\n movable = that.movable;\n\n that.initial = movable[that.axis];\n that.delta = options.location - that.initial;\n\n that.duration = typeof options.duration == \"number\" ? options.duration : 300;\n\n that.tick = that._easeProxy(options.ease);\n\n that.startDate = new Date();\n that.start();\n },\n\n _easeProxy: function(ease) {\n var that = this;\n\n return function() {\n that.movable.moveAxis(that.axis, ease(that.timePassed(), that.initial, that.delta, that.duration));\n };\n }\n });\n\n extend(Transition, {\n easeOutExpo: function(t, b, c, d) {\n return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;\n },\n\n easeOutBack: function(t, b, c, d, s) {\n s = 1.70158;\n return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;\n }\n });\n\n fx.Animation = Animation;\n fx.Transition = Transition;\n fx.createEffect = createEffect;\n\n fx.box = function(element) {\n element = $(element);\n var result = element.offset();\n result.width = kendo._outerWidth(element);\n result.height = kendo._outerHeight(element);\n return result;\n };\n\n fx.transformOrigin = function(inner, outer) {\n var x = (inner.left - outer.left) * outer.width / (outer.width - inner.width),\n y = (inner.top - outer.top) * outer.height / (outer.height - inner.height);\n\n return {\n x: isNaN(x) ? 0 : x,\n y: isNaN(y) ? 0 : y\n };\n };\n\n fx.fillScale = function(inner, outer) {\n return Math.min(inner.width / outer.width, inner.height / outer.height);\n };\n\n fx.fitScale = function(inner, outer) {\n return Math.max(inner.width / outer.width, inner.height / outer.height);\n };\n})(window.kendo.jQuery);\n","import './kendo.core.js';\nimport './kendo.userevents.js';\n\nvar __meta__ = {\n id: \"draganddrop\",\n name: \"Drag & drop\",\n category: \"framework\",\n description: \"Drag & drop functionality for any DOM element.\",\n depends: [ \"core\", \"userevents\" ]\n};\n\n(function($, undefined$1) {\n var kendo = window.kendo,\n support = kendo.support,\n document = window.document,\n $window = $(window),\n Class = kendo.Class,\n Widget = kendo.ui.Widget,\n Observable = kendo.Observable,\n UserEvents = kendo.UserEvents,\n extend = $.extend,\n getOffset = kendo.getOffset,\n draggables = {},\n dropTargets = {},\n dropAreas = {},\n lastDropTarget,\n elementUnderCursor = kendo.elementUnderCursor,\n KEYUP = \"keyup\",\n CHANGE = \"change\",\n\n // Draggable events\n DRAGSTART = \"dragstart\",\n HOLD = \"hold\",\n DRAG = \"drag\",\n DRAGEND = \"dragend\",\n DRAGCANCEL = \"dragcancel\",\n HINTDESTROYED = \"hintDestroyed\",\n\n // DropTarget events\n DRAGENTER = \"dragenter\",\n DRAGLEAVE = \"dragleave\",\n DROP = \"drop\";\n\n function contains(parent, child) {\n try {\n return $.contains(parent, child) || parent == child;\n } catch (e) {\n return false;\n }\n }\n\n function numericCssPropery(element, property) {\n return parseInt(element.css(property), 10) || 0;\n }\n\n function within(value, range) {\n return Math.min(Math.max(value, range.min), range.max);\n }\n\n function containerBoundaries(container, element) {\n var offset = getOffset(container),\n outerWidth = kendo._outerWidth,\n outerHeight = kendo._outerHeight,\n minX = offset.left + numericCssPropery(container, \"borderLeftWidth\") + numericCssPropery(container, \"paddingLeft\"),\n minY = offset.top + numericCssPropery(container, \"borderTopWidth\") + numericCssPropery(container, \"paddingTop\"),\n maxX = minX + container.width() - outerWidth(element, true),\n maxY = minY + container.height() - outerHeight(element, true);\n\n return {\n x: { min: minX, max: maxX },\n y: { min: minY, max: maxY }\n };\n }\n\n function checkTarget(target, targets, areas) {\n var theTarget, theFilter, i = 0,\n targetLen = targets && targets.length,\n areaLen = areas && areas.length;\n\n while (target && target.parentNode) {\n for (i = 0; i < targetLen; i ++) {\n theTarget = targets[i];\n if (theTarget.element[0] === target) {\n return { target: theTarget, targetElement: target };\n }\n }\n\n for (i = 0; i < areaLen; i ++) {\n theFilter = areas[i];\n if ($.contains(theFilter.element[0], target) && support.matchesSelector.call(target, theFilter.options.filter)) {\n return { target: theFilter, targetElement: target };\n }\n }\n\n target = target.parentNode;\n }\n\n return undefined$1;\n }\n\n var TapCapture = Observable.extend({\n init: function(element, options) {\n var that = this,\n domElement = element[0];\n\n that.capture = false;\n\n if (domElement.addEventListener) {\n $.each(kendo.eventMap.down.split(\" \"), function() {\n domElement.addEventListener(this, that._press.bind(that), true);\n });\n $.each(kendo.eventMap.up.split(\" \"), function() {\n domElement.addEventListener(this, that._release.bind(that), true);\n });\n } else {\n $.each(kendo.eventMap.down.split(\" \"), function() {\n domElement.attachEvent(this, that._press.bind(that));\n });\n $.each(kendo.eventMap.up.split(\" \"), function() {\n domElement.attachEvent(this, that._release.bind(that));\n });\n }\n\n Observable.fn.init.call(that);\n\n that.bind([\"press\", \"release\"], options || {});\n },\n\n captureNext: function() {\n this.capture = true;\n },\n\n cancelCapture: function() {\n this.capture = false;\n },\n\n _press: function(e) {\n var that = this;\n that.trigger(\"press\");\n if (that.capture) {\n e.preventDefault();\n }\n },\n\n _release: function(e) {\n var that = this;\n that.trigger(\"release\");\n\n if (that.capture) {\n e.preventDefault();\n that.cancelCapture();\n }\n }\n });\n\n var PaneDimension = Observable.extend({\n init: function(options) {\n var that = this;\n Observable.fn.init.call(that);\n\n that.forcedEnabled = false;\n\n $.extend(that, options);\n\n that.scale = 1;\n\n if (that.horizontal) {\n that.measure = \"offsetWidth\";\n that.scrollSize = \"scrollWidth\";\n that.axis = \"x\";\n } else {\n that.measure = \"offsetHeight\";\n that.scrollSize = \"scrollHeight\";\n that.axis = \"y\";\n }\n },\n\n makeVirtual: function() {\n $.extend(this, {\n virtual: true,\n forcedEnabled: true,\n _virtualMin: 0,\n _virtualMax: 0\n });\n },\n\n virtualSize: function(min, max) {\n if (this._virtualMin !== min || this._virtualMax !== max) {\n this._virtualMin = min;\n this._virtualMax = max;\n this.update();\n }\n },\n\n outOfBounds: function(offset) {\n return offset > this.max || offset < this.min;\n },\n\n forceEnabled: function() {\n this.forcedEnabled = true;\n },\n\n getSize: function() {\n return this.container[0][this.measure];\n },\n\n getTotal: function() {\n return this.element[0][this.scrollSize];\n },\n\n rescale: function(scale) {\n this.scale = scale;\n },\n\n update: function(silent) {\n var that = this,\n total = that.virtual ? that._virtualMax : that.getTotal(),\n scaledTotal = total * that.scale,\n size = that.getSize();\n\n if (total === 0 && !that.forcedEnabled) {\n return; // we are not visible.\n }\n\n that.max = that.virtual ? -that._virtualMin : 0;\n that.size = size;\n that.total = scaledTotal;\n that.min = Math.min(that.max, size - scaledTotal);\n that.minScale = size / total;\n that.centerOffset = (scaledTotal - size) / 2;\n\n that.enabled = that.forcedEnabled || (scaledTotal > size);\n\n if (!silent) {\n that.trigger(CHANGE, that);\n }\n }\n });\n\n var PaneDimensions = Observable.extend({\n init: function(options) {\n var that = this;\n\n Observable.fn.init.call(that);\n\n that.x = new PaneDimension(extend({ horizontal: true }, options));\n that.y = new PaneDimension(extend({ horizontal: false }, options));\n that.container = options.container;\n that.forcedMinScale = options.minScale;\n that.maxScale = options.maxScale || 100;\n\n that.bind(CHANGE, options);\n },\n\n rescale: function(newScale) {\n this.x.rescale(newScale);\n this.y.rescale(newScale);\n this.refresh();\n },\n\n centerCoordinates: function() {\n return { x: Math.min(0, -this.x.centerOffset), y: Math.min(0, -this.y.centerOffset) };\n },\n\n refresh: function() {\n var that = this;\n that.x.update();\n that.y.update();\n that.enabled = that.x.enabled || that.y.enabled;\n that.minScale = that.forcedMinScale || Math.min(that.x.minScale, that.y.minScale);\n that.fitScale = Math.max(that.x.minScale, that.y.minScale);\n that.trigger(CHANGE);\n }\n });\n\n var PaneAxis = Observable.extend({\n init: function(options) {\n var that = this;\n extend(that, options);\n Observable.fn.init.call(that);\n },\n\n outOfBounds: function() {\n return this.dimension.outOfBounds(this.movable[this.axis]);\n },\n\n dragMove: function(delta) {\n var that = this,\n dimension = that.dimension,\n axis = that.axis,\n movable = that.movable,\n position = movable[axis] + delta;\n\n if (!dimension.enabled) {\n return;\n }\n\n if ((position < dimension.min && delta < 0) || (position > dimension.max && delta > 0)) {\n delta *= that.resistance;\n }\n\n movable.translateAxis(axis, delta);\n that.trigger(CHANGE, that);\n }\n });\n\n var Pane = Class.extend({\n\n init: function(options) {\n var that = this,\n x,\n y,\n resistance,\n movable;\n\n extend(that, { elastic: true }, options);\n\n resistance = that.elastic ? 0.5 : 0;\n movable = that.movable;\n\n that.x = x = new PaneAxis({\n axis: \"x\",\n dimension: that.dimensions.x,\n resistance: resistance,\n movable: movable\n });\n\n that.y = y = new PaneAxis({\n axis: \"y\",\n dimension: that.dimensions.y,\n resistance: resistance,\n movable: movable\n });\n\n that.userEvents.bind([\"press\", \"move\", \"end\", \"gesturestart\", \"gesturechange\"], {\n gesturestart: function(e) {\n that.gesture = e;\n that.offset = that.dimensions.container.offset();\n },\n\n press: function(e) {\n if ($(e.event.target).closest(\"a\").is(\"[data-navigate-on-press=true]\")) {\n e.sender.cancel();\n }\n },\n\n gesturechange: function(e) {\n var previousGesture = that.gesture,\n previousCenter = previousGesture.center,\n\n center = e.center,\n\n scaleDelta = e.distance / previousGesture.distance,\n\n minScale = that.dimensions.minScale,\n maxScale = that.dimensions.maxScale,\n coordinates;\n\n if (movable.scale <= minScale && scaleDelta < 1) {\n // Resist shrinking. Instead of shrinking from 1 to 0.5, it will shrink to 0.5 + (1 /* minScale */ - 0.5) * 0.8 = 0.9;\n scaleDelta += (1 - scaleDelta) * 0.8;\n }\n\n if (movable.scale * scaleDelta >= maxScale) {\n scaleDelta = maxScale / movable.scale;\n }\n\n var offsetX = movable.x + that.offset.left,\n offsetY = movable.y + that.offset.top;\n\n coordinates = {\n x: (offsetX - previousCenter.x) * scaleDelta + center.x - offsetX,\n y: (offsetY - previousCenter.y) * scaleDelta + center.y - offsetY\n };\n\n movable.scaleWith(scaleDelta);\n\n x.dragMove(coordinates.x);\n y.dragMove(coordinates.y);\n\n that.dimensions.rescale(movable.scale);\n that.gesture = e;\n e.preventDefault();\n },\n\n move: function(e) {\n if (e.event.target.tagName.match(/textarea|input/i)) {\n return;\n }\n\n if (x.dimension.enabled || y.dimension.enabled) {\n x.dragMove(e.x.delta);\n y.dragMove(e.y.delta);\n e.preventDefault();\n } else {\n e.touch.skip();\n }\n },\n\n end: function(e) {\n e.preventDefault();\n }\n });\n }\n });\n\n var TRANSFORM_STYLE = support.transitions.prefix + \"Transform\",\n translate;\n\n\n if (support.hasHW3D) {\n translate = function(x, y, scale) {\n return \"translate3d(\" + x + \"px,\" + y + \"px,0) scale(\" + scale + \")\";\n };\n } else {\n translate = function(x, y, scale) {\n return \"translate(\" + x + \"px,\" + y + \"px) scale(\" + scale + \")\";\n };\n }\n\n var Movable = Observable.extend({\n init: function(element) {\n var that = this;\n\n Observable.fn.init.call(that);\n\n that.element = $(element);\n that.element[0].style.webkitTransformOrigin = \"left top\";\n that.x = 0;\n that.y = 0;\n that.scale = 1;\n that._saveCoordinates(translate(that.x, that.y, that.scale));\n },\n\n translateAxis: function(axis, by) {\n this[axis] += by;\n this.refresh();\n },\n\n scaleTo: function(scale) {\n this.scale = scale;\n this.refresh();\n },\n\n scaleWith: function(scaleDelta) {\n this.scale *= scaleDelta;\n this.refresh();\n },\n\n translate: function(coordinates) {\n this.x += coordinates.x;\n this.y += coordinates.y;\n this.refresh();\n },\n\n moveAxis: function(axis, value) {\n this[axis] = value;\n this.refresh();\n },\n\n moveTo: function(coordinates) {\n extend(this, coordinates);\n this.refresh();\n },\n\n refresh: function() {\n var that = this,\n x = that.x,\n y = that.y,\n newCoordinates;\n\n if (that.round) {\n x = Math.round(x);\n y = Math.round(y);\n }\n\n newCoordinates = translate(x, y, that.scale);\n\n if (newCoordinates != that.coordinates) {\n if (kendo.support.browser.msie && kendo.support.browser.version < 10) {\n that.element[0].style.position = \"absolute\";\n that.element[0].style.left = that.x + \"px\";\n that.element[0].style.top = that.y + \"px\";\n\n } else {\n that.element[0].style[TRANSFORM_STYLE] = newCoordinates;\n }\n that._saveCoordinates(newCoordinates);\n that.trigger(CHANGE);\n }\n },\n\n _saveCoordinates: function(coordinates) {\n this.coordinates = coordinates;\n }\n });\n\n function destroyDroppable(collection, widget) {\n var groupName = widget.options.group,\n droppables = collection[groupName],\n i;\n\n Widget.fn.destroy.call(widget);\n\n if (droppables.length > 1) {\n for (i = 0; i < droppables.length; i++) {\n if (droppables[i] == widget) {\n droppables.splice(i, 1);\n break;\n }\n }\n } else {\n droppables.length = 0; // WTF, porting this from the previous destroyGroup\n delete collection[groupName];\n }\n }\n\n var DropTarget = Widget.extend({\n init: function(element, options) {\n var that = this;\n\n Widget.fn.init.call(that, element, options);\n\n var group = that.options.group;\n\n if (!(group in dropTargets)) {\n dropTargets[group] = [ that ];\n } else {\n dropTargets[group].push( that );\n }\n },\n\n events: [\n DRAGENTER,\n DRAGLEAVE,\n DROP\n ],\n\n options: {\n name: \"DropTarget\",\n group: \"default\"\n },\n\n destroy: function() {\n destroyDroppable(dropTargets, this);\n },\n\n _trigger: function(eventName, e) {\n var that = this,\n draggable = draggables[that.options.group];\n\n if (draggable) {\n return that.trigger(eventName, extend({}, e.event, {\n draggable: draggable,\n dropTarget: e.dropTarget\n }));\n }\n },\n\n _over: function(e) {\n this._trigger(DRAGENTER, e);\n },\n\n _out: function(e) {\n this._trigger(DRAGLEAVE, e);\n },\n\n _drop: function(e) {\n var that = this,\n draggable = draggables[that.options.group];\n\n if (draggable) {\n draggable.dropped = !that._trigger(DROP, e);\n }\n }\n });\n\n DropTarget.destroyGroup = function(groupName) {\n var group = dropTargets[groupName] || dropAreas[groupName],\n i;\n\n if (group) {\n for (i = 0; i < group.length; i++) {\n Widget.fn.destroy.call(group[i]);\n }\n\n group.length = 0;\n delete dropTargets[groupName];\n delete dropAreas[groupName];\n }\n };\n\n DropTarget._cache = dropTargets;\n\n var DropTargetArea = DropTarget.extend({\n init: function(element, options) {\n var that = this;\n\n Widget.fn.init.call(that, element, options);\n\n var group = that.options.group;\n\n if (!(group in dropAreas)) {\n dropAreas[group] = [ that ];\n } else {\n dropAreas[group].push( that );\n }\n },\n\n destroy: function() {\n destroyDroppable(dropAreas, this);\n },\n\n options: {\n name: \"DropTargetArea\",\n group: \"default\",\n filter: null\n }\n });\n\n var Draggable = Widget.extend({\n init: function(element, options) {\n var that = this;\n\n Widget.fn.init.call(that, element, options);\n\n that._activated = false;\n\n that.userEvents = new UserEvents(that.element, {\n global: true,\n allowSelection: true,\n filter: that.options.filter,\n threshold: that.options.distance,\n start: that._start.bind(that),\n hold: that._hold.bind(that),\n move: that._drag.bind(that),\n end: that._end.bind(that),\n cancel: that._cancel.bind(that),\n select: that._select.bind(that)\n });\n\n if (kendo.support.touch) {\n that.element.find(that.options.filter).css('touch-action', 'none');\n }\n\n that._afterEndHandler = that._afterEnd.bind(that);\n that._captureEscape = that._captureEscape.bind(that);\n },\n\n events: [\n HOLD,\n DRAGSTART,\n DRAG,\n DRAGEND,\n DRAGCANCEL,\n HINTDESTROYED\n ],\n\n options: {\n name: \"Draggable\",\n distance: ( kendo.support.touch ? 0 : 5),\n group: \"default\",\n cursorOffset: null,\n axis: null,\n container: null,\n filter: null,\n ignore: null,\n holdToDrag: false,\n autoScroll: false,\n dropped: false\n },\n\n cancelHold: function() {\n this._activated = false;\n },\n\n _captureEscape: function(e) {\n var that = this;\n\n if (e.keyCode === kendo.keys.ESC) {\n that._trigger(DRAGCANCEL, { event: e });\n that.userEvents.cancel();\n }\n },\n\n _updateHint: function(e) {\n var that = this,\n coordinates,\n options = that.options,\n boundaries = that.boundaries,\n axis = options.axis,\n cursorOffset = that.options.cursorOffset;\n\n if (cursorOffset) {\n coordinates = { left: e.x.location + cursorOffset.left, top: e.y.location + cursorOffset.top };\n } else {\n that.hintOffset.left += e.x.delta;\n that.hintOffset.top += e.y.delta;\n coordinates = $.extend({}, that.hintOffset);\n }\n\n if (boundaries) {\n coordinates.top = within(coordinates.top, boundaries.y);\n coordinates.left = within(coordinates.left, boundaries.x);\n }\n\n if (axis === \"x\") {\n delete coordinates.top;\n } else if (axis === \"y\") {\n delete coordinates.left;\n }\n\n that.hint.css(coordinates);\n },\n\n _shouldIgnoreTarget: function(target) {\n var ignoreSelector = this.options.ignore;\n return ignoreSelector && $(target).is(ignoreSelector);\n },\n\n _select: function(e) {\n if (!this._shouldIgnoreTarget(e.event.target)) {\n e.preventDefault();\n }\n },\n\n _start: function(e) {\n var that = this,\n options = that.options,\n container = options.container ? $(options.container) : null,\n hint = options.hint;\n\n if (this._shouldIgnoreTarget(e.touch.initialTouch) || (options.holdToDrag && !that._activated)) {\n that.userEvents.cancel();\n return;\n }\n\n that.currentTarget = e.target;\n that.currentTargetOffset = getOffset(that.currentTarget);\n\n if (hint) {\n if (that.hint) {\n that.hint.stop(true, true).remove();\n }\n\n that.hint = kendo.isFunction(hint) ? $(hint.call(that, that.currentTarget)) : hint;\n\n var offset = getOffset(that.currentTarget);\n that.hintOffset = offset;\n\n that.hint.css( {\n position: \"absolute\",\n zIndex: 20000, // the Window's z-index is 10000 and can be raised because of z-stacking\n left: offset.left,\n top: offset.top\n })\n .appendTo(document.body);\n\n that.angular(\"compile\", function() {\n that.hint.removeAttr(\"ng-repeat\");\n var scopeTarget = $(e.target);\n\n while (!scopeTarget.data(\"$$kendoScope\") && scopeTarget.length) {\n scopeTarget = scopeTarget.parent();\n }\n\n return {\n elements: that.hint.get(),\n scopeFrom: scopeTarget.data(\"$$kendoScope\")\n };\n });\n }\n\n draggables[options.group] = that;\n\n that.dropped = false;\n\n if (container) {\n that.boundaries = containerBoundaries(container, that.hint);\n }\n\n $(document).on(KEYUP, that._captureEscape);\n\n if (that._trigger(DRAGSTART, e)) {\n that.userEvents.cancel();\n that._afterEnd();\n }\n\n that.userEvents.capture();\n },\n\n _hold: function(e) {\n this.currentTarget = e.target;\n\n if (this._trigger(HOLD, e)) {\n this.userEvents.cancel();\n } else {\n this._activated = true;\n }\n },\n\n _drag: function(e) {\n e.preventDefault();\n\n var cursorElement = this._elementUnderCursor(e);\n\n if (this.options.autoScroll && this._cursorElement !== cursorElement) {\n this._scrollableParent = findScrollableParent(cursorElement);\n this._cursorElement = cursorElement;\n }\n\n this._lastEvent = e;\n this._processMovement(e, cursorElement);\n\n if (this.options.autoScroll) {\n // chrome seems to trigger mousemove when mouse is moved outside of the window (over the Chrome), too.\n if (this._scrollableParent[0]) {\n var velocity = autoScrollVelocity(e.x.location, e.y.location, scrollableViewPort(this._scrollableParent));\n\n\n this._scrollCompenstation = $.extend({}, this.hintOffset);\n this._scrollVelocity = velocity;\n\n if (velocity.y === 0 && velocity.x === 0) {\n clearInterval(this._scrollInterval);\n this._scrollInterval = null;\n } else if (!this._scrollInterval) {\n this._scrollInterval = setInterval(this._autoScroll.bind(this), 50);\n }\n }\n }\n\n if (this.hint) {\n this._updateHint(e);\n }\n },\n\n _processMovement: function(e, cursorElement) {\n this._withDropTarget(cursorElement, function(target, targetElement) {\n if (!target) {\n if (lastDropTarget) {\n lastDropTarget._trigger(DRAGLEAVE, extend(e, { dropTarget: $(lastDropTarget.targetElement) }));\n lastDropTarget = null;\n }\n return;\n }\n\n if (lastDropTarget) {\n if (targetElement === lastDropTarget.targetElement) {\n return;\n }\n\n lastDropTarget._trigger(DRAGLEAVE, extend(e, { dropTarget: $(lastDropTarget.targetElement) }));\n }\n\n target._trigger(DRAGENTER, extend(e, { dropTarget: $(targetElement) }));\n lastDropTarget = extend(target, { targetElement: targetElement });\n });\n\n this._trigger(DRAG, extend(e, { dropTarget: lastDropTarget, elementUnderCursor: cursorElement }));\n },\n\n _autoScroll: function() {\n var parent = this._scrollableParent[0],\n velocity = this._scrollVelocity,\n compensation = this._scrollCompenstation;\n\n if (!parent) {\n return;\n }\n\n var cursorElement = this._elementUnderCursor(this._lastEvent);\n this._processMovement(this._lastEvent, cursorElement);\n\n var yIsScrollable, xIsScrollable;\n\n var isRootNode = parent === scrollableRoot()[0];\n\n if (isRootNode) {\n yIsScrollable = document.body.scrollHeight > $window.height();\n xIsScrollable = document.body.scrollWidth > $window.width();\n } else {\n yIsScrollable = parent.offsetHeight <= parent.scrollHeight;\n xIsScrollable = parent.offsetWidth <= parent.scrollWidth;\n }\n\n var yDelta = parent.scrollTop + velocity.y;\n var yInBounds = yIsScrollable && yDelta > 0 && yDelta < parent.scrollHeight;\n\n var xDelta = parent.scrollLeft + velocity.x;\n var xInBounds = xIsScrollable && xDelta > 0 && xDelta < parent.scrollWidth;\n\n if (yInBounds) {\n parent.scrollTop += velocity.y;\n } else if (yIsScrollable && yDelta < 0) {\n parent.scrollTop = 0;\n }\n\n if (xInBounds) {\n parent.scrollLeft += velocity.x;\n } else if (xIsScrollable && xDelta < 0) {\n parent.scrollLeft = 0;\n }\n\n if (this.hint && isRootNode && (xInBounds || yInBounds)) {\n if (yInBounds) {\n compensation.top += velocity.y;\n }\n\n if (xInBounds) {\n compensation.left += velocity.x;\n }\n\n this.hint.css(compensation);\n }\n },\n\n _end: function(e) {\n this._withDropTarget(this._elementUnderCursor(e), function(target, targetElement) {\n if (target) {\n target._drop(extend({}, e, { dropTarget: $(targetElement) }));\n lastDropTarget = null;\n }\n });\n\n clearInterval(this._scrollInterval);\n this._scrollInterval = null;\n this._cancel(this._trigger(DRAGEND, e));\n },\n\n _cancel: function(isDefaultPrevented) {\n var that = this;\n\n that._scrollableParent = null;\n this._cursorElement = null;\n clearInterval(this._scrollInterval);\n that._activated = false;\n\n if (that.hint && !that.dropped) {\n setTimeout(function() {\n that.hint.stop(true, true);\n\n if (isDefaultPrevented) {\n that._afterEndHandler();\n } else {\n that.hint.animate(that.currentTargetOffset, \"fast\", that._afterEndHandler);\n }\n }, 0);\n\n } else {\n that._afterEnd();\n }\n },\n\n _trigger: function(eventName, e) {\n var that = this;\n\n return that.trigger(\n eventName, extend(\n {},\n e.event,\n {\n x: e.x,\n y: e.y,\n currentTarget: that.currentTarget,\n initialTarget: e.touch ? e.touch.initialTouch : null,\n dropTarget: e.dropTarget,\n elementUnderCursor: e.elementUnderCursor\n }\n ));\n },\n\n _elementUnderCursor: function(e) {\n var target = elementUnderCursor(e),\n hint = this.hint;\n\n if (hint && contains(hint[0], target)) {\n hint.hide();\n target = elementUnderCursor(e);\n // IE8 does not return the element in iframe from first attempt\n if (!target) {\n target = elementUnderCursor(e);\n }\n hint.show();\n }\n\n return target;\n },\n\n _withDropTarget: function(element, callback) {\n var result,\n group = this.options.group,\n targets = dropTargets[group],\n areas = dropAreas[group];\n\n if (targets && targets.length || areas && areas.length) {\n result = checkTarget(element, targets, areas);\n\n if (result) {\n callback(result.target, result.targetElement);\n } else {\n callback();\n }\n }\n },\n\n destroy: function() {\n var that = this;\n\n Widget.fn.destroy.call(that);\n\n that._afterEnd();\n\n that.userEvents.destroy();\n\n this._scrollableParent = null;\n this._cursorElement = null;\n clearInterval(this._scrollInterval);\n\n that.currentTarget = null;\n },\n\n _afterEnd: function() {\n var that = this;\n\n if (that.hint) {\n that.hint.remove();\n }\n\n delete draggables[that.options.group];\n\n that.trigger(\"destroy\");\n that.trigger(HINTDESTROYED);\n $(document).off(KEYUP, that._captureEscape);\n }\n });\n\n kendo.ui.plugin(DropTarget);\n kendo.ui.plugin(DropTargetArea);\n kendo.ui.plugin(Draggable);\n kendo.TapCapture = TapCapture;\n kendo.containerBoundaries = containerBoundaries;\n\n extend(kendo.ui, {\n Pane: Pane,\n PaneDimensions: PaneDimensions,\n Movable: Movable\n });\n\n function scrollableViewPort(element) {\n var root = scrollableRoot()[0],\n offset,\n top,\n left;\n\n if (element[0] === root) {\n top = root.scrollTop;\n left = root.scrollLeft;\n\n return {\n top: top,\n left: left,\n bottom: top + $window.height(),\n right: left + $window.width()\n };\n } else {\n offset = element.offset();\n offset.bottom = offset.top + element.height();\n offset.right = offset.left + element.width();\n return offset;\n }\n }\n\n function scrollableRoot() {\n return $(kendo.support.browser.edge || kendo.support.browser.safari ? document.body : document.documentElement);\n }\n\n function findScrollableParent(element) {\n var root = scrollableRoot();\n\n if (!element || element === document.body || element === document.documentElement) {\n return root;\n }\n\n var parent = $(element)[0];\n\n while (parent && !kendo.isScrollable(parent) && parent !== document.body) {\n parent = parent.parentNode;\n }\n\n if (parent === document.body) {\n return root;\n }\n\n return $(parent);\n }\n\n function autoScrollVelocity(mouseX, mouseY, rect) {\n var velocity = { x: 0, y: 0 };\n\n var AUTO_SCROLL_AREA = 50;\n\n if (mouseX - rect.left < AUTO_SCROLL_AREA) {\n velocity.x = -(AUTO_SCROLL_AREA - (mouseX - rect.left));\n } else if (rect.right - mouseX < AUTO_SCROLL_AREA) {\n velocity.x = AUTO_SCROLL_AREA - (rect.right - mouseX);\n }\n\n if (mouseY - rect.top < AUTO_SCROLL_AREA) {\n velocity.y = -(AUTO_SCROLL_AREA - (mouseY - rect.top));\n } else if (rect.bottom - mouseY < AUTO_SCROLL_AREA) {\n velocity.y = AUTO_SCROLL_AREA - (rect.bottom - mouseY);\n }\n\n return velocity;\n }\n\n // export for testing\n kendo.ui.Draggable.utils = {\n autoScrollVelocity: autoScrollVelocity,\n scrollableViewPort: scrollableViewPort,\n findScrollableParent: findScrollableParent\n };\n\n })(window.kendo.jQuery);\n","import './kendo.fx.js';\nimport './kendo.draganddrop.js';\n\nvar __meta__ = {\n id: \"mobile.scroller\",\n name: \"Scroller\",\n category: \"mobile\",\n description: \"The Kendo Mobile Scroller widget enables touch friendly kinetic scrolling for the contents of a given DOM element.\",\n depends: [ \"fx\", \"draganddrop\" ]\n};\n\n(function($, undefined$1) {\n var kendo = window.kendo,\n mobile = kendo.mobile,\n fx = kendo.effects,\n ui = mobile.ui,\n extend = $.extend,\n Widget = ui.Widget,\n Class = kendo.Class,\n Movable = kendo.ui.Movable,\n Pane = kendo.ui.Pane,\n PaneDimensions = kendo.ui.PaneDimensions,\n Transition = fx.Transition,\n Animation = fx.Animation,\n abs = Math.abs,\n SNAPBACK_DURATION = 500,\n SCROLLBAR_OPACITY = 0.7,\n FRICTION = 0.96,\n VELOCITY_MULTIPLIER = 10,\n MAX_VELOCITY = 55,\n OUT_OF_BOUNDS_FRICTION = 0.5,\n ANIMATED_SCROLLER_PRECISION = 5,\n RELEASECLASS = \"km-scroller-release\",\n REFRESHCLASS = \"km-scroller-refresh\",\n PULL = \"pull\",\n CHANGE = \"change\",\n RESIZE = \"resize\",\n SCROLL = \"scroll\",\n MOUSE_WHEEL_ID = 2;\n\n var ZoomSnapBack = Animation.extend({\n init: function(options) {\n var that = this;\n Animation.fn.init.call(that);\n extend(that, options);\n\n that.userEvents.bind(\"gestureend\", that.start.bind(that));\n that.tapCapture.bind(\"press\", that.cancel.bind(that));\n },\n\n enabled: function() {\n return this.movable.scale < this.dimensions.minScale;\n },\n\n done: function() {\n return this.dimensions.minScale - this.movable.scale < 0.01;\n },\n\n tick: function() {\n var movable = this.movable;\n movable.scaleWith(1.1);\n this.dimensions.rescale(movable.scale);\n },\n\n onEnd: function() {\n var movable = this.movable;\n movable.scaleTo(this.dimensions.minScale);\n this.dimensions.rescale(movable.scale);\n }\n });\n\n var DragInertia = Animation.extend({\n init: function(options) {\n var that = this;\n\n Animation.fn.init.call(that);\n\n extend(that, options, {\n transition: new Transition({\n axis: options.axis,\n movable: options.movable,\n onEnd: function() { that._end(); }\n })\n });\n\n that.tapCapture.bind(\"press\", function() { that.cancel(); });\n that.userEvents.bind(\"end\", that.start.bind(that));\n that.userEvents.bind(\"gestureend\", that.start.bind(that));\n that.userEvents.bind(\"tap\", that.onEnd.bind(that));\n },\n\n onCancel: function() {\n this.transition.cancel();\n },\n\n freeze: function(location) {\n var that = this;\n that.cancel();\n that._moveTo(location);\n },\n\n onEnd: function() {\n var that = this;\n if (that.paneAxis.outOfBounds()) {\n that._snapBack();\n } else {\n that._end();\n }\n },\n\n done: function() {\n return abs(this.velocity) < 1;\n },\n\n start: function(e) {\n var that = this,\n velocity;\n\n if (!that.dimension.enabled) { return; }\n\n if (that.paneAxis.outOfBounds()) {\n if (that.transition._started) {\n that.transition.cancel();\n that.velocity = Math.min(e.touch[that.axis].velocity * that.velocityMultiplier, MAX_VELOCITY);\n\n Animation.fn.start.call(that);\n } else {\n that._snapBack();\n }\n } else {\n velocity = e.touch.id === MOUSE_WHEEL_ID ? 0 : e.touch[that.axis].velocity;\n that.velocity = Math.max(Math.min(velocity * that.velocityMultiplier, MAX_VELOCITY), -MAX_VELOCITY);\n\n that.tapCapture.captureNext();\n Animation.fn.start.call(that);\n }\n },\n\n tick: function() {\n var that = this,\n dimension = that.dimension,\n friction = that.paneAxis.outOfBounds() ? OUT_OF_BOUNDS_FRICTION : that.friction,\n delta = (that.velocity *= friction),\n location = that.movable[that.axis] + delta;\n\n if (!that.elastic && dimension.outOfBounds(location)) {\n location = Math.max(Math.min(location, dimension.max), dimension.min);\n that.velocity = 0;\n }\n\n that.movable.moveAxis(that.axis, location);\n },\n\n _end: function() {\n this.tapCapture.cancelCapture();\n this.end();\n },\n\n _snapBack: function() {\n var that = this,\n dimension = that.dimension,\n snapBack = that.movable[that.axis] > dimension.max ? dimension.max : dimension.min;\n that._moveTo(snapBack);\n },\n\n _moveTo: function(location) {\n this.transition.moveTo({ location: location, duration: SNAPBACK_DURATION, ease: Transition.easeOutExpo });\n }\n });\n\n var AnimatedScroller = Animation.extend({\n init: function(options) {\n var that = this;\n\n kendo.effects.Animation.fn.init.call(this);\n\n extend(that, options, {\n origin: {},\n destination: {},\n offset: {}\n });\n },\n\n tick: function() {\n this._updateCoordinates();\n this.moveTo(this.origin);\n },\n\n done: function() {\n return abs(this.offset.y) < ANIMATED_SCROLLER_PRECISION && abs(this.offset.x) < ANIMATED_SCROLLER_PRECISION;\n },\n\n onEnd: function() {\n this.moveTo(this.destination);\n if (this.callback) {\n this.callback.call();\n }\n },\n\n setCoordinates: function(from, to) {\n this.offset = {};\n this.origin = from;\n this.destination = to;\n },\n\n setCallback: function(callback) {\n if (callback && kendo.isFunction(callback)) {\n this.callback = callback;\n } else {\n callback = undefined$1;\n }\n },\n\n _updateCoordinates: function() {\n this.offset = {\n x: (this.destination.x - this.origin.x) / 4,\n y: (this.destination.y - this.origin.y) / 4\n };\n\n this.origin = {\n y: this.origin.y + this.offset.y,\n x: this.origin.x + this.offset.x\n };\n }\n });\n\n var ScrollBar = Class.extend({\n init: function(options) {\n var that = this,\n horizontal = options.axis === \"x\",\n element = $('
');\n\n if (horizontal) {\n element.attr(\"aria-orientation\", \"horizontal\");\n }\n\n extend(that, options, {\n element: element,\n elementSize: 0,\n movable: new Movable(element),\n scrollMovable: options.movable,\n alwaysVisible: options.alwaysVisible,\n size: horizontal ? \"width\" : \"height\"\n });\n\n that.scrollMovable.bind(CHANGE, that.refresh.bind(that));\n that.container.append(element);\n if (options.alwaysVisible) {\n that.show();\n }\n },\n\n refresh: function() {\n var that = this,\n axis = that.axis,\n dimension = that.dimension,\n paneSize = dimension.size,\n scrollMovable = that.scrollMovable,\n sizeRatio = paneSize / dimension.total,\n position = Math.round(-scrollMovable[axis] * sizeRatio),\n size = Math.round(paneSize * sizeRatio);\n\n if (sizeRatio >= 1) {\n this.element.css(\"display\", \"none\");\n } else {\n this.element.css(\"display\", \"\");\n }\n\n if (position + size > paneSize) {\n size = paneSize - position;\n } else if (position < 0) {\n size += position;\n position = 0;\n }\n\n if (that.elementSize != size) {\n that.element.css(that.size, size + \"px\");\n that.elementSize = size;\n }\n\n that._ariaValue(position, dimension.size - that.elementSize);\n\n that.movable.moveAxis(axis, position);\n },\n\n show: function() {\n this.element.css({ opacity: SCROLLBAR_OPACITY, visibility: \"visible\" });\n },\n\n hide: function() {\n if (!this.alwaysVisible) {\n this.element.css({ opacity: 0 });\n }\n },\n\n _ariaValue: function(current, total) {\n var element = this.element;\n\n if (current > total) {\n current = total;\n }\n\n element.attr(\"aria-valuemax\", total);\n element.attr(\"aria-valuenow\", current);\n }\n });\n\n var Scroller = Widget.extend({\n init: function(element, options) {\n var that = this;\n Widget.fn.init.call(that, element, options);\n\n element = that.element;\n\n that._native = that.options.useNative && kendo.support.hasNativeScrolling;\n if (that._native) {\n element.addClass(\"km-native-scroller\")\n .prepend('