Socket
Socket
Sign inDemoInstall

@syncfusion/ej2-data

Package Overview
Dependencies
Maintainers
2
Versions
167
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@syncfusion/ej2-data - npm Package Compare versions

Comparing version 16.2.52 to 16.3.17

75

CHANGELOG.md

@@ -5,77 +5,2 @@ # Changelog

## 16.2.50 (2018-08-28)
### DataManager
#### Bug Fixes
- `ODataV4` - Added `ETag` information for CRUD operations.
- `ODataV4` - Resolved `404 Not Found` error, during update and delete when having string value as primary key.
## 16.2.49 (2018-08-21)
### DataManager
#### Bug Fixes
- `RemoteSaveAdaptor` - Provide support to use the updated records.
## 16.2.48 (2018-08-14)
### DataManager
#### Bug Fixes
- `ODataV4` - Script error when using local time zone offset fixed.
- `ODataV4` - Multiple select query in expanded entity is not proper fixed.
## 16.2.47 (2018-08-07)
### DataManager
#### Bug Fixes
- `ODataV4` - Provided support to send date with time zone offset.
- `ODataV4` - Added `ETag` information while performing CRUD operations.
- `ODataV4` - Getting undefined promise object in update and insert action is fixed.
- `ODataV4` - Added expand query while using complex field selecting.
- Sending server request undefined `url` property is fixed.
## 16.2.46 (2018-07-30)
### DataManager
#### Bug Fixes
- `ODataV4` - Added preference header information while performing CRUD operations.
- `ODataV4` - Changed update type from `PUT` to `PATCH` and provided option to change type.
#### Breaking Changes
- To conform `ODataV4` standard, now update operation uses `PATCH` type instead of `PUT`. It can be changed using `updateType` option of the `ODataV4Adaptor`.
## 16.2.45 (2018-07-17)
### DataManager
#### Bug Fixes
- Predicate and shows type error with date object.
## 16.2.43 (2018-07-03)
### DataManager
#### Bug Fixes
- Grouping by format is resolved.
## 16.2.42 (2018-06-28)
### DataManager
#### Bug Fixes
- Invoking success, fail and always handlers through execute Query method is resolved.
## 16.1.42 (2018-05-15)

@@ -82,0 +7,0 @@

4

dist/ej2-data.umd.min.js
/*!
* filename: ej2-data.umd.min.js
* version : 16.2.52
* version : 16.3.17
* Copyright Syncfusion Inc. 2001 - 2018. All rights reserved.

@@ -10,3 +10,3 @@ * Use of this code is subject to the terms of our license.

*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@syncfusion/ej2-base")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base"],t):t(e.ej={},e.ej2Base)}(this,function(e,t){"use strict";var r=function(){function e(e){return this.subQuery=null,this.isChild=!1,this.queries=[],this.key="",this.fKey="","string"==typeof e?this.fromTable=e:e&&e instanceof Array&&(this.lookups=e),this.expands=[],this.sortedColumns=[],this.groupedColumns=[],this.subQuery=null,this.isChild=!1,this.params=[],this}return e.prototype.setKey=function(e){return this.key=e,this},e.prototype.using=function(e){return this.dataManager=e,this},e.prototype.execute=function(e,t,r,n){return(e=e||this.dataManager)?e.executeQuery(this,t,r,n):a.throwError('Query - execute() : dataManager needs to be is set using "using" function or should be passed as argument')},e.prototype.executeLocal=function(e){return(e=e||this.dataManager)?e.executeLocal(this):a.throwError('Query - executeLocal() : dataManager needs to be is set using "using" function or should be passed as argument')},e.prototype.clone=function(){var t=new e;return t.queries=this.queries.slice(0),t.key=this.key,t.isChild=this.isChild,t.dataManager=this.dataManager,t.fromTable=this.fromTable,t.params=this.params.slice(0),t.expands=this.expands.slice(0),t.sortedColumns=this.sortedColumns.slice(0),t.groupedColumns=this.groupedColumns.slice(0),t.subQuerySelector=this.subQuerySelector,t.subQuery=this.subQuery,t.fKey=this.fKey,t.isCountRequired=this.isCountRequired,t},e.prototype.from=function(e){return this.fromTable=e,this},e.prototype.addParams=function(e,t){return"function"==typeof t?this.params.push({key:e,fn:t}):this.params.push({key:e,value:t}),this},e.prototype.expand=function(e){return this.expands="string"==typeof e?[].slice.call([e],0):e.slice(0),this},e.prototype.where=function(e,t,r,o,a){t=t?t.toLowerCase():null;var s=null;return"string"==typeof e?s=new n(e,t,r,o,a):e instanceof n&&(s=e),this.queries.push({fn:"onWhere",e:s}),this},e.prototype.search=function(e,t,r,n,o){"string"==typeof t&&(t=[t]),r=r||"contains";var s=a.fnOperators[r];return this.queries.push({fn:"onSearch",e:{fieldNames:t,operator:r,searchKey:e,ignoreCase:n,ignoreAccent:o,comparer:s}}),this},e.prototype.sortBy=function(t,r,n){var o,s,i="ascending";if("string"==typeof t&&a.endsWith(t.toLowerCase()," desc")&&(t=t.replace(/ desc$/i,""),r="descending"),r&&"string"!=typeof r||(i=r?r.toLowerCase():"ascending",r=a.fnSort(r)),n){o=e.filterQueries(this.queries,"onSortBy");for(var u=0;u<o.length;u++)if("string"==typeof(s=o[u].e.fieldName)){if(s===t)return this}else if(s instanceof Array)for(var c=0;c<s.length;c++)if(s[c]===t||t.toLowerCase()===s[c]+" desc")return this}return this.queries.push({fn:"onSortBy",e:{fieldName:t,comparer:r,direction:i}}),this},e.prototype.sortByDesc=function(e){return this.sortBy(e,"descending")},e.prototype.group=function(e,t,r){return this.sortBy(e,null,!0),this.queries.push({fn:"onGroup",e:{fieldName:e,comparer:t||null,format:r||null}}),this},e.prototype.page=function(e,t){return this.queries.push({fn:"onPage",e:{pageIndex:e,pageSize:t}}),this},e.prototype.range=function(e,t){return this.queries.push({fn:"onRange",e:{start:e,end:t}}),this},e.prototype.take=function(e){return this.queries.push({fn:"onTake",e:{nos:e}}),this},e.prototype.skip=function(e){return this.queries.push({fn:"onSkip",e:{nos:e}}),this},e.prototype.select=function(e){return"string"==typeof e&&(e=[].slice.call([e],0)),this.queries.push({fn:"onSelect",e:{fieldNames:e}}),this},e.prototype.hierarchy=function(e,t){return this.subQuerySelector=t,this.subQuery=e,this},e.prototype.foreignKey=function(e){return this.fKey=e,this},e.prototype.requiresCount=function(){return this.isCountRequired=!0,this},e.prototype.aggregate=function(e,t){return this.queries.push({fn:"onAggregates",e:{field:t,type:e}}),this},e.filterQueries=function(e,t){return e.filter(function(e){return e.fn===t})},e.filterQueryLists=function(e,t){for(var r=e.filter(function(e){return-1!==t.indexOf(e.fn)}),n={},o=0;o<r.length;o++)n[r[o].fn]||(n[r[o].fn]=r[o].e);return n},e}(),n=function(){function e(t,r,n,o,s){return void 0===o&&(o=!1),this.ignoreAccent=!1,this.isComplex=!1,"string"==typeof t?(this.field=t,this.operator=r.toLowerCase(),this.value=n,this.ignoreCase=o,this.ignoreAccent=s,this.isComplex=!1,this.comparer=a.fnOperators.processOperator(this.operator)):(t instanceof e&&n instanceof e||n instanceof Array)&&(this.isComplex=!0,this.condition=r.toLowerCase(),this.predicates=[t],n instanceof Array?[].push.apply(this.predicates,n):this.predicates.push(n)),this}return e.and=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.combinePredicates([].slice.call(t,0),"and")},e.prototype.and=function(t,r,n,o,a){return e.combine(this,t,r,n,"and",o,a)},e.or=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.combinePredicates([].slice.call(t,0),"or")},e.prototype.or=function(t,r,n,o,a){return e.combine(this,t,r,n,"or",o,a)},e.fromJson=function(e){if(e instanceof Array){for(var t=[],r=0,n=e.length;r<n;r++)t.push(this.fromJSONData(e[r]));return t}var o=e;return this.fromJSONData(o)},e.prototype.validate=function(e){var t,r,n=this.predicates?this.predicates:[];if(!this.isComplex&&this.comparer)return this.comparer.call(this,a.getObject(this.field,e),this.value,this.ignoreCase,this.ignoreAccent);t="and"===this.condition;for(var o=0;o<n.length;o++)if(r=n[o].validate(e),t){if(!r)return!1}else if(r)return!0;return t},e.prototype.toJson=function(){var e,t;if(this.isComplex){e=[],t=this.predicates;for(var r=0;r<t.length;r++)e.push(t[r].toJson())}return{isComplex:this.isComplex,field:this.field,operator:this.operator,value:this.value,ignoreCase:this.ignoreCase,ignoreAccent:this.ignoreAccent,condition:this.condition,predicates:e}},e.combinePredicates=function(t,r){if(1===t.length){if(!(t[0]instanceof Array))return t[0];t=t[0]}return new e(t[0],r,t.slice(1))},e.combine=function(t,r,n,o,s,i,u){return r instanceof e?e[s](t,r):"string"==typeof r?e[s](t,new e(r,n,o,i,u)):a.throwError("Predicate - "+s+" : invalid arguments")},e.fromJSONData=function(t){for(var r=t.predicates||[],n=r.length,o=[],a=0;a<n;a++)o.push(this.fromJSONData(r[a]));return t.isComplex?new e(o[0],t.condition,o.slice(1)):new e(t.field,t.operator,t.value,t.ignoreCase,t.ignoreAccent)},e}(),o={GroupGuid:"{271bbba0-1ee7}"},a=function(){function e(){}return e.getValue=function(e,t){return"function"==typeof e?e.call(t||{}):e},e.endsWith=function(e,t){return e.slice(-t.length)===t},e.startsWith=function(e,t){return e.slice(0,t.length)===t},e.fnSort=function(t){return"ascending"===(t=t?e.toLowerCase(t):"ascending")?this.fnAscending:this.fnDescending},e.fnAscending=function(e,t){return null===t||void 0===t?-1:"string"==typeof e?e.localeCompare(t):null===e||void 0===e?1:e-t},e.fnDescending=function(e,t){return null===t||void 0===t?1:"string"==typeof e?-1*e.localeCompare(t):null===e||void 0===e?-1:t-e},e.extractFields=function(e,t){for(var r={},n=0;n<t.length;n++)r=this.setValue(t[n],this.getObject(t[n],e),r);return r},e.select=function(e,t){for(var r=[],n=0;n<e.length;n++)r.push(this.extractFields(e[n],t));return r},e.group=function(r,n,a,s,i,u){s=s||1;var c=r;if(c.GroupGuid===o.GroupGuid){for(var l=function(e){if(t.isNullOrUndefined(i))c[e].items=p.group(c[e].items,n,a,c.level+1,null,u),c[e].count=c[e].items.length;else{var r=-1,o=i.filter(function(t){return t.key===c[e].key});r=i.indexOf(o[0]),c[e].items=p.group(c[e].items,n,a,c.level+1,i[r].items,u),c[e].count=i[r].count}},p=this,d=0;d<c.length;d++)l(d);return c.childLevels+=1,c}var h={},f=[];f.GroupGuid=o.GroupGuid,f.level=s,f.childLevels=0,f.records=c;for(var g=function(e){var r=y.getVal(c,e,n);if(t.isNullOrUndefined(u)||(r=u(r,n)),!h[r]&&(h[r]={key:r,count:0,items:[],aggregates:{},field:n},f.push(h[r]),!t.isNullOrUndefined(i))){var o=i.filter(function(e){return e.key===h[r].key});h[r].count=o[0].count}h[r].count=t.isNullOrUndefined(i)?h[r].count+=1:h[r].count,h[r].items.push(c[e])},y=this,v=0;v<c.length;v++)g(v);if(a&&a.length){var m=function(r){for(var n={},o=void 0,s=a,u=0;u<a.length;u++)if(o=e.aggregates[a[u].type],t.isNullOrUndefined(i))o&&(n[s[u].field+" - "+s[u].type]=o(f[r].items,s[u].field));else{var c=i.filter(function(e){return e.key===f[r].key});o&&(n[s[u].field+" - "+s[u].type]=o(c[0].items,s[u].field))}f[r].aggregates=n};for(v=0;v<f.length;v++)m(v)}return c.length&&f||c},e.buildHierarchy=function(e,t,r,n,o){var a,s={};for(n.result&&(n=n.result),n.GroupGuid&&this.throwError("DataManager: Do not have support Grouping in hierarchy"),a=0;a<n.length;a++){(s[i=this.getObject(e,n[a])]||(s[i]=[])).push(n[a])}for(a=0;a<r.length;a++){var i=this.getObject(o||e,r[a]);r[a][t]=s[i]}},e.getFieldList=function(e,t,r){if(void 0===r&&(r=""),void 0===t||null===t)return this.getFieldList(e,[],r);for(var n=e,o=0,a=Object.keys(e);o<a.length;o++){var s=a[o];"object"!=typeof n[s]||n[s]instanceof Array?t.push(r+s):this.getFieldList(n[s],t,r+s+".")}return t},e.getObject=function(e,t){if(!e)return t;if(t){if(-1===e.indexOf("."))return t[e];for(var r=t,n=e.split("."),o=0;o<n.length&&null!=r;o++)r=r[n[o]];return r}},e.setValue=function(e,r,n){var o,a,s=e.toString().split("."),i=n||{},u=i,c=s.length;for(o=0;o<c;o++)a=s[o],o+1===c?u[a]=void 0===r?void 0:r:t.isNullOrUndefined(u[a])&&(u[a]={}),u=u[a];return i},e.sort=function(e,t,r){if(e.length<=1)return e;var n=parseInt((e.length/2).toString(),10),o=e.slice(0,n),a=e.slice(n);return o=this.sort(o,t,r),a=this.sort(a,t,r),this.merge(o,a,t,r)},e.ignoreDiacritics=function(t){if("string"!=typeof t)return t;return t.split("").map(function(t){return t in e.diacritics?e.diacritics[t]:t}).join("")},e.merge=function(e,t,r,n){for(var o,a=[];e.length>0||t.length>0;)o=e.length>0&&t.length>0?n?n(this.getVal(e,0,r),this.getVal(t,0,r))<=0?e:t:e[0][r]<e[0][r]?e:t:e.length>0?e:t,a.push(o.shift());return a},e.getVal=function(e,t,r){return r?this.getObject(r,e[t]):e[t]},e.toLowerCase=function(e){return e?"string"==typeof e?e.toLowerCase():e.toString():0===e||!1===e?e.toString():""},e.callAdaptorFunction=function(e,r,n,o){if(r in e){var a=e[r](n,o);t.isNullOrUndefined(a)||(n=a)}return n},e.isPlainObject=function(e){return!!e&&e.constructor===Object},e.isCors=function(){var e=null;try{e=new window.XMLHttpRequest}catch(e){}return!!e&&"withCredentials"in e},e.getGuid=function(e){var t;return(e||"")+"00000000-0000-4000-0000-000000000000".replace(/0/g,function(e,r){if("crypto"in window&&"getRandomValues"in crypto){var n=new Uint8Array(1);window.crypto.getRandomValues(n),t=n[0]%16|0}else t=16*Math.random()|0;return"0123456789abcdef"[19===r?3&t|8:t]})},e.isNull=function(e){return void 0===e||null===e},e.getItemFromComparer=function(r,n,o){var a,s,i,u=0,c="string"==typeof e.getVal(r,0,n);if(r.length)for(;t.isNullOrUndefined(a)&&u<r.length;)a=e.getVal(r,u,n),i=r[u++];for(;u<r.length;u++)s=e.getVal(r,u,n),t.isNullOrUndefined(s)||(c&&(a=+a,s=+s),o(a,s)>0&&(a=s,i=r[u]));return i},e.distinct=function(r,n,o){o=!t.isNullOrUndefined(o)&&o;var a,s=[],i={};return r.forEach(function(t,u){(a=e.getVal(r,u,n))in i||(s.push(o?r[u]:a),i[a]=1)}),s},e.serverTimezoneOffset=null,e.throwError=function(e){try{throw new Error(e)}catch(e){throw e.message+"\n"+e.stack}},e.aggregates={sum:function(t,r){for(var n,o=0,a="number"!=typeof e.getVal(t,0,r),s=0;s<t.length;s++)n=e.getVal(t,s,r),isNaN(n)||null===n||(a&&(n=+n),o+=n);return o},average:function(t,r){return e.aggregates.sum(t,r)/t.length},min:function(t,r){var n;return"function"==typeof r&&(n=r,r=null),e.getObject(r,e.getItemFromComparer(t,r,n||e.fnAscending))},max:function(t,r){var n;return"function"==typeof r&&(n=r,r=null),e.getObject(r,e.getItemFromComparer(t,r,n||e.fnDescending))},truecount:function(e,t){return new y(e).executeLocal((new r).where(t,"equal",!0,!0)).length},falsecount:function(e,t){return new y(e).executeLocal((new r).where(t,"equal",!1,!0)).length},count:function(e,t){return e.length}},e.operatorSymbols={"<":"lessthan",">":"greaterthan","<=":"lessthanorequal",">=":"greaterthanorequal","==":"equal","!=":"notequal","*=":"contains","$=":"endswith","^=":"startswith"},e.odBiOperator={"<":" lt ",">":" gt ","<=":" le ",">=":" ge ","==":" eq ","!=":" ne ",lessthan:" lt ",lessthanorequal:" le ",greaterthan:" gt ",greaterthanorequal:" ge ",equal:" eq ",notequal:" ne "},e.odUniOperator={"$=":"endswith","^=":"startswith","*=":"substringof",endswith:"endswith",startswith:"startswith",contains:"substringof"},e.odv4UniOperator={"$=":"endswith","^=":"startswith","*=":"contains",endswith:"endswith",startswith:"startswith",contains:"contains"},e.diacritics={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"},e.fnOperators={equal:function(t,r,n,o){return o&&(t=e.ignoreDiacritics(t),r=e.ignoreDiacritics(r)),n?e.toLowerCase(t)===e.toLowerCase(r):t===r},notequal:function(t,r,n,o){return o&&(t=e.ignoreDiacritics(t),r=e.ignoreDiacritics(r)),!e.fnOperators.equal(t,r,n)},lessthan:function(t,r,n){return n?e.toLowerCase(t)<e.toLowerCase(r):t<r},greaterthan:function(t,r,n){return n?e.toLowerCase(t)>e.toLowerCase(r):t>r},lessthanorequal:function(t,r,n){return n?e.toLowerCase(t)<=e.toLowerCase(r):t<=r},greaterthanorequal:function(t,r,n){return n?e.toLowerCase(t)>=e.toLowerCase(r):t>=r},contains:function(r,n,o,a){return a&&(r=e.ignoreDiacritics(r),n=e.ignoreDiacritics(n)),o?!t.isNullOrUndefined(r)&&!t.isNullOrUndefined(n)&&-1!==e.toLowerCase(r).indexOf(e.toLowerCase(n)):!t.isNullOrUndefined(r)&&!t.isNullOrUndefined(n)&&-1!==r.toString().indexOf(n)},notnull:function(e){return null!==e},isnull:function(e){return null===e},startswith:function(t,r,n,o){return o&&(t=e.ignoreDiacritics(t),r=e.ignoreDiacritics(r)),n?t&&r&&e.startsWith(e.toLowerCase(t),e.toLowerCase(r)):t&&r&&e.startsWith(t,r)},endswith:function(t,r,n,o){return o&&(t=e.ignoreDiacritics(t),r=e.ignoreDiacritics(r)),n?t&&r&&e.endsWith(e.toLowerCase(t),e.toLowerCase(r)):t&&r&&e.endsWith(t,r)},processSymbols:function(t){var r=e.operatorSymbols[t];if(r){return e.fnOperators[r]}return e.throwError("Query - Process Operator : Invalid operator")},processOperator:function(t){var r=e.fnOperators[t];return r||e.fnOperators.processSymbols(t)}},e.parse={parseJson:function(t){return"string"==typeof t?t=JSON.parse(t,e.parse.jsonReviver):t instanceof Array?e.parse.iterateAndReviveArray(t):"object"==typeof t&&e.parse.iterateAndReviveJson(t),t},iterateAndReviveArray:function(t){for(var r=0;r<t.length;r++)"object"==typeof t[r]?e.parse.iterateAndReviveJson(t[r]):"string"!=typeof t[r]||/^[\s]*\[|^[\s]*\{|\"/g.test(t[r])?t[r]=e.parse.parseJson(t[r]):t[r]=e.parse.jsonReviver("",t[r])},iterateAndReviveJson:function(t){for(var r,n=0,o=Object.keys(t);n<o.length;n++){var a=o[n];e.startsWith(a,"__")||("object"==typeof(r=t[a])?r instanceof Array?e.parse.iterateAndReviveArray(r):r&&e.parse.iterateAndReviveJson(r):t[a]=e.parse.jsonReviver(t[a],r))}},jsonReviver:function(t,r){var n=r;if("string"==typeof r){var o=/^\/Date\(([+-]?[0-9]+)([+-][0-9]{4})?\)\/$/.exec(r);if(o)return e.dateParse.toTimeZone(new Date(parseInt(o[1],10)),e.serverTimezoneOffset,!0);if(/^(\d{4}\-\d\d\-\d\d([tT][\d:\.]*){1})([zZ]|([+\-])(\d\d):?(\d\d))?$/.test(r)){var a=n.split(/[^0-9]/);r=e.dateParse.toTimeZone(new Date(parseInt(a[0],10),parseInt(a[1],10)-1,parseInt(a[2],10),parseInt(a[3],10),parseInt(a[4],10),parseInt(a[5],10)),e.serverTimezoneOffset,!0)}}return r},isJson:function(t){return"string"==typeof t[0]?t:e.parse.parseJson(t)},isGuid:function(e){return null!=/[A-Fa-f0-9]{8}(?:-[A-Fa-f0-9]{4}){3}-[A-Fa-f0-9]{12}/i.exec(e)},replacer:function(t,r){return e.isPlainObject(t)?e.parse.jsonReplacer(t,r):t instanceof Array?e.parse.arrayReplacer(t):t instanceof Date?e.parse.jsonReplacer({val:t},r).val:t},jsonReplacer:function(t,r){for(var n,o=0,a=Object.keys(t);o<a.length;o++){var s=a[o];if((n=t[s])instanceof Date){var i=n;t[s]=e.dateParse.toTimeZone(e.dateParse.addSelfOffset(i),e.serverTimezoneOffset).toJSON()}}return t},arrayReplacer:function(t){for(var r=0;r<t.length;r++)e.isPlainObject(t[r])?t[r]=e.parse.jsonReplacer(t[r]):t[r]instanceof Date&&(t[r]=e.parse.jsonReplacer({date:t[r]}).date);return t}},e.dateParse={addSelfOffset:function(e){return new Date(+e-6e4*e.getTimezoneOffset())},toUTC:function(e){return new Date(+e+6e4*e.getTimezoneOffset())},toTimeZone:function(t,r,n){if(null===r)return t;var o=n?e.dateParse.toUTC(t):t;return new Date(+o-36e5*r)},toLocalTime:function(e){var t=e,r=-t.getTimezoneOffset(),n=r>=0?"+":"-",o=function(e){var t=Math.floor(Math.abs(e));return(t<10?"0":"")+t};return t.getFullYear()+"-"+o(t.getMonth()+1)+"-"+o(t.getDate())+"T"+o(t.getHours())+":"+o(t.getMinutes())+":"+o(t.getSeconds())+n+o(r/60)+":"+o(r%60)}},e}(),s=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),i=function(){function e(t){this.options={from:"table",requestType:"json",sortBy:"sorted",select:"select",skip:"skip",group:"group",take:"take",search:"search",count:"requiresCounts",where:"where",aggregates:"aggregates"},this.type=e,this.dataSource=t,this.pvt={}}return e.prototype.processResponse=function(e,t,r,n){return e},e}(),u=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return s(n,e),n.prototype.processQuery=function(e,t){for(var r,n,o=e.dataSource.json.slice(0),a=o.length,s=!0,i={},u=0;u<t.queries.length;u++)r=this[(n=t.queries[u]).fn].call(this,o,n.e,t),"onAggregates"===n.fn?i[n.e.field+" - "+n.e.type]=r:o=void 0!==r?r:o,"onPage"!==n.fn&&"onSkip"!==n.fn&&"onTake"!==n.fn&&"onRange"!==n.fn||(s=!1),s&&(a=o.length);return t.isCountRequired&&(o={result:o,count:a,aggregates:i}),o},n.prototype.batchRequest=function(e,t,r){var n;for(n=0;n<t.addedRecords.length;n++)this.insert(e,t.addedRecords[n]);for(n=0;n<t.changedRecords.length;n++)this.update(e,r.key,t.changedRecords[n]);for(n=0;n<t.deletedRecords.length;n++)this.remove(e,r.key,t.deletedRecords[n]);return t},n.prototype.onWhere=function(e,t){return e&&e.length?e.filter(function(e){if(t)return t.validate(e)}):e},n.prototype.onAggregates=function(e,t){var r=a.aggregates[t.type];return e&&r&&0!==e.length?r(e,t.field):null},n.prototype.onSearch=function(e,t){return e&&e.length?(0===t.fieldNames.length&&a.getFieldList(e[0],t.fieldNames),e.filter(function(e){for(var r=0;r<t.fieldNames.length;r++)if(t.comparer.call(e,a.getObject(t.fieldNames[r],e),t.searchKey,t.ignoreCase,t.ignoreAccent))return!0;return!1})):e},n.prototype.onSortBy=function(e,t,r){if(!e||!e.length)return e;var n,o=a.getValue(t.fieldName,r);if(!o)return e.sort(t.comparer);if(o instanceof Array){for(var s=(o=o.slice(0)).length-1;s>=0;s--)o[s]&&(n=t.comparer,a.endsWith(o[s]," desc")&&(n=a.fnSort("descending"),o[s]=o[s].replace(" desc","")),e=a.sort(e,o[s],n));return e}return a.sort(e,o,t.comparer)},n.prototype.onGroup=function(e,t,n){if(!e||!e.length)return e;var o=r.filterQueries(n.queries,"onAggregates"),s=[];if(o.length)for(var i=void 0,u=0;u<o.length;u++)i=o[u].e,s.push({type:i.type,field:a.getValue(i.field,n)});return a.group(e,a.getValue(t.fieldName,n),s,null,null,t.comparer)},n.prototype.onPage=function(e,t,r){var n=a.getValue(t.pageSize,r),o=(a.getValue(t.pageIndex,r)-1)*n,s=o+n;return e&&e.length?e.slice(o,s):e},n.prototype.onRange=function(e,t){return e&&e.length?e.slice(a.getValue(t.start),a.getValue(t.end)):e},n.prototype.onTake=function(e,t){return e&&e.length?e.slice(0,a.getValue(t.nos)):e},n.prototype.onSkip=function(e,t){return e&&e.length?e.slice(a.getValue(t.nos)):e},n.prototype.onSelect=function(e,t){return e&&e.length?a.select(e,a.getValue(t.fieldNames)):e},n.prototype.insert=function(e,r,n,o,a){return t.isNullOrUndefined(a)?e.dataSource.json.push(r):e.dataSource.json.splice(a,0,r)},n.prototype.remove=function(e,t,r,n){var o,a=e.dataSource.json;for("object"==typeof r&&(r=r[t]),o=0;o<a.length&&a[o][t]!==r;o++);return o!==a.length?a.splice(o,1):null},n.prototype.update=function(e,r,n,o){var a,s=e.dataSource.json,i=n[r];for(a=0;a<s.length&&s[a][r]!==i;a++);return a<s.length?t.merge(s[a],n):null},n}(i),c=function(e){function o(){return null!==e&&e.apply(this,arguments)||this}return s(o,e),o.prototype.processQuery=function(e,t,n){var o,s,i=this.getQueryRequest(t),u=r.filterQueryLists(t.queries,["onSelect","onPage","onSkip","onTake","onRange"]),c=t.params,l=e.dataSource.url,p=null,d=this.options,h={sorts:[],groups:[],filters:[],searches:[],aggregates:[]};"onPage"in u?(o=u.onPage,s=((s=a.getValue(o.pageIndex,t))-1)*(p=a.getValue(o.pageSize,t))):"onRange"in u&&(s=(o=u.onRange).start,p=o.end-o.start);for(var f=0;f<i.sorts.length;f++)o=a.getValue(i.sorts[f].e.fieldName,t),h.sorts.push(a.callAdaptorFunction(this,"onEachSort",{name:o,direction:i.sorts[f].e.direction},t));n&&(o=this.getFiltersFrom(n,t))&&h.filters.push(a.callAdaptorFunction(this,"onEachWhere",o.toJson(),t));for(f=0;f<i.filters.length;f++){h.filters.push(a.callAdaptorFunction(this,"onEachWhere",i.filters[f].e.toJson(),t));for(var g=0,y="object"==typeof h.filters[f]?Object.keys(h.filters[f]):[];g<y.length;g++){var v=y[g];a.isNull(h[v])&&delete h[v]}}for(f=0;f<i.searches.length;f++)o=i.searches[f].e,h.searches.push(a.callAdaptorFunction(this,"onEachSearch",{fields:o.fieldNames,operator:o.operator,key:o.searchKey,ignoreCase:o.ignoreCase},t));for(f=0;f<i.groups.length;f++)h.groups.push(a.getValue(i.groups[f].e.fieldName,t));for(f=0;f<i.aggregates.length;f++)o=i.aggregates[f].e,h.aggregates.push({type:o.type,field:a.getValue(o.field,t)});var m={};this.getRequestQuery(d,t,u,h,m),a.callAdaptorFunction(this,"addParams",{dm:e,query:t,params:c,reqParams:m});for(var S=0,b=Object.keys(m);S<b.length;S++){v=b[S];(a.isNull(m[v])||""===m[v]||0===m[v].length)&&delete m[v]}d.skip in m&&d.take in m||null===p||(m[d.skip]=a.callAdaptorFunction(this,"onSkip",s,t),m[d.take]=a.callAdaptorFunction(this,"onTake",p,t));var O=this.pvt;return this.pvt={},"json"===this.options.requestType?{data:JSON.stringify(m),url:l,pvtData:O,type:"POST",contentType:"application/json; charset=utf-8"}:(o=this.convertToQueryString(m,t,e),o=(-1!==e.dataSource.url.indexOf("?")?"&":"/")+o,{type:"GET",url:o.length?l.replace(/\/*$/,o):l,pvtData:O})},o.prototype.getRequestQuery=function(e,t,r,n,o){var s=o;s[e.from]=t.fromTable,e.expand&&(s[e.expand]="onExpand"in this&&"onSelect"in r?a.callAdaptorFunction(this,"onExpand",{selects:a.getValue(r.onSelect.fieldNames,t),expands:t.expands},t):t.expands),s[e.select]="onSelect"in r?a.callAdaptorFunction(this,"onSelect",a.getValue(r.onSelect.fieldNames,t),t):"",s[e.count]=t.isCountRequired?a.callAdaptorFunction(this,"onCount",t.isCountRequired,t):"",s[e.search]=n.searches.length?a.callAdaptorFunction(this,"onSearch",n.searches,t):"",s[e.skip]="onSkip"in r?a.callAdaptorFunction(this,"onSkip",a.getValue(r.onSkip.nos,t),t):"",s[e.take]="onTake"in r?a.callAdaptorFunction(this,"onTake",a.getValue(r.onTake.nos,t),t):"",s[e.where]=n.filters.length||n.searches.length?a.callAdaptorFunction(this,"onWhere",n.filters,t):"",s[e.sortBy]=n.sorts.length?a.callAdaptorFunction(this,"onSortBy",n.sorts,t):"",s[e.group]=n.groups.length?a.callAdaptorFunction(this,"onGroup",n.groups,t):"",s[e.aggregates]=n.aggregates.length?a.callAdaptorFunction(this,"onAggregates",n.aggregates,t):"",s.param=[]},o.prototype.convertToQueryString=function(e,t,r){return""},o.prototype.processResponse=function(e,t,r,n,o,s){var i=o,u=i.pvtData||{},c=e.groupDs;if(n&&n.getResponseHeader("Content-Type")&&-1!==n.getResponseHeader("Content-Type").indexOf("xml"))return r.isCountRequired?{result:[],count:0}:[];var l=JSON.parse(i.data);if(l&&"batch"===l.action&&e.addedRecords)return s.addedRecords=e.addedRecords,s;e.d&&(e=e.d);var p={};return"count"in e&&(p.count=e.count),p.result=e.result?e.result:e,this.getAggregateResult(u,e,p,c,r),a.isNull(p.count)?p.result:{result:p.result,count:p.count,aggregates:p.aggregates}},o.prototype.onGroup=function(e){return this.pvt.groups=e,e},o.prototype.onAggregates=function(e){this.pvt.aggregates=e},o.prototype.batchRequest=function(e,t,r,n,o){return{type:"POST",url:e.dataSource.batchUrl||e.dataSource.crudUrl||e.dataSource.removeUrl||e.dataSource.url,contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify({changed:t.changedRecords,added:t.addedRecords,deleted:t.deletedRecords,action:"batch",table:r[void 0],key:r[void 0]})}},o.prototype.beforeSend=function(e,t){},o.prototype.insert=function(e,t,r){return{url:e.dataSource.insertUrl||e.dataSource.crudUrl||e.dataSource.url,data:JSON.stringify({value:t,table:r,action:"insert"})}},o.prototype.remove=function(e,t,r,n){return{type:"POST",url:e.dataSource.removeUrl||e.dataSource.crudUrl||e.dataSource.url,data:JSON.stringify({key:r,keyColumn:t,table:n,action:"remove"})}},o.prototype.update=function(e,t,r,n){return{type:"POST",url:e.dataSource.updateUrl||e.dataSource.crudUrl||e.dataSource.url,data:JSON.stringify({value:r,action:"update",keyColumn:t,key:r[t],table:n})}},o.prototype.getFiltersFrom=function(e,t){var r,o=t.fKey,s=o,i=t.key,u=[];"object"!=typeof e[0]&&(s=null);for(var c=0;c<e.length;c++)r="object"==typeof e[0]?a.getObject(i||s,e[c]):e[c],u.push(new n(o,"equal",r));return n.or(u)},o.prototype.getAggregateResult=function(e,n,o,s,i){var u=n;if(n&&n.result&&(u=n.result),e&&e.aggregates&&e.aggregates.length){var c=e.aggregates,l=void 0,p=u,d={};n.aggregate&&(p=n.aggregate);for(var h=0;h<c.length;h++)(l=a.aggregates[c[h].type])&&(d[c[h].field+" - "+c[h].type]=l(p,c[h].field));o.aggregates=d}if(e&&e.groups&&e.groups.length){var f=e.groups;for(h=0;h<f.length;h++){t.isNullOrUndefined(s)||(s=a.group(s,f[h]));var g=r.filterQueries(i.queries,"onGroup")[h].e;u=a.group(u,f[h],e.aggregates,null,s,g.comparer)}o.result=u}return o},o.prototype.getQueryRequest=function(e){var t={sorts:[],groups:[],filters:[],searches:[],aggregates:[]};return t.sorts=r.filterQueries(e.queries,"onSortBy"),t.groups=r.filterQueries(e.queries,"onGroup"),t.filters=r.filterQueries(e.queries,"onWhere"),t.searches=r.filterQueries(e.queries,"onSearch"),t.aggregates=r.filterQueries(e.queries,"onAggregates"),t},o.prototype.addParams=function(e){var t=e.reqParams;e.params.length&&(t.params={});for(var r=0,n=e.params;r<n.length;r++){var o=n[r];if(t[o.key])throw new Error("Query() - addParams: Custom Param is conflicting other request arguments");t[o.key]=o.value,o.fn&&(t[o.key]=o.fn.call(e.query,o.key,e.query,e.dm)),t.params[o.key]=t[o.key]}},o}(i),l=function(e){function r(r){var n=e.call(this)||this;return n.options=t.extend({},n.options,{requestType:"get",accept:"application/json;odata=light;q=1,application/json;odata=verbose;q=0.5",multipartAccept:"multipart/mixed",sortBy:"$orderby",select:"$select",skip:"$skip",take:"$top",count:"$inlinecount",where:"$filter",expand:"$expand",batch:"$batch",changeSet:"--changeset_",batchPre:"batch_",contentId:"Content-Id: ",batchContent:"Content-Type: multipart/mixed; boundary=",changeSetContent:"Content-Type: application/http\nContent-Transfer-Encoding: binary ",batchChangeSetContentType:"Content-Type: application/json; charset=utf-8 ",updateType:"PUT"}),n.getModuleName=t.getValue("getModulename",n),t.extend(n.options,r||{}),n}return s(r,e),r.prototype.onPredicate=function(e,n,o){var s,i,u="",c=e.value,l=typeof c,p=e.field?r.getField(e.field):null;if(c instanceof Date&&(c="datetime'"+a.parse.replacer(c)+"'"),"string"===l&&(c="'"+c+"'",o&&(p="cast("+p+", 'Edm.String')"),a.parse.isGuid(c)&&(i="guid"),e.ignoreCase&&(i||(p="tolower("+p+")"),c=c.toLowerCase())),s=a.odBiOperator[e.operator])return u+=p,u+=s,i&&(u+=i),u+c;if(t.isNullOrUndefined(this.getModuleName)?s=a.odUniOperator[e.operator]:"ODataV4Adaptor"===this.getModuleName()&&(s=a.odv4UniOperator[e.operator]),"substringof"===s){var d=c;c=p,p=d}return u+=s+"(",u+=p+",",i&&(u+=i),u+=c+")"},r.prototype.addParams=function(t){e.prototype.addParams.call(this,t),delete t.reqParams.params},r.prototype.onComplexPredicate=function(e,t,r){for(var n=[],o=0;o<e.predicates.length;o++)n.push("("+this.onEachWhere(e.predicates[o],t,r)+")");return n.join(" "+e.condition+" ")},r.prototype.onEachWhere=function(e,t,r){return e.isComplex?this.onComplexPredicate(e,t,r):this.onPredicate(e,t,r)},r.prototype.onWhere=function(e){return this.pvt.search&&e.push(this.onEachWhere(this.pvt.search,null,!0)),e.join(" and ")},r.prototype.onEachSearch=function(e){e.fields&&0===e.fields.length&&a.throwError("Query() - Search : oData search requires list of field names to search");for(var t=this.pvt.search||[],r=0;r<e.fields.length;r++)t.push(new n(e.fields[r],e.operator,e.key,e.ignoreCase));this.pvt.search=t},r.prototype.onSearch=function(e){return this.pvt.search=n.or(this.pvt.search),""},r.prototype.onEachSort=function(e){var t=[];if(e.name instanceof Array)for(var n=0;n<e.name.length;n++)t.push(r.getField(e.name[n])+("descending"===e.direction?" desc":""));else t.push(r.getField(e.name)+("descending"===e.direction?" desc":""));return t.join(",")},r.prototype.onSortBy=function(e){return e.reverse().join(",")},r.prototype.onGroup=function(e){return this.pvt.groups=e,[]},r.prototype.onSelect=function(e){for(var t=0;t<e.length;t++)e[t]=r.getField(e[t]);return e.join(",")},r.prototype.onAggregates=function(e){return this.pvt.aggregates=e,""},r.prototype.onCount=function(e){return!0===e?"allpages":""},r.prototype.beforeSend=function(e,t,r){a.endsWith(r.url,this.options.batch)&&"post"===r.type.toLowerCase()?(t.setRequestHeader("Accept",this.options.multipartAccept),t.setRequestHeader("DataServiceVersion","2.0"),t.overrideMimeType("text/plain; charset=x-user-defined")):t.setRequestHeader("Accept",this.options.accept),t.setRequestHeader("DataServiceVersion","2.0"),t.setRequestHeader("MaxDataServiceVersion","2.0")},r.prototype.processResponse=function(e,r,n,o,s,i){if(!t.isNullOrUndefined(e.d)){var u=n&&n.isCountRequired?e.d.results:e.d;if(!t.isNullOrUndefined(u))for(var c=0;c<u.length;c++)t.isNullOrUndefined(u[c].__metadata)||delete u[c].__metadata}var l=s&&s.pvtData,p=this.processBatchResponse(e,n,o,s,i);if(p)return p;var d=o&&s.getResponseHeader("DataServiceVersion"),h=null,f=d&&parseInt(d,10)||2;if(n&&n.isCountRequired){var g="__count";(e[g]||e["odata.count"])&&(h=e[g]||e["odata.count"]),e.d&&(e=e.d),(e[g]||e["odata.count"])&&(h=e[g]||e["odata.count"])}3===f&&e.value&&(e=e.value),e.d&&(e=e.d),f<3&&e.results&&(e=e.results);var y={};return y.count=h,y.result=e,this.getAggregateResult(l,e,y,null,n),a.isNull(h)?y.result:{result:y.result,count:y.count,aggregates:y.aggregates}},r.prototype.convertToQueryString=function(e,t,r){var n=[],o=e.table||"";delete e.table,r.dataSource.requiresFormat&&(e.$format="json");for(var a=0,s=Object.keys(e);a<s.length;a++){var i=s[a];n.push(i+"="+e[i])}return n=n.join("&"),r.dataSource.url&&-1!==r.dataSource.url.indexOf("?")&&!o?n:n.length?o+"?"+n:o||""},r.prototype.localTimeReplacer=function(e,r){for(var n=0,o=t.isNullOrUndefined(r)?[]:Object.keys(r);n<o.length;n++){var s=o[n];r[s]instanceof Date&&(r[s]=a.dateParse.toLocalTime(r[s]))}return r},r.prototype.insert=function(e,t,r){return{url:e.dataSource.url.replace(/\/*$/,r?"/"+r:""),data:JSON.stringify(t,this.options.localTime?this.localTimeReplacer:null)}},r.prototype.remove=function(e,t,r,n){var o;return o="string"==typeof r?"('"+r+"')":"("+r+")",{type:"DELETE",url:e.dataSource.url.replace(/\/*$/,n?"/"+n:"")+o}},r.prototype.update=function(e,r,n,o,a,s){"PATCH"!==this.options.updateType||t.isNullOrUndefined(s)||(n=this.compareAndRemove(n,s,r));var i;return i="string"==typeof n[r]?"('"+n[r]+"')":"("+n[r]+")",{type:this.options.updateType,url:e.dataSource.url.replace(/\/*$/,o?"/"+o:"")+i,data:JSON.stringify(n,this.options.localTime?this.localTimeReplacer:null),accept:this.options.accept}},r.prototype.batchRequest=function(e,t,r,n,o){var s=r.guid=a.getGuid(this.options.batchPre),i=e.dataSource.url.replace(/\/*$/,"/"+this.options.batch),u={url:r.url,key:r.key,cid:1,cSet:a.getGuid(this.options.changeSet)},c="--"+s+"\n";return c+="Content-Type: multipart/mixed; boundary="+u.cSet.replace("--","")+"\n",this.pvt.changeSet=0,c+=this.generateInsertRequest(t.addedRecords,u),c+=this.generateUpdateRequest(t.changedRecords,u,o?o.changedRecords:[]),c+=this.generateDeleteRequest(t.deletedRecords,u),c+=u.cSet+"--\n",c+="--"+s+"--",{type:"POST",url:i,dataType:"json",contentType:"multipart/mixed; charset=UTF-8;boundary="+s,data:c}},r.prototype.generateDeleteRequest=function(e,t){if(!e)return"";return this.generateBodyContent(e,t,{method:"DELETE ",url:function(e,t,r){return"("+e[t][r]+")"},data:function(e,t){return""}})+"\n"},r.prototype.generateInsertRequest=function(e,t){if(!e)return"";var r={method:"POST ",url:function(e,t,r){return""},data:function(e,t){return JSON.stringify(e[t])+"\n\n"}};return this.generateBodyContent(e,t,r)},r.prototype.generateUpdateRequest=function(e,t,r){var n=this;if(!e)return"";e.forEach(function(e){return e=n.compareAndRemove(e,r.filter(function(r){return a.getObject(t.key,r)===a.getObject(t.key,e)})[0],t.key)});var o={method:this.options.updateType+" ",url:function(e,t,r){return"("+e[t][r]+")"},data:function(e,t){return JSON.stringify(e[t])+"\n\n"}};return this.generateBodyContent(e,t,o)},r.getField=function(e){return e.replace(/\./g,"/")},r.prototype.generateBodyContent=function(e,r,n){for(var o="",a=0;a<e.length;a++)o+="\n"+r.cSet+"\n",o+=this.options.changeSetContent+"\n\n",o+=n.method,o+=r.url+n.url(e,a,r.key)+" HTTP/1.1\n",o+="Accept: "+this.options.accept+"\n",o+="Content-Id: "+this.pvt.changeSet+++"\n",o+=this.options.batchChangeSetContentType+"\n",t.isNullOrUndefined(e[a]["@odata.etag"])?o+="\n":(o+="If-Match: "+e[a]["@odata.etag"]+"\n\n",delete e[a]["@odata.etag"]),o+=n.data(e,a);return o},r.prototype.processBatchResponse=function(e,r,n,o,s){if(n&&n.getResponseHeader("Content-Type")&&-1!==n.getResponseHeader("Content-Type").indexOf("xml"))return r.isCountRequired?{result:[],count:0}:[];if(o&&this.options.batch&&a.endsWith(o.url,this.options.batch)&&"post"===o.type.toLowerCase()){var i=n.getResponseHeader("Content-Type"),u=void 0,c=void 0,l=e+"";if(i=i.substring(i.indexOf("=batchresponse")+1),(l=l.split(i)).length<2)return{};l=l[1];var p=/(?:\bContent-Type.+boundary=)(changesetresponse.+)/i.exec(l);p&&l.replace(p[0],"");for(var d=p?p[1]:"",h=(l=l.split(d)).length;h>-1;h--)/\bContent-ID:/i.test(l[h])&&/\bHTTP.+201/.test(l[h])&&(u=parseInt(/\bContent-ID: (\d+)/i.exec(l[h])[1],10),s.addedRecords[u]&&(c=a.parse.parseJson(/^\{.+\}/m.exec(l[h])[0]),t.extend({},s.addedRecords[u],this.processResponse(c))));return s}return null},r.prototype.compareAndRemove=function(e,r,n){var o=this;return t.isNullOrUndefined(r)?e:(Object.keys(e).forEach(function(t){t!==n&&"@odata.etag"!==t&&(a.isPlainObject(e[t])?(o.compareAndRemove(e[t],r[t]),0===Object.keys(e[t]).length&&delete e[t]):e[t]===r[t]?delete e[t]:e[t]&&r[t]&&e[t].valueOf()===r[t].valueOf()&&delete e[t])}),e)},r}(c),p=function(e){function r(r){var n=e.call(this,r)||this;return n.options=t.extend({},n.options,{requestType:"get",accept:"application/json, text/javascript, */*; q=0.01",multipartAccept:"multipart/mixed",sortBy:"$orderby",select:"$select",skip:"$skip",take:"$top",count:"$count",search:"$search",where:"$filter",expand:"$expand",batch:"$batch",changeSet:"--changeset_",batchPre:"batch_",contentId:"Content-Id: ",batchContent:"Content-Type: multipart/mixed; boundary=",changeSetContent:"Content-Type: application/http\nContent-Transfer-Encoding: binary ",batchChangeSetContentType:"Content-Type: application/json; charset=utf-8 ",updateType:"PATCH",localTime:!1}),t.getValue("getModulename",n.getModulename()),t.extend(n.options,r||{}),n}return s(r,e),r.prototype.getModulename=function(){return"ODataV4Adaptor"},r.prototype.onCount=function(e){return!0===e?"true":""},r.prototype.onPredicate=function(t,r,n){var o="",a=t.value instanceof Date;return o=e.prototype.onPredicate.call(this,t,r,n),a&&(o=o.replace(/datetime'(.*)'$/,"$1")),o},r.prototype.onEachSearch=function(e){var t=this.pvt.searches||[];t.push(e.key),this.pvt.searches=t},r.prototype.onSearch=function(e){return this.pvt.searches.join(" OR ")},r.prototype.onExpand=function(e){var t=this,r={},n={},o=e.expands.slice(),a=[];return e.selects.filter(function(e){return e.indexOf(".")>-1}).forEach(function(e){var t=e.split(".");t[0]in r||(r[t[0]]=[]),r[t[0]].push(t[1])}),Object.keys(r).forEach(function(e){-1===o.indexOf(e)&&o.push(e)}),o.forEach(function(e){n[e]=e in r?e+"("+t.options.select+"="+r[e].join(",")+")":e}),Object.keys(n).forEach(function(e){return a.push(n[e])}),a.join(",")},r.prototype.onSelect=function(t){return e.prototype.onSelect.call(this,t.filter(function(e){return-1===e.indexOf(".")}))},r.prototype.beforeSend=function(e,t,r){"POST"!==r.type&&"PUT"!==r.type&&"PATCH"!==r.type||t.setRequestHeader("Prefer","return=representation"),t.setRequestHeader("Accept",this.options.accept)},r.prototype.processResponse=function(r,n,o,s,i,u){var c=i&&i.pvtData,l=e.prototype.processBatchResponse.call(this,r,o,s,i,u);if(l)return l;var p=null;o&&o.isCountRequired&&"@odata.count"in r&&(p=r["@odata.count"]),r=t.isNullOrUndefined(r.value)?r:r.value;var d={};return d.count=p,d.result=r,this.getAggregateResult(c,r,d,null,o),a.isNull(p)?d.result:{result:d.result,count:p,aggregates:d.aggregates}},r}(l),d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return s(t,e),t.prototype.insert=function(e,t,r){return{type:"POST",url:e.dataSource.url,data:JSON.stringify(t)}},t.prototype.remove=function(e,t,r,n){return{type:"DELETE",url:e.dataSource.url+"/"+r,data:JSON.stringify(r)}},t.prototype.update=function(e,t,r,n){return{type:"PUT",url:e.dataSource.url,data:JSON.stringify(r)}},t.prototype.beforeSend=function(e,t,r){t.setRequestHeader("Accept","application/json, text/javascript, */*; q=0.01")},t.prototype.processResponse=function(e,t,r,n,o,s){var i=o&&o.pvtData,u=null,c={};if(o&&"post"!==o.type.toLowerCase()){var l=n&&o.getResponseHeader("DataServiceVersion"),p=l&&parseInt(l,10)||2;r&&r.isCountRequired&&(a.isNull(e.Count)||(u=e.Count)),p<3&&e.Items&&(e=e.Items),c.count=u,c.result=e,this.getAggregateResult(i,e,c,null,r)}return c.result=c.result||e,a.isNull(u)?c.result:{result:c.result,count:c.count,aggregates:c.aggregates}},t}(l),h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return s(t,e),t.prototype.processQuery=function(e,t,r){var n=(new c).processQuery(e,t,r),o=a.parse.parseJson(n.data),s={};if(o.param)for(var i=0;i<o.param.length;i++){var u=o.param[i],l=Object.keys(u)[0];s[l]=u[l]}s.value=o;return{data:JSON.stringify(s),url:n.url,pvtData:n.pvtData,type:"POST",contentType:"application/json; charset=utf-8"}},t}(c),f=function(e){function r(){var r=e.call(this)||this;return t.setValue("beforeSend",c.prototype.beforeSend,r),r}return s(r,e),r.prototype.insert=function(e,t,r){return this.updateType="add",{url:e.dataSource.insertUrl||e.dataSource.crudUrl||e.dataSource.url,data:JSON.stringify({value:t,table:r,action:"insert"})}},r.prototype.remove=function(t,r,n,o){return e.prototype.remove.call(this,t,r,n),{type:"POST",url:t.dataSource.removeUrl||t.dataSource.crudUrl||t.dataSource.url,data:JSON.stringify({key:n,keyColumn:r,table:o,action:"remove"})}},r.prototype.update=function(e,t,r,n){return this.updateType="update",this.updateKey=t,{type:"POST",url:e.dataSource.updateUrl||e.dataSource.crudUrl||e.dataSource.url,data:JSON.stringify({value:r,action:"update",keyColumn:t,key:r[t],table:n})}},r.prototype.processResponse=function(t,r,n,o,a,s,i){var u;if("add"===this.updateType&&e.prototype.insert.call(this,r,t,null,null,0),"update"===this.updateType&&e.prototype.update.call(this,r,this.updateKey,t),t.added)for(u=0;u<t.added.length;u++)e.prototype.insert.call(this,r,t.added[u]);if(t.changed)for(u=0;u<t.changed.length;u++)e.prototype.update.call(this,r,i.key,t.changed[u]);if(t.deleted)for(u=0;u<t.deleted.length;u++)e.prototype.remove.call(this,r,i.key,t.deleted[u]);return t},r.prototype.batchRequest=function(e,t,r){return{type:"POST",url:e.dataSource.batchUrl||e.dataSource.crudUrl||e.dataSource.url,contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify({changed:t.changedRecords,added:t.addedRecords,deleted:t.deletedRecords,action:"batch",table:r.url,key:r.key})}},r}(u),g=function(e){function n(r,n,o){var s=e.call(this)||this;s.isCrudAction=!1,s.isInsertAction=!1,t.isNullOrUndefined(r)||(s.cacheAdaptor=r),s.pageSize=o,s.guidId=a.getGuid("cacheAdaptor");window.localStorage.setItem(s.guidId,JSON.stringify({keys:[],results:[]}));var i=s.guidId;return t.isNullOrUndefined(n)||setInterval(function(){var e;e=a.parse.parseJson(window.localStorage.getItem(i));for(var t=[],r=0;r<e.results.length;r++){var o=+new Date,s=+new Date(e.results[r].timeStamp);e.results[r].timeStamp=o-s,o-s>n&&t.push(r)}for(r=0;r<t.length;r++)e.results.splice(t[r],1),e.keys.splice(t[r],1);window.localStorage.removeItem(i),window.localStorage.setItem(i,JSON.stringify(e))},n),s}return s(n,e),n.prototype.generateKey=function(e,t){var n=this.getQueryRequest(t),o=r.filterQueryLists(t.queries,["onSelect","onPage","onSkip","onTake","onRange"]),a=e;"onPage"in o&&(a+=o.onPage.pageIndex),n.sorts.forEach(function(e){a+=e.e.direction+e.e.fieldName}),n.groups.forEach(function(e){a+=e.e.fieldName}),n.searches.forEach(function(e){a+=e.e.searchKey});for(var s=0;s<n.filters.length;s++){var i=n.filters[s];if(i.e.isComplex){var u=t.clone();u.queries=[];for(var c=0;c<i.e.predicates.length;c++)u.queries.push({fn:"onWhere",e:i.e.predicates[c],filter:t.queries.filter});a+=i.e.condition+this.generateKey(e,u)}else a+=i.e.field+i.e.operator+i.e.value}return a},n.prototype.processQuery=function(e,t,r){var n,o=this.generateKey(e.dataSource.url,t),s=(n=a.parse.parseJson(window.localStorage.getItem(this.guidId)))?n.results[n.keys.indexOf(o)]:null;return null==s||this.isCrudAction||this.isInsertAction?(this.isCrudAction=null,this.isInsertAction=null,this.cacheAdaptor.processQuery.apply(this.cacheAdaptor,[].slice.call(arguments,0))):s},n.prototype.processResponse=function(e,t,r,n,o,s){if(this.isInsertAction||o&&this.cacheAdaptor.options.batch&&a.endsWith(o.url,this.cacheAdaptor.options.batch)&&"post"===o.type.toLowerCase())return this.cacheAdaptor.processResponse(e,t,r,n,o,s);e=this.cacheAdaptor.processResponse.apply(this.cacheAdaptor,[].slice.call(arguments,0));var i=r?this.generateKey(t.dataSource.url,r):t.dataSource.url,u={},c=(u=a.parse.parseJson(window.localStorage.getItem(this.guidId))).keys.indexOf(i);for(-1!==c&&(u.results.splice(c,1),u.keys.splice(c,1)),u.results[u.keys.push(i)-1]={keys:i,result:e.result,timeStamp:new Date,count:e.count};u.results.length>this.pageSize;)u.results.splice(0,1),u.keys.splice(0,1);return window.localStorage.setItem(this.guidId,JSON.stringify(u)),e},n.prototype.beforeSend=function(e,t,r){a.endsWith(r.url,this.cacheAdaptor.options.batch)&&"post"===r.type.toLowerCase()&&t.setRequestHeader("Accept",this.cacheAdaptor.options.multipartAccept),e.dataSource.crossDomain||t.setRequestHeader("Accept",this.cacheAdaptor.options.accept)},n.prototype.update=function(e,t,r,n){return this.isCrudAction=!0,this.cacheAdaptor.update(e,t,r,n)},n.prototype.insert=function(e,t,r){return this.isInsertAction=!0,this.cacheAdaptor.insert(e,t,r)},n.prototype.remove=function(e,t,r,n){return this.isCrudAction=!0,this.cacheAdaptor.remove(e,t,r,n)},n.prototype.batchRequest=function(e,t,r){return this.cacheAdaptor.batchRequest(e,t,r)},n}(c),y=function(){function e(e,n,o){var s=this;this.dateParse=!0,this.requests=[],e||this.dataSource||(e=[]),o=o||e.adaptor;var i;return e instanceof Array?i={json:e,offline:!0}:"object"==typeof e?(e.json||(e.json=[]),i={url:e.url,insertUrl:e.insertUrl,removeUrl:e.removeUrl,updateUrl:e.updateUrl,crudUrl:e.crudUrl,batchUrl:e.batchUrl,json:e.json,headers:e.headers,accept:e.accept,data:e.data,timeTillExpiration:e.timeTillExpiration,cachingPageSize:e.cachingPageSize,enableCaching:e.enableCaching,requestType:e.requestType,key:e.key,crossDomain:e.crossDomain,jsonp:e.jsonp,dataType:e.dataType,offline:void 0!==e.offline?e.offline:!(e.adaptor instanceof f)&&!e.url,requiresFormat:e.requiresFormat}):a.throwError("DataManager: Invalid arguments"),void 0!==i.requiresFormat||a.isCors()||(i.requiresFormat=!!t.isNullOrUndefined(i.crossDomain)||i.crossDomain),void 0===i.dataType&&(i.dataType="json"),this.dataSource=i,this.defaultQuery=n,i.url&&i.offline&&!i.json.length?(this.isDataAvailable=!1,this.adaptor=o||new l,this.dataSource.offline=!1,this.ready=this.executeQuery(n||new r),this.ready.then(function(e){s.dataSource.offline=!0,s.isDataAvailable=!0,i.json=e.result,s.adaptor=new u})):this.adaptor=i.offline?new u:new l,!i.jsonp&&this.adaptor instanceof l&&(i.jsonp="callback"),this.adaptor=o||this.adaptor,i.enableCaching&&(this.adaptor=new g(this.adaptor,i.timeTillExpiration,i.cachingPageSize)),this}return e.prototype.setDefaultQuery=function(e){return this.defaultQuery=e,this},e.prototype.executeLocal=function(n){this.defaultQuery||n instanceof r||a.throwError("DataManager - executeLocal() : A query is required to execute"),this.dataSource.json||a.throwError("DataManager - executeLocal() : Json data is required to execute"),n=n||this.defaultQuery;var o=this.adaptor.processQuery(this,n);if(n.subQuery){var s=n.subQuery.fromTable,i=n.subQuery.lookups,u=n.isCountRequired?o.result:o;i&&i instanceof Array&&a.buildHierarchy(n.subQuery.fKey,s,u,i,n.subQuery.key);for(var c=0;c<u.length;c++)u[c][s]instanceof Array&&(u[c]=t.extend({},{},u[c]),u[c][s]=this.adaptor.processResponse(n.subQuery.using(new e(u[c][s].slice(0))).executeLocal(),this,n))}return this.adaptor.processResponse(o,this,n)},e.prototype.executeQuery=function(t,n,o,s){var i=this;"function"==typeof t&&(s=o,o=n,n=t,t=null),t||(t=this.defaultQuery),t instanceof r||a.throwError("DataManager - executeQuery() : A query is required to execute");var u=new v,c={query:t};if(this.dataSource.offline||void 0===this.dataSource.url||""===this.dataSource.url)e.nextTick(function(){var r=i.executeLocal(t);c=e.getDeferedArgs(t,r,c),u.resolve(c)});else{var l=this.adaptor.processQuery(this,t);this.makeRequest(l,u,c,t)}return(n||o)&&u.promise.then(n,o),s&&u.promise.then(s,s),u.promise},e.getDeferedArgs=function(e,t,r){return e.isCountRequired?(r.result=t.result,r.count=t.count,r.aggregates=t.aggregates):r.result=t,r},e.nextTick=function(e){(window.setImmediate||window.setTimeout)(e,0)},e.prototype.extendRequest=function(e,r,n){return t.extend({},{type:"GET",dataType:this.dataSource.dataType,crossDomain:this.dataSource.crossDomain,jsonp:this.dataSource.jsonp,cache:!0,processData:!1,onSuccess:r,onFailure:n},e)},e.prototype.makeRequest=function(e,r,n,o){var s=this,i=!!o.subQuerySelector,u=function(e){n.error=e,r.reject(n)},c=function(e,t,o,a,s,i,u){n.xhr=o,n.count=t?parseInt(t.toString(),10):0,n.result=e,n.request=a,n.aggregates=i,n.actual=s,n.virtualSelectRecords=u,r.resolve(n)},l=function(e,t){var r=new v,l={parent:n};o.subQuery.isChild=!0;var p=s.adaptor.processQuery(s,o.subQuery,e?s.adaptor.processResponse(e):t),d=s.makeRequest(p,r,l,o.subQuery);return i||r.then(function(t){e&&(a.buildHierarchy(o.subQuery.fKey,o.subQuery.fromTable,e,t,o.subQuery.key),c(e,t.count,t.xhr))},u),d},p=this.extendRequest(e,function(e,t){-1===t.httpRequest.getResponseHeader("Content-Type").indexOf("xml")&&s.dateParse&&(e=a.parse.parseJson(e));var r=s.adaptor.processResponse(e,s,o,t.httpRequest,t),n=0,u=null,p=e.virtualSelectRecords;o.isCountRequired&&(n=r.count,u=r.aggregates,r=r.result),o.subQuery?i||l(r,t):c(r,n,t.httpRequest,t.type,e,u,p)},u),d=new t.Ajax(p);if(d.beforeSend=function(){s.beforeSend(d.httpRequest,d)},(p=d.send()).catch(function(e){return!0}),this.requests.push(d),i){var h=o.subQuerySelector.call(this,{query:o.subQuery,parent:o});h&&h.length?Promise.all([p,l(null,h)]).then(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e[0],n=s.adaptor.processResponse(r[0],s,o,s.requests[0].httpRequest,s.requests[0]),u=0;o.isCountRequired&&(u=n.count,n=n.result);var l=s.adaptor.processResponse(r[1],s,o.subQuery,s.requests[1].httpRequest,s.requests[1]);u=0,o.subQuery.isCountRequired&&(u=l.count,l=l.result),a.buildHierarchy(o.subQuery.fKey,o.subQuery.fromTable,n,l,o.subQuery.key),i=!1,c(n,u,s.requests[0].httpRequest)}):i=!1}return p},e.prototype.beforeSend=function(e,t){this.adaptor.beforeSend(this,e,t);for(var r,n=this.dataSource.headers,o=0;n&&o<n.length;o++){r=[];for(var a=0,s=Object.keys(n[o]);a<s.length;a++){var i=s[a];r.push(i),e.setRequestHeader(i,n[o][i])}}},e.prototype.saveChanges=function(e,n,o,s,i){var u=this;o instanceof r&&(s=o,o=null);var c={url:o,key:n||this.dataSource.key},l=this.adaptor.batchRequest(this,e,c,s,i);if(this.dataSource.offline)return l;var p=new v,d=new t.Ajax(l);return d.beforeSend=function(){u.beforeSend(d.httpRequest,d)},d.onSuccess=function(t,r){p.resolve(u.adaptor.processResponse(a.parse.parseJson(t),u,null,r.httpRequest,r,e,c))},d.onFailure=function(e){p.reject([{error:e}])},d.send().catch(function(e){return!0}),p.promise},e.prototype.insert=function(e,t,n,o){t instanceof r&&(n=t,t=null);var a=this.adaptor.insert(this,e,t,n,o);return this.dataSource.offline?a:this.doAjaxRequest(a)},e.prototype.remove=function(e,t,n,o){"object"==typeof t&&(t=t[e]),n instanceof r&&(o=n,n=null);var a=this.adaptor.remove(this,e,t,n,o);return this.dataSource.offline?a:this.doAjaxRequest(a)},e.prototype.update=function(e,t,n,o,a){n instanceof r&&(o=n,n=null);var s=this.adaptor.update(this,e,t,n,o,a);return this.dataSource.offline?s:this.doAjaxRequest(s)},e.prototype.doAjaxRequest=function(e){var r=this,n=new v;e=t.extend({},{type:"POST",contentType:"application/json; charset=utf-8",processData:!1},e);var o=new t.Ajax(e);return o.beforeSend=function(){r.beforeSend(o.httpRequest,o)},o.onSuccess=function(e,t){try{a.parse.parseJson(e)}catch(t){e=[]}e=r.adaptor.processResponse(a.parse.parseJson(e),r,null,t.httpRequest,t),n.resolve(e)},o.onFailure=function(e){n.reject([{error:e}])},o.send().catch(function(e){return!0}),n.promise},e}(),v=function(){return function(){var e=this;this.promise=new Promise(function(t,r){e.resolve=t,e.reject=r}),this.then=this.promise.then.bind(this.promise),this.catch=this.promise.catch.bind(this.promise)}}();e.DataManager=y,e.Deferred=v,e.Query=r,e.Predicate=n,e.Adaptor=i,e.JsonAdaptor=u,e.UrlAdaptor=c,e.ODataAdaptor=l,e.ODataV4Adaptor=p,e.WebApiAdaptor=d,e.WebMethodAdaptor=h,e.RemoteSaveAdaptor=f,e.CacheAdaptor=g,e.DataUtil=a,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@syncfusion/ej2-base")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base"],t):t(e.ej={},e.ej2Base)}(this,function(e,t){"use strict";var r=function(){function e(e){return this.subQuery=null,this.isChild=!1,this.queries=[],this.key="",this.fKey="","string"==typeof e?this.fromTable=e:e&&e instanceof Array&&(this.lookups=e),this.expands=[],this.sortedColumns=[],this.groupedColumns=[],this.subQuery=null,this.isChild=!1,this.params=[],this}return e.prototype.setKey=function(e){return this.key=e,this},e.prototype.using=function(e){return this.dataManager=e,this},e.prototype.execute=function(e,t,r,n){return(e=e||this.dataManager)?e.executeQuery(this,t,r,n):a.throwError('Query - execute() : dataManager needs to be is set using "using" function or should be passed as argument')},e.prototype.executeLocal=function(e){return(e=e||this.dataManager)?e.executeLocal(this):a.throwError('Query - executeLocal() : dataManager needs to be is set using "using" function or should be passed as argument')},e.prototype.clone=function(){var t=new e;return t.queries=this.queries.slice(0),t.key=this.key,t.isChild=this.isChild,t.dataManager=this.dataManager,t.fromTable=this.fromTable,t.params=this.params.slice(0),t.expands=this.expands.slice(0),t.sortedColumns=this.sortedColumns.slice(0),t.groupedColumns=this.groupedColumns.slice(0),t.subQuerySelector=this.subQuerySelector,t.subQuery=this.subQuery,t.fKey=this.fKey,t.isCountRequired=this.isCountRequired,t},e.prototype.from=function(e){return this.fromTable=e,this},e.prototype.addParams=function(e,t){return"function"==typeof t?this.params.push({key:e,fn:t}):this.params.push({key:e,value:t}),this},e.prototype.expand=function(e){return this.expands="string"==typeof e?[].slice.call([e],0):e.slice(0),this},e.prototype.where=function(e,t,r,o,a){t=t?t.toLowerCase():null;var s=null;return"string"==typeof e?s=new n(e,t,r,o,a):e instanceof n&&(s=e),this.queries.push({fn:"onWhere",e:s}),this},e.prototype.search=function(e,t,r,n,o){"string"==typeof t&&(t=[t]),r=r||"contains";var s=a.fnOperators[r];return this.queries.push({fn:"onSearch",e:{fieldNames:t,operator:r,searchKey:e,ignoreCase:n,ignoreAccent:o,comparer:s}}),this},e.prototype.sortBy=function(t,r,n){var o,s,i="ascending";if("string"==typeof t&&a.endsWith(t.toLowerCase()," desc")&&(t=t.replace(/ desc$/i,""),r="descending"),r&&"string"!=typeof r||(i=r?r.toLowerCase():"ascending",r=a.fnSort(r)),n){o=e.filterQueries(this.queries,"onSortBy");for(var u=0;u<o.length;u++)if("string"==typeof(s=o[u].e.fieldName)){if(s===t)return this}else if(s instanceof Array)for(var c=0;c<s.length;c++)if(s[c]===t||t.toLowerCase()===s[c]+" desc")return this}return this.queries.push({fn:"onSortBy",e:{fieldName:t,comparer:r,direction:i}}),this},e.prototype.sortByDesc=function(e){return this.sortBy(e,"descending")},e.prototype.group=function(e,t,r){return this.sortBy(e,null,!0),this.queries.push({fn:"onGroup",e:{fieldName:e,comparer:t||null,format:r||null}}),this},e.prototype.page=function(e,t){return this.queries.push({fn:"onPage",e:{pageIndex:e,pageSize:t}}),this},e.prototype.range=function(e,t){return this.queries.push({fn:"onRange",e:{start:e,end:t}}),this},e.prototype.take=function(e){return this.queries.push({fn:"onTake",e:{nos:e}}),this},e.prototype.skip=function(e){return this.queries.push({fn:"onSkip",e:{nos:e}}),this},e.prototype.select=function(e){return"string"==typeof e&&(e=[].slice.call([e],0)),this.queries.push({fn:"onSelect",e:{fieldNames:e}}),this},e.prototype.hierarchy=function(e,t){return this.subQuerySelector=t,this.subQuery=e,this},e.prototype.foreignKey=function(e){return this.fKey=e,this},e.prototype.requiresCount=function(){return this.isCountRequired=!0,this},e.prototype.aggregate=function(e,t){return this.queries.push({fn:"onAggregates",e:{field:t,type:e}}),this},e.filterQueries=function(e,t){return e.filter(function(e){return e.fn===t})},e.filterQueryLists=function(e,t){for(var r=e.filter(function(e){return-1!==t.indexOf(e.fn)}),n={},o=0;o<r.length;o++)n[r[o].fn]||(n[r[o].fn]=r[o].e);return n},e}(),n=function(){function e(t,r,n,o,s){return void 0===o&&(o=!1),this.ignoreAccent=!1,this.isComplex=!1,"string"==typeof t?(this.field=t,this.operator=r.toLowerCase(),this.value=n,this.ignoreCase=o,this.ignoreAccent=s,this.isComplex=!1,this.comparer=a.fnOperators.processOperator(this.operator)):(t instanceof e&&n instanceof e||n instanceof Array)&&(this.isComplex=!0,this.condition=r.toLowerCase(),this.predicates=[t],n instanceof Array?[].push.apply(this.predicates,n):this.predicates.push(n)),this}return e.and=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.combinePredicates([].slice.call(t,0),"and")},e.prototype.and=function(t,r,n,o,a){return e.combine(this,t,r,n,"and",o,a)},e.or=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.combinePredicates([].slice.call(t,0),"or")},e.prototype.or=function(t,r,n,o,a){return e.combine(this,t,r,n,"or",o,a)},e.fromJson=function(e){if(e instanceof Array){for(var t=[],r=0,n=e.length;r<n;r++)t.push(this.fromJSONData(e[r]));return t}var o=e;return this.fromJSONData(o)},e.prototype.validate=function(e){var t,r,n=this.predicates?this.predicates:[];if(!this.isComplex&&this.comparer)return this.comparer.call(this,a.getObject(this.field,e),this.value,this.ignoreCase,this.ignoreAccent);t="and"===this.condition;for(var o=0;o<n.length;o++)if(r=n[o].validate(e),t){if(!r)return!1}else if(r)return!0;return t},e.prototype.toJson=function(){var e,t;if(this.isComplex){e=[],t=this.predicates;for(var r=0;r<t.length;r++)e.push(t[r].toJson())}return{isComplex:this.isComplex,field:this.field,operator:this.operator,value:this.value,ignoreCase:this.ignoreCase,ignoreAccent:this.ignoreAccent,condition:this.condition,predicates:e}},e.combinePredicates=function(t,r){if(1===t.length){if(!(t[0]instanceof Array))return t[0];t=t[0]}return new e(t[0],r,t.slice(1))},e.combine=function(t,r,n,o,s,i,u){return r instanceof e?e[s](t,r):"string"==typeof r?e[s](t,new e(r,n,o,i,u)):a.throwError("Predicate - "+s+" : invalid arguments")},e.fromJSONData=function(t){for(var r=t.predicates||[],n=r.length,o=[],a=0;a<n;a++)o.push(this.fromJSONData(r[a]));return t.isComplex?new e(o[0],t.condition,o.slice(1)):new e(t.field,t.operator,t.value,t.ignoreCase,t.ignoreAccent)},e}(),o={GroupGuid:"{271bbba0-1ee7}"},a=function(){function e(){}return e.getValue=function(e,t){return"function"==typeof e?e.call(t||{}):e},e.endsWith=function(e,t){return e.slice(-t.length)===t},e.startsWith=function(e,t){return e.slice(0,t.length)===t},e.fnSort=function(t){return"ascending"===(t=t?e.toLowerCase(t):"ascending")?this.fnAscending:this.fnDescending},e.fnAscending=function(e,t){return null===t||void 0===t?-1:"string"==typeof e?e.localeCompare(t):null===e||void 0===e?1:e-t},e.fnDescending=function(e,t){return null===t||void 0===t?1:"string"==typeof e?-1*e.localeCompare(t):null===e||void 0===e?-1:t-e},e.extractFields=function(e,t){for(var r={},n=0;n<t.length;n++)r=this.setValue(t[n],this.getObject(t[n],e),r);return r},e.select=function(e,t){for(var r=[],n=0;n<e.length;n++)r.push(this.extractFields(e[n],t));return r},e.group=function(r,n,a,s,i,u){s=s||1;var c=r;if(c.GroupGuid===o.GroupGuid){for(var l=function(e){if(t.isNullOrUndefined(i))c[e].items=p.group(c[e].items,n,a,c.level+1,null,u),c[e].count=c[e].items.length;else{var r=-1,o=i.filter(function(t){return t.key===c[e].key});r=i.indexOf(o[0]),c[e].items=p.group(c[e].items,n,a,c.level+1,i[r].items,u),c[e].count=i[r].count}},p=this,d=0;d<c.length;d++)l(d);return c.childLevels+=1,c}var h={},f=[];f.GroupGuid=o.GroupGuid,f.level=s,f.childLevels=0,f.records=c;for(var g=function(e){var r=y.getVal(c,e,n);if(t.isNullOrUndefined(u)||(r=u(r,n)),!h[r]&&(h[r]={key:r,count:0,items:[],aggregates:{},field:n},f.push(h[r]),!t.isNullOrUndefined(i))){var o=i.filter(function(e){return e.key===h[r].key});h[r].count=o[0].count}h[r].count=t.isNullOrUndefined(i)?h[r].count+=1:h[r].count,h[r].items.push(c[e])},y=this,v=0;v<c.length;v++)g(v);if(a&&a.length){var m=function(r){for(var n={},o=void 0,s=a,u=0;u<a.length;u++)if(o=e.aggregates[a[u].type],t.isNullOrUndefined(i))o&&(n[s[u].field+" - "+s[u].type]=o(f[r].items,s[u].field));else{var c=i.filter(function(e){return e.key===f[r].key});o&&(n[s[u].field+" - "+s[u].type]=o(c[0].items,s[u].field))}f[r].aggregates=n};for(v=0;v<f.length;v++)m(v)}return c.length&&f||c},e.buildHierarchy=function(e,t,r,n,o){var a,s={};for(n.result&&(n=n.result),n.GroupGuid&&this.throwError("DataManager: Do not have support Grouping in hierarchy"),a=0;a<n.length;a++){(s[i=this.getObject(e,n[a])]||(s[i]=[])).push(n[a])}for(a=0;a<r.length;a++){var i=this.getObject(o||e,r[a]);r[a][t]=s[i]}},e.getFieldList=function(e,t,r){if(void 0===r&&(r=""),void 0===t||null===t)return this.getFieldList(e,[],r);for(var n=e,o=0,a=Object.keys(e);o<a.length;o++){var s=a[o];"object"!=typeof n[s]||n[s]instanceof Array?t.push(r+s):this.getFieldList(n[s],t,r+s+".")}return t},e.getObject=function(e,t){if(!e)return t;if(t){if(-1===e.indexOf("."))return t[e];for(var r=t,n=e.split("."),o=0;o<n.length&&null!=r;o++)r=r[n[o]];return r}},e.setValue=function(e,r,n){var o,a,s=e.toString().split("."),i=n||{},u=i,c=s.length;for(o=0;o<c;o++)a=s[o],o+1===c?u[a]=void 0===r?void 0:r:t.isNullOrUndefined(u[a])&&(u[a]={}),u=u[a];return i},e.sort=function(e,t,r){if(e.length<=1)return e;var n=parseInt((e.length/2).toString(),10),o=e.slice(0,n),a=e.slice(n);return o=this.sort(o,t,r),a=this.sort(a,t,r),this.merge(o,a,t,r)},e.ignoreDiacritics=function(t){if("string"!=typeof t)return t;return t.split("").map(function(t){return t in e.diacritics?e.diacritics[t]:t}).join("")},e.merge=function(e,t,r,n){for(var o,a=[];e.length>0||t.length>0;)o=e.length>0&&t.length>0?n?n(this.getVal(e,0,r),this.getVal(t,0,r))<=0?e:t:e[0][r]<e[0][r]?e:t:e.length>0?e:t,a.push(o.shift());return a},e.getVal=function(e,t,r){return r?this.getObject(r,e[t]):e[t]},e.toLowerCase=function(e){return e?"string"==typeof e?e.toLowerCase():e.toString():0===e||!1===e?e.toString():""},e.callAdaptorFunction=function(e,r,n,o){if(r in e){var a=e[r](n,o);t.isNullOrUndefined(a)||(n=a)}return n},e.isPlainObject=function(e){return!!e&&e.constructor===Object},e.isCors=function(){var e=null;try{e=new window.XMLHttpRequest}catch(e){}return!!e&&"withCredentials"in e},e.getGuid=function(e){var t;return(e||"")+"00000000-0000-4000-0000-000000000000".replace(/0/g,function(e,r){if("crypto"in window&&"getRandomValues"in crypto){var n=new Uint8Array(1);window.crypto.getRandomValues(n),t=n[0]%16|0}else t=16*Math.random()|0;return"0123456789abcdef"[19===r?3&t|8:t]})},e.isNull=function(e){return void 0===e||null===e},e.getItemFromComparer=function(r,n,o){var a,s,i,u=0,c="string"==typeof e.getVal(r,0,n);if(r.length)for(;t.isNullOrUndefined(a)&&u<r.length;)a=e.getVal(r,u,n),i=r[u++];for(;u<r.length;u++)s=e.getVal(r,u,n),t.isNullOrUndefined(s)||(c&&(a=+a,s=+s),o(a,s)>0&&(a=s,i=r[u]));return i},e.distinct=function(r,n,o){o=!t.isNullOrUndefined(o)&&o;var a,s=[],i={};return r.forEach(function(t,u){(a=e.getVal(r,u,n))in i||(s.push(o?r[u]:a),i[a]=1)}),s},e.serverTimezoneOffset=null,e.throwError=function(e){try{throw new Error(e)}catch(e){throw e.message+"\n"+e.stack}},e.aggregates={sum:function(t,r){for(var n,o=0,a="number"!=typeof e.getVal(t,0,r),s=0;s<t.length;s++)n=e.getVal(t,s,r),isNaN(n)||null===n||(a&&(n=+n),o+=n);return o},average:function(t,r){return e.aggregates.sum(t,r)/t.length},min:function(t,r){var n;return"function"==typeof r&&(n=r,r=null),e.getObject(r,e.getItemFromComparer(t,r,n||e.fnAscending))},max:function(t,r){var n;return"function"==typeof r&&(n=r,r=null),e.getObject(r,e.getItemFromComparer(t,r,n||e.fnDescending))},truecount:function(e,t){return new y(e).executeLocal((new r).where(t,"equal",!0,!0)).length},falsecount:function(e,t){return new y(e).executeLocal((new r).where(t,"equal",!1,!0)).length},count:function(e,t){return e.length}},e.operatorSymbols={"<":"lessthan",">":"greaterthan","<=":"lessthanorequal",">=":"greaterthanorequal","==":"equal","!=":"notequal","*=":"contains","$=":"endswith","^=":"startswith"},e.odBiOperator={"<":" lt ",">":" gt ","<=":" le ",">=":" ge ","==":" eq ","!=":" ne ",lessthan:" lt ",lessthanorequal:" le ",greaterthan:" gt ",greaterthanorequal:" ge ",equal:" eq ",notequal:" ne "},e.odUniOperator={"$=":"endswith","^=":"startswith","*=":"substringof",endswith:"endswith",startswith:"startswith",contains:"substringof"},e.odv4UniOperator={"$=":"endswith","^=":"startswith","*=":"contains",endswith:"endswith",startswith:"startswith",contains:"contains"},e.diacritics={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"},e.fnOperators={equal:function(t,r,n,o){return o&&(t=e.ignoreDiacritics(t),r=e.ignoreDiacritics(r)),n?e.toLowerCase(t)===e.toLowerCase(r):t===r},notequal:function(t,r,n,o){return o&&(t=e.ignoreDiacritics(t),r=e.ignoreDiacritics(r)),!e.fnOperators.equal(t,r,n)},lessthan:function(t,r,n){return n?e.toLowerCase(t)<e.toLowerCase(r):t<r},greaterthan:function(t,r,n){return n?e.toLowerCase(t)>e.toLowerCase(r):t>r},lessthanorequal:function(t,r,n){return n?e.toLowerCase(t)<=e.toLowerCase(r):t<=r},greaterthanorequal:function(t,r,n){return n?e.toLowerCase(t)>=e.toLowerCase(r):t>=r},contains:function(r,n,o,a){return a&&(r=e.ignoreDiacritics(r),n=e.ignoreDiacritics(n)),o?!t.isNullOrUndefined(r)&&!t.isNullOrUndefined(n)&&-1!==e.toLowerCase(r).indexOf(e.toLowerCase(n)):!t.isNullOrUndefined(r)&&!t.isNullOrUndefined(n)&&-1!==r.toString().indexOf(n)},notnull:function(e){return null!==e},isnull:function(e){return null===e},startswith:function(t,r,n,o){return o&&(t=e.ignoreDiacritics(t),r=e.ignoreDiacritics(r)),n?t&&r&&e.startsWith(e.toLowerCase(t),e.toLowerCase(r)):t&&r&&e.startsWith(t,r)},endswith:function(t,r,n,o){return o&&(t=e.ignoreDiacritics(t),r=e.ignoreDiacritics(r)),n?t&&r&&e.endsWith(e.toLowerCase(t),e.toLowerCase(r)):t&&r&&e.endsWith(t,r)},processSymbols:function(t){var r=e.operatorSymbols[t];if(r){return e.fnOperators[r]}return e.throwError("Query - Process Operator : Invalid operator")},processOperator:function(t){var r=e.fnOperators[t];return r||e.fnOperators.processSymbols(t)}},e.parse={parseJson:function(t){return"string"==typeof t?t=JSON.parse(t,e.parse.jsonReviver):t instanceof Array?e.parse.iterateAndReviveArray(t):"object"==typeof t&&e.parse.iterateAndReviveJson(t),t},iterateAndReviveArray:function(t){for(var r=0;r<t.length;r++)"object"==typeof t[r]?e.parse.iterateAndReviveJson(t[r]):"string"!=typeof t[r]||/^[\s]*\[|^[\s]*\{|\"/g.test(t[r])?t[r]=e.parse.parseJson(t[r]):t[r]=e.parse.jsonReviver("",t[r])},iterateAndReviveJson:function(t){for(var r,n=0,o=Object.keys(t);n<o.length;n++){var a=o[n];e.startsWith(a,"__")||("object"==typeof(r=t[a])?r instanceof Array?e.parse.iterateAndReviveArray(r):r&&e.parse.iterateAndReviveJson(r):t[a]=e.parse.jsonReviver(t[a],r))}},jsonReviver:function(t,r){var n=r;if("string"==typeof r){var o=/^\/Date\(([+-]?[0-9]+)([+-][0-9]{4})?\)\/$/.exec(r);if(o)return e.dateParse.toTimeZone(new Date(parseInt(o[1],10)),e.serverTimezoneOffset,!0);if(/^(\d{4}\-\d\d\-\d\d([tT][\d:\.]*){1})([zZ]|([+\-])(\d\d):?(\d\d))?$/.test(r)){var a=n.split(/[^0-9]/);r=e.dateParse.toTimeZone(new Date(parseInt(a[0],10),parseInt(a[1],10)-1,parseInt(a[2],10),parseInt(a[3],10),parseInt(a[4],10),parseInt(a[5],10)),e.serverTimezoneOffset,!0)}}return r},isJson:function(t){return"string"==typeof t[0]?t:e.parse.parseJson(t)},isGuid:function(e){return null!=/[A-Fa-f0-9]{8}(?:-[A-Fa-f0-9]{4}){3}-[A-Fa-f0-9]{12}/i.exec(e)},replacer:function(t,r){return e.isPlainObject(t)?e.parse.jsonReplacer(t,r):t instanceof Array?e.parse.arrayReplacer(t):t instanceof Date?e.parse.jsonReplacer({val:t},r).val:t},jsonReplacer:function(t,r){for(var n,o=0,a=Object.keys(t);o<a.length;o++){var s=a[o];if((n=t[s])instanceof Date){var i=n;t[s]=e.dateParse.toTimeZone(e.dateParse.addSelfOffset(i),e.serverTimezoneOffset).toJSON()}}return t},arrayReplacer:function(t){for(var r=0;r<t.length;r++)e.isPlainObject(t[r])?t[r]=e.parse.jsonReplacer(t[r]):t[r]instanceof Date&&(t[r]=e.parse.jsonReplacer({date:t[r]}).date);return t}},e.dateParse={addSelfOffset:function(e){return new Date(+e-6e4*e.getTimezoneOffset())},toUTC:function(e){return new Date(+e+6e4*e.getTimezoneOffset())},toTimeZone:function(t,r,n){if(null===r)return t;var o=n?e.dateParse.toUTC(t):t;return new Date(+o-36e5*r)},toLocalTime:function(e){var t=e,r=-t.getTimezoneOffset(),n=r>=0?"+":"-",o=function(e){var t=Math.floor(Math.abs(e));return(t<10?"0":"")+t};return t.getFullYear()+"-"+o(t.getMonth()+1)+"-"+o(t.getDate())+"T"+o(t.getHours())+":"+o(t.getMinutes())+":"+o(t.getSeconds())+n+o(r/60)+":"+o(r%60)}},e}(),s=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),i=function(){function e(t){this.options={from:"table",requestType:"json",sortBy:"sorted",select:"select",skip:"skip",group:"group",take:"take",search:"search",count:"requiresCounts",where:"where",aggregates:"aggregates"},this.type=e,this.dataSource=t,this.pvt={}}return e.prototype.processResponse=function(e,t,r,n){return e},e}(),u=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return s(n,e),n.prototype.processQuery=function(e,t){for(var r,n,o=e.dataSource.json.slice(0),a=o.length,s=!0,i={},u=0;u<t.queries.length;u++)r=this[(n=t.queries[u]).fn].call(this,o,n.e,t),"onAggregates"===n.fn?i[n.e.field+" - "+n.e.type]=r:o=void 0!==r?r:o,"onPage"!==n.fn&&"onSkip"!==n.fn&&"onTake"!==n.fn&&"onRange"!==n.fn||(s=!1),s&&(a=o.length);return t.isCountRequired&&(o={result:o,count:a,aggregates:i}),o},n.prototype.batchRequest=function(e,t,r){var n;for(n=0;n<t.addedRecords.length;n++)this.insert(e,t.addedRecords[n]);for(n=0;n<t.changedRecords.length;n++)this.update(e,r.key,t.changedRecords[n]);for(n=0;n<t.deletedRecords.length;n++)this.remove(e,r.key,t.deletedRecords[n]);return t},n.prototype.onWhere=function(e,t){return e&&e.length?e.filter(function(e){if(t)return t.validate(e)}):e},n.prototype.onAggregates=function(e,t){var r=a.aggregates[t.type];return e&&r&&0!==e.length?r(e,t.field):null},n.prototype.onSearch=function(e,t){return e&&e.length?(0===t.fieldNames.length&&a.getFieldList(e[0],t.fieldNames),e.filter(function(e){for(var r=0;r<t.fieldNames.length;r++)if(t.comparer.call(e,a.getObject(t.fieldNames[r],e),t.searchKey,t.ignoreCase,t.ignoreAccent))return!0;return!1})):e},n.prototype.onSortBy=function(e,t,r){if(!e||!e.length)return e;var n,o=a.getValue(t.fieldName,r);if(!o)return e.sort(t.comparer);if(o instanceof Array){for(var s=(o=o.slice(0)).length-1;s>=0;s--)o[s]&&(n=t.comparer,a.endsWith(o[s]," desc")&&(n=a.fnSort("descending"),o[s]=o[s].replace(" desc","")),e=a.sort(e,o[s],n));return e}return a.sort(e,o,t.comparer)},n.prototype.onGroup=function(e,t,n){if(!e||!e.length)return e;var o=r.filterQueries(n.queries,"onAggregates"),s=[];if(o.length)for(var i=void 0,u=0;u<o.length;u++)i=o[u].e,s.push({type:i.type,field:a.getValue(i.field,n)});return a.group(e,a.getValue(t.fieldName,n),s,null,null,t.comparer)},n.prototype.onPage=function(e,t,r){var n=a.getValue(t.pageSize,r),o=(a.getValue(t.pageIndex,r)-1)*n,s=o+n;return e&&e.length?e.slice(o,s):e},n.prototype.onRange=function(e,t){return e&&e.length?e.slice(a.getValue(t.start),a.getValue(t.end)):e},n.prototype.onTake=function(e,t){return e&&e.length?e.slice(0,a.getValue(t.nos)):e},n.prototype.onSkip=function(e,t){return e&&e.length?e.slice(a.getValue(t.nos)):e},n.prototype.onSelect=function(e,t){return e&&e.length?a.select(e,a.getValue(t.fieldNames)):e},n.prototype.insert=function(e,r,n,o,a){return t.isNullOrUndefined(a)?e.dataSource.json.push(r):e.dataSource.json.splice(a,0,r)},n.prototype.remove=function(e,t,r,n){var o,a=e.dataSource.json;for("object"==typeof r&&(r=r[t]),o=0;o<a.length&&a[o][t]!==r;o++);return o!==a.length?a.splice(o,1):null},n.prototype.update=function(e,r,n,o){var a,s=e.dataSource.json,i=n[r];for(a=0;a<s.length&&s[a][r]!==i;a++);return a<s.length?t.merge(s[a],n):null},n}(i),c=function(e){function o(){return null!==e&&e.apply(this,arguments)||this}return s(o,e),o.prototype.processQuery=function(e,t,n){var o,s,i=this.getQueryRequest(t),u=r.filterQueryLists(t.queries,["onSelect","onPage","onSkip","onTake","onRange"]),c=t.params,l=e.dataSource.url,p=null,d=this.options,h={sorts:[],groups:[],filters:[],searches:[],aggregates:[]};"onPage"in u?(o=u.onPage,s=((s=a.getValue(o.pageIndex,t))-1)*(p=a.getValue(o.pageSize,t))):"onRange"in u&&(s=(o=u.onRange).start,p=o.end-o.start);for(var f=0;f<i.sorts.length;f++)o=a.getValue(i.sorts[f].e.fieldName,t),h.sorts.push(a.callAdaptorFunction(this,"onEachSort",{name:o,direction:i.sorts[f].e.direction},t));n&&(o=this.getFiltersFrom(n,t))&&h.filters.push(a.callAdaptorFunction(this,"onEachWhere",o.toJson(),t));for(f=0;f<i.filters.length;f++){h.filters.push(a.callAdaptorFunction(this,"onEachWhere",i.filters[f].e.toJson(),t));for(var g=0,y="object"==typeof h.filters[f]?Object.keys(h.filters[f]):[];g<y.length;g++){var v=y[g];a.isNull(h[v])&&delete h[v]}}for(f=0;f<i.searches.length;f++)o=i.searches[f].e,h.searches.push(a.callAdaptorFunction(this,"onEachSearch",{fields:o.fieldNames,operator:o.operator,key:o.searchKey,ignoreCase:o.ignoreCase},t));for(f=0;f<i.groups.length;f++)h.groups.push(a.getValue(i.groups[f].e.fieldName,t));for(f=0;f<i.aggregates.length;f++)o=i.aggregates[f].e,h.aggregates.push({type:o.type,field:a.getValue(o.field,t)});var m={};this.getRequestQuery(d,t,u,h,m),a.callAdaptorFunction(this,"addParams",{dm:e,query:t,params:c,reqParams:m});for(var S=0,b=Object.keys(m);S<b.length;S++){v=b[S];(a.isNull(m[v])||""===m[v]||0===m[v].length)&&delete m[v]}d.skip in m&&d.take in m||null===p||(m[d.skip]=a.callAdaptorFunction(this,"onSkip",s,t),m[d.take]=a.callAdaptorFunction(this,"onTake",p,t));var O=this.pvt;return this.pvt={},"json"===this.options.requestType?{data:JSON.stringify(m),url:l,pvtData:O,type:"POST",contentType:"application/json; charset=utf-8"}:(o=this.convertToQueryString(m,t,e),o=(-1!==e.dataSource.url.indexOf("?")?"&":"/")+o,{type:"GET",url:o.length?l.replace(/\/*$/,o):l,pvtData:O})},o.prototype.getRequestQuery=function(e,t,r,n,o){var s=o;s[e.from]=t.fromTable,e.expand&&(s[e.expand]="onExpand"in this&&"onSelect"in r?a.callAdaptorFunction(this,"onExpand",{selects:a.getValue(r.onSelect.fieldNames,t),expands:t.expands},t):t.expands),s[e.select]="onSelect"in r?a.callAdaptorFunction(this,"onSelect",a.getValue(r.onSelect.fieldNames,t),t):"",s[e.count]=t.isCountRequired?a.callAdaptorFunction(this,"onCount",t.isCountRequired,t):"",s[e.search]=n.searches.length?a.callAdaptorFunction(this,"onSearch",n.searches,t):"",s[e.skip]="onSkip"in r?a.callAdaptorFunction(this,"onSkip",a.getValue(r.onSkip.nos,t),t):"",s[e.take]="onTake"in r?a.callAdaptorFunction(this,"onTake",a.getValue(r.onTake.nos,t),t):"",s[e.where]=n.filters.length||n.searches.length?a.callAdaptorFunction(this,"onWhere",n.filters,t):"",s[e.sortBy]=n.sorts.length?a.callAdaptorFunction(this,"onSortBy",n.sorts,t):"",s[e.group]=n.groups.length?a.callAdaptorFunction(this,"onGroup",n.groups,t):"",s[e.aggregates]=n.aggregates.length?a.callAdaptorFunction(this,"onAggregates",n.aggregates,t):"",s.param=[]},o.prototype.convertToQueryString=function(e,t,r){return""},o.prototype.processResponse=function(e,t,r,n,o,s){var i=o,u=i.pvtData||{},c=e.groupDs;if(n&&n.getResponseHeader("Content-Type")&&-1!==n.getResponseHeader("Content-Type").indexOf("xml"))return r.isCountRequired?{result:[],count:0}:[];var l=JSON.parse(i.data);if(l&&"batch"===l.action&&e.addedRecords)return s.addedRecords=e.addedRecords,s;e.d&&(e=e.d);var p={};return"count"in e&&(p.count=e.count),p.result=e.result?e.result:e,this.getAggregateResult(u,e,p,c,r),a.isNull(p.count)?p.result:{result:p.result,count:p.count,aggregates:p.aggregates}},o.prototype.onGroup=function(e){return this.pvt.groups=e,e},o.prototype.onAggregates=function(e){this.pvt.aggregates=e},o.prototype.batchRequest=function(e,t,r,n,o){return{type:"POST",url:e.dataSource.batchUrl||e.dataSource.crudUrl||e.dataSource.removeUrl||e.dataSource.url,contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify({changed:t.changedRecords,added:t.addedRecords,deleted:t.deletedRecords,action:"batch",table:r[void 0],key:r[void 0]})}},o.prototype.beforeSend=function(e,t){},o.prototype.insert=function(e,t,r){return{url:e.dataSource.insertUrl||e.dataSource.crudUrl||e.dataSource.url,data:JSON.stringify({value:t,table:r,action:"insert"})}},o.prototype.remove=function(e,t,r,n){return{type:"POST",url:e.dataSource.removeUrl||e.dataSource.crudUrl||e.dataSource.url,data:JSON.stringify({key:r,keyColumn:t,table:n,action:"remove"})}},o.prototype.update=function(e,t,r,n){return{type:"POST",url:e.dataSource.updateUrl||e.dataSource.crudUrl||e.dataSource.url,data:JSON.stringify({value:r,action:"update",keyColumn:t,key:r[t],table:n})}},o.prototype.getFiltersFrom=function(e,t){var r,o=t.fKey,s=o,i=t.key,u=[];"object"!=typeof e[0]&&(s=null);for(var c=0;c<e.length;c++)r="object"==typeof e[0]?a.getObject(i||s,e[c]):e[c],u.push(new n(o,"equal",r));return n.or(u)},o.prototype.getAggregateResult=function(e,n,o,s,i){var u=n;if(n&&n.result&&(u=n.result),e&&e.aggregates&&e.aggregates.length){var c=e.aggregates,l=void 0,p=u,d={};n.aggregate&&(p=n.aggregate);for(var h=0;h<c.length;h++)(l=a.aggregates[c[h].type])&&(d[c[h].field+" - "+c[h].type]=l(p,c[h].field));o.aggregates=d}if(e&&e.groups&&e.groups.length){var f=e.groups;for(h=0;h<f.length;h++){t.isNullOrUndefined(s)||(s=a.group(s,f[h]));var g=r.filterQueries(i.queries,"onGroup")[h].e;u=a.group(u,f[h],e.aggregates,null,s,g.comparer)}o.result=u}return o},o.prototype.getQueryRequest=function(e){var t={sorts:[],groups:[],filters:[],searches:[],aggregates:[]};return t.sorts=r.filterQueries(e.queries,"onSortBy"),t.groups=r.filterQueries(e.queries,"onGroup"),t.filters=r.filterQueries(e.queries,"onWhere"),t.searches=r.filterQueries(e.queries,"onSearch"),t.aggregates=r.filterQueries(e.queries,"onAggregates"),t},o.prototype.addParams=function(e){var t=e.reqParams;e.params.length&&(t.params={});for(var r=0,n=e.params;r<n.length;r++){var o=n[r];if(t[o.key])throw new Error("Query() - addParams: Custom Param is conflicting other request arguments");t[o.key]=o.value,o.fn&&(t[o.key]=o.fn.call(e.query,o.key,e.query,e.dm)),t.params[o.key]=t[o.key]}},o}(i),l=function(e){function r(r){var n=e.call(this)||this;return n.options=t.extend({},n.options,{requestType:"get",accept:"application/json;odata=light;q=1,application/json;odata=verbose;q=0.5",multipartAccept:"multipart/mixed",sortBy:"$orderby",select:"$select",skip:"$skip",take:"$top",count:"$inlinecount",where:"$filter",expand:"$expand",batch:"$batch",changeSet:"--changeset_",batchPre:"batch_",contentId:"Content-Id: ",batchContent:"Content-Type: multipart/mixed; boundary=",changeSetContent:"Content-Type: application/http\nContent-Transfer-Encoding: binary ",batchChangeSetContentType:"Content-Type: application/json; charset=utf-8 ",updateType:"PUT"}),n.getModuleName=t.getValue("getModulename",n),t.extend(n.options,r||{}),n}return s(r,e),r.prototype.onPredicate=function(e,n,o){var s,i,u="",c=e.value,l=typeof c,p=e.field?r.getField(e.field):null;if(c instanceof Date&&(c="datetime'"+a.parse.replacer(c)+"'"),"string"===l&&(c="'"+c+"'",o&&(p="cast("+p+", 'Edm.String')"),a.parse.isGuid(c)&&(i="guid"),e.ignoreCase&&(i||(p="tolower("+p+")"),c=c.toLowerCase())),s=a.odBiOperator[e.operator])return u+=p,u+=s,i&&(u+=i),u+c;if(t.isNullOrUndefined(this.getModuleName)?s=a.odUniOperator[e.operator]:"ODataV4Adaptor"===this.getModuleName()&&(s=a.odv4UniOperator[e.operator]),"substringof"===s){var d=c;c=p,p=d}return u+=s+"(",u+=p+",",i&&(u+=i),u+=c+")"},r.prototype.addParams=function(t){e.prototype.addParams.call(this,t),delete t.reqParams.params},r.prototype.onComplexPredicate=function(e,t,r){for(var n=[],o=0;o<e.predicates.length;o++)n.push("("+this.onEachWhere(e.predicates[o],t,r)+")");return n.join(" "+e.condition+" ")},r.prototype.onEachWhere=function(e,t,r){return e.isComplex?this.onComplexPredicate(e,t,r):this.onPredicate(e,t,r)},r.prototype.onWhere=function(e){return this.pvt.search&&e.push(this.onEachWhere(this.pvt.search,null,!0)),e.join(" and ")},r.prototype.onEachSearch=function(e){e.fields&&0===e.fields.length&&a.throwError("Query() - Search : oData search requires list of field names to search");for(var t=this.pvt.search||[],r=0;r<e.fields.length;r++)t.push(new n(e.fields[r],e.operator,e.key,e.ignoreCase));this.pvt.search=t},r.prototype.onSearch=function(e){return this.pvt.search=n.or(this.pvt.search),""},r.prototype.onEachSort=function(e){var t=[];if(e.name instanceof Array)for(var n=0;n<e.name.length;n++)t.push(r.getField(e.name[n])+("descending"===e.direction?" desc":""));else t.push(r.getField(e.name)+("descending"===e.direction?" desc":""));return t.join(",")},r.prototype.onSortBy=function(e){return e.reverse().join(",")},r.prototype.onGroup=function(e){return this.pvt.groups=e,[]},r.prototype.onSelect=function(e){for(var t=0;t<e.length;t++)e[t]=r.getField(e[t]);return e.join(",")},r.prototype.onAggregates=function(e){return this.pvt.aggregates=e,""},r.prototype.onCount=function(e){return!0===e?"allpages":""},r.prototype.beforeSend=function(e,t,r){a.endsWith(r.url,this.options.batch)&&"post"===r.type.toLowerCase()?(t.setRequestHeader("Accept",this.options.multipartAccept),t.setRequestHeader("DataServiceVersion","2.0"),t.overrideMimeType("text/plain; charset=x-user-defined")):t.setRequestHeader("Accept",this.options.accept),t.setRequestHeader("DataServiceVersion","2.0"),t.setRequestHeader("MaxDataServiceVersion","2.0")},r.prototype.processResponse=function(e,r,n,o,s,i){if(!t.isNullOrUndefined(e.d)){var u=n&&n.isCountRequired?e.d.results:e.d;if(!t.isNullOrUndefined(u))for(var c=0;c<u.length;c++)t.isNullOrUndefined(u[c].__metadata)||delete u[c].__metadata}var l=s&&s.pvtData,p=this.processBatchResponse(e,n,o,s,i);if(p)return p;var d=o&&s.getResponseHeader("DataServiceVersion"),h=null,f=d&&parseInt(d,10)||2;if(n&&n.isCountRequired){var g="__count";(e[g]||e["odata.count"])&&(h=e[g]||e["odata.count"]),e.d&&(e=e.d),(e[g]||e["odata.count"])&&(h=e[g]||e["odata.count"])}3===f&&e.value&&(e=e.value),e.d&&(e=e.d),f<3&&e.results&&(e=e.results);var y={};return y.count=h,y.result=e,this.getAggregateResult(l,e,y,null,n),a.isNull(h)?y.result:{result:y.result,count:y.count,aggregates:y.aggregates}},r.prototype.convertToQueryString=function(e,t,r){var n=[],o=e.table||"";delete e.table,r.dataSource.requiresFormat&&(e.$format="json");for(var a=0,s=Object.keys(e);a<s.length;a++){var i=s[a];n.push(i+"="+e[i])}return n=n.join("&"),r.dataSource.url&&-1!==r.dataSource.url.indexOf("?")&&!o?n:n.length?o+"?"+n:o||""},r.prototype.localTimeReplacer=function(e,r){for(var n=0,o=t.isNullOrUndefined(r)?[]:Object.keys(r);n<o.length;n++){var s=o[n];r[s]instanceof Date&&(r[s]=a.dateParse.toLocalTime(r[s]))}return r},r.prototype.insert=function(e,t,r){return{url:e.dataSource.url.replace(/\/*$/,r?"/"+r:""),data:JSON.stringify(t,this.options.localTime?this.localTimeReplacer:null)}},r.prototype.remove=function(e,t,r,n){var o;return o="string"==typeof r?"('"+r+"')":"("+r+")",{type:"DELETE",url:e.dataSource.url.replace(/\/*$/,n?"/"+n:"")+o}},r.prototype.update=function(e,r,n,o,a,s){"PATCH"!==this.options.updateType||t.isNullOrUndefined(s)||(n=this.compareAndRemove(n,s,r));var i;return i="string"==typeof n[r]?"('"+n[r]+"')":"("+n[r]+")",{type:this.options.updateType,url:e.dataSource.url.replace(/\/*$/,o?"/"+o:"")+i,data:JSON.stringify(n,this.options.localTime?this.localTimeReplacer:null),accept:this.options.accept}},r.prototype.batchRequest=function(e,t,r,n,o){var s=r.guid=a.getGuid(this.options.batchPre),i=e.dataSource.url.replace(/\/*$/,"/"+this.options.batch),u={url:r.url,key:r.key,cid:1,cSet:a.getGuid(this.options.changeSet)},c="--"+s+"\n";return c+="Content-Type: multipart/mixed; boundary="+u.cSet.replace("--","")+"\n",this.pvt.changeSet=0,c+=this.generateInsertRequest(t.addedRecords,u),c+=this.generateUpdateRequest(t.changedRecords,u,o?o.changedRecords:[]),c+=this.generateDeleteRequest(t.deletedRecords,u),c+=u.cSet+"--\n",c+="--"+s+"--",{type:"POST",url:i,dataType:"json",contentType:"multipart/mixed; charset=UTF-8;boundary="+s,data:c}},r.prototype.generateDeleteRequest=function(e,t){if(!e)return"";return this.generateBodyContent(e,t,{method:"DELETE ",url:function(e,t,r){return"("+e[t][r]+")"},data:function(e,t){return""}})+"\n"},r.prototype.generateInsertRequest=function(e,t){if(!e)return"";var r={method:"POST ",url:function(e,t,r){return""},data:function(e,t){return JSON.stringify(e[t])+"\n\n"}};return this.generateBodyContent(e,t,r)},r.prototype.generateUpdateRequest=function(e,t,r){var n=this;if(!e)return"";e.forEach(function(e){return e=n.compareAndRemove(e,r.filter(function(r){return a.getObject(t.key,r)===a.getObject(t.key,e)})[0],t.key)});var o={method:this.options.updateType+" ",url:function(e,t,r){return"("+e[t][r]+")"},data:function(e,t){return JSON.stringify(e[t])+"\n\n"}};return this.generateBodyContent(e,t,o)},r.getField=function(e){return e.replace(/\./g,"/")},r.prototype.generateBodyContent=function(e,r,n){for(var o="",a=0;a<e.length;a++)o+="\n"+r.cSet+"\n",o+=this.options.changeSetContent+"\n\n",o+=n.method,o+=r.url+n.url(e,a,r.key)+" HTTP/1.1\n",o+="Accept: "+this.options.accept+"\n",o+="Content-Id: "+this.pvt.changeSet+++"\n",o+=this.options.batchChangeSetContentType+"\n",t.isNullOrUndefined(e[a]["@odata.etag"])?o+="\n":(o+="If-Match: "+e[a]["@odata.etag"]+"\n\n",delete e[a]["@odata.etag"]),o+=n.data(e,a);return o},r.prototype.processBatchResponse=function(e,r,n,o,s){if(n&&n.getResponseHeader("Content-Type")&&-1!==n.getResponseHeader("Content-Type").indexOf("xml"))return r.isCountRequired?{result:[],count:0}:[];if(o&&this.options.batch&&a.endsWith(o.url,this.options.batch)&&"post"===o.type.toLowerCase()){var i=n.getResponseHeader("Content-Type"),u=void 0,c=void 0,l=e+"";if(i=i.substring(i.indexOf("=batchresponse")+1),(l=l.split(i)).length<2)return{};l=l[1];var p=/(?:\bContent-Type.+boundary=)(changesetresponse.+)/i.exec(l);p&&l.replace(p[0],"");for(var d=p?p[1]:"",h=(l=l.split(d)).length;h>-1;h--)/\bContent-ID:/i.test(l[h])&&/\bHTTP.+201/.test(l[h])&&(u=parseInt(/\bContent-ID: (\d+)/i.exec(l[h])[1],10),s.addedRecords[u]&&(c=a.parse.parseJson(/^\{.+\}/m.exec(l[h])[0]),t.extend({},s.addedRecords[u],this.processResponse(c))));return s}return null},r.prototype.compareAndRemove=function(e,r,n){var o=this;return t.isNullOrUndefined(r)?e:(Object.keys(e).forEach(function(t){t!==n&&"@odata.etag"!==t&&(a.isPlainObject(e[t])?(o.compareAndRemove(e[t],r[t]),0===Object.keys(e[t]).length&&delete e[t]):e[t]===r[t]?delete e[t]:e[t]&&r[t]&&e[t].valueOf()===r[t].valueOf()&&delete e[t])}),e)},r}(c),p=function(e){function r(r){var n=e.call(this,r)||this;return n.options=t.extend({},n.options,{requestType:"get",accept:"application/json, text/javascript, */*; q=0.01",multipartAccept:"multipart/mixed",sortBy:"$orderby",select:"$select",skip:"$skip",take:"$top",count:"$count",search:"$search",where:"$filter",expand:"$expand",batch:"$batch",changeSet:"--changeset_",batchPre:"batch_",contentId:"Content-Id: ",batchContent:"Content-Type: multipart/mixed; boundary=",changeSetContent:"Content-Type: application/http\nContent-Transfer-Encoding: binary ",batchChangeSetContentType:"Content-Type: application/json; charset=utf-8 ",updateType:"PATCH",localTime:!1}),t.getValue("getModulename",n.getModulename()),t.extend(n.options,r||{}),n}return s(r,e),r.prototype.getModulename=function(){return"ODataV4Adaptor"},r.prototype.onCount=function(e){return!0===e?"true":""},r.prototype.onPredicate=function(t,r,n){var o="",a=t.value instanceof Date;return o=e.prototype.onPredicate.call(this,t,r,n),a&&(o=o.replace(/datetime'(.*)'$/,"$1")),o},r.prototype.onEachSearch=function(e){var t=this.pvt.searches||[];t.push(e.key),this.pvt.searches=t},r.prototype.onSearch=function(e){return this.pvt.searches.join(" OR ")},r.prototype.onExpand=function(e){var t=this,r={},n={},o=e.expands.slice(),a=[];return e.selects.filter(function(e){return e.indexOf(".")>-1}).forEach(function(e){var t=e.split(".");t[0]in r||(r[t[0]]=[]),r[t[0]].push(t[1])}),Object.keys(r).forEach(function(e){-1===o.indexOf(e)&&o.push(e)}),o.forEach(function(e){n[e]=e in r?e+"("+t.options.select+"="+r[e].join(",")+")":e}),Object.keys(n).forEach(function(e){return a.push(n[e])}),a.join(",")},r.prototype.onSelect=function(t){return e.prototype.onSelect.call(this,t.filter(function(e){return-1===e.indexOf(".")}))},r.prototype.beforeSend=function(e,t,r){"POST"!==r.type&&"PUT"!==r.type&&"PATCH"!==r.type||t.setRequestHeader("Prefer","return=representation"),t.setRequestHeader("Accept",this.options.accept)},r.prototype.processResponse=function(r,n,o,s,i,u){var c=i&&i.pvtData,l=e.prototype.processBatchResponse.call(this,r,o,s,i,u);if(l)return l;var p=null;o&&o.isCountRequired&&"@odata.count"in r&&(p=r["@odata.count"]),r=t.isNullOrUndefined(r.value)?r:r.value;var d={};return d.count=p,d.result=r,this.getAggregateResult(c,r,d,null,o),a.isNull(p)?d.result:{result:d.result,count:p,aggregates:d.aggregates}},r}(l),d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return s(t,e),t.prototype.insert=function(e,t,r){return{type:"POST",url:e.dataSource.url,data:JSON.stringify(t)}},t.prototype.remove=function(e,t,r,n){return{type:"DELETE",url:e.dataSource.url+"/"+r,data:JSON.stringify(r)}},t.prototype.update=function(e,t,r,n){return{type:"PUT",url:e.dataSource.url,data:JSON.stringify(r)}},t.prototype.beforeSend=function(e,t,r){t.setRequestHeader("Accept","application/json, text/javascript, */*; q=0.01")},t.prototype.processResponse=function(e,t,r,n,o,s){var i=o&&o.pvtData,u=null,c={};if(o&&"post"!==o.type.toLowerCase()){var l=n&&o.getResponseHeader("DataServiceVersion"),p=l&&parseInt(l,10)||2;r&&r.isCountRequired&&(a.isNull(e.Count)||(u=e.Count)),p<3&&e.Items&&(e=e.Items),c.count=u,c.result=e,this.getAggregateResult(i,e,c,null,r)}return c.result=c.result||e,a.isNull(u)?c.result:{result:c.result,count:c.count,aggregates:c.aggregates}},t}(l),h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return s(t,e),t.prototype.processQuery=function(e,t,r){var n=(new c).processQuery(e,t,r),o=a.parse.parseJson(n.data),s={};if(o.param)for(var i=0;i<o.param.length;i++){var u=o.param[i],l=Object.keys(u)[0];s[l]=u[l]}s.value=o;return{data:JSON.stringify(s),url:n.url,pvtData:n.pvtData,type:"POST",contentType:"application/json; charset=utf-8"}},t}(c),f=function(e){function r(){var r=e.call(this)||this;return t.setValue("beforeSend",c.prototype.beforeSend,r),r}return s(r,e),r.prototype.insert=function(e,t,r){return this.updateType="add",{url:e.dataSource.insertUrl||e.dataSource.crudUrl||e.dataSource.url,data:JSON.stringify({value:t,table:r,action:"insert"})}},r.prototype.remove=function(t,r,n,o){return e.prototype.remove.call(this,t,r,n),{type:"POST",url:t.dataSource.removeUrl||t.dataSource.crudUrl||t.dataSource.url,data:JSON.stringify({key:n,keyColumn:r,table:o,action:"remove"})}},r.prototype.update=function(e,t,r,n){return this.updateType="update",this.updateKey=t,{type:"POST",url:e.dataSource.updateUrl||e.dataSource.crudUrl||e.dataSource.url,data:JSON.stringify({value:r,action:"update",keyColumn:t,key:r[t],table:n})}},r.prototype.processResponse=function(t,r,n,o,a,s,i){var u;if("add"===this.updateType&&e.prototype.insert.call(this,r,t),"update"===this.updateType&&e.prototype.update.call(this,r,this.updateKey,t),t.added)for(u=0;u<t.added.length;u++)e.prototype.insert.call(this,r,t.added[u]);if(t.changed)for(u=0;u<t.changed.length;u++)e.prototype.update.call(this,r,i.key,t.changed[u]);if(t.deleted)for(u=0;u<t.deleted.length;u++)e.prototype.remove.call(this,r,i.key,t.deleted[u]);return t},r.prototype.batchRequest=function(e,t,r){return{type:"POST",url:e.dataSource.batchUrl||e.dataSource.crudUrl||e.dataSource.url,contentType:"application/json; charset=utf-8",dataType:"json",data:JSON.stringify({changed:t.changedRecords,added:t.addedRecords,deleted:t.deletedRecords,action:"batch",table:r.url,key:r.key})}},r}(u),g=function(e){function n(r,n,o){var s=e.call(this)||this;s.isCrudAction=!1,s.isInsertAction=!1,t.isNullOrUndefined(r)||(s.cacheAdaptor=r),s.pageSize=o,s.guidId=a.getGuid("cacheAdaptor");window.localStorage.setItem(s.guidId,JSON.stringify({keys:[],results:[]}));var i=s.guidId;return t.isNullOrUndefined(n)||setInterval(function(){var e;e=a.parse.parseJson(window.localStorage.getItem(i));for(var t=[],r=0;r<e.results.length;r++){var o=+new Date,s=+new Date(e.results[r].timeStamp);e.results[r].timeStamp=o-s,o-s>n&&t.push(r)}for(r=0;r<t.length;r++)e.results.splice(t[r],1),e.keys.splice(t[r],1);window.localStorage.removeItem(i),window.localStorage.setItem(i,JSON.stringify(e))},n),s}return s(n,e),n.prototype.generateKey=function(e,t){var n=this.getQueryRequest(t),o=r.filterQueryLists(t.queries,["onSelect","onPage","onSkip","onTake","onRange"]),a=e;"onPage"in o&&(a+=o.onPage.pageIndex),n.sorts.forEach(function(e){a+=e.e.direction+e.e.fieldName}),n.groups.forEach(function(e){a+=e.e.fieldName}),n.searches.forEach(function(e){a+=e.e.searchKey});for(var s=0;s<n.filters.length;s++){var i=n.filters[s];if(i.e.isComplex){var u=t.clone();u.queries=[];for(var c=0;c<i.e.predicates.length;c++)u.queries.push({fn:"onWhere",e:i.e.predicates[c],filter:t.queries.filter});a+=i.e.condition+this.generateKey(e,u)}else a+=i.e.field+i.e.operator+i.e.value}return a},n.prototype.processQuery=function(e,t,r){var n,o=this.generateKey(e.dataSource.url,t),s=(n=a.parse.parseJson(window.localStorage.getItem(this.guidId)))?n.results[n.keys.indexOf(o)]:null;return null==s||this.isCrudAction||this.isInsertAction?(this.isCrudAction=null,this.isInsertAction=null,this.cacheAdaptor.processQuery.apply(this.cacheAdaptor,[].slice.call(arguments,0))):s},n.prototype.processResponse=function(e,t,r,n,o,s){if(this.isInsertAction||o&&this.cacheAdaptor.options.batch&&a.endsWith(o.url,this.cacheAdaptor.options.batch)&&"post"===o.type.toLowerCase())return this.cacheAdaptor.processResponse(e,t,r,n,o,s);e=this.cacheAdaptor.processResponse.apply(this.cacheAdaptor,[].slice.call(arguments,0));var i=r?this.generateKey(t.dataSource.url,r):t.dataSource.url,u={},c=(u=a.parse.parseJson(window.localStorage.getItem(this.guidId))).keys.indexOf(i);for(-1!==c&&(u.results.splice(c,1),u.keys.splice(c,1)),u.results[u.keys.push(i)-1]={keys:i,result:e.result,timeStamp:new Date,count:e.count};u.results.length>this.pageSize;)u.results.splice(0,1),u.keys.splice(0,1);return window.localStorage.setItem(this.guidId,JSON.stringify(u)),e},n.prototype.beforeSend=function(e,t,r){a.endsWith(r.url,this.cacheAdaptor.options.batch)&&"post"===r.type.toLowerCase()&&t.setRequestHeader("Accept",this.cacheAdaptor.options.multipartAccept),e.dataSource.crossDomain||t.setRequestHeader("Accept",this.cacheAdaptor.options.accept)},n.prototype.update=function(e,t,r,n){return this.isCrudAction=!0,this.cacheAdaptor.update(e,t,r,n)},n.prototype.insert=function(e,t,r){return this.isInsertAction=!0,this.cacheAdaptor.insert(e,t,r)},n.prototype.remove=function(e,t,r,n){return this.isCrudAction=!0,this.cacheAdaptor.remove(e,t,r,n)},n.prototype.batchRequest=function(e,t,r){return this.cacheAdaptor.batchRequest(e,t,r)},n}(c),y=function(){function e(e,n,o){var s=this;this.dateParse=!0,this.requests=[],e||this.dataSource||(e=[]),o=o||e.adaptor;var i;return e instanceof Array?i={json:e,offline:!0}:"object"==typeof e?(e.json||(e.json=[]),i={url:e.url,insertUrl:e.insertUrl,removeUrl:e.removeUrl,updateUrl:e.updateUrl,crudUrl:e.crudUrl,batchUrl:e.batchUrl,json:e.json,headers:e.headers,accept:e.accept,data:e.data,timeTillExpiration:e.timeTillExpiration,cachingPageSize:e.cachingPageSize,enableCaching:e.enableCaching,requestType:e.requestType,key:e.key,crossDomain:e.crossDomain,jsonp:e.jsonp,dataType:e.dataType,offline:void 0!==e.offline?e.offline:!(e.adaptor instanceof f)&&!e.url,requiresFormat:e.requiresFormat}):a.throwError("DataManager: Invalid arguments"),void 0!==i.requiresFormat||a.isCors()||(i.requiresFormat=!!t.isNullOrUndefined(i.crossDomain)||i.crossDomain),void 0===i.dataType&&(i.dataType="json"),this.dataSource=i,this.defaultQuery=n,i.url&&i.offline&&!i.json.length?(this.isDataAvailable=!1,this.adaptor=o||new l,this.dataSource.offline=!1,this.ready=this.executeQuery(n||new r),this.ready.then(function(e){s.dataSource.offline=!0,s.isDataAvailable=!0,i.json=e.result,s.adaptor=new u})):this.adaptor=i.offline?new u:new l,!i.jsonp&&this.adaptor instanceof l&&(i.jsonp="callback"),this.adaptor=o||this.adaptor,i.enableCaching&&(this.adaptor=new g(this.adaptor,i.timeTillExpiration,i.cachingPageSize)),this}return e.prototype.setDefaultQuery=function(e){return this.defaultQuery=e,this},e.prototype.executeLocal=function(n){this.defaultQuery||n instanceof r||a.throwError("DataManager - executeLocal() : A query is required to execute"),this.dataSource.json||a.throwError("DataManager - executeLocal() : Json data is required to execute"),n=n||this.defaultQuery;var o=this.adaptor.processQuery(this,n);if(n.subQuery){var s=n.subQuery.fromTable,i=n.subQuery.lookups,u=n.isCountRequired?o.result:o;i&&i instanceof Array&&a.buildHierarchy(n.subQuery.fKey,s,u,i,n.subQuery.key);for(var c=0;c<u.length;c++)u[c][s]instanceof Array&&(u[c]=t.extend({},{},u[c]),u[c][s]=this.adaptor.processResponse(n.subQuery.using(new e(u[c][s].slice(0))).executeLocal(),this,n))}return this.adaptor.processResponse(o,this,n)},e.prototype.executeQuery=function(t,n,o,s){var i=this;"function"==typeof t&&(s=o,o=n,n=t,t=null),t||(t=this.defaultQuery),t instanceof r||a.throwError("DataManager - executeQuery() : A query is required to execute");var u=new v,c={query:t};if(this.dataSource.offline||void 0===this.dataSource.url||""===this.dataSource.url)e.nextTick(function(){var r=i.executeLocal(t);c=e.getDeferedArgs(t,r,c),u.resolve(c)});else{var l=this.adaptor.processQuery(this,t);this.makeRequest(l,u,c,t)}return(n||o)&&u.promise.then(n,o),s&&u.promise.then(s,s),u.promise},e.getDeferedArgs=function(e,t,r){return e.isCountRequired?(r.result=t.result,r.count=t.count,r.aggregates=t.aggregates):r.result=t,r},e.nextTick=function(e){(window.setImmediate||window.setTimeout)(e,0)},e.prototype.extendRequest=function(e,r,n){return t.extend({},{type:"GET",dataType:this.dataSource.dataType,crossDomain:this.dataSource.crossDomain,jsonp:this.dataSource.jsonp,cache:!0,processData:!1,onSuccess:r,onFailure:n},e)},e.prototype.makeRequest=function(e,r,n,o){var s=this,i=!!o.subQuerySelector,u=function(e){n.error=e,r.reject(n)},c=function(e,t,o,a,s,i,u){n.xhr=o,n.count=t?parseInt(t.toString(),10):0,n.result=e,n.request=a,n.aggregates=i,n.actual=s,n.virtualSelectRecords=u,r.resolve(n)},l=function(e,t){var r=new v,l={parent:n};o.subQuery.isChild=!0;var p=s.adaptor.processQuery(s,o.subQuery,e?s.adaptor.processResponse(e):t),d=s.makeRequest(p,r,l,o.subQuery);return i||r.then(function(t){e&&(a.buildHierarchy(o.subQuery.fKey,o.subQuery.fromTable,e,t,o.subQuery.key),c(e,t.count,t.xhr))},u),d},p=this.extendRequest(e,function(e,t){-1===t.httpRequest.getResponseHeader("Content-Type").indexOf("xml")&&s.dateParse&&(e=a.parse.parseJson(e));var r=s.adaptor.processResponse(e,s,o,t.httpRequest,t),n=0,u=null,p=e.virtualSelectRecords;o.isCountRequired&&(n=r.count,u=r.aggregates,r=r.result),o.subQuery?i||l(r,t):c(r,n,t.httpRequest,t.type,e,u,p)},u),d=new t.Ajax(p);if(d.beforeSend=function(){s.beforeSend(d.httpRequest,d)},(p=d.send()).catch(function(e){return!0}),this.requests.push(d),i){var h=o.subQuerySelector.call(this,{query:o.subQuery,parent:o});h&&h.length?Promise.all([p,l(null,h)]).then(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e[0],n=s.adaptor.processResponse(r[0],s,o,s.requests[0].httpRequest,s.requests[0]),u=0;o.isCountRequired&&(u=n.count,n=n.result);var l=s.adaptor.processResponse(r[1],s,o.subQuery,s.requests[1].httpRequest,s.requests[1]);u=0,o.subQuery.isCountRequired&&(u=l.count,l=l.result),a.buildHierarchy(o.subQuery.fKey,o.subQuery.fromTable,n,l,o.subQuery.key),i=!1,c(n,u,s.requests[0].httpRequest)}):i=!1}return p},e.prototype.beforeSend=function(e,t){this.adaptor.beforeSend(this,e,t);for(var r,n=this.dataSource.headers,o=0;n&&o<n.length;o++){r=[];for(var a=0,s=Object.keys(n[o]);a<s.length;a++){var i=s[a];r.push(i),e.setRequestHeader(i,n[o][i])}}},e.prototype.saveChanges=function(e,n,o,s,i){var u=this;o instanceof r&&(s=o,o=null);var c={url:o,key:n||this.dataSource.key},l=this.adaptor.batchRequest(this,e,c,s,i);if(this.dataSource.offline)return l;var p=new v,d=new t.Ajax(l);return d.beforeSend=function(){u.beforeSend(d.httpRequest,d)},d.onSuccess=function(t,r){p.resolve(u.adaptor.processResponse(a.parse.parseJson(t),u,null,r.httpRequest,r,e,c))},d.onFailure=function(e){p.reject([{error:e}])},d.send().catch(function(e){return!0}),p.promise},e.prototype.insert=function(e,t,n,o){t instanceof r&&(n=t,t=null);var a=this.adaptor.insert(this,e,t,n,o);return this.dataSource.offline?a:this.doAjaxRequest(a)},e.prototype.remove=function(e,t,n,o){"object"==typeof t&&(t=t[e]),n instanceof r&&(o=n,n=null);var a=this.adaptor.remove(this,e,t,n,o);return this.dataSource.offline?a:this.doAjaxRequest(a)},e.prototype.update=function(e,t,n,o,a){n instanceof r&&(o=n,n=null);var s=this.adaptor.update(this,e,t,n,o,a);return this.dataSource.offline?s:this.doAjaxRequest(s)},e.prototype.doAjaxRequest=function(e){var r=this,n=new v;e=t.extend({},{type:"POST",contentType:"application/json; charset=utf-8",processData:!1},e);var o=new t.Ajax(e);return o.beforeSend=function(){r.beforeSend(o.httpRequest,o)},o.onSuccess=function(e,t){try{a.parse.parseJson(e)}catch(t){e=[]}e=r.adaptor.processResponse(a.parse.parseJson(e),r,null,t.httpRequest,t),n.resolve(e)},o.onFailure=function(e){n.reject([{error:e}])},o.send().catch(function(e){return!0}),n.promise},e}(),v=function(){return function(){var e=this;this.promise=new Promise(function(t,r){e.resolve=t,e.reject=r}),this.then=this.promise.then.bind(this.promise),this.catch=this.promise.catch.bind(this.promise)}}();e.DataManager=y,e.Deferred=v,e.Query=r,e.Predicate=n,e.Adaptor=i,e.JsonAdaptor=u,e.UrlAdaptor=c,e.ODataAdaptor=l,e.ODataV4Adaptor=p,e.WebApiAdaptor=d,e.WebMethodAdaptor=h,e.RemoteSaveAdaptor=f,e.CacheAdaptor=g,e.DataUtil=a,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=ej2-data.umd.min.js.map
/*!
* filename: index.d.ts
* version : 16.2.52
* version : 16.3.17
* Copyright Syncfusion Inc. 2001 - 2018. All rights reserved.

@@ -11,7 +11,5 @@ * Use of this code is subject to the terms of our license.

import * as _data from '@syncfusion/ej2-data';
import * as _base from '@syncfusion/ej2-base';
export declare namespace ej {
const data: typeof _data;
const base: typeof _base;
}
{
"name": "@syncfusion/ej2-data",
"version": "16.2.52",
"version": "16.3.17",
"description": "Essential JS 2 DataManager",

@@ -11,3 +11,3 @@ "author": "Syncfusion Inc.",

"dependencies": {
"@syncfusion/ej2-base": "~16.2.50"
"@syncfusion/ej2-base": "~16.3.17"
},

@@ -14,0 +14,0 @@ "devDependencies": {

@@ -16,2 +16,4 @@ import { Ajax } from '@syncfusion/ej2-base';

dataSource: DataOptions;
updateType: string;
updateKey: string;
/**

@@ -29,4 +31,2 @@ * It contains the datamanager operations list like group, searches, etc.,

*/
updateType: string;
updateKey: string;
constructor(ds?: DataOptions);

@@ -33,0 +33,0 @@ protected options: RemoteOptions;

@@ -1,3 +0,1 @@

import * as data from './index';
import * as base from '@syncfusion/ej2-base';
export { data, base };
export * from './index';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc