/** 
 * Kendo UI v2016.3.1118 (http://www.telerik.com/kendo-ui)                                                                                                                                              
 * Copyright 2016 Telerik AD. All rights reserved.                                                                                                                                                      
 *                                                                                                                                                                                                      
 * Kendo UI commercial licenses may be obtained at                                                                                                                                                      
 * http://www.telerik.com/purchase/license-agreement/kendo-ui-complete                                                                                                                                  
 * If you do not own a commercial license, this file shall be governed by the trial license terms.                                                                                                      
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       

*/
!function(e,define){define("kendo.data.min",["kendo.core.min","kendo.data.odata.min","kendo.data.xml.min"],e)}(function(){return function(e,t){function r(e,t,r,n){return function(i){var a,s={};for(a in i)s[a]=i[a];s.field=n?r+"."+i.field:r,t==Oe&&e._notifyChange&&e._notifyChange(s),e.trigger(t,s)}}function n(t,r){if(t===r)return!0;var i,a=e.type(t),s=e.type(r);if(a!==s)return!1;if("date"===a)return t.getTime()===r.getTime();if("object"!==a&&"array"!==a)return!1;for(i in t)if(!n(t[i],r[i]))return!1;return!0}function i(e,t){var r,n;for(n in e){if(r=e[n],he(r)&&r.field&&r.field===t)return r;if(r===t)return r}return null}function a(e){this.data=e||[]}function s(e,r){if(e){var n=typeof e===we?{field:e,dir:r}:e,i=ce(n)?n:n!==t?[n]:[];return ge(i,function(e){return!!e.dir})}}function o(e){var t,r,n,i,a=e.filters;if(a)for(t=0,r=a.length;t<r;t++)n=a[t],i=n.operator,i&&typeof i===we&&(n.operator=X[i.toLowerCase()]||i),o(n)}function u(e){if(e&&!fe(e))return!ce(e)&&e.filters||(e={logic:"and",filters:ce(e)?e:[e]}),o(e),e}function l(e,t){return!e.logic&&!t.logic&&(e.field===t.field&&e.value===t.value&&e.operator===t.operator)}function d(e){return e=e||{},fe(e)?{logic:"and",filters:[]}:u(e)}function h(e,t){return t.logic||e.field>t.field?1:e.field<t.field?-1:0}function f(e,t){var r,n,i,a,s;if(e=d(e),t=d(t),e.logic!==t.logic)return!1;if(i=(e.filters||[]).slice(),a=(t.filters||[]).slice(),i.length!==a.length)return!1;for(i=i.sort(h),a=a.sort(h),s=0;s<i.length;s++)if(r=i[s],n=a[s],r.logic&&n.logic){if(!f(r,n))return!1}else if(!l(r,n))return!1;return!0}function c(e){return ce(e)?e:[e]}function g(e,r){var n=typeof e===we?{field:e,dir:r}:e,i=ce(n)?n:n!==t?[n]:[];return B(i,function(e){return{field:e.field,dir:e.dir||"asc",aggregates:e.aggregates}})}function p(e,t){return e&&e.getTime&&t&&t.getTime?e.getTime()===t.getTime():e===t}function _(e,t,r,n,i,a){var s,o,u,l,d;for(t=t||[],l=t.length,s=0;s<l;s++)o=t[s],u=o.aggregate,d=o.field,e[d]=e[d]||{},a[d]=a[d]||{},a[d][u]=a[d][u]||{},e[d][u]=Y[u.toLowerCase()](e[d][u],r,me.accessor(d),n,i,a[d][u])}function v(e){return"number"==typeof e&&!isNaN(e)}function m(e){return e&&e.getTime}function y(e){var t,r=e.length,n=Array(r);for(t=0;t<r;t++)n[t]=e[t].toJSON();return n}function S(e,t,r,n,i){var a,s,o,u,l,d={};for(u=0,l=e.length;u<l;u++){a=e[u];for(s in t)o=i[s],o&&o!==s&&(d[o]||(d[o]=me.setter(o)),d[o](a,t[s](a)),delete a[s])}}function b(e,t,r,n,i){var a,s,o,u,l;for(u=0,l=e.length;u<l;u++){a=e[u];for(s in t)a[s]=r._parse(s,t[s](a)),o=i[s],o&&o!==s&&delete a[o]}}function w(e,t,r,n,i){var a,s,o,u;for(s=0,u=e.length;s<u;s++)a=e[s],o=n[a.field],o&&o!=a.field&&(a.field=o),a.value=r._parse(a.field,a.value),a.hasSubgroups?w(a.items,t,r,n,i):b(a.items,t,r,n,i)}function k(e,t,r,n,i,a){return function(s){return s=e(s),s&&!fe(n)&&("[object Array]"===We.call(s)||s instanceof Ye||(s=[s]),r(s,n,new t,i,a)),s||[]}}function x(e,t,r,n){for(var i,a,s,o=0;t.length&&n&&(i=t[o],a=i.items,s=a.length,e&&e.field===i.field&&e.value===i.value?(e.hasSubgroups&&e.items.length?x(e.items[e.items.length-1],i.items,r,n):(a=a.slice(r,r+n),e.items=e.items.concat(a)),t.splice(o--,1)):i.hasSubgroups&&a.length?(x(i,a,r,n),i.items.length||t.splice(o--,1)):(a=a.slice(r,r+n),i.items=a,i.items.length||t.splice(o--,1)),0===a.length?r-=s:(r=0,n-=a.length),!(++o>=t.length)););o<t.length&&t.splice(o,t.length-o)}function q(e){var t,r,n,i,a,s=[];for(t=0,r=e.length;t<r;t++)if(a=e.at(t),a.hasSubgroups)s=s.concat(q(a.items));else for(n=a.items,i=0;i<n.length;i++)s.push(n.at(i));return s}function D(e,t){var r,n,i;if(t)for(r=0,n=e.length;r<n;r++)i=e.at(r),i.hasSubgroups?D(i.items,t):i.items=new U(i.items,t)}function C(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r].hasSubgroups){if(C(e[r].items,t))return!0}else if(t(e[r].items,e[r]))return!0}function O(e,t,r,n){for(var i=0;i<e.length&&e[i].data!==t&&!z(e[i].data,r,n);i++);}function z(e,t,r){for(var n=0,i=e.length;n<i;n++){if(e[n]&&e[n].hasSubgroups)return z(e[n].items,t,r);if(e[n]===t||e[n]===r)return e[n]=r,!0}}function R(e,r,n,i,a){var s,o,u,l;for(s=0,o=e.length;s<o;s++)if(u=e[s],u&&!(u instanceof i))if(u.hasSubgroups===t||a){for(l=0;l<r.length;l++)if(r[l]===u){e[s]=r.at(l),O(n,r,u,e[s]);break}}else R(u.items,r,n,i,a)}function P(e,t){var r,n,i;for(r=0,n=e.length;r<n;r++)if(i=e.at(r),i.uid==t.uid)return e.splice(r,1),i}function T(e,t){return t?A(e,function(e){return e.uid&&e.uid==t.uid||e[t.idField]===t.id&&t.id!==t._defaultId}):-1}function F(e,t){return t?A(e,function(e){return e.uid==t.uid}):-1}function A(e,t){var r,n;for(r=0,n=e.length;r<n;r++)if(t(e[r]))return r;return-1}function I(e,t){var r,n;return e&&!fe(e)?(r=e[t],n=he(r)?r.from||r.field||t:e[t]||t,ye(n)?t:n):t}function N(e,t){var r,n,i,a={};for(i in e)"filters"!==i&&(a[i]=e[i]);if(e.filters)for(a.filters=[],r=0,n=e.filters.length;r<n;r++)a.filters[r]=N(e.filters[r],t);else a.field=I(t.fields,a.field);return a}function M(e,t){var r,n,i,a,s,o=[];for(r=0,n=e.length;r<n;r++){i={},a=e[r];for(s in a)i[s]=a[s];i.field=I(t.fields,i.field),i.aggregates&&ce(i.aggregates)&&(i.aggregates=M(i.aggregates,t)),o.push(i)}return o}function j(t,r){var n,i,a,s,o,u,l,d,h,f;for(t=e(t)[0],n=t.options,i=r[0],a=r[1],s=[],o=0,u=n.length;o<u;o++)h={},d=n[o],l=d.parentNode,l===t&&(l=null),d.disabled||l&&l.disabled||(l&&(h.optgroup=l.label),h[i.field]=d.text,f=d.attributes.value,f=f&&f.specified?d.value:d.text,h[a.field]=f,s.push(h));return s}function L(t,r){var n,i,a,s,o,u,l,d=e(t)[0].tBodies[0],h=d?d.rows:[],f=r.length,c=[];for(n=0,i=h.length;n<i;n++){for(o={},l=!0,s=h[n].cells,a=0;a<f;a++)u=s[a],"th"!==u.nodeName.toLowerCase()&&(l=!1,o[r[a].field]=u.innerHTML);l||c.push(o)}return c}function G(e){return function(){var t=this._data,r=ne.fn[e].apply(this,Je.call(arguments));return this._data!=t&&this._attachBubbleHandlers(),r}}function E(t,r){function n(e,t){return e.filter(t).add(e.find(t))}var i,a,s,o,u,l,d,h,f=e(t).children(),c=[],g=r[0].field,p=r[1]&&r[1].field,_=r[2]&&r[2].field,v=r[3]&&r[3].field;for(i=0,a=f.length;i<a;i++)s={_loaded:!0},o=f.eq(i),l=o[0].firstChild,h=o.children(),t=h.filter("ul"),h=h.filter(":not(ul)"),u=o.attr("data-id"),u&&(s.id=u),l&&(s[g]=3==l.nodeType?l.nodeValue:h.text()),p&&(s[p]=n(h,"a").attr("href")),v&&(s[v]=n(h,"img").attr("src")),_&&(d=n(h,".k-sprite").prop("className"),s[_]=d&&e.trim(d.replace("k-sprite",""))),t.length&&(s.items=E(t.eq(0),r)),"true"==o.attr("data-hasChildren")&&(s.hasChildren=!0),c.push(s);return c}var B,U,H,J,V,W,Q,K,$,X,Y,Z,ee,te,re,ne,ie,ae,se,oe,ue,le=e.extend,de=e.proxy,he=e.isPlainObject,fe=e.isEmptyObject,ce=e.isArray,ge=e.grep,pe=e.ajax,_e=e.each,ve=e.noop,me=window.kendo,ye=me.isFunction,Se=me.Observable,be=me.Class,we="string",ke="function",xe="create",qe="read",De="update",Ce="destroy",Oe="change",ze="sync",Re="get",Pe="error",Te="requestStart",Fe="progress",Ae="requestEnd",Ie=[xe,qe,De,Ce],Ne=function(e){return e},Me=me.getter,je=me.stringify,Le=Math,Ge=[].push,Ee=[].join,Be=[].pop,Ue=[].splice,He=[].shift,Je=[].slice,Ve=[].unshift,We={}.toString,Qe=me.support.stableSort,Ke=/^\/Date\((.*?)\)\/$/,$e=/(\r+|\n+)/g,Xe=/(?=['\\])/g,Ye=Se.extend({init:function(e,t){var r=this;r.type=t||H,Se.fn.init.call(r),r.length=e.length,r.wrapAll(e,r)},at:function(e){return this[e]},toJSON:function(){var e,t,r=this.length,n=Array(r);for(e=0;e<r;e++)t=this[e],t instanceof H&&(t=t.toJSON()),n[e]=t;return n},parent:ve,wrapAll:function(e,t){var r,n,i=this,a=function(){return i};for(t=t||[],r=0,n=e.length;r<n;r++)t[r]=i.wrap(e[r],a);return t},wrap:function(e,t){var r,n=this;return null!==e&&"[object Object]"===We.call(e)&&(r=e instanceof n.type||e instanceof W,r||(e=e instanceof H?e.toJSON():e,e=new n.type(e)),e.parent=t,e.bind(Oe,function(e){n.trigger(Oe,{field:e.field,node:e.node,index:e.index,items:e.items||[this],action:e.node?e.action||"itemloaded":"itemchange"})})),e},push:function(){var e,t=this.length,r=this.wrapAll(arguments);return e=Ge.apply(this,r),this.trigger(Oe,{action:"add",index:t,items:r}),e},slice:Je,sort:[].sort,join:Ee,pop:function(){var e=this.length,t=Be.apply(this);return e&&this.trigger(Oe,{action:"remove",index:e-1,items:[t]}),t},splice:function(e,t,r){var n,i,a,s=this.wrapAll(Je.call(arguments,2));if(n=Ue.apply(this,[e,t].concat(s)),n.length)for(this.trigger(Oe,{action:"remove",index:e,items:n}),i=0,a=n.length;i<a;i++)n[i]&&n[i].children&&n[i].unbind(Oe);return r&&this.trigger(Oe,{action:"add",index:e,items:s}),n},shift:function(){var e=this.length,t=He.apply(this);return e&&this.trigger(Oe,{action:"remove",index:0,items:[t]}),t},unshift:function(){var e,t=this.wrapAll(arguments);return e=Ve.apply(this,t),this.trigger(Oe,{action:"add",index:0,items:t}),e},indexOf:function(e){var t,r,n=this;for(t=0,r=n.length;t<r;t++)if(n[t]===e)return t;return-1},forEach:function(e){for(var t=0,r=this.length;t<r;t++)e(this[t],t,this)},map:function(e){for(var t=0,r=[],n=this.length;t<n;t++)r[t]=e(this[t],t,this);return r},reduce:function(e){var t,r=0,n=this.length;for(2==arguments.length?t=arguments[1]:r<n&&(t=this[r++]);r<n;r++)t=e(t,this[r],r,this);return t},reduceRight:function(e){var t,r=this.length-1;for(2==arguments.length?t=arguments[1]:r>0&&(t=this[r--]);r>=0;r--)t=e(t,this[r],r,this);return t},filter:function(e){for(var t,r=0,n=[],i=this.length;r<i;r++)t=this[r],e(t,r,this)&&(n[n.length]=t);return n},find:function(e){for(var t,r=0,n=this.length;r<n;r++)if(t=this[r],e(t,r,this))return t},every:function(e){for(var t,r=0,n=this.length;r<n;r++)if(t=this[r],!e(t,r,this))return!1;return!0},some:function(e){for(var t,r=0,n=this.length;r<n;r++)if(t=this[r],e(t,r,this))return!0;return!1},remove:function(e){var t=this.indexOf(e);t!==-1&&this.splice(t,1)},empty:function(){this.splice(0,this.length)}});"undefined"!=typeof Symbol&&Symbol.iterator&&!Ye.prototype[Symbol.iterator]&&(Ye.prototype[Symbol.iterator]=[][Symbol.iterator]),U=Ye.extend({init:function(e,t){Se.fn.init.call(this),this.type=t||H;for(var r=0;r<e.length;r++)this[r]=e[r];this.length=r,this._parent=de(function(){return this},this)},at:function(e){var t=this[e];return t instanceof this.type?t.parent=this._parent:t=this[e]=this.wrap(t,this._parent),t}}),H=Se.extend({init:function(e){var t,r,n=this,i=function(){return n};Se.fn.init.call(this),this._handlers={};for(r in e)t=e[r],"object"==typeof t&&t&&!t.getTime&&"_"!=r.charAt(0)&&(t=n.wrap(t,r,i)),n[r]=t;n.uid=me.guid()},shouldSerialize:function(e){return this.hasOwnProperty(e)&&"_handlers"!==e&&"_events"!==e&&typeof this[e]!==ke&&"uid"!==e},forEach:function(e){for(var t in this)this.shouldSerialize(t)&&e(this[t],t)},toJSON:function(){var e,t,r={};for(t in this)this.shouldSerialize(t)&&(e=this[t],(e instanceof H||e instanceof Ye)&&(e=e.toJSON()),r[t]=e);return r},get:function(e){var t,r=this;return r.trigger(Re,{field:e}),t="this"===e?r:me.getter(e,!0)(r)},_set:function(e,t){var r,n,i,a=this,s=e.indexOf(".")>=0;if(s)for(r=e.split("."),n="";r.length>1;){if(n+=r.shift(),i=me.getter(n,!0)(a),i instanceof H)return i.set(r.join("."),t),s;n+="."}return me.setter(e)(a,t),s},set:function(e,t){var r=this,n=!1,i=e.indexOf(".")>=0,a=me.getter(e,!0)(r);return a!==t&&(a instanceof Se&&this._handlers[e]&&(this._handlers[e].get&&a.unbind(Re,this._handlers[e].get),a.unbind(Oe,this._handlers[e].change)),n=r.trigger("set",{field:e,value:t}),n||(i||(t=r.wrap(t,e,function(){return r})),(!r._set(e,t)||e.indexOf("(")>=0||e.indexOf("[")>=0)&&r.trigger(Oe,{field:e}))),n},parent:ve,wrap:function(e,t,n){var i,a,s,o,u=this,l=We.call(e);return null==e||"[object Object]"!==l&&"[object Array]"!==l||(s=e instanceof Ye,o=e instanceof ne,"[object Object]"!==l||o||s?("[object Array]"===l||s||o)&&(s||o||(e=new Ye(e)),a=r(u,Oe,t,!1),e.bind(Oe,a),u._handlers[t]={change:a}):(e instanceof H||(e=new H(e)),i=r(u,Re,t,!0),e.bind(Re,i),a=r(u,Oe,t,!0),e.bind(Oe,a),u._handlers[t]={get:i,change:a}),e.parent=n),e}}),J={number:function(e){return me.parseFloat(e)},date:function(e){return me.parseDate(e)},"boolean":function(e){return typeof e===we?"true"===e.toLowerCase():null!=e?!!e:e},string:function(e){return null!=e?e+"":e},"default":function(e){return e}},V={string:"",number:0,date:new Date,"boolean":!1,"default":""},W=H.extend({init:function(r){var n,i,a=this;if((!r||e.isEmptyObject(r))&&(r=e.extend({},a.defaults,r),a._initializers))for(n=0;n<a._initializers.length;n++)i=a._initializers[n],r[i]=a.defaults[i]();H.fn.init.call(a,r),a.dirty=!1,a.idField&&(a.id=a.get(a.idField),a.id===t&&(a.id=a._defaultId))},shouldSerialize:function(e){return H.fn.shouldSerialize.call(this,e)&&"uid"!==e&&!("id"!==this.idField&&"id"===e)&&"dirty"!==e&&"_accessors"!==e},_parse:function(e,t){var r,n=this,a=e,s=n.fields||{};return e=s[e],e||(e=i(s,a)),e&&(r=e.parse,!r&&e.type&&(r=J[e.type.toLowerCase()])),r?r(t):t},_notifyChange:function(e){var t=e.action;"add"!=t&&"remove"!=t||(this.dirty=!0)},editable:function(e){return e=(this.fields||{})[e],!e||e.editable!==!1},set:function(e,t,r){var i=this,a=i.dirty;i.editable(e)&&(t=i._parse(e,t),n(t,i.get(e))||(i.dirty=!0,H.fn.set.call(i,e,t,r)&&!a&&(i.dirty=a)))},accept:function(e){var t,r,n=this,i=function(){return n};for(t in e)r=e[t],"_"!=t.charAt(0)&&(r=n.wrap(e[t],t,i)),n._set(t,r);n.idField&&(n.id=n.get(n.idField)),n.dirty=!1},isNew:function(){return this.id===this._defaultId}}),W.define=function(e,r){r===t&&(r=e,e=W);var n,i,a,s,o,u,l,d,h=le({defaults:{}},r),f={},c=h.id,g=[];if(c&&(h.idField=c),h.id&&delete h.id,c&&(h.defaults[c]=h._defaultId=""),"[object Array]"===We.call(h.fields)){for(u=0,l=h.fields.length;u<l;u++)a=h.fields[u],typeof a===we?f[a]={}:a.field&&(f[a.field]=a);h.fields=f}for(i in h.fields)a=h.fields[i],s=a.type||"default",o=null,d=i,i=typeof a.field===we?a.field:i,a.nullable||(o=h.defaults[d!==i?d:i]=a.defaultValue!==t?a.defaultValue:V[s.toLowerCase()],"function"==typeof o&&g.push(i)),r.id===i&&(h._defaultId=o),h.defaults[d!==i?d:i]=o,a.parse=a.parse||J[s];return g.length>0&&(h._initializers=g),n=e.extend(h),n.define=function(e){return W.define(n,e)},h.fields&&(n.fields=h.fields,n.idField=h.idField),n},Q={selector:function(e){return ye(e)?e:Me(e)},compare:function(e){var t=this.selector(e);return function(e,r){return e=t(e),r=t(r),null==e&&null==r?0:null==e?-1:null==r?1:e.localeCompare?e.localeCompare(r):e>r?1:e<r?-1:0}},create:function(e){var t=e.compare||this.compare(e.field);return"desc"==e.dir?function(e,r){return t(r,e,!0)}:t},combine:function(e){return function(t,r){var n,i,a=e[0](t,r);for(n=1,i=e.length;n<i;n++)a=a||e[n](t,r);return a}}},K=le({},Q,{asc:function(e){var t=this.selector(e);return function(e,r){var n=t(e),i=t(r);return n&&n.getTime&&i&&i.getTime&&(n=n.getTime(),i=i.getTime()),n===i?e.__position-r.__position:null==n?-1:null==i?1:n.localeCompare?n.localeCompare(i):n>i?1:-1}},desc:function(e){var t=this.selector(e);return function(e,r){var n=t(e),i=t(r);return n&&n.getTime&&i&&i.getTime&&(n=n.getTime(),i=i.getTime()),n===i?e.__position-r.__position:null==n?1:null==i?-1:i.localeCompare?i.localeCompare(n):n<i?1:-1}},create:function(e){return this[e.dir](e.field)}}),B=function(e,t){var r,n=e.length,i=Array(n);for(r=0;r<n;r++)i[r]=t(e[r],r,e);return i},$=function(){function e(e){return e.replace(Xe,"\\").replace($e,"")}function t(t,r,n,i){var a;return null!=n&&(typeof n===we&&(n=e(n),a=Ke.exec(n),a?n=new Date((+a[1])):i?(n="'"+n.toLowerCase()+"'",r="(("+r+" || '')+'').toLowerCase()"):n="'"+n+"'"),n.getTime&&(r="("+r+"&&"+r+".getTime?"+r+".getTime():"+r+")",n=n.getTime())),r+" "+t+" "+n}return{quote:function(t){return t&&t.getTime?"new Date("+t.getTime()+")":"string"==typeof t?"'"+e(t)+"'":""+t},eq:function(e,r,n){return t("==",e,r,n)},neq:function(e,r,n){return t("!=",e,r,n)},gt:function(e,r,n){return t(">",e,r,n)},gte:function(e,r,n){return t(">=",e,r,n)},lt:function(e,r,n){return t("<",e,r,n)},lte:function(e,r,n){return t("<=",e,r,n)},startswith:function(t,r,n){return n&&(t="("+t+" || '').toLowerCase()",r&&(r=r.toLowerCase())),r&&(r=e(r)),t+".lastIndexOf('"+r+"', 0) == 0"},doesnotstartwith:function(t,r,n){return n&&(t="("+t+" || '').toLowerCase()",r&&(r=r.toLowerCase())),r&&(r=e(r)),t+".lastIndexOf('"+r+"', 0) == -1"},endswith:function(t,r,n){return n&&(t="("+t+" || '').toLowerCase()",r&&(r=r.toLowerCase())),r&&(r=e(r)),t+".indexOf('"+r+"', "+t+".length - "+(r||"").length+") >= 0"},doesnotendwith:function(t,r,n){return n&&(t="("+t+" || '').toLowerCase()",r&&(r=r.toLowerCase())),r&&(r=e(r)),t+".indexOf('"+r+"', "+t+".length - "+(r||"").length+") < 0"},contains:function(t,r,n){return n&&(t="("+t+" || '').toLowerCase()",r&&(r=r.toLowerCase())),r&&(r=e(r)),t+".indexOf('"+r+"') >= 0"},doesnotcontain:function(t,r,n){return n&&(t="("+t+" || '').toLowerCase()",r&&(r=r.toLowerCase())),r&&(r=e(r)),t+".indexOf('"+r+"') == -1"},isempty:function(e){return e+" === ''"},isnotempty:function(e){return e+" !== ''"},isnull:function(e){return"("+e+" === null || "+e+" === undefined)"},isnotnull:function(e){return"("+e+" !== null && "+e+" !== undefined)"}}}(),a.filterExpr=function(e){var r,n,i,s,o,u,l=[],d={and:" && ",or:" || "},h=[],f=[],c=e.filters;for(r=0,n=c.length;r<n;r++)i=c[r],o=i.field,u=i.operator,i.filters?(s=a.filterExpr(i),i=s.expression.replace(/__o\[(\d+)\]/g,function(e,t){return t=+t,"__o["+(f.length+t)+"]"}).replace(/__f\[(\d+)\]/g,function(e,t){return t=+t,"__f["+(h.length+t)+"]"}),f.push.apply(f,s.operators),h.push.apply(h,s.fields)):(typeof o===ke?(s="__f["+h.length+"](d)",h.push(o)):s=me.expr(o),typeof u===ke?(i="__o["+f.length+"]("+s+", "+$.quote(i.value)+")",f.push(u)):i=$[(u||"eq").toLowerCase()](s,i.value,i.ignoreCase===t||i.ignoreCase)),l.push(i);return{expression:"("+l.join(d[e.logic])+")",fields:h,operators:f}},X={"==":"eq",equals:"eq",isequalto:"eq",equalto:"eq",equal:"eq","!=":"neq",ne:"neq",notequals:"neq",isnotequalto:"neq",notequalto:"neq",notequal:"neq","<":"lt",islessthan:"lt",lessthan:"lt",less:"lt","<=":"lte",le:"lte",islessthanorequalto:"lte",lessthanequal:"lte",">":"gt",isgreaterthan:"gt",greaterthan:"gt",greater:"gt",">=":"gte",isgreaterthanorequalto:"gte",greaterthanequal:"gte",ge:"gte",notsubstringof:"doesnotcontain",isnull:"isnull",isempty:"isempty",isnotempty:"isnotempty"},a.normalizeFilter=u,a.compareFilters=f,a.prototype={toArray:function(){return this.data},range:function(e,t){return new a(this.data.slice(e,e+t))},skip:function(e){return new a(this.data.slice(e))},take:function(e){return new a(this.data.slice(0,e))},select:function(e){return new a(B(this.data,e))},order:function(e,t){var r={dir:t};return e&&(e.compare?r.compare=e.compare:r.field=e),new a(this.data.slice(0).sort(Q.create(r)))},orderBy:function(e){return this.order(e,"asc")},orderByDescending:function(e){return this.order(e,"desc")},sort:function(e,t,r){var n,i,a=s(e,t),o=[];if(r=r||Q,a.length){for(n=0,i=a.length;n<i;n++)o.push(r.create(a[n]));return this.orderBy({compare:r.combine(o)})}return this},filter:function(e){var t,r,n,i,s,o,l,d,h=this.data,f=[];if(e=u(e),!e||0===e.filters.length)return this;for(i=a.filterExpr(e),o=i.fields,l=i.operators,s=d=Function("d, __f, __o","return "+i.expression),(o.length||l.length)&&(d=function(e){return s(e,o,l)}),t=0,n=h.length;t<n;t++)r=h[t],d(r)&&f.push(r);return new a(f)},group:function(e,t){e=g(e||[]),t=t||this.data;var r,n=this,i=new a(n.data);return e.length>0&&(r=e[0],i=i.groupBy(r).select(function(n){var i=new a(t).filter([{field:n.field,operator:"eq",value:n.value,ignoreCase:!1}]);return{field:n.field,value:n.value,items:e.length>1?new a(n.items).group(e.slice(1),i.toArray()).toArray():n.items,hasSubgroups:e.length>1,aggregates:i.aggregate(r.aggregates)}})),i},groupBy:function(e){if(fe(e)||!this.data.length)return new a([]);var t,r,n,i,s=e.field,o=this._sortForGrouping(s,e.dir||"asc"),u=me.accessor(s),l=u.get(o[0],s),d={field:s,value:l,items:[]},h=[d];for(n=0,i=o.length;n<i;n++)t=o[n],r=u.get(t,s),p(l,r)||(l=r,d={field:s,value:l,items:[]},h.push(d)),d.items.push(t);return new a(h)},_sortForGrouping:function(e,t){var r,n,i=this.data;if(!Qe){for(r=0,n=i.length;r<n;r++)i[r].__position=r;for(i=new a(i).sort(e,t,K).toArray(),r=0,n=i.length;r<n;r++)delete i[r].__position;return i}return this.sort(e,t).toArray()},aggregate:function(e){var t,r,n={},i={};if(e&&e.length)for(t=0,r=this.data.length;t<r;t++)_(n,e,this.data[t],t,r,i);return n}},Y={sum:function(e,t,r){var n=r.get(t);return v(e)?v(n)&&(e+=n):e=n,e},count:function(e){return(e||0)+1},average:function(e,r,n,i,a,s){var o=n.get(r);return s.count===t&&(s.count=0),v(e)?v(o)&&(e+=o):e=o,v(o)&&s.count++,i==a-1&&v(e)&&(e/=s.count),e},max:function(e,t,r){var n=r.get(t);return v(e)||m(e)||(e=n),e<n&&(v(n)||m(n))&&(e=n),e},min:function(e,t,r){var n=r.get(t);return v(e)||m(e)||(e=n),e>n&&(v(n)||m(n))&&(e=n),e}},a.process=function(e,r){r=r||{};var n,i=new a(e),o=r.group,u=g(o||[]).concat(s(r.sort||[])),l=r.filterCallback,d=r.filter,h=r.skip,f=r.take;return d&&(i=i.filter(d),l&&(i=l(i)),n=i.toArray().length),u&&(i=i.sort(u),o&&(e=i.toArray())),h!==t&&f!==t&&(i=i.range(h,f)),o&&(i=i.group(o,e)),{total:n,data:i.toArray()}},Z=be.extend({init:function(e){this.data=e.data},read:function(e){e.success(this.data)},update:function(e){e.success(e.data)},create:function(e){e.success(e.data)},destroy:function(e){e.success(e.data)}}),ee=be.extend({init:function(e){var t,r=this;e=r.options=le({},r.options,e),_e(Ie,function(t,r){typeof e[r]===we&&(e[r]={url:e[r]})}),r.cache=e.cache?te.create(e.cache):{find:ve,add:ve},t=e.parameterMap,ye(e.push)&&(r.push=e.push),r.push||(r.push=Ne),r.parameterMap=ye(t)?t:function(e){var r={};return _e(e,function(e,n){e in t&&(e=t[e],he(e)&&(n=e.value(n),e=e.key)),r[e]=n}),r}},options:{parameterMap:Ne},create:function(e){return pe(this.setup(e,xe))},read:function(r){var n,i,a,s=this,o=s.cache;r=s.setup(r,qe),n=r.success||ve,i=r.error||ve,a=o.find(r.data),a!==t?n(a):(r.success=function(e){o.add(r.data,e),n(e)},e.ajax(r))},update:function(e){return pe(this.setup(e,De))},destroy:function(e){return pe(this.setup(e,Ce))},setup:function(e,t){e=e||{};var r,n=this,i=n.options[t],a=ye(i.data)?i.data(e.data):i.data;return e=le(!0,{},i,e),r=le(!0,{},a,e.data),e.data=n.parameterMap(r,t),ye(e.url)&&(e.url=e.url(r)),e}}),te=be.extend({init:function(){this._store={}},add:function(e,r){e!==t&&(this._store[je(e)]=r)},find:function(e){return this._store[je(e)]},clear:function(){this._store={}},remove:function(e){delete this._store[je(e)]}}),te.create=function(e){var t={inmemory:function(){return new te}};return he(e)&&ye(e.find)?e:e===!0?new te:t[e]()},re=be.extend({init:function(e){var t,r,n,i,a,s,o,u,l,d,h,f,c,g=this;e=e||{};for(t in e)r=e[t],g[t]=typeof r===we?Me(r):r;i=e.modelBase||W,he(g.model)&&(g.model=n=i.define(g.model)),a=de(g.data,g),g._dataAccessFunction=a,g.model&&(s=de(g.groups,g),o=de(g.serialize,g),u={},l={},d={},h={},f=!1,n=g.model,n.fields&&(_e(n.fields,function(e,t){var r;c=e,he(t)&&t.field?c=t.field:typeof t===we&&(c=t),he(t)&&t.from&&(r=t.from),f=f||r&&r!==e||c!==e,l[e]=Me(r||c),d[e]=Me(e),u[r||c]=e,h[e]=r||c}),!e.serialize&&f&&(g.serialize=k(o,n,S,d,u,h))),g._dataAccessFunction=a,g.data=k(a,n,b,l,u,h),g.groups=k(s,n,w,l,u,h))},errors:function(e){return e?e.errors:null},parse:Ne,data:Ne,total:function(e){return e.length},groups:Ne,aggregates:function(){return{}},serialize:function(e){return e}}),ne=Se.extend({init:function(e){var r,n,i,a=this;e&&(n=e.data),e=a.options=le({},a.options,e),a._map={},a._prefetch={},a._data=[],a._pristineData=[],a._ranges=[],a._view=[],a._pristineTotal=0,a._destroyed=[],a._pageSize=e.pageSize,a._page=e.page||(e.pageSize?1:t),a._sort=s(e.sort),a._filter=u(e.filter),a._group=g(e.group),a._aggregate=e.aggregate,a._total=e.total,a._shouldDetachObservableParents=!0,Se.fn.init.call(a),a.transport=ie.create(e,n,a),ye(a.transport.push)&&a.transport.push({pushCreate:de(a._pushCreate,a),pushUpdate:de(a._pushUpdate,a),pushDestroy:de(a._pushDestroy,a)}),null!=e.offlineStorage&&("string"==typeof e.offlineStorage?(i=e.offlineStorage,a._storage={getItem:function(){return JSON.parse(localStorage.getItem(i))},setItem:function(e){localStorage.setItem(i,je(a.reader.serialize(e)))}}):a._storage=e.offlineStorage),a.reader=new me.data.readers[e.schema.type||"json"](e.schema),r=a.reader.model||{},a._detachObservableParents(),a._data=a._observe(a._data),a._online=!0,a.bind(["push",Pe,Oe,Te,ze,Ae,Fe],e)},options:{data:null,schema:{modelBase:W},offlineStorage:null,serverSorting:!1,serverPaging:!1,serverFiltering:!1,serverGrouping:!1,serverAggregates:!1,batch:!1},clone:function(){return this},online:function(r){return r!==t?this._online!=r&&(this._online=r,r)?this.sync():e.Deferred().resolve().promise():this._online},offlineData:function(e){return null==this.options.offlineStorage?null:e!==t?this._storage.setItem(e):this._storage.getItem()||[]},_isServerGrouped:function(){var e=this.group()||[];return this.options.serverGrouping&&e.length},_pushCreate:function(e){this._push(e,"pushCreate")},_pushUpdate:function(e){this._push(e,"pushUpdate")},_pushDestroy:function(e){this._push(e,"pushDestroy")},_push:function(e,t){var r=this._readData(e);r||(r=e),this[t](r)},_flatData:function(e,t){if(e){if(this._isServerGrouped())return q(e);if(!t)for(var r=0;r<e.length;r++)e.at(r)}return e},parent:ve,get:function(e){var t,r,n=this._flatData(this._data);for(t=0,r=n.length;t<r;t++)if(n[t].id==e)return n[t]},getByUid:function(e){var t,r,n=this._flatData(this._data);if(n)for(t=0,r=n.length;t<r;t++)if(n[t].uid==e)return n[t]},indexOf:function(e){return F(this._data,e)},at:function(e){return this._data.at(e)},data:function(e){var r,n=this;if(e===t){if(n._data)for(r=0;r<n._data.length;r++)n._data.at(r);return n._data}n._detachObservableParents(),n._data=this._observe(e),n._pristineData=e.slice(0),n._storeData(),n._ranges=[],n.trigger("reset"),n._addRange(n._data),n._total=n._data.length,n._pristineTotal=n._total,n._process(n._data)},view:function(e){return e===t?this._view:(this._view=this._observeView(e),t)},_observeView:function(e){var t,r=this;return R(e,r._data,r._ranges,r.reader.model||H,r._isServerGrouped()),t=new U(e,r.reader.model),t.parent=function(){return r.parent()},t},flatView:function(){var e=this.group()||[];return e.length?q(this._view):this._view},add:function(e){return this.insert(this._data.length,e)},_createNewModel:function(e){return this.reader.model?new this.reader.model(e):e instanceof H?e:new H(e)},insert:function(e,t){return t||(t=e,e=0),t instanceof W||(t=this._createNewModel(t)),this._isServerGrouped()?this._data.splice(e,0,this._wrapInEmptyGroup(t)):this._data.splice(e,0,t),t},pushCreate:function(e){var t,r,n,i,a,s;ce(e)||(e=[e]),t=[],r=this.options.autoSync,this.options.autoSync=!1;try{for(n=0;n<e.length;n++)i=e[n],a=this.add(i),t.push(a),s=a.toJSON(),this._isServerGrouped()&&(s=this._wrapInEmptyGroup(s)),this._pristineData.push(s)}finally{this.options.autoSync=r}t.length&&this.trigger("push",{type:"create",items:t})},pushUpdate:function(e){var t,r,n,i,a;for(ce(e)||(e=[e]),t=[],r=0;r<e.length;r++)n=e[r],i=this._createNewModel(n),a=this.get(i.id),a?(t.push(a),a.accept(n),a.trigger(Oe),this._updatePristineForModel(a,n)):this.pushCreate(n);t.length&&this.trigger("push",{type:"update",items:t})},pushDestroy:function(e){var t=this._removeItems(e);t.length&&this.trigger("push",{type:"destroy",items:t})},_removeItems:function(e){var t,r,n,i,a,s;ce(e)||(e=[e]),t=[],r=this.options.autoSync,this.options.autoSync=!1;try{for(n=0;n<e.length;n++)i=e[n],a=this._createNewModel(i),s=!1,this._eachItem(this._data,function(e){var r,n;for(r=0;r<e.length;r++)if(n=e.at(r),n.id===a.id){t.push(n),e.splice(r,1),s=!0;break}}),s&&(this._removePristineForModel(a),this._destroyed.pop())}finally{this.options.autoSync=r}return t},remove:function(e){var t,r=this,n=r._isServerGrouped();return this._eachItem(r._data,function(i){if(t=P(i,e),t&&n)return t.isNew&&t.isNew()||r._destroyed.push(t),!0}),this._removeModelFromRanges(e),this._updateRangesLength(),e},destroyed:function(){return this._destroyed},created:function(){var e,t,r=[],n=this._flatData(this._data);for(e=0,t=n.length;e<t;e++)n[e].isNew&&n[e].isNew()&&r.push(n[e]);return r},updated:function(){var e,t,r=[],n=this._flatData(this._data);for(e=0,t=n.length;e<t;e++)n[e].isNew&&!n[e].isNew()&&n[e].dirty&&r.push(n[e]);return r},sync:function(){var t,r=this,n=[],i=[],a=r._destroyed,s=e.Deferred().resolve().promise();if(r.online()){if(!r.reader.model)return s;n=r.created(),i=r.updated(),t=[],r.options.batch&&r.transport.submit?t=r._sendSubmit(n,i,a):(t.push.apply(t,r._send("create",n)),t.push.apply(t,r._send("update",i)),t.push.apply(t,r._send("destroy",a))),s=e.when.apply(null,t).then(function(){var e,t;for(e=0,t=arguments.length;e<t;e++)arguments[e]&&r._accept(arguments[e]);r._storeData(!0),r._change({action:"sync"}),r.trigger(ze)})}else r._storeData(!0),r._change({action:"sync"});return s},cancelChanges:function(e){var t=this;e instanceof me.data.Model?t._cancelModel(e):(t._destroyed=[],t._detachObservableParents(),t._data=t._observe(t._pristineData),t.options.serverPaging&&(t._total=t._pristineTotal),t._ranges=[],t._addRange(t._data),t._change(),t._markOfflineUpdatesAsDirty())},_markOfflineUpdatesAsDirty:function(){var e=this;null!=e.options.offlineStorage&&e._eachItem(e._data,function(e){var t,r;for(t=0;t<e.length;t++)r=e.at(t),"update"!=r.__state__&&"create"!=r.__state__||(r.dirty=!0)})},hasChanges:function(){var e,t,r=this._flatData(this._data);if(this._destroyed.length)return!0;for(e=0,t=r.length;e<t;e++)if(r[e].isNew&&r[e].isNew()||r[e].dirty)return!0;return!1},_accept:function(t){var r,n=this,i=t.models,a=t.response,s=0,o=n._isServerGrouped(),u=n._pristineData,l=t.type;if(n.trigger(Ae,{response:a,type:l}),a&&!fe(a)){if(a=n.reader.parse(a),n._handleCustomErrors(a))return;a=n.reader.data(a),ce(a)||(a=[a])}else a=e.map(i,function(e){return e.toJSON()});for("destroy"===l&&(n._destroyed=[]),s=0,r=i.length;s<r;s++)"destroy"!==l?(i[s].accept(a[s]),"create"===l?u.push(o?n._wrapInEmptyGroup(i[s]):a[s]):"update"===l&&n._updatePristineForModel(i[s],a[s])):n._removePristineForModel(i[s])},_updatePristineForModel:function(e,t){this._executeOnPristineForModel(e,function(e,r){me.deepExtend(r[e],t)})},_executeOnPristineForModel:function(e,t){this._eachPristineItem(function(r){var n=T(r,e);if(n>-1)return t(n,r),!0})},_removePristineForModel:function(e){this._executeOnPristineForModel(e,function(e,t){t.splice(e,1)})},_readData:function(e){var t=this._isServerGrouped()?this.reader.groups:this.reader.data;return t.call(this.reader,e)},_eachPristineItem:function(e){this._eachItem(this._pristineData,e)},_eachItem:function(e,t){e&&e.length&&(this._isServerGrouped()?C(e,t):t(e))},_pristineForModel:function(e){var t,r,n=function(n){if(r=T(n,e),r>-1)return t=n[r],!0};return this._eachPristineItem(n),t},_cancelModel:function(e){var t=this._pristineForModel(e);this._eachItem(this._data,function(r){var n=F(r,e);n>=0&&(!t||e.isNew()&&!t.__state__?r.splice(n,1):(r[n].accept(t),"update"==t.__state__&&(r[n].dirty=!0)))})},_submit:function(t,r){var n=this;n.trigger(Te,{type:"submit"}),n.transport.submit(le({success:function(r,n){var i=e.grep(t,function(e){return e.type==n})[0];i&&i.resolve({response:r,models:i.models,type:n})},error:function(e,r,i){for(var a=0;a<t.length;a++)t[a].reject(e);n.error(e,r,i)}},r))},_sendSubmit:function(t,r,n){var i=this,a=[];return i.options.batch&&(t.length&&a.push(e.Deferred(function(e){e.type="create",e.models=t})),r.length&&a.push(e.Deferred(function(e){e.type="update",e.models=r})),n.length&&a.push(e.Deferred(function(e){e.type="destroy",e.models=n})),i._submit(a,{data:{created:i.reader.serialize(y(t)),updated:i.reader.serialize(y(r)),destroyed:i.reader.serialize(y(n))}})),a},_promise:function(t,r,n){var i=this;return e.Deferred(function(e){i.trigger(Te,{type:n}),i.transport[n].call(i.transport,le({success:function(t){e.resolve({response:t,models:r,type:n})},error:function(t,r,n){e.reject(t),i.error(t,r,n)}},t))}).promise()},_send:function(e,t){var r,n,i=this,a=[],s=i.reader.serialize(y(t));if(i.options.batch)t.length&&a.push(i._promise({data:{models:s}},t,e));else for(r=0,n=t.length;r<n;r++)a.push(i._promise({data:s[r]},[t[r]],e));return a},read:function(t){
var r=this,n=r._params(t),i=e.Deferred();return r._queueRequest(n,function(){var e=r.trigger(Te,{type:"read"});e?(r._dequeueRequest(),i.resolve(e)):(r.trigger(Fe),r._ranges=[],r.trigger("reset"),r.online()?r.transport.read({data:n,success:function(e){r._ranges=[],r.success(e,n),i.resolve()},error:function(){var e=Je.call(arguments);r.error.apply(r,e),i.reject.apply(i,e)}}):null!=r.options.offlineStorage&&(r.success(r.offlineData(),n),i.resolve()))}),i.promise()},_readAggregates:function(e){return this.reader.aggregates(e)},success:function(e){var r,n,i,a,s,o,u,l,d=this,h=d.options;if(d.trigger(Ae,{response:e,type:"read"}),d.online()){if(e=d.reader.parse(e),d._handleCustomErrors(e))return d._dequeueRequest(),t;d._total=d.reader.total(e),d._aggregate&&h.serverAggregates&&(d._aggregateResult=d._readAggregates(e)),e=d._readData(e),d._destroyed=[]}else{for(e=d._readData(e),r=[],n={},i=d.reader.model,a=i?i.idField:"id",s=0;s<this._destroyed.length;s++)o=this._destroyed[s][a],n[o]=o;for(s=0;s<e.length;s++)u=e[s],l=u.__state__,"destroy"==l?n[u[a]]||this._destroyed.push(this._createNewModel(u)):r.push(u);e=r,d._total=e.length}d._pristineTotal=d._total,d._pristineData=e.slice(0),d._detachObservableParents(),d._data=d._observe(e),d._markOfflineUpdatesAsDirty(),d._storeData(),d._addRange(d._data),d._process(d._data),d._dequeueRequest()},_detachObservableParents:function(){if(this._data&&this._shouldDetachObservableParents)for(var e=0;e<this._data.length;e++)this._data[e].parent&&(this._data[e].parent=ve)},_storeData:function(e){function t(e){var r,n,i,a=[];for(r=0;r<e.length;r++)n=e.at(r),i=n.toJSON(),s&&n.items?i.items=t(n.items):(i.uid=n.uid,o&&(n.isNew()?i.__state__="create":n.dirty&&(i.__state__="update"))),a.push(i);return a}var r,n,i,a,s=this._isServerGrouped(),o=this.reader.model;if(null!=this.options.offlineStorage){for(r=t(this._data),n=[],i=0;i<this._destroyed.length;i++)a=this._destroyed[i].toJSON(),a.__state__="destroy",n.push(a);this.offlineData(r.concat(n)),e&&(this._pristineData=this._readData(r))}},_addRange:function(e){var t=this,r=t._skip||0,n=r+t._flatData(e,!0).length;t._ranges.push({start:r,end:n,data:e,timestamp:(new Date).getTime()}),t._ranges.sort(function(e,t){return e.start-t.start})},error:function(e,t,r){this._dequeueRequest(),this.trigger(Ae,{}),this.trigger(Pe,{xhr:e,status:t,errorThrown:r})},_params:function(e){var t=this,r=le({take:t.take(),skip:t.skip(),page:t.page(),pageSize:t.pageSize(),sort:t._sort,filter:t._filter,group:t._group,aggregate:t._aggregate},e);return t.options.serverPaging||(delete r.take,delete r.skip,delete r.page,delete r.pageSize),t.options.serverGrouping?t.reader.model&&r.group&&(r.group=M(r.group,t.reader.model)):delete r.group,t.options.serverFiltering?t.reader.model&&r.filter&&(r.filter=N(r.filter,t.reader.model)):delete r.filter,t.options.serverSorting?t.reader.model&&r.sort&&(r.sort=M(r.sort,t.reader.model)):delete r.sort,t.options.serverAggregates?t.reader.model&&r.aggregate&&(r.aggregate=M(r.aggregate,t.reader.model)):delete r.aggregate,r},_queueRequest:function(e,r){var n=this;n._requestInProgress?n._pending={callback:de(r,n),options:e}:(n._requestInProgress=!0,n._pending=t,r())},_dequeueRequest:function(){var e=this;e._requestInProgress=!1,e._pending&&e._queueRequest(e._pending.options,e._pending.callback)},_handleCustomErrors:function(e){if(this.reader.errors){var t=this.reader.errors(e);if(t)return this.trigger(Pe,{xhr:null,status:"customerror",errorThrown:"custom error",errors:t}),!0}return!1},_shouldWrap:function(e){var t=this.reader.model;return!(!t||!e.length)&&!(e[0]instanceof t)},_observe:function(e){var t,r=this,n=r.reader.model;return r._shouldDetachObservableParents=!0,e instanceof Ye?(r._shouldDetachObservableParents=!1,r._shouldWrap(e)&&(e.type=r.reader.model,e.wrapAll(e,e))):(t=r.pageSize()&&!r.options.serverPaging?U:Ye,e=new t(e,r.reader.model),e.parent=function(){return r.parent()}),r._isServerGrouped()&&D(e,n),r._changeHandler&&r._data&&r._data instanceof Ye?r._data.unbind(Oe,r._changeHandler):r._changeHandler=de(r._change,r),e.bind(Oe,r._changeHandler)},_updateTotalForAction:function(e,t){var r=this,n=parseInt(r._total,10);v(r._total)||(n=parseInt(r._pristineTotal,10)),"add"===e?n+=t.length:"remove"===e?n-=t.length:"itemchange"===e||"sync"===e||r.options.serverPaging?"sync"===e&&(n=r._pristineTotal=parseInt(r._total,10)):n=r._pristineTotal,r._total=n},_change:function(e){var t,r,n,i=this,a=e?e.action:"";if("remove"===a)for(t=0,r=e.items.length;t<r;t++)e.items[t].isNew&&e.items[t].isNew()||i._destroyed.push(e.items[t]);!i.options.autoSync||"add"!==a&&"remove"!==a&&"itemchange"!==a?(i._updateTotalForAction(a,e?e.items:[]),i._process(i._data,e)):(n=function(t){"sync"===t.action&&(i.unbind("change",n),i._updateTotalForAction(a,e.items))},i.first("change",n),i.sync())},_calculateAggregates:function(e,t){t=t||{};var r=new a(e),n=t.aggregate,i=t.filter;return i&&(r=r.filter(i)),r.aggregate(n)},_process:function(e,r){var n,i=this,a={};i.options.serverPaging!==!0&&(a.skip=i._skip,a.take=i._take||i._pageSize,a.skip===t&&i._page!==t&&i._pageSize!==t&&(a.skip=(i._page-1)*i._pageSize)),i.options.serverSorting!==!0&&(a.sort=i._sort),i.options.serverFiltering!==!0&&(a.filter=i._filter),i.options.serverGrouping!==!0&&(a.group=i._group),i.options.serverAggregates!==!0&&(a.aggregate=i._aggregate,i._aggregateResult=i._calculateAggregates(e,a)),n=i._queryProcess(e,a),i.view(n.data),n.total===t||i.options.serverFiltering||(i._total=n.total),r=r||{},r.items=r.items||i._view,i.trigger(Oe,r)},_queryProcess:function(e,t){return a.process(e,t)},_mergeState:function(e){var r=this;return e!==t&&(r._pageSize=e.pageSize,r._page=e.page,r._sort=e.sort,r._filter=e.filter,r._group=e.group,r._aggregate=e.aggregate,r._skip=r._currentRangeStart=e.skip,r._take=e.take,r._skip===t&&(r._skip=r._currentRangeStart=r.skip(),e.skip=r.skip()),r._take===t&&r._pageSize!==t&&(r._take=r._pageSize,e.take=r._take),e.sort&&(r._sort=e.sort=s(e.sort)),e.filter&&(r._filter=e.filter=u(e.filter)),e.group&&(r._group=e.group=g(e.group)),e.aggregate&&(r._aggregate=e.aggregate=c(e.aggregate))),e},query:function(r){var n,i,a=this.options.serverSorting||this.options.serverPaging||this.options.serverFiltering||this.options.serverGrouping||this.options.serverAggregates;return a||(this._data===t||0===this._data.length)&&!this._destroyed.length?this.read(this._mergeState(r)):(i=this.trigger(Te,{type:"read"}),i||(this.trigger(Fe),n=this._queryProcess(this._data,this._mergeState(r)),this.options.serverFiltering||(this._total=n.total!==t?n.total:this._data.length),this._aggregateResult=this._calculateAggregates(this._data,r),this.view(n.data),this.trigger(Ae,{type:"read"}),this.trigger(Oe,{items:n.data})),e.Deferred().resolve(i).promise())},fetch:function(e){var t=this,r=function(r){r!==!0&&ye(e)&&e.call(t)};return this._query().then(r)},_query:function(e){var t=this;return t.query(le({},{page:t.page(),pageSize:t.pageSize(),sort:t.sort(),filter:t.filter(),group:t.group(),aggregate:t.aggregate()},e))},next:function(e){var t=this,r=t.page(),n=t.total();if(e=e||{},r&&!(n&&r+1>t.totalPages()))return t._skip=t._currentRangeStart=r*t.take(),r+=1,e.page=r,t._query(e),r},prev:function(e){var t=this,r=t.page();if(e=e||{},r&&1!==r)return t._skip=t._currentRangeStart=t._skip-t.take(),r-=1,e.page=r,t._query(e),r},page:function(e){var r,n=this;return e!==t?(e=Le.max(Le.min(Le.max(e,1),n.totalPages()),1),n._query({page:e}),t):(r=n.skip(),r!==t?Le.round((r||0)/(n.take()||1))+1:t)},pageSize:function(e){var r=this;return e!==t?(r._query({pageSize:e,page:1}),t):r.take()},sort:function(e){var r=this;return e!==t?(r._query({sort:e}),t):r._sort},filter:function(e){var r=this;return e===t?r._filter:(r.trigger("reset"),r._query({filter:e,page:1}),t)},group:function(e){var r=this;return e!==t?(r._query({group:e}),t):r._group},total:function(){return parseInt(this._total||0,10)},aggregate:function(e){var r=this;return e!==t?(r._query({aggregate:e}),t):r._aggregate},aggregates:function(){var e=this._aggregateResult;return fe(e)&&(e=this._emptyAggregates(this.aggregate())),e},_emptyAggregates:function(e){var t,r,n={};if(!fe(e))for(t={},ce(e)||(e=[e]),r=0;r<e.length;r++)t[e[r].aggregate]=0,n[e[r].field]=t;return n},_wrapInEmptyGroup:function(e){var t,r,n,i,a=this.group();for(n=a.length-1,i=0;n>=i;n--)r=a[n],t={value:e.get(r.field),field:r.field,items:t?[t]:[e],hasSubgroups:!!t,aggregates:this._emptyAggregates(r.aggregates)};return t},totalPages:function(){var e=this,t=e.pageSize()||e.total();return Le.ceil((e.total()||0)/t)},inRange:function(e,t){var r=this,n=Le.min(e+t,r.total());return!r.options.serverPaging&&r._data.length>0||r._findRange(e,n).length>0},lastRange:function(){var e=this._ranges;return e[e.length-1]||{start:0,end:0,data:[]}},firstItemUid:function(){var e=this._ranges;return e.length&&e[0].data.length&&e[0].data[0].uid},enableRequestsInProgress:function(){this._skipRequestsInProgress=!1},_timeStamp:function(){return(new Date).getTime()},range:function(e,r){var n,i,a,s,o,u,l,d;if(this._currentRequestTimeStamp=this._timeStamp(),this._skipRequestsInProgress=!0,e=Le.min(e||0,this.total()),n=this,i=Le.max(Le.floor(e/r),0)*r,a=Le.min(i+r,n.total()),s=n._findRange(e,Le.min(e+r,n.total())),s.length){n._pending=t,n._skip=e>n.skip()?Le.min(a,(n.totalPages()-1)*n.take()):i,n._currentRangeStart=e,n._take=r,o=n.options.serverPaging,u=n.options.serverSorting,l=n.options.serverFiltering,d=n.options.serverAggregates;try{n.options.serverPaging=!0,n._isServerGrouped()||n.group()&&n.group().length||(n.options.serverSorting=!0),n.options.serverFiltering=!0,n.options.serverPaging=!0,n.options.serverAggregates=!0,o&&(n._detachObservableParents(),n._data=s=n._observe(s)),n._process(s)}finally{n.options.serverPaging=o,n.options.serverSorting=u,n.options.serverFiltering=l,n.options.serverAggregates=d}}else r!==t&&(n._rangeExists(i,a)?i<e&&n.prefetch(a,r,function(){n.range(e,r)}):n.prefetch(i,r,function(){e>i&&a<n.total()&&!n._rangeExists(a,Le.min(a+r,n.total()))?n.prefetch(a,r,function(){n.range(e,r)}):n.range(e,r)}))},_findRange:function(e,r){var n,i,a,o,u,l,d,h,f,c,p,_,v=this,m=v._ranges,y=[],S=v.options,b=S.serverSorting||S.serverPaging||S.serverFiltering||S.serverGrouping||S.serverAggregates;for(i=0,p=m.length;i<p;i++)if(n=m[i],e>=n.start&&e<=n.end){for(c=0,a=i;a<p;a++)if(n=m[a],f=v._flatData(n.data,!0),f.length&&e+c>=n.start&&(l=n.data,d=n.end,b||(_=g(v.group()||[]).concat(s(v.sort()||[])),h=v._queryProcess(n.data,{sort:_,filter:v.filter()}),f=l=h.data,h.total!==t&&(d=h.total)),o=0,e+c>n.start&&(o=e+c-n.start),u=f.length,d>r&&(u-=d-r),c+=u-o,y=v._mergeGroups(y,l,o,u),r<=n.end&&c==r-e))return y;break}return[]},_mergeGroups:function(e,t,r,n){if(this._isServerGrouped()){var i,a=t.toJSON();return e.length&&(i=e[e.length-1]),x(i,a,r,n),e.concat(a)}return e.concat(t.slice(r,n))},skip:function(){var e=this;return e._skip===t?e._page!==t?(e._page-1)*(e.take()||1):t:e._skip},currentRangeStart:function(){return this._currentRangeStart||0},take:function(){return this._take||this._pageSize},_prefetchSuccessHandler:function(e,t,r,n){var i=this,a=i._timeStamp();return function(s){var o,u,l,d=!1,h={start:e,end:t,data:[],timestamp:i._timeStamp()};if(i._dequeueRequest(),i.trigger(Ae,{response:s,type:"read"}),s=i.reader.parse(s),l=i._readData(s),l.length){for(o=0,u=i._ranges.length;o<u;o++)if(i._ranges[o].start===e){d=!0,h=i._ranges[o];break}d||i._ranges.push(h)}h.data=i._observe(l),h.end=h.start+i._flatData(h.data,!0).length,i._ranges.sort(function(e,t){return e.start-t.start}),i._total=i.reader.total(s),(n||a>=i._currentRequestTimeStamp||!i._skipRequestsInProgress)&&(r&&l.length?r():i.trigger(Oe,{}))}},prefetch:function(e,t,r){var n=this,i=Le.min(e+t,n.total()),a={take:t,skip:e,page:e/t+1,pageSize:t,sort:n._sort,filter:n._filter,group:n._group,aggregate:n._aggregate};n._rangeExists(e,i)?r&&r():(clearTimeout(n._timeout),n._timeout=setTimeout(function(){n._queueRequest(a,function(){n.trigger(Te,{type:"read"})?n._dequeueRequest():n.transport.read({data:n._params(a),success:n._prefetchSuccessHandler(e,i,r),error:function(){var e=Je.call(arguments);n.error.apply(n,e)}})})},100))},_multiplePrefetch:function(e,t,r){var n=this,i=Le.min(e+t,n.total()),a={take:t,skip:e,page:e/t+1,pageSize:t,sort:n._sort,filter:n._filter,group:n._group,aggregate:n._aggregate};n._rangeExists(e,i)?r&&r():n.trigger(Te,{type:"read"})||n.transport.read({data:n._params(a),success:n._prefetchSuccessHandler(e,i,r,!0)})},_rangeExists:function(e,t){var r,n,i=this,a=i._ranges;for(r=0,n=a.length;r<n;r++)if(a[r].start<=e&&a[r].end>=t)return!0;return!1},_removeModelFromRanges:function(e){var t,r,n,i,a;for(i=0,a=this._ranges.length;i<a&&(n=this._ranges[i],this._eachItem(n.data,function(n){t=P(n,e),t&&(r=!0)}),!r);i++);},_updateRangesLength:function(){var e,t,r,n,i=0;for(r=0,n=this._ranges.length;r<n;r++)e=this._ranges[r],e.start=e.start-i,t=this._flatData(e.data,!0).length,i=e.end-t,e.end=e.start+t}}),ie={},ie.create=function(t,r,n){var i,a=t.transport?e.extend({},t.transport):null;return a?(a.read=typeof a.read===we?{url:a.read}:a.read,"jsdo"===t.type&&(a.dataSource=n),t.type&&(me.data.transports=me.data.transports||{},me.data.schemas=me.data.schemas||{},me.data.transports[t.type]?he(me.data.transports[t.type])?a=le(!0,{},me.data.transports[t.type],a):i=new me.data.transports[t.type](le(a,{data:r})):me.logToConsole("Unknown DataSource transport type '"+t.type+"'.\nVerify that registration scripts for this type are included after Kendo UI on the page.","warn"),t.schema=le(!0,{},me.data.schemas[t.type],t.schema)),i||(i=ye(a.read)?a:new ee(a))):i=new Z({data:t.data||[]}),i},ne.create=function(e){(ce(e)||e instanceof Ye)&&(e={data:e});var r,n,i,a=e||{},s=a.data,o=a.fields,u=a.table,l=a.select,d={};if(s||!o||a.transport||(u?s=L(u,o):l&&(s=j(l,o),a.group===t&&s[0]&&s[0].optgroup!==t&&(a.group="optgroup"))),me.data.Model&&o&&(!a.schema||!a.schema.model)){for(r=0,n=o.length;r<n;r++)i=o[r],i.type&&(d[i.field]=i);fe(d)||(a.schema=le(!0,a.schema,{model:{fields:d}}))}return a.data=s,l=null,a.select=null,u=null,a.table=null,a instanceof ne?a:new ne(a)},ae=W.define({idField:"id",init:function(e){var t=this,r=t.hasChildren||e&&e.hasChildren,n="items",i={};me.data.Model.fn.init.call(t,e),typeof t.children===we&&(n=t.children),i={schema:{data:n,model:{hasChildren:r,id:t.idField,fields:t.fields}}},typeof t.children!==we&&le(i,t.children),i.data=e,r||(r=i.schema.data),typeof r===we&&(r=me.getter(r)),ye(r)&&(t.hasChildren=!!r.call(t,t)),t._childrenOptions=i,t.hasChildren&&t._initChildren(),t._loaded=!(!e||!e._loaded)},_initChildren:function(){var e,t,r,n=this;n.children instanceof se||(e=n.children=new se(n._childrenOptions),t=e.transport,r=t.parameterMap,t.parameterMap=function(e,t){return e[n.idField||"id"]=n.id,r&&(e=r(e,t)),e},e.parent=function(){return n},e.bind(Oe,function(e){e.node=e.node||n,n.trigger(Oe,e)}),e.bind(Pe,function(e){var t=n.parent();t&&(e.node=e.node||n,t.trigger(Pe,e))}),n._updateChildrenField())},append:function(e){this._initChildren(),this.loaded(!0),this.children.add(e)},hasChildren:!1,level:function(){for(var e=this.parentNode(),t=0;e&&e.parentNode;)t++,e=e.parentNode?e.parentNode():null;return t},_updateChildrenField:function(){var e=this._childrenOptions.schema.data;this[e||"items"]=this.children.data()},_childrenLoaded:function(){this._loaded=!0,this._updateChildrenField()},load:function(){var r,n,i={},a="_query";return this.hasChildren?(this._initChildren(),r=this.children,i[this.idField||"id"]=this.id,this._loaded||(r._data=t,a="read"),r.one(Oe,de(this._childrenLoaded,this)),n=r[a](i)):this.loaded(!0),n||e.Deferred().resolve().promise()},parentNode:function(){var e=this.parent();return e.parent()},loaded:function(e){return e===t?this._loaded:(this._loaded=e,t)},shouldSerialize:function(e){return W.fn.shouldSerialize.call(this,e)&&"children"!==e&&"_loaded"!==e&&"hasChildren"!==e&&"_childrenOptions"!==e}}),se=ne.extend({init:function(e){var t=ae.define({children:e});ne.fn.init.call(this,le(!0,{},{schema:{modelBase:t,model:t}},e)),this._attachBubbleHandlers()},_attachBubbleHandlers:function(){var e=this;e._data.bind(Pe,function(t){e.trigger(Pe,t)})},remove:function(e){var t,r=e.parentNode(),n=this;return r&&r._initChildren&&(n=r.children),t=ne.fn.remove.call(n,e),r&&!n.data().length&&(r.hasChildren=!1),t},success:G("success"),data:G("data"),insert:function(e,t){var r=this.parent();return r&&r._initChildren&&(r.hasChildren=!0,r._initChildren()),ne.fn.insert.call(this,e,t)},_find:function(e,t){var r,n,i,a,s=this._data;if(s){if(i=ne.fn[e].call(this,t))return i;for(s=this._flatData(this._data),r=0,n=s.length;r<n;r++)if(a=s[r].children,a instanceof se&&(i=a[e](t)))return i}},get:function(e){return this._find("get",e)},getByUid:function(e){return this._find("getByUid",e)}}),se.create=function(e){e=e&&e.push?{data:e}:e;var t=e||{},r=t.data,n=t.fields,i=t.list;return r&&r._dataSource?r._dataSource:(r||!n||t.transport||i&&(r=E(i,n)),t.data=r,t instanceof se?t:new se(t))},oe=me.Observable.extend({init:function(e,t,r){me.Observable.fn.init.call(this),this._prefetching=!1,this.dataSource=e,this.prefetch=!r;var n=this;e.bind("change",function(){n._change()}),e.bind("reset",function(){n._reset()}),this._syncWithDataSource(),this.setViewSize(t)},setViewSize:function(e){this.viewSize=e,this._recalculate()},at:function(e){var r=this.pageSize,n=!0;return e>=this.total()?(this.trigger("endreached",{index:e}),null):this.useRanges?this.useRanges?((e<this.dataOffset||e>=this.skip+r)&&(n=this.range(Math.floor(e/r)*r)),e===this.prefetchThreshold&&this._prefetch(),e===this.midPageThreshold?this.range(this.nextMidRange,!0):e===this.nextPageThreshold?this.range(this.nextFullRange):e===this.pullBackThreshold&&this.range(this.offset===this.skip?this.previousMidRange:this.previousFullRange),n?this.dataSource.at(e-this.dataOffset):(this.trigger("endreached",{index:e}),null)):t:this.dataSource.view()[e]},indexOf:function(e){return this.dataSource.data().indexOf(e)+this.dataOffset},total:function(){return parseInt(this.dataSource.total(),10)},next:function(){var e=this,t=e.pageSize,r=e.skip-e.viewSize+t,n=Le.max(Le.floor(r/t),0)*t;this.offset=r,this.dataSource.prefetch(n,t,function(){e._goToRange(r,!0)})},range:function(e,t){if(this.offset===e)return!0;var r=this,n=this.pageSize,i=Le.max(Le.floor(e/n),0)*n,a=this.dataSource;return t&&(i+=n),a.inRange(e,n)?(this.offset=e,this._recalculate(),this._goToRange(e),!0):!this.prefetch||(a.prefetch(i,n,function(){r.offset=e,r._recalculate(),r._goToRange(e,!0)}),!1)},syncDataSource:function(){var e=this.offset;this.offset=null,this.range(e)},destroy:function(){this.unbind()},_prefetch:function(){var e=this,t=this.pageSize,r=this.skip+t,n=this.dataSource;n.inRange(r,t)||this._prefetching||!this.prefetch||(this._prefetching=!0,this.trigger("prefetching",{skip:r,take:t}),n.prefetch(r,t,function(){e._prefetching=!1,e.trigger("prefetched",{skip:r,take:t})}))},_goToRange:function(e,t){this.offset===e&&(this.dataOffset=e,this._expanding=t,this.dataSource.range(e,this.pageSize),this.dataSource.enableRequestsInProgress())},_reset:function(){this._syncPending=!0},_change:function(){var e=this.dataSource;this.length=this.useRanges?e.lastRange().end:e.view().length,this._syncPending&&(this._syncWithDataSource(),this._recalculate(),this._syncPending=!1,this.trigger("reset",{offset:this.offset})),this.trigger("resize"),this._expanding&&this.trigger("expand"),delete this._expanding},_syncWithDataSource:function(){var e=this.dataSource;this._firstItemUid=e.firstItemUid(),this.dataOffset=this.offset=e.skip()||0,this.pageSize=e.pageSize(),this.useRanges=e.options.serverPaging},_recalculate:function(){var e=this.pageSize,t=this.offset,r=this.viewSize,n=Math.ceil(t/e)*e;this.skip=n,this.midPageThreshold=n+e-1,this.nextPageThreshold=n+r-1,this.prefetchThreshold=n+Math.floor(e/3*2),this.pullBackThreshold=this.offset-1,this.nextMidRange=n+e-r,this.nextFullRange=n,this.previousMidRange=t-r,this.previousFullRange=n-e}}),ue=me.Observable.extend({init:function(e,t){var r=this;me.Observable.fn.init.call(r),this.dataSource=e,this.batchSize=t,this._total=0,this.buffer=new oe(e,3*t),this.buffer.bind({endreached:function(e){r.trigger("endreached",{index:e.index})},prefetching:function(e){r.trigger("prefetching",{skip:e.skip,take:e.take})},prefetched:function(e){r.trigger("prefetched",{skip:e.skip,take:e.take})},reset:function(){r._total=0,r.trigger("reset")},resize:function(){r._total=Math.ceil(this.length/r.batchSize),r.trigger("resize",{total:r.total(),offset:this.offset})}})},syncDataSource:function(){this.buffer.syncDataSource()},at:function(e){var t,r,n=this.buffer,i=e*this.batchSize,a=this.batchSize,s=[];for(n.offset>i&&n.at(n.offset-1),r=0;r<a&&(t=n.at(i+r),null!==t);r++)s.push(t);return s},total:function(){return this._total},destroy:function(){this.buffer.destroy(),this.unbind()}}),le(!0,me.data,{readers:{json:re},Query:a,DataSource:ne,HierarchicalDataSource:se,Node:ae,ObservableObject:H,ObservableArray:Ye,LazyObservableArray:U,LocalTransport:Z,RemoteTransport:ee,Cache:te,DataReader:re,Model:W,Buffer:oe,BatchBuffer:ue})}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,r){(r||t)()});
//# sourceMappingURL=kendo.data.min.js.map
