/*
    *
    * Wijmo Library 5.20181.462
    * http://wijmo.com/
    *
    * Copyright(c) GrapeCity, Inc.  All rights reserved.
    *
    * Licensed under the GrapeCity Commercial License.
    * sales@wijmo.com
    * wijmo.com/products/wijmo-5/license/
    *
    */
"use strict";function _getTagValue(e,t){var i=e.querySelector(t);return i?i.innerHTML||i.textContent:null}function _getLevelNumber(e){return Number(_getTagValue(e,"LNum"))}function _getCaptionValue(e){return _getLevelNumber(e)>0?_getTagValue(e,"Caption"):null}function _getCellValue(e,t){var i="Cell[CellOrdinal='"+t.toString()+"']",r=e.querySelector(i);if(r){var n=_getTagValue(r,"Value");if(n)return Number(n)}return null}function _findSubFieldByName(e,t){if(e.subFields)for(var i=0;i<e.subFields.length;i++){var r=e.subFields[i];if(r.header==t)return r}return e}function _containsFolder(e,t){if(e.subFields)for(var i=0;i<e.subFields.length;i++)if(e.subFields[i].header==t)return!0;return!1}var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])};return function(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(exports,"__esModule",{value:!0});var wjcCore=require("wijmo/wijmo"),wjcGridFilter=require("wijmo/wijmo.grid.filter"),wjcInput=require("wijmo/wijmo.input"),wjcGrid=require("wijmo/wijmo.grid"),wjcChart=require("wijmo/wijmo.chart"),wjcSelfRef=require("wijmo/wijmo.olap"),wjcSelf=wjcSelfRef||exports;window.wijmo=window.wijmo||{},window.wijmo.olap=wjcSelf;var _Tally=function(){function e(){this._cnt=0,this._cntn=0,this._sum=0,this._sum2=0,this._min=null,this._max=null,this._first=null,this._last=null}return e.prototype.add=function(t,i){t instanceof e?(this._sum+=t._sum,this._sum2+=t._sum2,this._max=this._max&&t._max?Math.max(this._max,t._max):this._max||t._max,this._min=this._min&&t._min?Math.min(this._min,t._min):this._min||t._min,this._cnt+=t._cnt,this._cntn+=t._cntn):null!=t&&(this._cnt++,wjcCore.isBoolean(t)&&(t=t?1:0),(null==this._min||t<this._min)&&(this._min=t),(null==this._max||t>this._max)&&(this._max=t),null==this._first&&(this._first=t),this._last=t,wjcCore.isNumber(t)&&!isNaN(t)&&(wjcCore.isNumber(i)&&(t*=i),this._cntn++,this._sum+=t,this._sum2+=t*t))},e.prototype.getAggregate=function(e){if(0==this._cnt)return null;var t=0==this._cntn?0:this._sum/this._cntn;switch(e){case wjcCore.Aggregate.Avg:return t;case wjcCore.Aggregate.Cnt:return this._cnt;case wjcCore.Aggregate.Max:return this._max;case wjcCore.Aggregate.Min:return this._min;case wjcCore.Aggregate.Rng:return this._max-this._min;case wjcCore.Aggregate.Sum:return this._sum;case wjcCore.Aggregate.VarPop:return this._cntn<=1?0:this._sum2/this._cntn-t*t;case wjcCore.Aggregate.StdPop:return this._cntn<=1?0:Math.sqrt(this._sum2/this._cntn-t*t);case wjcCore.Aggregate.Var:return this._cntn<=1?0:(this._sum2/this._cntn-t*t)*this._cntn/(this._cntn-1);case wjcCore.Aggregate.Std:return this._cntn<=1?0:Math.sqrt((this._sum2/this._cntn-t*t)*this._cntn/(this._cntn-1));case wjcCore.Aggregate.First:return this._first;case wjcCore.Aggregate.Last:return this._last}throw"Invalid aggregate type."},e}();exports._Tally=_Tally;var _PivotKey=function(){function e(e,t,i,r,n){this._fields=e,this._fieldCount=t,this._valueFields=i,this._valueFieldIndex=r,this._item=n}return Object.defineProperty(e.prototype,"fields",{get:function(){return this._fields},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"valueFields",{get:function(){return this._valueFields},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"valueField",{get:function(){return this._valueFields[this._valueFieldIndex]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"values",{get:function(){if(null==this._vals){this._vals=new Array(this._fieldCount);for(var e=0;e<this._fieldCount;e++){var t=this._fields[e];this._vals[e]=t._getValue(this._item,!1)}}return this._vals},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fieldNames",{get:function(){if(!this._names){this._names=[];for(var e=0;e<this.fields.length;e++){var t=this._fields[e];this._names.push(t._getName())}}return this._names},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"aggregate",{get:function(){var e=this._valueFields,t=this._valueFieldIndex;return wjcCore.assert(e&&t>-1&&t<e.length,"aggregate not available for this key"),e[t].aggregate},enumerable:!0,configurable:!0}),e.prototype.getValue=function(e,t){if(0==this.values.length)return wjcCore.culture.olap.PivotEngine.grandTotal;if(e>this.values.length-1)return wjcCore.culture.olap.PivotEngine.subTotal;var i=this.values[e];if(t&&!wjcCore.isString(i)){var r=this.fields[e],n=r?r.format:"";i=wjcCore.Globalize.format(this.values[e],n)}return i},Object.defineProperty(e.prototype,"level",{get:function(){return this._fieldCount==this._fields.length?-1:this._fieldCount},enumerable:!0,configurable:!0}),e.prototype.compareTo=function(e){var t=0;if(null!=e&&e._fields==this._fields){for(var i=this.values,r=e.values,n=Math.min(i.length,r.length),o=0;o<n;o++){var s=null!=i[o]?wjcCore.getType(i[o]):null,l=i[o],a=r[o],c=this._fields[o];if(c.sortComparer&&(t=c.sortComparer(l,a),wjcCore.isNumber(t))){if(0!=t)return c.descending?-t:t}else{if(s==wjcCore.DataType.Date){var d=c.format;if(d&&"d"!=d&&"D"!=d){var u=c._getValue(this._item,!0),h=c._getValue(e._item,!0),p=wjcCore.Globalize.parseDate(u,d),_=wjcCore.Globalize.parseDate(h,d);p&&_?(l=p,a=_):(l=u,a=h)}}if(!(l==a||wjcCore.DateTime.equals(l,a)))return null==l?1:null==a?-1:(t=l<a?-1:1,c.descending?-t:t)}}if(i.length==r.length&&0!=(t=this._valueFieldIndex-e._valueFieldIndex))return t;if(0!=(t=r.length-i.length))return t*(this.fields.engine.totalsBeforeData?-1:1)}return 0},e.prototype.matchesItem=function(e){for(var t=0;t<this._vals.length;t++)if(this.getValue(t,!0)!=this._fields[t]._getValue(e,!0))return!1;return!0},e.prototype.toString=function(e){if(!this._key||e){for(var t="",i=0;i<this._fieldCount;i++){var r=this._fields[i];t+=r._getName()+":"+r._getValue(this._item,!0)+";"}if(this._valueFields?t+=this._valueFields[this._valueFieldIndex]._getName()+":0;":t+="{total}",e)return t+e.toString();this._key=t}return this._key},e._ROW_KEY_NAME="$rowKey",e}();exports._PivotKey=_PivotKey;var _PivotNode=function(){function e(e,t,i,r,n,o){this._key=new _PivotKey(e,t,i,r,n),this._nodes={},this._parent=o}return e.prototype.getNode=function(t,i,r,n,o){for(var s=this,l=0;l<i;l++){a=t[l]._getValue(o,!0);(c=s._nodes[a])||(c=new e(t,l+1,r,n,o,s),s._nodes[a]=c),s=c}if(r&&n>-1){var a=r[n].header,c=s._nodes[a];c||(c=new e(t,i,r,n,o,s),s._nodes[a]=c),s=c}return s},Object.defineProperty(e.prototype,"key",{get:function(){return this._key},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tree",{get:function(){return this._tree||(this._tree=new e(null,0,null,-1,null)),this._tree},enumerable:!0,configurable:!0}),e}();exports._PivotNode=_PivotNode;var PivotCollectionView=function(e){function t(t){var i=e.call(this)||this;return i._ng=wjcCore.asType(t,PivotEngine,!1),i}return __extends(t,e),Object.defineProperty(t.prototype,"engine",{get:function(){return this._ng},enumerable:!0,configurable:!0}),t.prototype._performSort=function(e){var t=this._ng;if(t.sortableGroups&&t._getShowRowTotals()==ShowTotals.Subtotals){var i=0,r=e.length-1;0==this._getItemLevel(e[i])&&i++,0==this._getItemLevel(e[r])&&r--,this._sortGroups(e,1,i,r)}else this._sortData(e)},t.prototype._performFilter=function(e){return this._ng&&0==this._ng.valueFields.length&&0==this._ng.rowFields.length?[]:this.canFilter&&this._filter?e.filter(this._filter,this):e},t.prototype._getGroupRange=function(e,t){var i=this._ng,r=e.indexOf(t),n=r,o=this._getItemLevel(e[r]);if(i.totalsBeforeData)for(n=r;n<e.length-1&&!((s=this._getItemLevel(e[n+1]))>-1&&s<=o);n++);else for(r=n;r;r--){var s=this._getItemLevel(e[r-1]);if(s>-1&&s<=o)break}return[r,n]},t.prototype._sortGroups=function(t,i,r,n){for(var o=[],s=r;s<=n;s++)this._getItemLevel(t[s])==i&&o.push(t[s]);if(o.length){e.prototype._performSort.call(this,o);for(var l=[],s=0;s<o.length;s++){for(var a=this._getGroupRange(t,o[s]),c=l.length,d=a[0];d<=a[1];d++)l.push(t[d]);i<this._ng.rowFields.length-1?this._sortGroups(l,i+1,r+c,l.length-1):this._sortSegment(l,r+c,l.length-1)}for(s=0;s<l.length;s++)t[r+s]=l[s]}else this._sortData(t)},t.prototype._sortSegment=function(t,i,r){var n=t.slice(i,r);e.prototype._performSort.call(this,n);for(var o=0;o<n.length;o++)t[i+o]=n[o]},t.prototype._sortData=function(t){for(var i=0;i<t.length;i++)if(!(this._getItemLevel(t[i])>-1)){for(var r=i;r<t.length-1&&!(this._getItemLevel(t[r+1])>-1);r++);if(r>i){var n=t.slice(i,r+1);e.prototype._performSort.call(this,n);for(var o=0;o<n.length;o++)t[i+o]=n[o]}i=r}},t.prototype._getItemLevel=function(e){return e[_PivotKey._ROW_KEY_NAME].level},t}(wjcCore.CollectionView);exports.PivotCollectionView=PivotCollectionView;var PivotField=function(){function e(e,t,i,r){this.propertyChanged=new wjcCore.Event,this._ng=e,this._binding=new wjcCore.Binding(t),this._header=i||wjcCore.toHeaderCase(t),this._aggregate=wjcCore.Aggregate.Sum,this._showAs=ShowAs.NoCalculation,this._isContentHtml=!1,this._format="",this._filter=new PivotFilter(this),r&&wjcCore.copy(this,r)}return Object.defineProperty(e.prototype,"binding",{get:function(){return this._binding?this._binding.path:null},set:function(e){if(e!=this.binding){var t=this.binding,i=wjcCore.asString(e);if(this._binding=i?new wjcCore.Binding(i):null,!this._dataType&&this._ng&&this._binding){var r=this._ng.collectionView;if(r&&r.sourceCollection&&r.sourceCollection.length){var n=r.sourceCollection[0];this._dataType=wjcCore.getType(this._binding.getValue(n))}}var o=new wjcCore.PropertyChangedEventArgs("binding",t,e);this.onPropertyChanged(o)}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"header",{get:function(){return this._header},set:function(e){e=wjcCore.asString(e,!1);var t=this._ng.fields.getField(e);!e||t&&t!=this?wjcCore.assert(!1,"field headers must be unique and non-empty."):this._setProp("_header",wjcCore.asString(e))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"filter",{get:function(){return this._filter},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"aggregate",{get:function(){return this._aggregate},set:function(e){this._setProp("_aggregate",wjcCore.asEnum(e,wjcCore.Aggregate))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"showAs",{get:function(){return this._showAs},set:function(e){this._setProp("_showAs",wjcCore.asEnum(e,ShowAs))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"weightField",{get:function(){return this._weightField},set:function(t){this._setProp("_weightField",wjcCore.asType(t,e,!0))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dataType",{get:function(){return this._dataType},set:function(e){this._setProp("_dataType",wjcCore.asEnum(e,wjcCore.DataType))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isMeasure",{get:function(){return this._dataType==wjcCore.DataType.Number},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"subFields",{get:function(){return this._subFields},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"format",{get:function(){return this._format},set:function(e){this._setProp("_format",wjcCore.asString(e))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(e){this._setProp("_width",wjcCore.asNumber(e,!0,!0))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"wordWrap",{get:function(){return this._wordWrap},set:function(e){this._setProp("_wordWrap",wjcCore.asBoolean(e))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"descending",{get:function(){return!!this._descending},set:function(e){this._setProp("_descending",wjcCore.asBoolean(e))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isContentHtml",{get:function(){return this._isContentHtml},set:function(e){this._setProp("_isContentHtml",wjcCore.asBoolean(e))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"sortComparer",{get:function(){return this._srtCmp},set:function(e){e!=this.sortComparer&&(this._srtCmp=wjcCore.asFunction(e))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"engine",{get:function(){return this._ng},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"collectionView",{get:function(){return this.engine?this.engine.collectionView:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isActive",{get:function(){return this._getIsActive()},set:function(e){this._setIsActive(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"parentField",{get:function(){return this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"key",{get:function(){return this.header},enumerable:!0,configurable:!0}),e.prototype.onPropertyChanged=function(e){this.propertyChanged.raise(this,e),this._ng._fieldPropertyChanged(this,e)},e.prototype._copy=function(e,t){var i=this;return"subFields"==e&&(this._subFields?this._subFields.splice(0,this._subFields.length):this._subFields=[],t&&t.length&&t.forEach(function(e){var t=i.engine._createField(e,i._autoGenerated);i._subFields.push(t)}),!0)},e.prototype._getIsActive=function(){if(this._ng&&!this._hasSubFields())for(var e=this._ng._viewLists,t=0;t<e.length;t++)for(var i=e[t],r=0;r<i.length;r++)if(i[r].binding==this.binding)return!0;return!1},e.prototype._setIsActive=function(e){if(this._ng&&!this._hasSubFields()){var t=this.isActive;if((e=wjcCore.asBoolean(e))!=t)if(e)this.isMeasure?this._ng.valueFields.push(this):this._ng.rowFields.push(this);else{for(var i=this._ng._viewLists,r=0;r<i.length;r++)for(var n=i[r],o=0;o<n.length;o++)(l=n[o])!=this&&l.parentField!=this||(n.removeAt(o),o--);for(var s=this._ng.fields,o=s.length-1;o>=0;o--){var l=s[o];l.parentField==this&&(s.removeAt(o),o--)}}}},e.prototype._hasSubFields=function(){return null!=this._subFields&&this._subFields.length>0},e.prototype._clone=function(){var t=new e(this._ng,this.binding);this._ng._copyProps(t,this,e._props),t._autoGenerated=!0,t._parent=this;for(var i=this.header.replace(/\d+$/,""),r=2;;r++){var n=i+r.toString();if(null==this._ng.fields.getField(n)){t._header=n;break}}return t},e.prototype._setProp=function(e,t,i){var r=this[e];if(t!=r){this[e]=t;var n=new wjcCore.PropertyChangedEventArgs(e.substr(1),r,t);this.onPropertyChanged(n)}},e.prototype._getName=function(){return this.header||this.binding},e.prototype._getValue=function(e,t){var i=this._binding._key?e[this._binding._key]:this._binding.getValue(e);return t&&"string"!=typeof i?wjcCore.Globalize.format(i,this._format):i},e.prototype._getWeight=function(e){var t=this._weightField?this._weightField._getValue(e,!1):null;return wjcCore.isNumber(t)?t:null},e._props=["dataType","format","width","wordWrap","aggregate","showAs","descending","isContentHtml"],e}();exports.PivotField=PivotField;var CubePivotField=function(e){function t(t,i,r,n){var o=e.call(this,t,i,r,n)||this;return wjcCore.assert(null!=o.dimensionType,"CubePivotField objects must specify the field's dimensionType"),o}return __extends(t,e),Object.defineProperty(t.prototype,"header",{get:function(){return this._header},set:function(e){this._setProp("_header",wjcCore.asString(e))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dimensionType",{get:function(){return this._dimensionType},set:function(e){this._setProp("_dimensionType",wjcCore.asEnum(e,DimensionType,!1))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isMeasure",{get:function(){switch(this._dimensionType){case 1:case 8:return!0}return!1},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"key",{get:function(){return this.binding},enumerable:!0,configurable:!0}),t.prototype._clone=function(){throw"CubePivotField objects cannot be cloned"},t}(PivotField);exports.CubePivotField=CubePivotField;var DimensionType;!function(e){e[e.Dimension=0]="Dimension",e[e.Measure=1]="Measure",e[e.Kpi=2]="Kpi",e[e.NameSet=3]="NameSet",e[e.Attribute=4]="Attribute",e[e.Folder=5]="Folder",e[e.Hierarchy=6]="Hierarchy",e[e.Date=7]="Date",e[e.Currency=8]="Currency"}(DimensionType=exports.DimensionType||(exports.DimensionType={}));var PivotFieldCollection=function(e){function t(t){var i=e.call(this)||this;return i._ng=t,i}return __extends(t,e),Object.defineProperty(t.prototype,"maxItems",{get:function(){return this._maxItems},set:function(e){this._maxItems=wjcCore.asInt(e,!0,!0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"engine",{get:function(){return this._ng},enumerable:!0,configurable:!0}),t.prototype.getField=function(e){return this._getField(this,e)},t.prototype._getField=function(e,t){for(var i=0;i<e.length;i++){var r=e[i];if(r.key==t)return r;if(r._hasSubFields()&&(r=this._getField(r.subFields,t)))return r}return null},t.prototype.push=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];for(var r=this._ng,n=0;t&&n<t.length;n++){var o=t[n];if(wjcCore.isString(o)&&(o=this==r.fields?new PivotField(r,o):r.fields.getField(o)),wjcCore.assert(o instanceof PivotField,"This collection must contain PivotField objects only."),o.key&&this.getField(o.key))return wjcCore.assert(!1,"PivotField keys must be unique."),-1;if(null!=this._maxItems&&this.length>=this._maxItems)break;e.prototype.push.call(this,o)}return this.length},t}(wjcCore.ObservableArray);exports.PivotFieldCollection=PivotFieldCollection;var PivotFilter=function(){function e(e){this._fld=e;var t=e;this._valueFilter=new wjcGridFilter.ValueFilter(t),this._conditionFilter=new wjcGridFilter.ConditionFilter(t)}return Object.defineProperty(e.prototype,"filterType",{get:function(){return null!=this._filterType?this._filterType:this._fld.engine.defaultFilterType},set:function(e){(e=wjcCore.asEnum(e,wjcGridFilter.FilterType,!0))!=this._filterType&&(this._filterType=e,this.clear())},enumerable:!0,configurable:!0}),e.prototype.apply=function(e){return this._conditionFilter.apply(e)&&this._valueFilter.apply(e)},Object.defineProperty(e.prototype,"isActive",{get:function(){return this._conditionFilter.isActive||this._valueFilter.isActive},enumerable:!0,configurable:!0}),e.prototype.clear=function(){var e=!1;this._valueFilter.isActive&&(this._valueFilter.clear(),e=!0),this._conditionFilter.isActive&&(this._valueFilter.clear(),e=!0),e&&this._fld.onPropertyChanged(new wjcCore.PropertyChangedEventArgs("filter",null,null))},Object.defineProperty(e.prototype,"valueFilter",{get:function(){return this._valueFilter},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"conditionFilter",{get:function(){return this._conditionFilter},enumerable:!0,configurable:!0}),e}();exports.PivotFilter=PivotFilter,wjcCore.culture.olap=wjcCore.culture.olap||{},wjcCore.culture.olap.PivotFieldEditor=window.wijmo.culture.olap.PivotFieldEditor||{dialogHeader:"Field settings:",header:"Header:",summary:"Summary:",showAs:"Show As:",weighBy:"Weigh by:",sort:"Sort:",filter:"Filter:",format:"Format:",sample:"Sample:",edit:"Edit...",clear:"Clear",ok:"OK",cancel:"Cancel",none:"(none)",sorts:{asc:"Ascending",desc:"Descending"},aggs:{sum:"Sum",cnt:"Count",avg:"Average",max:"Max",min:"Min",rng:"Range",std:"StdDev",var:"Var",stdp:"StdDevPop",varp:"VarPop",first:"First",last:"Last"},calcs:{noCalc:"No calculation",dRow:"Difference from previous row",dRowPct:"% Difference from previous row",dCol:"Difference from previous column",dColPct:"% Difference from previous column",dPctGrand:"% of grand total",dPctRow:"% of row total",dPctCol:"% of column total",dRunTot:"Running total",dRunTotPct:"% running total"},formats:{n0:"Integer (n0)",n2:"Float (n2)",c:"Currency (c)",p0:"Percentage (p0)",p2:"Percentage (p2)",n2c:"Thousands (n2,)",n2cc:"Millions (n2,,)",n2ccc:"Billions (n2,,,)",d:"Date (d)",MMMMddyyyy:"Month Day Year (MMMM dd, yyyy)",dMyy:"Day Month Year (d/M/yy)",ddMyy:"Day Month Year (dd/M/yy)",dMyyyy:"Day Month Year (dd/M/yyyy)",MMMyyyy:"Month Year (MMM yyyy)",MMMMyyyy:"Month Year (MMMM yyyy)",yyyy:"Year (yyyy)",yyyyQq:'Year Quarter (yyyy "Q"q)',FYEEEEQU:'Fiscal Year Quarter ("FY"EEEE "Q"U)'}};var PivotFieldEditor=function(e){function t(t,i){var r=e.call(this,t,null,!0)||this;wjcCore.assert(null!=wjcInput,"Missing dependency: PivotFieldEditor requires wijmo.input."),r.hostElement.tabIndex=-1;var n=r.getTemplate();r.applyTemplate("wj-control wj-pivotfieldeditor",n,{_dBnd:"sp-bnd",_dHdr:"div-hdr",_dAgg:"div-agg",_dShw:"div-shw",_dWFl:"div-wfl",_dSrt:"div-srt",_btnFltEdt:"btn-flt-edt",_btnFltClr:"btn-flt-clr",_dFmt:"div-fmt",_dSmp:"div-smp",_btnApply:"btn-apply",_btnCancel:"btn-cancel",_gDlg:"g-dlg",_gHdr:"g-hdr",_gAgg:"g-agg",_gShw:"g-shw",_gWfl:"g-wfl",_gSrt:"g-srt",_gFlt:"g-flt",_gFmt:"g-fmt",_gSmp:"g-smp"}),r._pvDate=new Date;var o=wjcCore.culture.olap.PivotFieldEditor;return wjcCore.setText(r._gDlg,o.dialogHeader),wjcCore.setText(r._gHdr,o.header),wjcCore.setText(r._gAgg,o.summary),wjcCore.setText(r._gShw,o.showAs),wjcCore.setText(r._gWfl,o.weighBy),wjcCore.setText(r._gSrt,o.sort),wjcCore.setText(r._gFlt,o.filter),wjcCore.setText(r._gFmt,o.format),wjcCore.setText(r._gSmp,o.sample),wjcCore.setText(r._btnFltEdt,o.edit),wjcCore.setText(r._btnFltClr,o.clear),wjcCore.setText(r._btnApply,o.ok),wjcCore.setText(r._btnCancel,o.cancel),r._cmbHdr=new wjcInput.ComboBox(r._dHdr),r._cmbAgg=new wjcInput.ComboBox(r._dAgg),r._cmbShw=new wjcInput.ComboBox(r._dShw),r._cmbWFl=new wjcInput.ComboBox(r._dWFl),r._cmbSrt=new wjcInput.ComboBox(r._dSrt),r._cmbFmt=new wjcInput.ComboBox(r._dFmt),r._cmbSmp=new wjcInput.ComboBox(r._dSmp),r._initAggregateOptions(),r._initShowAsOptions(),r._initFormatOptions(),r._initSortOptions(),r._updatePreview(),r._cmbShw.textChanged.addHandler(r._updateFormat,r),r._cmbFmt.textChanged.addHandler(r._updatePreview,r),r.addEventListener(r._btnFltEdt,"click",function(e){r._editFilter(),e.preventDefault()}),r.addEventListener(r._btnFltClr,"click",function(e){wjcCore.enable(r._btnFltClr,!1),r._createFilterEditor(),setTimeout(function(){r._eFlt.clearEditor()}),e.preventDefault()}),r.addEventListener(r._btnApply,"click",function(e){r.updateField()}),r.initialize(i),r}return __extends(t,e),Object.defineProperty(t.prototype,"field",{get:function(){return this._fld},set:function(e){e!=this._fld&&(this._fld=wjcCore.asType(e,PivotField),this.updateEditor())},enumerable:!0,configurable:!0}),t.prototype.updateEditor=function(){if(this._fld){this._dBnd.textContent=this._fld.binding,this._cmbHdr.text=this._fld.header,this._cmbAgg.collectionView.refresh(),this._cmbAgg.selectedValue=this._fld.aggregate,this._cmbSrt.selectedValue=this._fld.descending,this._cmbShw.selectedValue=this._fld.showAs,this._initWeighByOptions(),wjcCore.enable(this._btnFltClr,this._fld.filter.isActive),this._cmbFmt.collectionView.refresh(),this._cmbFmt.selectedValue=this._fld.format,this._cmbFmt.selectedValue||(this._cmbFmt.text=this._fld.format);var e=this._fld instanceof CubePivotField;this._cmbAgg.isDisabled=e,this._cmbWFl.isDisabled=e}},t.prototype.updateField=function(){if(this._fld){var e=this._cmbHdr.text.trim();this._fld.header=e||wjcCore.toHeaderCase(this._fld.binding),this._fld.aggregate=this._cmbAgg.selectedValue,this._fld.showAs=this._cmbShw.selectedValue,this._fld.weightField=this._cmbWFl.selectedValue,this._fld.descending=this._cmbSrt.selectedValue,this._eFlt&&this._eFlt.updateFilter(),this._fld.format=this._cmbFmt.selectedValue||this._cmbFmt.text}},t.prototype._initAggregateOptions=function(){var e=this,t=wjcCore.culture.olap.PivotFieldEditor.aggs,i=wjcCore.Aggregate,r=[{key:t.sum,val:i.Sum,all:!1},{key:t.cnt,val:i.Cnt,all:!0},{key:t.avg,val:i.Avg,all:!1},{key:t.max,val:i.Max,all:!0},{key:t.min,val:i.Min,all:!0},{key:t.rng,val:i.Rng,all:!1},{key:t.std,val:i.Std,all:!1},{key:t.var,val:i.Var,all:!1},{key:t.stdp,val:i.StdPop,all:!1},{key:t.varp,val:i.VarPop,all:!1},{key:t.first,val:i.First,all:!0},{key:t.last,val:i.Last,all:!0}];this._cmbAgg.itemsSource=r,this._cmbAgg.collectionView.filter=function(t){if(t&&t.all)return!0;if(e._fld){var i=e._fld.dataType;return i==wjcCore.DataType.Number||i==wjcCore.DataType.Boolean}return!1},this._cmbAgg.initialize({displayMemberPath:"key",selectedValuePath:"val"})},t.prototype._initShowAsOptions=function(){var e=wjcCore.culture.olap.PivotFieldEditor.calcs,t=[{key:e.noCalc,val:ShowAs.NoCalculation},{key:e.dRow,val:ShowAs.DiffRow},{key:e.dRowPct,val:ShowAs.DiffRowPct},{key:e.dCol,val:ShowAs.DiffCol},{key:e.dColPct,val:ShowAs.DiffColPct},{key:e.dPctGrand,val:ShowAs.PctGrand},{key:e.dPctRow,val:ShowAs.PctRow},{key:e.dPctCol,val:ShowAs.PctCol},{key:e.dRunTot,val:ShowAs.RunTot},{key:e.dRunTotPct,val:ShowAs.RunTotPct}];this._cmbShw.itemsSource=t,this._cmbShw.initialize({displayMemberPath:"key",selectedValuePath:"val"})},t.prototype._initFormatOptions=function(){var e=this,t=wjcCore.culture.olap.PivotFieldEditor.formats,i=[{key:t.n0,val:"n0",all:!0},{key:t.n2,val:"n2",all:!0},{key:t.c,val:"c",all:!0},{key:t.p0,val:"p0",all:!0},{key:t.p2,val:"p2",all:!0},{key:t.n2c,val:"n2,",all:!0},{key:t.n2cc,val:"n2,,",all:!0},{key:t.n2ccc,val:"n2,,,",all:!0},{key:t.d,val:"d",all:!1},{key:t.MMMMddyyyy,val:"MMMM dd, yyyy",all:!1},{key:t.dMyy,val:"d/M/yy",all:!1},{key:t.ddMyy,val:"dd/M/yy",all:!1},{key:t.dMyyyy,val:"dd/M/yyyy",all:!1},{key:t.MMMyyyy,val:"MMM yyyy",all:!1},{key:t.MMMMyyyy,val:"MMMM yyyy",all:!1},{key:t.yyyy,val:"yyyy",all:!1},{key:t.yyyyQq,val:'yyyy "Q"q',all:!1},{key:t.FYEEEEQU,val:'"FY"EEEE "Q"U',all:!1}];this._cmbFmt.itemsSource=i,this._cmbFmt.isEditable=!0,this._cmbFmt.isRequired=!1,this._cmbFmt.collectionView.filter=function(t){return!(!t||!t.all)||!!e._fld&&e._fld.dataType==wjcCore.DataType.Date},this._cmbFmt.initialize({displayMemberPath:"key",selectedValuePath:"val"})},t.prototype._initWeighByOptions=function(){var e=[{key:wjcCore.culture.olap.PivotFieldEditor.none,val:null}];if(this._fld)for(var t=this._fld.engine,i=0;i<t.fields.length;i++){var r=t.fields[i];r!=this._fld&&r.dataType==wjcCore.DataType.Number&&e.push({key:r.header,val:r})}this._cmbWFl.initialize({displayMemberPath:"key",selectedValuePath:"val",itemsSource:e,selectedValue:this._fld.weightField})},t.prototype._initSortOptions=function(){var e=wjcCore.culture.olap.PivotFieldEditor.sorts,t=[{key:e.asc,val:!1},{key:e.desc,val:!0}];this._cmbSrt.itemsSource=t,this._cmbSrt.initialize({displayMemberPath:"key",selectedValuePath:"val"})},t.prototype._updateFormat=function(){switch(this._cmbShw.selectedValue){case ShowAs.DiffRowPct:case ShowAs.DiffColPct:this._cmbFmt.selectedValue="p0";break;default:this._cmbFmt.selectedValue="n0"}},t.prototype._updatePreview=function(){var e=this._cmbFmt.selectedValue||this._cmbFmt.text,t=wjcCore.Globalize.format,i="";if(e){var r=e[0].toLowerCase();i="nfgxc".indexOf(r)>-1?t(1234.5678,e):"p"==r?t(.12345678,e):t(this._pvDate,e)}this._cmbSmp.text=i},t.prototype._editFilter=function(){this._createFilterEditor(),wjcCore.showPopup(this._dFlt,this._btnFltEdt,!1,!1,!1),wjcCore.moveFocus(this._dFlt,0)},t.prototype._createFilterEditor=function(){var e=this;this._dFlt||(this._dFlt=document.createElement("div"),this._eFlt=new PivotFilterEditor(this._dFlt,this._fld),wjcCore.addClass(this._dFlt,"wj-dropdown-panel"),this._eFlt.lostFocus.addHandler(function(){setTimeout(function(){var t=wjcCore.Control.getControl(e._dFlt);t&&!t.containsFocus()&&e._closeFilter()},10)}),this._eFlt.finishEditing.addHandler(function(){e._closeFilter(),wjcCore.enable(e._btnFltClr,!0)}))},t.prototype._closeFilter=function(){this._dFlt&&(wjcCore.hidePopup(this._dFlt,!0),this.focus())},t.controlTemplate='<div><div class="wj-dialog-header" tabindex="-1"><span wj-part="g-dlg"></span> <span wj-part="sp-bnd"></span></div><div class="wj-dialog-body"><table style="table-layout:fixed"><tr><td wj-part="g-hdr"></td><td><div wj-part="div-hdr"></div></td></tr><tr class="wj-separator"><td wj-part="g-agg"></td><td><div wj-part="div-agg"></div></td></tr><tr class="wj-separator"><td wj-part="g-shw"></td><td><div wj-part="div-shw"></div></td></tr><tr><td wj-part="g-wfl"></td><td><div wj-part="div-wfl"></div></td></tr><tr><td wj-part="g-srt"></td><td><div wj-part="div-srt"></div></td></tr><tr class="wj-separator"><td wj-part="g-flt"></td><td><div><a wj-part="btn-flt-edt" class="wj-btn"></a>&nbsp;&nbsp;<a wj-part="btn-flt-clr" class="wj-btn"></a></div></td></tr><tr class="wj-separator"><td wj-part="g-fmt"></td><td><div wj-part="div-fmt"></div></td></tr><tr><td wj-part="g-smp"></td><td><div wj-part="div-smp" readonly tabindex="-1"></div></td></tr></table></div><div class="wj-dialog-footer"><a wj-part="btn-apply" class="wj-btn wj-hide"></a>&nbsp;&nbsp;<a wj-part="btn-cancel" class="wj-btn wj-hide"></a></div></div>',t}(wjcCore.Control);exports.PivotFieldEditor=PivotFieldEditor;var PivotFilterEditor=function(e){function t(t,i,r){var n=e.call(this,t)||this;n.finishEditing=new wjcCore.Event;wjcCore.assert(null!=wjcInput,"Missing dependency: PivotFilterEditor requires wijmo.input."),n.hostElement.tabIndex=-1;var o=n.getTemplate();n.applyTemplate("wj-control wj-content wj-pivotfiltereditor",o,{_divType:"div-type",_aVal:"a-val",_aCnd:"a-cnd",_divEdtVal:"div-edt-val",_divEdtCnd:"div-edt-cnd",_btnOk:"btn-ok"}),wjcCore.setText(n._aVal,wjcCore.culture.FlexGridFilter.values),wjcCore.setText(n._aCnd,wjcCore.culture.FlexGridFilter.conditions),wjcCore.setText(n._btnOk,wjcCore.culture.olap.PivotFieldEditor.ok);var s=n._btnClicked.bind(n);return n.addEventListener(n._btnOk,"click",s),n.addEventListener(n._aVal,"click",s),n.addEventListener(n._aCnd,"click",s),n.addEventListener(n.hostElement,"keydown",function(e){switch(e.keyCode){case wjcCore.Key.Enter:switch(e.target.tagName){case"A":case"BUTTON":n._btnClicked(e);break;default:n.onFinishEditing(new wjcCore.CancelEventArgs)}e.preventDefault();break;case wjcCore.Key.Escape:n.onFinishEditing(new wjcCore.CancelEventArgs),e.preventDefault();break;case wjcCore.Key.Tab:wjcCore.moveFocus(n.hostElement,e.shiftKey?-1:1),e.preventDefault()}}),n._fld=i,n.initialize(r),n.updateEditor(),n}return __extends(t,e),Object.defineProperty(t.prototype,"field",{get:function(){return this._fld},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"filter",{get:function(){return this._fld?this._fld.filter:null},enumerable:!0,configurable:!0}),t.prototype.updateEditor=function(){var e=wjcGridFilter.FilterType.None;this.filter&&(e=this.filter.conditionFilter.isActive||0==(this.filter.filterType&wjcGridFilter.FilterType.Value)?wjcGridFilter.FilterType.Condition:wjcGridFilter.FilterType.Value,this._showFilter(e)),this._edtVal&&this._edtVal.updateEditor(),this._edtCnd&&this._edtCnd.updateEditor()},t.prototype.updateFilter=function(){switch(this._getFilterType()){case wjcGridFilter.FilterType.Value:this._edtVal.updateFilter(),this.filter.conditionFilter.clear();break;case wjcGridFilter.FilterType.Condition:this._edtCnd.updateFilter(),this.filter.valueFilter.clear()}this.field.onPropertyChanged(new wjcCore.PropertyChangedEventArgs("filter",null,null))},t.prototype.clearEditor=function(){this._edtVal&&this._edtVal.clearEditor(),this._edtCnd&&this._edtCnd.clearEditor()},t.prototype.onFinishEditing=function(e){return this.finishEditing.raise(this,e),!e.cancel},t.prototype._showFilter=function(e){switch(e==wjcGridFilter.FilterType.Value&&null==this._edtVal&&(this._edtVal=new wjcGridFilter.ValueFilterEditor(this._divEdtVal,this.filter.valueFilter)),e==wjcGridFilter.FilterType.Condition&&null==this._edtCnd&&(this._edtCnd=new wjcGridFilter.ConditionFilterEditor(this._divEdtCnd,this.filter.conditionFilter)),0!=(e&this.filter.filterType)&&(e==wjcGridFilter.FilterType.Value?(this._divEdtVal.style.display="",this._divEdtCnd.style.display="none",this._enableLink(this._aVal,!1),this._enableLink(this._aCnd,!0)):(this._divEdtVal.style.display="none",this._divEdtCnd.style.display="",this._enableLink(this._aVal,!0),this._enableLink(this._aCnd,!1))),this.filter.filterType){case wjcGridFilter.FilterType.None:case wjcGridFilter.FilterType.Condition:case wjcGridFilter.FilterType.Value:this._divType.style.display="none";break;default:this._divType.style.display=""}},t.prototype._enableLink=function(e,t){e.style.textDecoration=t?"":"none",e.style.fontWeight=t?"":"bold",wjcCore.setAttribute(e,"href",t?"":null)},t.prototype._getFilterType=function(){var e=wjcGridFilter.FilterType;return"none"!=this._divEdtVal.style.display?e.Value:e.Condition},t.prototype._btnClicked=function(e){if(e.preventDefault(),e.stopPropagation(),!wjcCore.hasClass(e.target,"wj-state-disabled"))return e.target==this._aVal?(this._showFilter(wjcGridFilter.FilterType.Value),void wjcCore.moveFocus(this._edtVal.hostElement,0)):e.target==this._aCnd?(this._showFilter(wjcGridFilter.FilterType.Condition),void wjcCore.moveFocus(this._edtCnd.hostElement,0)):void this.onFinishEditing(new wjcCore.CancelEventArgs)},t.controlTemplate='<div><div wj-part="div-type" style="text-align:center;margin-bottom:12px;font-size:80%"><a wj-part="a-cnd" href="" tabindex="-1" draggable="false"></a>&nbsp;|&nbsp;<a wj-part="a-val" href="" tabindex="-1" draggable="false"></a></div><div wj-part="div-edt-val" tabindex="-1"></div><div wj-part="div-edt-cnd" tabindex="-1"></div><div style="text-align:right;margin-top:10px"><a wj-part="btn-ok" class="wj-btn"></a></div>',t}(wjcCore.Control);exports.PivotFilterEditor=PivotFilterEditor,wjcCore.culture.olap=wjcCore.culture.olap||{},wjcCore.culture.olap.PivotEngine=window.wijmo.culture.olap.PivotEngine||{grandTotal:"Grand Total",subTotal:"Subtotal"};var ShowTotals;!function(e){e[e.None=0]="None",e[e.GrandTotals=1]="GrandTotals",e[e.Subtotals=2]="Subtotals"}(ShowTotals=exports.ShowTotals||(exports.ShowTotals={}));var ShowAs;!function(e){e[e.NoCalculation=0]="NoCalculation",e[e.DiffRow=1]="DiffRow",e[e.DiffRowPct=2]="DiffRowPct",e[e.DiffCol=3]="DiffCol",e[e.DiffColPct=4]="DiffColPct",e[e.PctGrand=5]="PctGrand",e[e.PctRow=6]="PctRow",e[e.PctCol=7]="PctCol",e[e.RunTot=8]="RunTot",e[e.RunTotPct=9]="RunTotPct"}(ShowAs=exports.ShowAs||(exports.ShowAs={}));var PivotEngine=function(){function e(e){this._autoGenFields=!0,this._allowFieldEditing=!0,this._showRowTotals=ShowTotals.GrandTotals,this._showColTotals=ShowTotals.GrandTotals,this._totalsBefore=!1,this._sortableGroups=!0,this._showZeros=!1,this._updating=0,this._dirty=!1,this._cntTotal=0,this._cntFiltered=0,this._async=!0,this._serverParms={timeout:_ServerConnection._TIMEOUT,pollInterval:_ServerConnection._POLL_INTERVAL,maxDetail:_ServerConnection._MAXDETAIL},this.itemsSourceChanged=new wjcCore.Event,this.viewDefinitionChanged=new wjcCore.Event,this.updatingView=new wjcCore.Event,this.updatedView=new wjcCore.Event,this.error=new wjcCore.Event,this._pivotView=new PivotCollectionView(this),this._fields=new PivotFieldCollection(this),this._rowFields=new PivotFieldCollection(this),this._columnFields=new PivotFieldCollection(this),this._valueFields=new PivotFieldCollection(this),this._filterFields=new PivotFieldCollection(this),this._viewLists=[this._rowFields,this._columnFields,this._valueFields,this._filterFields];var t=this._fieldListChanged.bind(this);this._fields.collectionChanged.addHandler(t),this._viewLists.forEach(function(e){e.collectionChanged.addHandler(t)}),this._defaultFilterType=null,e&&wjcCore.copy(this,e)}return Object.defineProperty(e.prototype,"itemsSource",{get:function(){return this._items},set:function(e){var t=this;this._items!=e&&(this._cv&&(this._cv.collectionChanged.removeHandler(this._cvCollectionChanged,this),this._cv=null),this._server&&(this._server.clearPendingRequests(),this._server=null),this._items=e,wjcCore.isString(e)?this._server=new _ServerConnection(this,e):wjcCore.isObject(e)&&!wjcCore.tryCast(e,"ICollectionView")?this._server=new _SqlServerConnection(this,e):this._cv=wjcCore.asCollectionView(e),null!=this._cv&&this._cv.collectionChanged.addHandler(this._cvCollectionChanged,this),this.deferUpdate(function(){t.autoGenerateFields&&t._generateFields(),t._updateFieldTypes()}),this.onItemsSourceChanged())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isServer",{get:function(){return null!=this._server},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"collectionView",{get:function(){return this._cv},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pivotView",{get:function(){return this._pivotView},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"showRowTotals",{get:function(){return this._showRowTotals},set:function(e){(e=wjcCore.asEnum(e,ShowTotals))!=this.showRowTotals&&(this._showRowTotals=e,this.onViewDefinitionChanged(),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"showColumnTotals",{get:function(){return this._showColTotals},set:function(e){(e=wjcCore.asEnum(e,ShowTotals))!=this.showColumnTotals&&(this._showColTotals=e,this.onViewDefinitionChanged(),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"totalsBeforeData",{get:function(){return this._totalsBefore},set:function(e){e!=this._totalsBefore&&(this._totalsBefore=wjcCore.asBoolean(e),this.onViewDefinitionChanged(),this._updatePivotView())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"sortableGroups",{get:function(){return this._sortableGroups},set:function(e){e!=this._sortableGroups&&(this._sortableGroups=wjcCore.asBoolean(e),this.onViewDefinitionChanged())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"sortOnServer",{get:function(){return this._sortOnServer},set:function(e){this._sortOnServer=wjcCore.asBoolean(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"showZeros",{get:function(){return this._showZeros},set:function(e){e!=this._showZeros&&(this._showZeros=wjcCore.asBoolean(e),this.onViewDefinitionChanged(),this._updatePivotView())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"defaultFilterType",{get:function(){return null!=this._defaultFilterType?this._defaultFilterType:this._server?wjcGridFilter.FilterType.Condition:wjcGridFilter.FilterType.Both},set:function(e){this._defaultFilterType=wjcCore.asEnum(e,wjcGridFilter.FilterType)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"autoGenerateFields",{get:function(){return this._autoGenFields},set:function(e){this._autoGenFields=wjcCore.asBoolean(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"allowFieldEditing",{get:function(){return this._allowFieldEditing},set:function(e){this._allowFieldEditing=wjcCore.asBoolean(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fields",{get:function(){return this._fields},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rowFields",{get:function(){return this._rowFields},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"columnFields",{get:function(){return this._columnFields},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"filterFields",{get:function(){return this._filterFields},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"valueFields",{get:function(){return this._valueFields},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"viewDefinition",{get:function(){var e=this,t={showZeros:this.showZeros,showColumnTotals:this.showColumnTotals,showRowTotals:this.showRowTotals,defaultFilterType:this.defaultFilterType,totalsBeforeData:this.totalsBeforeData,sortableGroups:this.sortableGroups,fields:[],rowFields:this._getFieldCollectionProxy(this.rowFields),columnFields:this._getFieldCollectionProxy(this.columnFields),filterFields:this._getFieldCollectionProxy(this.filterFields),valueFields:this._getFieldCollectionProxy(this.valueFields)};return this.fields.forEach(function(i){var r=e._getFieldDefinition(i);t.fields.push(r)}),JSON.stringify(t)},set:function(t){var i=this,r=JSON.parse(t);r&&this.deferUpdate(function(){i._copyProps(i,r,e._props),i.fields.clear(),r.fields.forEach(function(e){var t=i._getFieldFromDefinition(e);i.fields.push(t)}),r.fields.forEach(function(e,t){wjcCore.isString(e.weightField)&&(i.fields[t].weightField=i.fields.getField(e.weightField))}),i._setFieldCollectionProxy(i.rowFields,r.rowFields),i._setFieldCollectionProxy(i.columnFields,r.columnFields),i._setFieldCollectionProxy(i.filterFields,r.filterFields),i._setFieldCollectionProxy(i.valueFields,r.valueFields)})},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isViewDefined",{get:function(){var e=this._valueFields.length,t=this._rowFields.length,i=this._columnFields.length;return this._server?e>0&&(t>0||i>0):e>0||t>0||i>0},enumerable:!0,configurable:!0}),e.prototype.beginUpdate=function(){this.cancelPendingUpdates(),this._updating++},e.prototype.endUpdate=function(){this._updating--,this._updating<=0&&(this.onViewDefinitionChanged(),this.refresh())},Object.defineProperty(e.prototype,"isUpdating",{get:function(){return this._updating>0},enumerable:!0,configurable:!0}),e.prototype.deferUpdate=function(e){try{this.beginUpdate(),e()}finally{this.endUpdate()}},e.prototype.refresh=function(e){void 0===e&&(e=!1),this.isUpdating&&!e||this._updateView()},e.prototype.invalidate=function(){var e=this;this._toInv&&(this._toInv=clearTimeout(this._toInv)),this.isUpdating||(this._toInv=setTimeout(function(){e.refresh()},wjcCore.Control._REFRESH_INTERVAL))},Object.defineProperty(e.prototype,"async",{get:function(){return this._async},set:function(e){e!=this._async&&(this.cancelPendingUpdates(),this._async=wjcCore.asBoolean(e))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"serverTimeout",{get:function(){return this._serverParms.timeout},set:function(e){this._serverParms.timeout=wjcCore.asNumber(e,!1,!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"serverPollInterval",{get:function(){return this._serverParms.pollInterval},set:function(e){this._serverParms.pollInterval=wjcCore.asNumber(e,!1,!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"serverMaxDetail",{get:function(){return this._serverParms.maxDetail},set:function(e){this._serverParms.maxDetail=wjcCore.asNumber(e,!1,!0)},enumerable:!0,configurable:!0}),e.prototype.cancelPendingUpdates=function(){this._toUpdateTallies&&(clearTimeout(this._toUpdateTallies),this._toUpdateTallies=null)},e.prototype.getDetail=function(e,t){var i=this,r=e?e[_PivotKey._ROW_KEY_NAME]:null,n=this._getKey(t);if(this._server)return this._server.getDetail(r,n);var o=[];return this.collectionView.items.forEach(function(e){!i._applyFilter(e)||null!=r&&!r.matchesItem(e)||null!=n&&!n.matchesItem(e)||o.push(e)}),o},e.prototype.getDetailView=function(e,t){var i=this.getDetail(e,t);return new wjcCore.CollectionView(i)},e.prototype.getKeys=function(e,t){var i=e?e[_PivotKey._ROW_KEY_NAME]:null,r=this._getKey(t);return{rowKey:{fields:i.fieldNames,values:i.values},colKey:{fields:r.fieldNames,values:r.values}}},e.prototype.editField=function(e){if(this.allowFieldEditing){var t=new PivotFieldEditor(document.createElement("div"),{field:e});new wjcInput.Popup(document.createElement("div"),{content:t.hostElement}).show(!0)}},e.prototype.removeField=function(e){for(var t=0;t<this._viewLists.length;t++){var i=this._viewLists[t],r=i.indexOf(e);if(r>-1)return void i.removeAt(r)}},e.prototype.onItemsSourceChanged=function(e){this.itemsSourceChanged.raise(this,e)},e.prototype.onViewDefinitionChanged=function(e){this._updating||this.viewDefinitionChanged.raise(this,e)},e.prototype.onUpdatingView=function(e){this.updatingView.raise(this,e)},e.prototype.onUpdatedView=function(e){this.updatedView.raise(this,e)},e.prototype.onError=function(e){return this.error.raise(this,e),!e.cancel},e.prototype._copy=function(e,t){var i=this;switch(e){case"fields":return this.fields.clear(),this._viewLists.forEach(function(e){e.clear()}),wjcCore.asArray(t).forEach(function(e){var t=i._createField(e,!1);i.fields.push(t)}),this._updateFieldTypes(),!0;case"rowFields":case"columnFields":case"valueFields":case"filterFields":return this[e].clear(),wjcCore.isArray(t)||(this[e].maxItems=t.maxItems,t=t.items),wjcCore.asArray(t).forEach(function(t){var r=i.fields.getField(t);i[e].push(r)}),!0}return!1},e.prototype._getKey=function(e){return this._keys[e]},e.prototype._getRowLevel=function(e){if(wjcCore.isNumber(e)){var t=this._pivotView.items[e];e=t?t[_PivotKey._ROW_KEY_NAME]:null}return e?e.level:-1},e.prototype._getColLevel=function(e){return wjcCore.isNumber(e)&&(e=this._colBindings[e]),wjcCore.isString(e)&&(e=this._getKey(e)),wjcCore.assert(null==e||e instanceof _PivotKey,"invalid parameter in call to _getColLevel"),e?e.level:-1},e.prototype._applyFilter=function(e){for(var t=this._activeFilterFields,i=0;i<t.length;i++)if(!t[i].filter.apply(e))return!1;return!0},e.prototype._updateView=function(){var e=this;this.cancelPendingUpdates(),this._cntTotal=this._cntFiltered=0,this._tallies={},this._keys={},this._activeFilterFields=[],this._server&&this.isViewDefined?this._server.getOutputView(function(t){e.isViewDefined&&(e._server.updateTallies(t),e._updatePivotView())}):(this._viewLists.forEach(function(t){t.forEach(function(t){t.filter.isActive&&e._activeFilterFields.push(t)})}),this.isViewDefined&&wjcCore.hasItems(this._cv)?(this._batchStart=Date.now(),this._updateTallies(this._cv.items,0)):this._updatePivotView())},e.prototype._updateTallies=function(t,i){var r=this,n=t.length,o=new _PivotNode(this._rowFields,0,null,-1,null),s=this.valueFields;0==s.length&&this.columnFields.length>0&&(s=new PivotFieldCollection(this)).push(new PivotField(this,""));for(var l=ShowTotals,a=this._rowFields.length,c=this._getShowRowTotals(),d=c==l.None?a:0,u=c==l.GrandTotals?Math.max(1,a):1,h=this._columnFields.length,p=this._getShowColTotals(),_=p==l.None?h:0,g=p==l.GrandTotals?Math.max(1,h):1,f=s.length,w=this,v=i;v<n;v++){var y=function(n){if(w._async&&n-i>=e._BATCH_SIZE&&Date.now()-w._batchStart>e._BATCH_DELAY)return w._toUpdateTallies=setTimeout(function(){r.onUpdatingView(new ProgressEventArgs(Math.round(n/t.length*100))),r._batchStart=Date.now(),r._updateTallies(t,n)},e._BATCH_TIMEOUT),{value:void 0};w._cntTotal++;var l=t[n];if(!w._activeFilterFields.length||w._applyFilter(l)){w._cntFiltered++;for(var c=d;c<=a;c+=u){var p=o.getNode(w._rowFields,c,null,-1,l),v=p.key,y=v.toString(),m=w._tallies[y];m||(w._keys[y]=v,w._tallies[y]=m={});for(var C=_;C<=h;C+=g)for(var b=0;b<f;b++){var F=p.tree.getNode(w._columnFields,C,s,b,l).key,j=F.toString(),x=m[j];x||(w._keys[j]=F,x=m[j]=new _Tally);var T=s[b],P=T._getValue(l,!1),S=T._weightField?T._getWeight(l):null;x.add(P,S)}}}}(v);if("object"==typeof y)return y.value}this._toUpdateTallies=null,this._updatePivotView()},e.prototype._updatePivotView=function(){var e=this;this._pivotView.deferUpdate(function(){e.onUpdatingView(new ProgressEventArgs(100));var t=e._pivotView.sourceCollection;t.length=0;var i={};for(var r in e._tallies)i[r]=!0;var n={};for(var r in e._tallies){d=e._tallies[r];for(var o in d)n[o]=!0}for(var s=e._getSortedKeys(i,e._server&&e.sortOnServer),l=e._getSortedKeys(n),a=0;a<s.length;a++){var c=s[a],d=e._tallies[c],u={};u[_PivotKey._ROW_KEY_NAME]=e._getKey(c);for(var h=0;h<l.length;h++){var p=l[h],_=d[p],g=e._getKey(p),f=_?_.getAggregate(g.aggregate):null;0!=f||e._showZeros||(f=null),u[p]=f}t.push(u)}e._colBindings=l,e._updateFieldValues(t),e._pivotView.sortDescriptions.clear(),e.onUpdatedView()})},e.prototype._getSortedKeys=function(e,t){var i=this,r=Object.keys(e);return t||r.sort(function(e,t){return i._keys[e].compareTo(i._keys[t])}),r},e.prototype._updateFieldValues=function(e){for(var t=this.valueFields.length,i=this,r=0;r<t;r++)!function(r){var n=i.valueFields[r];switch(n.showAs){case ShowAs.RunTot:case ShowAs.RunTotPct:for(c=r;c<i._colBindings.length;c+=t){for(p=0;p<e.length;p++)(d=e[p])[_=i._colBindings[c]]=i._getRunningTotal(e,p,c,n.showAs);if(n.showAs==ShowAs.RunTotPct)for(p=0;p<e.length;p++){var o=(d=e[p])[_=i._colBindings[c]];if(wjcCore.isNumber(o)){var s=i._getLastValueInRowGroup(e,p,c);0!=s&&(d[_]=o/s)}}}break;case ShowAs.PctGrand:case ShowAs.PctCol:var l=0;if(n.showAs==ShowAs.PctGrand)for(c=r;c<i._colBindings.length;c+=t)-1==i._getColLevel(c)&&(l+=i._getColTotal(e,c));for(var a=function(t){n.showAs==ShowAs.PctCol&&(l=i._getColTotal(e,t));var r=i._colBindings[t];e.forEach(function(e,t){var i=e[r];wjcCore.isNumber(i)&&(e[r]=0!=l?i/l:null)})},c=r;c<i._colBindings.length;c+=t)a(c);break;case ShowAs.PctRow:for(p=0;p<e.length;p++){for(var d=e[p],u=0,c=r;c<i._colBindings.length;c+=t)-1==i._getColLevel(c)&&(h=d[_=i._colBindings[c]],wjcCore.isNumber(h)&&(u+=h));for(c=r;c<i._colBindings.length;c+=t){var h=d[_=i._colBindings[c]];wjcCore.isNumber(h)&&(d[_]=0!=u?h/u:null)}}break;case ShowAs.DiffRow:case ShowAs.DiffRowPct:for(c=r;c<i._colBindings.length;c+=t)for(p=e.length-1;p>=0;p--)(d=e[p])[_=i._colBindings[c]]=i._getRowDifference(e,p,c,n.showAs);break;case ShowAs.DiffCol:case ShowAs.DiffColPct:for(var p=0;p<e.length;p++)for(c=i._colBindings.length-t+r;c>=0;c-=t){var d=e[p],_=i._colBindings[c];d[_]=i._getColDifference(e,p,c,n.showAs)}}}(r)},e.prototype._getColTotal=function(e,t){var i=this,r=this._colBindings[t],n=0;return e.forEach(function(e,t){if(-1==i._getRowLevel(t)){var o=e[r];wjcCore.isNumber(o)&&(n+=o)}}),n},e.prototype._getRunningTotal=function(e,t,i,r){var n=this._getRowLevel(t);if(0==n)return null;for(var o=this._colBindings[i],s=e[t][o],l=this._getShowRowTotals(),a=this.rowFields.length-2,c=t-1;c>=0;c--){var d=this._getRowLevel(c);if(d==n){if(a>-1&&n<0&&l!=ShowTotals.Subtotals){var u=e[t].$rowKey,h=e[c].$rowKey;if(u.values[a]!=h.values[a])return null}s+=e[c][o];break}if(d>n)break}return s},e.prototype._getLastValueInRowGroup=function(e,t,i){for(var r=this._colBindings[i],n=e[t][r],o=this._getRowLevel(t),s=this.rowFields.length-2,l=this._getShowRowTotals(),a=t+1;a<e.length;a++){var c=this._getRowLevel(a);if(c==o){if(s>-1&&o<0&&l!=ShowTotals.Subtotals){var d=e[t].$rowKey,u=e[a].$rowKey;if(d.values[s]!=u.values[s])return n}n=e[a][r]}if(c>o)break}return n},e.prototype._getRowDifference=function(e,t,i,r){var n=this._getRowLevel(t);if(0==n)return null;for(var o=this.rowFields.length-2,s=this._getShowRowTotals(),l=t-1;l>=0;l--){var a=this._getRowLevel(l);if(a==n){if(o>-1&&n<0&&s!=ShowTotals.Subtotals){var c=e[t].$rowKey,d=e[l].$rowKey;if(c.values[o]!=d.values[o])return null}var u=this._colBindings[i],h=e[t][u],p=e[l][u],_=h-p;return r==ShowAs.DiffRowPct&&(_/=p),_}if(a>n)break}return null},e.prototype._getColDifference=function(e,t,i,r){var n=this._getColLevel(i);if(0==n)return null;for(var o=this.valueFields.length,s=this.columnFields.length-2,l=this._getShowColTotals(),a=i-o;a>=0;a-=o){var c=this._getColLevel(a);if(c==n){if(s>-1&&n<0&&l!=ShowTotals.Subtotals){var d=this._getKey(this._colBindings[i]),u=this._getKey(this._colBindings[a]);if(d.values[s]!=u.values[s])return null}var h=e[t],p=h[this._colBindings[i]],_=h[this._colBindings[a]],g=p-_;return r==ShowAs.DiffColPct&&(g/=_),g}if(c>n)break}return null},e.prototype._getShowRowTotals=function(){return this._valueFields.length?this._showRowTotals:ShowTotals.None},e.prototype._getShowColTotals=function(){return this._valueFields.length?this._showColTotals:ShowTotals.None},e.prototype._generateFields=function(){var e=this;this._viewLists.forEach(function(e){e.clear()});for(var t=0;t<this.fields.length;t++)(a=this.fields[t])._autoGenerated&&(this.fields.removeAt(t),t--);if(this._server)this._server.getFields().forEach(function(t){var i=e._createField(t,!0);e.fields.getField(i.header)||e.fields.push(i)});else{var i=this.collectionView,r=i?i.sourceCollection:null,n=r?r[0]:null;if(n&&this.autoGenerateFields)for(var o in n)for(var s=null,l=0;l<r.length&&l<1e3&&null==s;l++)if(s=r[l][o],wjcCore.isPrimitive(s)){var a=this._createField({binding:o,header:wjcCore.toHeaderCase(o),dataType:wjcCore.getType(s)},!0);this.fields.getField(a.header)||this.fields.push(a)}}},e.prototype._updateFieldTypes=function(){var e=this,t=this.collectionView,i=t?t.sourceCollection:null;i&&i.length&&this.fields.forEach(function(t){e._updateFieldType(t,i)})},e.prototype._updateFieldType=function(e,t){var i=this;if(e._hasSubFields())e.subFields.forEach(function(e){i._updateFieldType(e,t)});else if(null==e.dataType&&e.binding)for(var r=0;r<t.length&&r<1e3;r++){var n=e._binding.getValue(t[r]);if(null!=n){e.dataType=wjcCore.isPrimitive(n)?wjcCore.getType(n):null;break}}},e.prototype._createField=function(e,t){var i;return wjcCore.isString(e)?i=new PivotField(this,e):e&&(e.key&&delete e.key,i=null!=e.dimensionType?new CubePivotField(this,e.binding,e.header,e):new PivotField(this,e.binding,e.header,e),null!=e.dataType&&(i.dataType=e.dataType)),i._autoGenerated=t,(t||wjcCore.isString(e))&&(i.format=i.dataType==wjcCore.DataType.Date?"d":"n0",i.aggregate=i.dataType==wjcCore.DataType.Number?wjcCore.Aggregate.Sum:wjcCore.Aggregate.Cnt),e&&!wjcCore.isString(e)&&wjcCore.copy(i,e),i},e.prototype._cvCollectionChanged=function(e,t){this.invalidate()},e.prototype._fieldListChanged=function(e,t){if(t.action==wjcCore.NotifyCollectionChangedAction.Add){for(var i=e,r=0;r<i.length-1;r++)if(i[r].key)for(var n=r+1;n<i.length;n++)i[r].key==i[n].key&&(i.removeAt(n),n--);if(i!=this._fields)if(this._fields.getField(t.item.key)){for(r=0;r<this._viewLists.length;r++)if(this._viewLists[r]!=i){var o=this._viewLists[r];(s=o.indexOf(t.item))>-1&&o.removeAt(s)}}else i.removeAt(t.index);if(wjcCore.isNumber(i.maxItems)&&i.maxItems>-1)for(;i.length>i.maxItems;){var s=i.length-1;i[s]==t.item&&s>0&&s--,i.removeAt(s)}}this.onViewDefinitionChanged(),this.invalidate()},e.prototype._fieldPropertyChanged=function(e,t){if(this.onViewDefinitionChanged(),e.isActive){var i=t.propertyName;"width"!=i&&"wordWrap"!=i&&"isContentHtml"!=i?"format"==i&&this.valueFields.indexOf(e)>-1?this._pivotView.refresh():"showAs"!=i?"descending"!=i?"aggregate"!=i?this.invalidate():this.valueFields.indexOf(e)>-1&&!this.isUpdating&&(this._server?this._updateView():this._updatePivotView()):this._updatePivotView():this.valueFields.indexOf(e)>-1&&!this.isUpdating&&this._updatePivotView():this._pivotView.refresh()}},e.prototype._copyProps=function(e,t,i){for(var r=0;r<i.length;r++){var n=i[r];null!=t[n]&&(e[n]=t[n])}},e.prototype._getFieldFromDefinition=function(e){var t=e.filter;e.filter&&delete e.filter;var i=this._createField(e,!0);return t&&(this._setFilterProxy(i,t),e.filter=t),i},e.prototype._getFieldDefinition=function(e){var t=this,i={binding:e.binding,header:e.header,dataType:e.dataType,aggregate:e.aggregate,showAs:e.showAs,descending:e.descending,format:e.format,width:e.width,wordWrap:e.wordWrap,isContentHtml:e.isContentHtml};return e.weightField&&(i.weightField=e.weightField._getName()),e.key&&(i.key=e.key),e.filter.isActive&&(i.filter=this._getFilterProxy(e)),e._hasSubFields()&&(i.subFields=[],e.subFields.forEach(function(e){i.subFields.push(t._getFieldDefinition(e))})),e instanceof CubePivotField&&(i.dimensionType=e.dimensionType),i},e.prototype._getFieldCollectionProxy=function(e){var t={items:[]};wjcCore.isNumber(e.maxItems)&&e.maxItems>-1&&(t.maxItems=e.maxItems);for(var i=0;i<e.length;i++){var r=e[i];t.items.push(r.key)}return t},e.prototype._setFieldCollectionProxy=function(e,t){e.clear(),e.maxItems=wjcCore.isNumber(t.maxItems)?t.maxItems:null;for(var i=0;i<t.items.length;i++)e.push(t.items[i])},e.prototype._getFilterProxy=function(e){var t=e.filter;if(t.conditionFilter.isActive){var i=t.conditionFilter,r={type:"condition",condition1:{operator:i.condition1.operator,value:i.condition1.value},and:i.and,condition2:{operator:i.condition2.operator,value:i.condition2.value}};return i.condition1.isActive||delete r.condition1,i.condition2.isActive||delete r.condition2,r}if(t.valueFilter.isActive){var n=t.valueFilter;return{type:"value",filterText:n.filterText,showValues:n.showValues}}return wjcCore.assert(!1,"inactive filters shouldn't be persisted."),null},e.prototype._setFilterProxy=function(e,t){var i=e.filter;switch(i.clear(),t.type){case"condition":var r=i.conditionFilter;if(t.condition1){n=wjcCore.changeType(t.condition1.value,e.dataType,e.format);r.condition1.value=n||t.condition1.value,r.condition1.operator=t.condition1.operator}if(wjcCore.isBoolean(t.and)&&(r.and=t.and),t.condition2){var n=wjcCore.changeType(t.condition2.value,e.dataType,e.format);r.condition2.value=n||t.condition2.value,r.condition2.operator=t.condition2.operator}break;case"value":var o=i.valueFilter;o.filterText=t.filterText,o.showValues=t.showValues}},e._BATCH_SIZE=1e4,e._BATCH_TIMEOUT=0,e._BATCH_DELAY=100,e._props=["showZeros","showRowTotals","showColumnTotals","totalsBeforeData","sortableGroups","defaultFilterType"],e}();exports.PivotEngine=PivotEngine;var ProgressEventArgs=function(e){function t(t){var i=e.call(this)||this;return i._progress=wjcCore.asNumber(t),i}return __extends(t,e),Object.defineProperty(t.prototype,"progress",{get:function(){return this._progress},enumerable:!0,configurable:!0}),t}(wjcCore.EventArgs);exports.ProgressEventArgs=ProgressEventArgs;var _MdxQueryBuilder=function(){function e(e,t){this._ng=null,this._cubeName=null,this._ng=e,this._cubeName=t}return e.prototype.buildQuery=function(){var e=new _TextBuilder,t=this.buildWhereSection(this._ng.valueFields);return e.append("SELECT ",this.buildAxes()," FROM ",this.buildCubeName(),t),e.append(" CELL PROPERTIES VALUE, FORMAT_STRING"),e.toString()},e.prototype.buildWhereSection=function(e){var t=new _TextBuilder;return 1==e.length&&(t.append(this.buildSetForMeasuresShelf(e)),t.wrap(" WHERE ","")),t.toString()},e.prototype.buildCubeName=function(){var e=new _TextBuilder;e.append(this.buildSubcubeExpression());var t=e.length>0;return t&&e.wrap("SELECT "," FROM "),e.append("[",this._cubeName,"]"),t&&e.wrap("(",")"),e.toString()},e.prototype.buildSubcubeExpression=function(){var e=new _TextBuilder,t=this.getMeasureFilterExpressions(this._ng.valueFields),i=this.buildFilterAttributeSet(this._ng.filterFields),r=this.buildFilterAttributeSet(this._ng.rowFields,t),n=this.buildFilterAttributeSet(this._ng.columnFields,0==r.length?t:null);return e.joinItemToList(i),e.joinItemToList(r),e.joinItemToList(n),e.length>0&&(e.wrap("(",")"),e.append(" ON COLUMNS")),e.toString()},e.prototype.buildFilterAttributeSet=function(e,t){for(var i=new _TextBuilder,r=0;r<e.length;r++){var n=e[r],o=this.buildFilterString(n,0==r?t:null);i.joinItemToList(o)}return i.toString()},e.prototype.buildFilterString=function(e,t){var i=new _TextBuilder;return e.filter.isActive?e.filter.filterType==wjcGridFilter.FilterType.Condition&&i.append(this.getConditionFilterString(e,t)):t&&i.append(this.getConditionFilterString(e,t)),i.toString()},e.prototype.getConditionFilterString=function(e,t){var i=new _TextBuilder,r=e.key+".LEVELS(1).ALLMEMBERS",n=e.filter.conditionFilter.condition1,o=e.filter.conditionFilter.condition2;return n.isActive&&(i.append(this.getConditionFilterExpression(e,n)),o.isActive&&i.append(e.filter.conditionFilter.and?" AND ":" OR ")),o.isActive&&i.append(this.getConditionFilterExpression(e,o)),t&&t.length>0&&(i.length>0&&i.append(" AND "),i.append(t.join(" AND "))),i.length>0&&i.wrap("Filter("+r+",(","))"),i.toString()},e.prototype.getMeasureFilterExpressions=function(e){for(var t=[],i=0;i<e.length;i++){var r=new _TextBuilder,n=e[i],o=(n.dimensionType,DimensionType.Measure,n.filter.conditionFilter.condition1),s=n.filter.conditionFilter.condition2;o.isActive&&(r.append(this.getConditionFilterExpression(n,o)),s.isActive&&r.append(n.filter.conditionFilter.and?" AND ":" OR ")),s.isActive&&r.append(this.getConditionFilterExpression(n,s)),r.length>0&&(r.wrap("(",")"),t.push(r.toString()))}return t},e.prototype.getConditionFilterExpression=function(e,t){if(!t.isActive)return"";var i=e.dimensionType==DimensionType.Measure,r=e.dataType==wjcCore.DataType.Number,n=e.dataType==wjcCore.DataType.Date,o=r||n?"member_value":"member_caption",s=i?e.key:e.key+".CurrentMember."+o,l=n?"CDate('"+wjcCore.Globalize.formatDate(t.value,"d")+"')":t.value.toString(),a=new _TextBuilder;switch(t.operator){case wjcGridFilter.Operator.BW:a.append("(Left(",s,",",l.length.toString(),')="',l,'")');break;case wjcGridFilter.Operator.EW:a.append("(Right(",s,",",l.length.toString(),')="',l,'")');break;case wjcGridFilter.Operator.EQ:i||r||n?a.append("(",s,")=",l):a.append("(",s,')="',l,'"');break;case wjcGridFilter.Operator.NE:i||r||n?a.append("(",s,")<>",l):a.append("(",s,')<>"',l,'"');break;case wjcGridFilter.Operator.CT:a.append("(InStr(1,",s,',"',l,'")>0)');break;case wjcGridFilter.Operator.NC:a.append("(InStr(1,",s,',"',l,'")=0))');break;case wjcGridFilter.Operator.GT:a.append("(",s,")>",l);break;case wjcGridFilter.Operator.LT:a.append("(",s,")<",l);break;case wjcGridFilter.Operator.GE:a.append("(",s,")>=",l);break;case wjcGridFilter.Operator.LE:a.append("(",s,")<=",l)}return a.toString()},e.prototype.buildAxes=function(){var e=new _TextBuilder,t=this.buildSetForAttributesShelf(this._ng.rowFields);return e.joinItemToList(t),this._ng.rowFields.length>0&&(this._ng.columnFields.length>0||this._ng.valueFields.length>1?e.append(" ON ROWS"):e.append(" ON COLUMNS")),t=this.buildSetForAttributesColumnShelf(this._ng.columnFields),e.joinItemToList(t),this._ng.columnFields.length>0&&e.append(" ON COLUMNS"),this._ng.valueFields.length>1&&0==this._ng.columnFields.length&&(t=this.buildSetForMeasuresShelf(this._ng.valueFields),e.joinItemToList(t),e.append(" ON COLUMNS")),e.toString()},e.prototype.buildSetForAttributesShelf=function(e){for(var t=new _TextBuilder,i=0;i<e.length;i++){var r=e[i];r.dimensionType!=DimensionType.Attribute&&r.dimensionType!=DimensionType.Hierarchy||t.joinItemToList(this.buildAttributeSetForAxis(r)),i>0&&t.wrap("CrossJoin(",")")}return t.wrap("NON EMPTY ",""),t.toString()},e.prototype.buildSetForAttributesColumnShelf=function(e){for(var t=new _TextBuilder,i=0;i<e.length;i++){var r=e[i];r.dimensionType!=DimensionType.Attribute&&r.dimensionType!=DimensionType.Hierarchy||t.joinItemToList(this.buildAttributeSetForAxis(r))}return this._ng.valueFields.length>1&&e.length>0&&t.joinItemToList(this.buildSetForMeasuresShelf(this._ng.valueFields)),(this._ng.valueFields.length>1&&e.length>0||e.length>1)&&t.wrap("CrossJoin(",")"),t.wrap("NON EMPTY ",""),t.toString()},e.prototype.buildSetForMeasuresShelf=function(e){for(var t=new _TextBuilder,i=0;i<e.length;i++){var r=e[i];r.dimensionType!=DimensionType.Measure&&r.dimensionType!=DimensionType.Kpi||t.joinItemToList(this.buildMeasureSetForAxis(r))}return t.wrap("{","}"),t.toString()},e.prototype.buildAttributeSetForAxis=function(e){var t=new _TextBuilder;return e.dimensionType==DimensionType.Hierarchy&&(t.append(e.key),t.append(".ALLMEMBERS"),t.wrap("{","}"),t.wrap("HIERARCHIZE(",")")),t.toString()},e.prototype.buildMeasureSetForAxis=function(e){var t=new _TextBuilder;return e.dimensionType!=DimensionType.Measure&&e.dimensionType!=DimensionType.Kpi||t.append(e.key),t.toString()},e}();exports._MdxQueryBuilder=_MdxQueryBuilder;var _ServerConnection=function(){function e(e,t){this._ng=wjcCore.asType(e,PivotEngine),wjcCore.assert(this._isValidUrl(t),"Invalid service Url: "+t+")")}return e.prototype.getFields=function(){var e=this,t=null;return wjcCore.httpRequest(this._getUrl("Fields"),{async:!1,success:function(e){t=JSON.parse(e.responseText),wjcCore.isArray(t)||console.error("Failed to get fields from server: "+e.responseText)},error:function(t){e._handleError("Getting Fields",t)}}),t},e.prototype.getOutputView=function(e){var t=this;this.clearPendingRequests(),this._sendHttpRequest("Analyses",{method:"POST",data:{view:this._ng.viewDefinition},success:function(i){var r=JSON.parse(i.responseText);t._token=r.token,t._start=Date.now(),t._handleResult(r.status,e)},error:function(e){t._handleError("Analyses",e)}})},e.prototype.getDetail=function(t,i){for(var r,n=[],o=this._ng.rowFields.length,s=t?t.values.length:0,l=0;l<o;l++)l<s?n.push(e._getRequestedValue(t.values[l])):n.push(null);o=this._ng.columnFields.length,s=i?i.values.length:0;for(l=0;l<o;l++)l<s?n.push(e._getRequestedValue(i.values[l])):n.push(null);return r=new wjcCore.ObservableArray,this._loadArray("Detail",r,{method:"POST",view:this._ng.viewDefinition,keys:n,max:this._ng.serverMaxDetail}),r},e._getRequestedValue=function(e){if(wjcCore.isDate(e)){var t=e;return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()))}return e},e.prototype.clearPendingRequests=function(){this._clearRequest(),this._clearTimeout(),this._clearToken()},e.prototype.updateTallies=function(e){var t=this,i=this._ng,r=i.rowFields.length,n=i.columnFields.length,o=i.valueFields.length,s=new _PivotNode(i.rowFields,0,null,-1,null),l=null,a=0,c=function(e,c,d){var u=t._getAggregatedFieldCount(e,i.rowFields),h=s.getNode(i.rowFields,r-u,null,-1,e),p=h.key,_=p.toString(),g=p.toString(a>0?a:null),f=i._tallies[g];f||(_!==l&&(a=0,g=_),l=_,i._keys[g]=p,i._tallies[g]=f={}),u=t._getAggregatedFieldCount(e,i.columnFields);for(var w=0;w<o;w++){var v=h.tree.getNode(i.columnFields,n-u,i.valueFields,w,e).key,y=v.toString(),m=i.valueFields[w],C=f[y];if(C)return!1;i._keys[y]=v,(C=f[y]=new _ServerTally).add(t._getFieldValue(m,e,!1))}return!0};e.forEach(function(e,t,i){c(e)||(a++,c(e))})},e.prototype._getFieldValue=function(e,t,i){var r=t[e.key];return i&&"string"!=typeof r?wjcCore.Globalize.format(r,e.format):r},e.prototype._getAggregatedFieldCount=function(e,t){for(var i=t.length,r=0,n=0;n<i;n++){var o=t[n];null==this._getFieldValue(o,e,!1)&&r++}return r},e.prototype._loadArray=function(e,t,i){var r=this;i||(i={}),null==i.skip&&(i.skip=0),null==i.top&&(i.top=100);var n=wjcCore.isNumber(i.max)?i.max:1e6;this._request=wjcCore.httpRequest(this._getUrl(e),{data:i,method:i.method||"GET",success:function(o){var s=JSON.parse(o.responseText);t.deferUpdate(function(){s.value.forEach(function(e){t.push(e)})}),s.value.length==i.top&&t.length<n&&(i.skip+=i.top,r._loadArray(e,t,i))},error:function(t){r._handleError(e,t)}})},e.prototype._getUrl=function(e,t,i){void 0===t&&(t=this._token);var r=this._ng.itemsSource.toString(),n=r.lastIndexOf("/");r.substr(0,n);switch(e=e.toLowerCase()){case"rawdata":case"detail":return r;case"fields":case"analyses":return r+"/"+e;case"clear":return r+"/analyses/"+t+"/";case"result":case"status":return r+"/analyses/"+t+"/"+e;case"uniquevalues":return r+"/fields/"+i+"/"+e}wjcCore.assert(!1,"Unrecognized command")},e.prototype._isValidUrl=function(e){var t=document.createElement("a");return t.href=wjcCore.asString(e),t.href=t.href,t.protocol&&t.hostname&&t.pathname&&"/"!=e[e.length-1]},e.prototype._handleResult=function(e,t){var i=this;switch(e.executingStatus.toLowerCase()){case"executing":case"notset":if(Date.now()-this._start>this._ng.serverTimeout)return void this._handleError("Analyses",{status:500,statusText:"Analysis timed out"});this._progress=e.progress,this._ng.onUpdatingView(new ProgressEventArgs(this._progress)),this._clearTimeout(),this._toGetStatus=setTimeout(function(){i._waitUntilComplete(t)},this._ng.serverPollInterval);break;case"completed":this._progress=100,this._ng.onUpdatingView(new ProgressEventArgs(this._progress)),this._getResults(t);break;case"exception":this._getResults(t);break;default:this._handleError("Analyses",{status:500,statusText:"Unexpected result..."})}},e.prototype._waitUntilComplete=function(e){var t=this;this._sendHttpRequest("Status",{success:function(i){var r=JSON.parse(i.responseText);t._handleResult(r,e)},error:function(e){t._handleError("Status",e)}})},e.prototype._getResults=function(e){var t=this;this._sendHttpRequest("Result",{success:function(i){t._clearToken();var r=JSON.parse(i.responseText);wjcCore.assert(wjcCore.isArray(r),"Result array Expected.");var n=[];t._ng._viewLists.forEach(function(e){n=n.concat(e.filter(function(e){return e.dataType==wjcCore.DataType.Date}))}),n.length>0&&r.forEach(function(e){n.forEach(function(t){var i=t._binding,r=i.getValue(e);wjcCore.isString(r)&&i.setValue(e,new Date(r))})}),wjcCore.asFunction(e)(r)},error:function(e){t._handleError("Result",e)}})},e.prototype._handleError=function(e,t){this.clearPendingRequests(),e='** HttpRequest error on command "'+e+'"',this._ng.onError(new wjcCore.RequestErrorEventArgs(t,e))&&this._throwResponseError(e,t)},e.prototype._throwResponseError=function(e,t){e=e+"\r\n"+t.status+"\r\n";var i=t.responseText||"";throw 500==t.status&&t.responseText&&(i=JSON.parse(t.responseText).ExceptionMessage),e+=i||t.statusText},e.prototype._sendHttpRequest=function(e,t){var i=this._getUrl(e);this._request=wjcCore.httpRequest(i,t)},e.prototype._clearToken=function(){this._token&&(this._clearRequest(),this._clearTimeout(),this._sendHttpRequest("Clear",{method:"DELETE"}),this._token=null)},e.prototype._clearRequest=function(){this._request&&4!=this._request.readyState&&(this._request.abort(),this._request=null)},e.prototype._clearTimeout=function(){this._toGetStatus&&(clearTimeout(this._toGetStatus),this._toGetStatus=null)},e._TIMEOUT=6e4,e._POLL_INTERVAL=500,e._MAXDETAIL=1e3,e}();exports._ServerConnection=_ServerConnection;var _ServerTally=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.add=function(e,t){wjcCore.assert(0==this._cnt,"Server tallies have a single value."),this._aggregatedValue=e},t.prototype.getAggregate=function(e){return this._aggregatedValue},t}(_Tally),_SqlServerConnection=function(e){function t(t,i){var r=e.call(this,t,i.url)||this;return r._jsonResult=null,r._dataTypes=null,r._debug=!1,wjcCore.assert(wjcCore.isString(i.cube)&&!wjcCore.isNullOrWhiteSpace(i.cube),"Cube name required."),r._cubeName=i.cube,r._url=i.url,r}return __extends(t,e),t.prototype.getFields=function(){this._getSession();return this._jsonResult=null,this._dataTypes=null,this._getProperties(this._token),this._getDimensions(this._token),this._endSession(),this._jsonResult},t.prototype.getOutputView=function(e){this._ng.onUpdatingView(new ProgressEventArgs(0));var t=this,i=new _MdxQueryBuilder(this._ng,this._cubeName).buildQuery();this._jsonResult=[],this._getSession(),this._execQuery(this._token,i,function(i){wjcCore.asFunction(e)(t._jsonResult),t._ng.onUpdatingView(new ProgressEventArgs(100))})},t.prototype.getDetail=function(e,t){throw"getDetail method not supported"},t.prototype._getSession=function(){var e=this,t=this._url;return wjcCore.httpRequest(t,{async:!1,data:_ENV_SESSION,method:"POST",requestHeaders:{"Content-Type":"text/xml"},success:function(t){var i=t.responseXML.getElementsByTagName("Session");e._token=i[0].getAttribute("SessionId")},error:function(t){e._handleError("Begin Session",t)}})},t.prototype._endSession=function(){var e=this,t=this._url;return wjcCore.httpRequest(t,{async:!1,data:_ENV_ENDSESSION(e._token),method:"POST",requestHeaders:{"Content-Type":"text/xml"},error:function(t){e._handleError("End Session",t)},complete:function(t){e._token=void 0}})},t.prototype._getProperties=function(e){var t=this,i=this._url;return wjcCore.httpRequest(i,{async:!1,data:_ENV_PROPERTIES(e,t._cubeName),method:"POST",requestHeaders:{"Content-Type":"text/xml"},success:function(e){for(var i={},r=e.responseXML.getElementsByTagName("row"),n=0;n<r.length;n++){var o=_getTagValue(r[n],"HIERARCHY_UNIQUE_NAME");switch(Number(_getTagValue(r[n],"DATA_TYPE"))){case 2:case 3:case 4:case 5:case 6:i[o]=wjcCore.DataType.Number;break;case 7:i[o]=wjcCore.DataType.Date}}t._dataTypes=i},error:function(e){t._handleError("Get Properties",e)}})},t.prototype._getDimensions=function(e){var t=this,i=this._url;return wjcCore.httpRequest(i,{async:!1,data:_ENV_DIMENSIONS(e,t._cubeName),method:"POST",requestHeaders:{"Content-Type":"text/xml"},success:function(i){for(var r=[],n=i.responseXML.getElementsByTagName("row"),o=0;o<n.length;o++)if("2"!==_getTagValue(n[o],"DIMENSION_TYPE")){var s=_getTagValue(n[o],"DIMENSION_UNIQUE_NAME"),l={header:_getTagValue(n[o],"DIMENSION_CAPTION"),dataType:wjcCore.DataType.Object,dimensionType:DimensionType.Dimension,subFields:[]};t._getSubFolders(e,s,l),r.push(l)}else t._getMeasures(e,r);var a={header:"KPIs",dataType:wjcCore.DataType.Object,dimensionType:DimensionType.Kpi,subFields:[]};t._getKPIs(e,a),r.push(a),t._jsonResult=r},error:function(e){t._handleError("Get Dimensions",e)}})},t.prototype._getSubFolders=function(e,t,i){var r=this,n=this._url;wjcCore.httpRequest(n,{async:!1,data:_ENV_HIERARCHIES(e,r._cubeName,t),method:"POST",requestHeaders:{"Content-Type":"text/xml"},success:function(e){for(var t=e.responseXML.getElementsByTagName("row"),n=0;n<t.length;n++){var o={header:_getTagValue(t[n],"HIERARCHY_NAME"),binding:_getTagValue(t[n],"HIERARCHY_UNIQUE_NAME"),dataType:wjcCore.DataType.String,dimensionType:DimensionType.Hierarchy};r._dataTypes[o.binding]&&(o.dataType=r._dataTypes[o.binding]);for(var s=_getTagValue(t[n],"HIERARCHY_DISPLAY_FOLDER").split("\\"),l=i,a=0;a<s.length;a++)if(""!=s[a]){var c={header:s[a],dataType:wjcCore.DataType.Object,dimensionType:DimensionType.Folder,subFields:[]};_containsFolder(l,s[a])?l=_findSubFieldByName(l,s[a]):(l.subFields.push(c),l=c)}l.subFields.push(o)}},error:function(e){r._handleError("Get Hierarchies",e)}})},t.prototype._getMeasures=function(e,t){var i=this,r=this._url;return wjcCore.httpRequest(r,{async:!1,data:_ENV_MEASURES(e,i._cubeName),method:"POST",requestHeaders:{"Content-Type":"text/xml"},success:function(e){for(var i=e.responseXML.getElementsByTagName("row"),r={},n=0;n<i.length;n++){var o=_getTagValue(i[n],"MEASUREGROUP_NAME"),s={header:_getTagValue(i[n],"MEASURE_CAPTION"),binding:_getTagValue(i[n],"MEASURE_UNIQUE_NAME"),dataType:wjcCore.DataType.Number,dimensionType:DimensionType.Measure};if(Object.keys(r).indexOf(o)<0){var l={header:o,dataType:wjcCore.DataType.Number,dimensionType:DimensionType.Measure,subFields:[]};l.subFields.push(s),t.push(l),r[o]=l}else r[o].subFields.push(s)}},error:function(e){i._handleError("Get Measures",e)}})},t.prototype._getKPIs=function(e,t){var i=this,r=this._url;return wjcCore.httpRequest(r,{async:!1,data:_ENV_KPIS(e,i._cubeName),method:"POST",requestHeaders:{"Content-Type":"text/xml"},success:function(e){for(var i=e.responseXML.getElementsByTagName("row"),r=0;r<i.length;r++){for(var n=_getTagValue(i[r],"KPI_DISPLAY_FOLDER").split("\\"),o=t,s=0;s<n.length;s++){var l={header:n[s],dataType:wjcCore.DataType.Object,dimensionType:DimensionType.Folder,subFields:[]};_containsFolder(o,n[s])?o=_findSubFieldByName(o,n[s]):(o.subFields.push(l),o=l)}var a={header:_getTagValue(i[r],"KPI_CAPTION"),binding:_getTagValue(i[r],"KPI_VALUE"),dataType:wjcCore.DataType.Number,dimensionType:DimensionType.Kpi};o.subFields.push(a)}},error:function(e){i._handleError("Get KPIs",e)}})},t.prototype._execQuery=function(e,t,i){var r=this,n=this._url;return wjcCore.httpRequest(n,{async:!0,data:_ENV_QUERY(e,t),method:"POST",requestHeaders:{"Content-Type":"text/xml"},success:function(e){var n=e.responseXML,o=n.querySelector("Error");if(o)throw"SSAS Error\r\n"+o.getAttribute("Description")+"\r\n"+t;r._createPivotKeys(n),wjcCore.asFunction(i)(e)},error:function(e){r._handleError("Execute Query",e)},complete:function(e){r._endSession()}})},t.prototype._createPivotKeys=function(e){var t=null,i=null,r=e.querySelector("CellData");this._ng.columnFields.length>0||this._ng.valueFields.length>1?(i=e.querySelector("Axis[name='Axis0']"),this._ng.rowFields.length>0&&(t=e.querySelector("Axis[name='Axis1']"))):this._ng.rowFields.length>0&&(t=e.querySelector("Axis[name='Axis0']"));var n=t&&this._ng.rowFields.length>0,o=i&&this._ng.columnFields.length>0;n&&o?this._createRowKeys(r,t,i):n?this._createRowOnlyKeys(r,t):o&&this._createColumnOnlyKeys(r,i)},t.prototype._createRowKeys=function(e,t,i){for(var r=0,n=t.getElementsByTagName("Tuple"),o=i.getElementsByTagName("Tuple").length,s=0;s<n.length;s++){var l=n[s],a=this._validateTuple(l);a?r=this._createColumnKeys(e,i,a,r):r+=o}},t.prototype._createRowOnlyKeys=function(e,t){for(var i=0,r=t.getElementsByTagName("Tuple"),n=this._ng.valueFields.length,o=0;o<r.length;o++){var s=r[o],l=this._validateTuple(s);if(l){for(var a=0;a<this._ng.valueFields.length;a++)l[this._ng.valueFields[a].key]=_getCellValue(e,i++);this._jsonResult.push(l)}else i+=n}},t.prototype._createColumnKeys=function(e,t,i,r){for(var n=t.getElementsByTagName("Tuple"),o=this._ng.valueFields.length,s=0;s<n.length;s+=o){var l=n[s],a=this._validateTuple(l);if(a){for(var c in i)a[c]=i[c];for(var d=0;d<this._ng.valueFields.length;d++)a[this._ng.valueFields[d].key]=_getCellValue(e,r++);this._jsonResult.push(a)}else r+=o}return r},t.prototype._createColumnOnlyKeys=function(e,t){for(var i=0,r=t.getElementsByTagName("Tuple"),n=this._ng.valueFields.length,o=0;o<r.length;o+=n){var s=r[o],l=this._validateTuple(s);if(l){for(var a=0;a<this._ng.valueFields.length;a++)l[this._ng.valueFields[a].key]=_getCellValue(e,i++);this._jsonResult.push(l)}}},t.prototype._validateTuple=function(e){for(var t=e.getElementsByTagName("Member"),i=void 0,r={},n=0;n<t.length;n++){var o=t[n],s=_getLevelNumber(o),l=o.getAttribute("Hierarchy"),a=_getCaptionValue(o);if(0==n)i=s;else if(s>i)return null;l.indexOf(".")>=0&&(r[l]=a)}return r},t}(_ServerConnection);exports._SqlServerConnection=_SqlServerConnection;var _ENV_SESSION='\n    <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">\n        <Header>\n            <BeginSession soap:mustUnderstand="1" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:schemas-microsoft-com:xml-analysis" />\n        </Header>\n        <Body>\n            <Execute xmlns="urn:schemas-microsoft-com:xml-analysis">\n                <Command>\n                    <Statement />\n                </Command>\n                <Properties>\n                </Properties>\n            </Execute>\n        </Body>\n    </Envelope>',_ENV_ENDSESSION=function(e){return'\n    <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">\n        <Header>\n            <XA:EndSession soap:mustUnderstand="1" SessionId="'+e+'" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:XA="urn:schemas-microsoft-com:xml-analysis" />\n        </Header>\n        <Body>\n            <Execute xmlns="urn:schemas-microsoft-com:xml-analysis">\n                <Command>\n                    <Statement />\n                </Command>\n                <Properties>\n                </Properties>\n            </Execute>\n        </Body>\n    </Envelope>'},_ENV_DIMENSIONS=function(e,t){return'\n    <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">\n        <Header>\n            <XA:Session soap:mustUnderstand="1" SessionId="'+e+'" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:XA="urn:schemas-microsoft-com:xml-analysis" />\n        </Header>\n        <Body>\n            <Discover xmlns="urn:schemas-microsoft-com:xml-analysis">\n                <RequestType>MDSCHEMA_DIMENSIONS</RequestType>\n                <Restrictions>\n                    <RestrictionList>\n                        <CUBE_NAME>'+t+"</CUBE_NAME>\n                    </RestrictionList>\n                </Restrictions>\n                <Properties>\n                </Properties>\n            </Discover>\n        </Body>\n    </Envelope>"},_ENV_HIERARCHIES=function(e,t,i){return'\n    <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">\n        <Header>\n            <XA:Session soap:mustUnderstand="1" SessionId="'+e+'" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:XA="urn:schemas-microsoft-com:xml-analysis" />\n        </Header>\n        <Body>\n            <Discover xmlns="urn:schemas-microsoft-com:xml-analysis">\n                <RequestType>MDSCHEMA_HIERARCHIES</RequestType>\n                <Restrictions>\n                    <RestrictionList>\n                        <CUBE_NAME>'+t+"</CUBE_NAME>\n                        <DIMENSION_UNIQUE_NAME>"+i+"</DIMENSION_UNIQUE_NAME>\n                    </RestrictionList>\n                </Restrictions>\n                <Properties>\n                </Properties>\n            </Discover>\n        </Body>\n    </Envelope>"},_ENV_MEASURES=function(e,t){return'\n    <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">\n        <Header>\n            <XA:Session soap:mustUnderstand="1" SessionId="'+e+'" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:XA="urn:schemas-microsoft-com:xml-analysis" />\n        </Header>\n        <Body>\n            <Discover xmlns="urn:schemas-microsoft-com:xml-analysis">\n                <RequestType>MDSCHEMA_MEASURES</RequestType>\n                <Restrictions>\n                    <RestrictionList>\n                        <CUBE_NAME>'+t+"</CUBE_NAME>\n                    </RestrictionList>\n                </Restrictions>\n                <Properties>\n                </Properties>\n            </Discover>\n        </Body>\n    </Envelope>"},_ENV_KPIS=function(e,t){return'\n    <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">\n        <Header>\n            <XA:Session soap:mustUnderstand="1" SessionId="'+e+'" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:XA="urn:schemas-microsoft-com:xml-analysis" />\n        </Header>\n        <Body>\n            <Discover xmlns="urn:schemas-microsoft-com:xml-analysis">\n                <RequestType>MDSCHEMA_KPIS</RequestType>\n                <Restrictions>\n                    <RestrictionList>\n                        <CUBE_NAME>'+t+"</CUBE_NAME>\n                    </RestrictionList>\n                </Restrictions>\n                <Properties>\n                </Properties>\n            </Discover>\n        </Body>\n    </Envelope>"},_ENV_LEVELS=function(e,t){return'\n    <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">\n        <Header>\n            <XA:Session soap:mustUnderstand="1" SessionId="'+e+'" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:XA="urn:schemas-microsoft-com:xml-analysis" />\n        </Header>\n        <Body>\n            <Discover xmlns="urn:schemas-microsoft-com:xml-analysis">\n                <RequestType>MDSCHEMA_LEVELS</RequestType>\n                <Restrictions>\n                    <RestrictionList>\n                        <CUBE_NAME>'+t+"</CUBE_NAME>\n                    </RestrictionList>\n                </Restrictions>\n                <Properties>\n                </Properties>\n            </Discover>\n        </Body>\n    </Envelope>"},_ENV_PROPERTIES=function(e,t){return'\n    <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">\n        <Header>\n            <XA:Session soap:mustUnderstand="1" SessionId="'+e+'" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:XA="urn:schemas-microsoft-com:xml-analysis" />\n        </Header>\n        <Body>\n            <Discover xmlns="urn:schemas-microsoft-com:xml-analysis">\n                <RequestType>MDSCHEMA_PROPERTIES</RequestType>\n                <Restrictions>\n                    <RestrictionList>\n                        <CUBE_NAME>'+t+"</CUBE_NAME>\n                        <PROPERTY_NAME>MEMBER_VALUE</PROPERTY_NAME>\n                    </RestrictionList>\n                </Restrictions>\n                <Properties>\n                </Properties>\n            </Discover>\n        </Body>\n    </Envelope>"},_ENV_QUERY=function(e,t){return'\n    <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">\n        <Header>\n            <XA:Session soap:mustUnderstand="1" SessionId="'+e+'" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:XA="urn:schemas-microsoft-com:xml-analysis" />\n        </Header>\n        <Body>\n            <Execute xmlns="urn:schemas-microsoft-com:xml-analysis">\n                <Command>\n                    <Statement>\n                        <![CDATA[\n                        '+t+"\n                        ]]>\n                    </Statement>\n                </Command>\n                <Properties>\n                    <PropertyList>\n                        <Content>Data</Content>\n                    </PropertyList>\n                </Properties>\n            </Execute>\n        </Body>\n    </Envelope>"},_TextBuilder=function(){function e(){this._text=""}return Object.defineProperty(e.prototype,"length",{get:function(){return this._text.length},enumerable:!0,configurable:!0}),e.prototype.toString=function(){return this._text},e.prototype.append=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._text=(i=this._text).concat.apply(i,e);var i},e.prototype.joinToList=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];var r=t.join();this.length>0&&r.length>0?this._text=(n=this._text).concat.apply(n,[e].concat(t)):r.length>0&&(this._text=r);var n},e.prototype.joinItemToList=function(e){this.joinToList(",",e)},e.prototype.wrap=function(e,t){this.length>0&&(this._text=e.concat(this._text,t))},e.wrap=function(e,t,i){return t.length>0?e.concat(t,i):""},e}();exports._TextBuilder=_TextBuilder,wjcCore.culture.olap=wjcCore.culture.olap||{},wjcCore.culture.olap._ListContextMenu=window.wijmo.culture.olap._ListContextMenu||{up:"Move Up",down:"Move Down",first:"Move to Beginning",last:"Move to End",filter:"Move to Report Filter",rows:"Move to Row Labels",cols:"Move to Column Labels",vals:"Move to Values",remove:"Remove Field",edit:"Field Settings...",detail:"Show Detail..."};var _ListContextMenu=function(e){function t(t){var i=e.call(this,document.createElement("div"),{header:"Field Context Menu",displayMemberPath:"text",commandParameterPath:"parm",command:{executeCommand:function(e){i._execute(e)},canExecuteCommand:function(e){return i._canExecute(e)}}})||this;return i._full=t,i.itemsSource=i._getMenuItems(t),wjcCore.addClass(i.dropDown,"context-menu wj-olap-context-menu"),i}return __extends(t,e),t.prototype.refresh=function(t){void 0===t&&(t=!0),this.itemsSource=this._getMenuItems(this._full),e.prototype.refresh.call(this,t)},t.prototype.attach=function(e){var t=this;wjcCore.assert(e instanceof wjcGrid.FlexGrid,"Expecting a FlexGrid control...");var i=e.hostElement;i.addEventListener("contextmenu",function(r){t._selectField(e,r)&&(r.preventDefault(),t.owner=i,t.show(r))})},t.prototype._selectField=function(e,t){var i=e.hitTest(t);if(i.panel!=e.cells||!i.range.isValid)return!1;var r=e.rows[i.row].dataItem;return!(r instanceof CubePivotField&&r.subFields&&r.subFields.length)&&(e.select(i.range,!0),!0)},t.prototype._getMenuItems=function(e){var t;t=e?[{text:'<div class="menu-icon"></div>*',parm:"up"},{text:'<div class="menu-icon"></div>*',parm:"down"},{text:'<div class="menu-icon"></div>*',parm:"first"},{text:'<div class="menu-icon"></div>*',parm:"last"},{text:'<div class="wj-separator"></div>'},{text:'<div class="menu-icon"><span class="wj-glyph-filter"></span></div>*',parm:"filter"},{text:'<div class="menu-icon">&#8801;</div>*',parm:"rows"},{text:'<div class="menu-icon">&#10996;</div>*',parm:"cols"},{text:'<div class="menu-icon">&#931;</div>*',parm:"vals"},{text:'<div class="wj-separator"></div>'},{text:'<div class="menu-icon menu-icon-remove">&#10006;</div>*',parm:"remove"},{text:'<div class="wj-separator"></div>'},{text:'<div class="menu-icon">&#9965;</div>*',parm:"edit"}]:[{text:'<div class="menu-icon"><span class="wj-glyph-filter"></span></div>*',parm:"filter"},{text:'<div class="menu-icon">&#8801;</div>*',parm:"rows"},{text:'<div class="menu-icon">&#10996;</div>*',parm:"cols"},{text:'<div class="menu-icon">&#931;</div>*',parm:"vals"},{text:'<div class="wj-separator"></div>'},{text:'<div class="menu-icon">&#9965;</div>*',parm:"edit"}];for(var i=0;i<t.length;i++){var r=t[i];if(r.parm){var n=wjcCore.culture.olap._ListContextMenu[r.parm];wjcCore.assert(n,"missing localized text for item "+r.parm),r.text=r.text.replace(/([^>]+$)/,n)}}return t},t.prototype._execute=function(e){var t=wjcCore.Control.getControl(this.owner),i=t.itemsSource,r=t.selection.row,n=t.rows[r].dataItem,o=n?n.engine:null,s=this._getTargetList(o,e);switch(e){case"up":case"first":case"down":case"last":if(o){var l=i.indexOf(n),a="up"==e?l-1:"first"==e?0:"down"==e?l+1:"last"==e?i.length:-1;o.deferUpdate(function(){i.removeAt(l),i.insert(a,n)})}break;case"filter":case"rows":case"cols":case"vals":s&&n&&s.push(n);break;case"remove":n&&o.removeField(n);break;case"edit":n&&o.editField(n)}},t.prototype._canExecute=function(e){var t=wjcCore.Control.getControl(this.owner);if(!t)return!1;var i=t.selection.row,r=i>-1?t.rows[i].dataItem:null,n=r?r.engine:null,o=this._getTargetList(n,e),s=!!r&&r instanceof CubePivotField,l=!!r&&r.isMeasure;switch(e){case"up":case"first":return i>0;case"down":case"last":return i<t.rows.length-1;case"filter":case"rows":case"cols":return!l&&o&&o.indexOf(r)<0;case"vals":return(!s||l)&&o&&o.indexOf(r)<0;case"edit":return n&&n.allowFieldEditing;case"detail":return r&&!s}return!0},t.prototype._getTargetList=function(e,t){if(e)switch(t){case"filter":return e.filterFields;case"rows":return e.rowFields;case"cols":return e.columnFields;case"vals":return e.valueFields}return null},t}(wjcInput.Menu);exports._ListContextMenu=_ListContextMenu,wjcCore.culture.olap=wjcCore.culture.olap||{},wjcCore.culture.olap.PivotPanel=window.wijmo.culture.olap.PivotPanel||{fields:"Choose fields to add to report:",drag:"Drag fields between areas below:",filters:"Filters",cols:"Columns",rows:"Rows",vals:"Values",defer:"Defer Updates",update:"Update"};var PivotPanel=function(e){function t(t,i){var r=e.call(this,t,null,!0)||this;r._showIcons=!0,r._restrictDrag=null,r.itemsSourceChanged=new wjcCore.Event,r.viewDefinitionChanged=new wjcCore.Event,r.updatingView=new wjcCore.Event,r.updatedView=new wjcCore.Event;var n="Missing dependency: PivotPanel requires ";wjcCore.assert(null!=wjcInput,n+"wijmo.input."),wjcCore.assert(null!=wjcGrid&&null!=wjcGridFilter,n+"wijmo.grid.filter.");var o=r.getTemplate();r.applyTemplate("wj-control wj-content wj-pivotpanel",o,{_dFields:"d-fields",_dFilters:"d-filters",_dRows:"d-rows",_dCols:"d-cols",_dVals:"d-vals",_dProgress:"d-prog",_btnUpdate:"btn-update",_chkDefer:"chk-defer",_gFlds:"g-flds",_gDrag:"g-drag",_gFlt:"g-flt",_gCols:"g-cols",_gRows:"g-rows",_gVals:"g-vals",_gDefer:"g-defer"}),r._globalize();var s=r.hostElement;r.addEventListener(s,"dragstart",r._dragstart.bind(r)),r.addEventListener(s,"dragover",r._dragover.bind(r)),r.addEventListener(s,"dragleave",r._dragover.bind(r)),r.addEventListener(s,"drop",r._drop.bind(r)),r.addEventListener(s,"dragend",r._dragend.bind(r)),r._lbFields=r._createFieldGrid(r._dFields),r._lbFilters=r._createFieldGrid(r._dFilters),r._lbRows=r._createFieldGrid(r._dRows),r._lbCols=r._createFieldGrid(r._dCols),r._lbVals=r._createFieldGrid(r._dVals);var l=r._ctxMenuShort=new _ListContextMenu(!1);return l.attach(r._lbFields),(l=r._ctxMenuFull=new _ListContextMenu(!0)).attach(r._lbFilters),l.attach(r._lbRows),l.attach(r._lbCols),l.attach(r._lbVals),r._dMarker=wjcCore.createElement('<div class="wj-marker" style="display:none">&nbsp;</div>'),r.hostElement.appendChild(r._dMarker),r.addEventListener(r._btnUpdate,"click",function(e){r._ng.refresh(!0),e.preventDefault()}),r.addEventListener(r._chkDefer,"click",function(e){wjcCore.enable(r._btnUpdate,r._chkDefer.checked),r._chkDefer.checked?r._ng.beginUpdate():r._ng.endUpdate()}),r.engine=new PivotEngine,r.initialize(i),r}return __extends(t,e),t.prototype._getProductInfo=function(){return"D6F4,PivotPanel"},Object.defineProperty(t.prototype,"engine",{get:function(){return this._ng},set:function(e){this._ng&&(this._ng.itemsSourceChanged.removeHandler(this._itemsSourceChanged),this._ng.viewDefinitionChanged.removeHandler(this._viewDefinitionChanged),this._ng.updatingView.removeHandler(this._updatingView),this._ng.updatedView.removeHandler(this._updatedView),this._ng.error.removeHandler(this._requestError)),e=wjcCore.asType(e,PivotEngine,!1),this._ng=e,this._ng.itemsSourceChanged.addHandler(this._itemsSourceChanged,this),this._ng.viewDefinitionChanged.addHandler(this._viewDefinitionChanged,this),this._ng.updatingView.addHandler(this._updatingView,this),this._ng.updatedView.addHandler(this._updatedView,this),this._ng.error.addHandler(this._requestError,this),this._lbFields.itemsSource=e.fields,this._lbFilters.itemsSource=e.filterFields,this._lbRows.itemsSource=e.rowFields,this._lbCols.itemsSource=e.columnFields,this._lbVals.itemsSource=e.valueFields,this._lbFields.collectionView.filter=function(e){return null==e.parentField}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"itemsSource",{get:function(){return this._ng.itemsSource},set:function(e){e instanceof PivotEngine?this.engine=e:this._ng.itemsSource=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"collectionView",{get:function(){return this._ng.collectionView},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pivotView",{get:function(){return this._ng.pivotView},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"autoGenerateFields",{get:function(){return this.engine.autoGenerateFields},set:function(e){this._ng.autoGenerateFields=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fields",{get:function(){return this._ng.fields},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rowFields",{get:function(){return this._ng.rowFields},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"columnFields",{get:function(){return this._ng.columnFields},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"valueFields",{get:function(){return this._ng.valueFields},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"filterFields",{get:function(){return this._ng.filterFields},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"viewDefinition",{get:function(){return this._ng.viewDefinition},set:function(e){this._ng.viewDefinition=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isViewDefined",{get:function(){return this._ng.isViewDefined},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"showFieldIcons",{get:function(){return this._showIcons},set:function(e){e!=this._showIcons&&(this._showIcons=wjcCore.asBoolean(e),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"restrictDragging",{get:function(){return this._restrictDrag},set:function(e){this._restrictDrag=wjcCore.asBoolean(e,!0)},enumerable:!0,configurable:!0}),t.prototype.onItemsSourceChanged=function(e){this.itemsSourceChanged.raise(this,e)},t.prototype.onViewDefinitionChanged=function(e){this.viewDefinitionChanged.raise(this,e)},t.prototype.onUpdatingView=function(e){this.updatingView.raise(this,e)},t.prototype.onUpdatedView=function(e){this.updatedView.raise(this,e)},t.prototype.refresh=function(t){void 0===t&&(t=!0),this._lbFields.refresh(),this._lbFilters.refresh(),this._lbRows.refresh(),this._lbCols.refresh(),this._lbVals.refresh(),t&&(this._globalize(),this._ctxMenuShort.refresh(),this._ctxMenuFull.refresh()),e.prototype.refresh.call(this,t)},t.prototype._copy=function(e,t){switch(e){case"engine":return this.engine=t,!0}return!1},t.prototype._globalize=function(){var e=wjcCore.culture.olap.PivotPanel;wjcCore.setText(this._gFlds,e.fields),wjcCore.setText(this._gDrag,e.drag),wjcCore.setText(this._gFlt,e.filters),wjcCore.setText(this._gCols,e.cols),wjcCore.setText(this._gRows,e.rows),wjcCore.setText(this._gVals,e.vals),wjcCore.setText(this._gDefer,e.defer),wjcCore.setText(this._btnUpdate,e.update)},t.prototype._itemsSourceChanged=function(e,t){this.onItemsSourceChanged(t)},t.prototype._viewDefinitionChanged=function(e,t){e.isUpdating||(this.invalidate(),this.onViewDefinitionChanged(t))},t.prototype._updatingView=function(e,t){var i=wjcCore.clamp(t.progress,5,100)%100;this._dProgress.style.width=i+"%",this.onUpdatingView(t)},t.prototype._updatedView=function(e,t){this.onUpdatedView(t)},t.prototype._requestError=function(e,t){this._dProgress.style.width="0"},t.prototype._createFieldGrid=function(e){var t=this,i=new wjcGrid.FlexGrid(e,{autoGenerateColumns:!1,childItemsPath:"subFields",columns:[{binding:"header",width:"*"}],headersVisibility:"None",selectionMode:"Cell",showAlternatingRows:!1});return i.cells.hostElement.parentElement.style.overflowX="hidden",i.formatItem.addHandler(function(e,i){var r=e.rows[i.row].dataItem;wjcCore.assert(r instanceof PivotField,"PivotField expected...");var n=r._hasSubFields();wjcCore.toggleClass(i.cell,"wj-header",n),i.cell.setAttribute("draggable",(!n).toString());var o=i.cell.innerHTML;r.filter.isActive&&(o+='&nbsp;&nbsp;<span class="wj-glyph-filter"></span>'),e==t._lbVals&&(o+=' <span class="wj-aggregate">('+wjcCore.Aggregate[r.aggregate]+")</span>"),e!=t._lbFields||n||(t._showIcons&&(o='<span class="wj-glyph-'+(r.isMeasure?"measure":"dimension")+'"></span> '+o),o='<label><input type="checkbox"'+(r.isActive?" checked":"")+"> "+o+"</label>"),i.cell.innerHTML=o}),i.addEventListener(e,"click",function(e){var r=e.target;if(r instanceof HTMLInputElement&&"checkbox"==r.type){var n=t._hitTestField(i,e);n instanceof PivotField&&(n.isActive=r.checked)}}),i},t.prototype._dragstart=function(e){var t=this._getFlexGridTarget(e);t&&(this._dragField=this._hitTestField(t,e),this._dragSource=this._dragField instanceof PivotField?t.hostElement:null,this._dragSource&&e.dataTransfer&&(wjcCore._startDrag(e.dataTransfer,"copyMove"),e.stopPropagation()))},t.prototype._dragover=function(e){var t=!1,i=this._getFlexGridTarget(e);if(i&&this._dragField){if(this._dragSource==this._dFields&&i!=this._lbFields){var r=i.itemsSource;if(null==r.maxItems||r.length<r.maxItems){var n=this._dragField;i.itemsSource.indexOf(n)<0?t=!0:i==this._lbVals&&(t=!(n instanceof CubePivotField))}}this._dragSource&&this._dragSource!=this._dFields&&(t=!0)}if(t&&this._getRestrictDrag()&&this._dragSource!=i.hostElement){var o=this._dragField.isMeasure;i==this._lbVals?t=o:i!=this._lbRows&&i!=this._lbCols||(t=!o)}t?(this._updateDropMarker(i,e),e.dataTransfer.dropEffect=this._dragSource==this._dFields?"copy":"move",e.preventDefault(),e.stopPropagation()):this._updateDropMarker()},t.prototype._drop=function(e){var t=this,i=this._getFlexGridTarget(e);if(i&&this._dragField){var r=wjcCore.Control.getControl(this._dragSource),n=this._dragField;r==this._lbFields&&i==this._lbVals&&i.itemsSource.indexOf(n)>-1&&(n=n._clone(),this.engine.fields.push(n)),i==this._lbFields?n.isActive=!1:this._ng.deferUpdate(function(){var e=i.itemsSource,r=e.indexOf(n);r!=t._dropIndex&&(r>-1&&(e.removeAt(r),r<t._dropIndex&&t._dropIndex--),e.insert(t._dropIndex,n))})}this._resetMouseState()},t.prototype._dragend=function(e){this._resetMouseState()},t.prototype._hitTestField=function(e,t){var i=e.hitTest(t.target);return i.panel==e.cells&&i.range.isValid?(e.select(i.range,!0),e.rows[i.row].dataItem):null},t.prototype._getRestrictDrag=function(){var e=this._restrictDrag;return null==e&&this.fields.length&&(e=this.fields[0]instanceof CubePivotField),e},t.prototype._resetMouseState=function(){this._dragSource=null,this._updateDropMarker()},t.prototype._getFlexGridTarget=function(e){var t=wjcCore.Control.getControl(wjcCore.closest(e.target,".wj-flexgrid"));return t instanceof wjcGrid.FlexGrid?t:null},t.prototype._updateDropMarker=function(e,t){if(t){var i;if(e.rows.length){var r=e.hitTest(t),n=r.row;n>-1?(i=e.getCellBoundingRect(n,0),r.point.y>i.top+i.height/2&&(i.top+=i.height,n++),this._dropIndex=n):(n=e.viewRange.bottomRow,(i=e.getCellBoundingRect(n,0)).top+=i.height,this._dropIndex=n+1)}else(i=wjcCore.Rect.fromBoundingRect(e.hostElement.getBoundingClientRect())).top+=4,this._dropIndex=0;var o=this.hostElement.getBoundingClientRect();wjcCore.setCss(this._dMarker,{left:Math.round(i.left-o.left),top:Math.round(i.top-o.top-2),width:Math.round(i.width),height:4,display:""})}else this._dMarker.style.display="none"},t.controlTemplate='<div><label wj-part="g-flds"></label><div wj-part="d-fields"></div><label wj-part="g-drag"></label><table><tr><td width="50%"><label><span class="wj-glyph wj-glyph-filter"></span> <span wj-part="g-flt"></span></label><div wj-part="d-filters"></div></td><td width= "50%" style= "border-left-style:solid"><label><span class="wj-glyph">&#10996;</span> <span wj-part="g-cols"></span></label><div wj-part="d-cols"></div></td></tr><tr style= "border-top-style:solid"><td width="50%"><label><span class="wj-glyph">&#8801;</span> <span wj-part="g-rows"></span></label><div wj-part="d-rows"></div></td><td width= "50%" style= "border-left-style:solid"><label><span class="wj-glyph">&#931;</span> <span wj-part="g-vals"></span></label><div wj-part="d-vals"></div></td></tr></table><div wj-part="d-prog" class="wj-state-selected" style="width:0px;height:3px"></div><div style="display:table"><label style="display:table-cell;vertical-align:middle"><input wj-part="chk-defer" type="checkbox"/> <span wj-part="g-defer"></span></label><a wj-part="btn-update" class="wj-btn wj-state-disabled" disabled ></a></div></div>',t}(wjcCore.Control);exports.PivotPanel=PivotPanel;var _GridContextMenu=function(e){function t(){var t=e.call(this,document.createElement("div"),{header:"PivotGrid Context Menu",displayMemberPath:"text",commandParameterPath:"parm",command:{executeCommand:function(e){t._execute(e)},canExecuteCommand:function(e){return t._canExecute(e)}}})||this;return t.itemsSource=t._getMenuItems(),wjcCore.addClass(t.dropDown,"context-menu wj-olap-context-menu"),t}return __extends(t,e),t.prototype.refresh=function(t){void 0===t&&(t=!0),this.itemsSource=this._getMenuItems(),e.prototype.refresh.call(this,t)},t.prototype.attach=function(e){var t=this;wjcCore.assert(e instanceof PivotGrid,"Expecting a PivotGrid control...");var i=e.hostElement;i.addEventListener("contextmenu",function(r){if(e.customContextMenu&&(r.preventDefault(),t.owner=i,t._selectField(r))){var n=t.dropDown;t.selectedIndex=-1,t.onIsDroppedDownChanging(new wjcCore.CancelEventArgs)&&(wjcCore.showPopup(n,r),t.onIsDroppedDownChanged(),n.focus())}})},t.prototype._selectField=function(e){this._targetField=null,this._htDown=null;var t=wjcCore.Control.getControl(this.owner),i=t.engine,r=t.hitTest(e);switch(r.cellType){case wjcGrid.CellType.Cell:t.select(r.range),this._targetField=i.valueFields[r.col%i.valueFields.length],this._htDown=r;break;case wjcGrid.CellType.ColumnHeader:this._targetField=i.columnFields[r.row];break;case wjcGrid.CellType.RowHeader:this._targetField=i.rowFields[r.col];break;case wjcGrid.CellType.TopLeft:r.row==r.panel.rows.length-1&&(this._targetField=i.rowFields[r.col])}return null!=this._targetField},t.prototype._getMenuItems=function(){for(var e=[{text:'<div class="menu-icon menu-icon-remove">&#10006;</div>Remove Field',parm:"remove"},{text:'<div class="menu-icon">&#9965;</div>Field Settings...',parm:"edit"},{text:'<div class="wj-separator"></div>'},{text:'<div class="menu-icon">&#8981;</div>Show Detail...',parm:"detail"}],t=0;t<e.length;t++){var i=e[t];if(i.parm){var r=wjcCore.culture.olap._ListContextMenu[i.parm];wjcCore.assert(r,"missing localized text for item "+i.parm),i.text=i.text.replace(/([^>]+$)/,r)}}return e},t.prototype._execute=function(e){var t=wjcCore.Control.getControl(this.owner),i=this._targetField,r=this._htDown;switch(e){case"remove":t.engine.removeField(i);break;case"edit":t.engine.editField(i);break;case"detail":t.showDetail(r.row,r.col)}},t.prototype._canExecute=function(e){var t=this._targetField,i=wjcCore.Control.getControl(this.owner),r=i?i.engine:null;switch(e){case"remove":return null!=t;case"edit":return null!=t&&r&&r.allowFieldEditing;case"detail":return null!=this._htDown&&r.valueFields.length&&null!=t&&!(t instanceof CubePivotField)}return!0},t}(wjcInput.Menu);exports._GridContextMenu=_GridContextMenu;var _PivotMergeManager=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.getMergedRange=function(t,i,r,n){void 0===n&&(n=!0);var o=t.grid.collectionView;if(this._ng=o instanceof PivotCollectionView?o.engine:null,!this._ng)return e.prototype.getMergedRange.call(this,t,i,r,n);if(i<0||i>=t.rows.length||r<0||r>=t.columns.length)return null;switch(t.cellType){case wjcGrid.CellType.TopLeft:return this._getMergedTopLeftRange(t,i,r);case wjcGrid.CellType.RowHeader:return this._getMergedRowHeaderRange(t,i,r,n?t.viewRange:null);case wjcGrid.CellType.ColumnHeader:return this._getMergedColumnHeaderRange(t,i,r,n?t.viewRange:null)}return null},t.prototype._getMergedTopLeftRange=function(e,t,i){for(var r=new wjcGrid.CellRange(t,i);r.col>0&&!e.getCellData(t,r.col,!0);)r.col--;for(;r.col2<e.columns.length-1&&!e.getCellData(t,r.col2+1,!0);)r.col2++;return r},t.prototype._getMergedRowHeaderRange=function(e,t,i,r){var n=this._ng._getRowLevel(t);if(n>-1&&i>=n){var o=e.getCellData(t,i,!1),s=void 0,l=void 0,a=r?r.col:0,c=r?r.col2:e.columns.length-1;for(s=i;s>a&&e.getCellData(t,s-1,!1)==o;s--);for(l=i;l<c&&e.getCellData(t,l+1,!1)==o;l++);return s!=l?new wjcGrid.CellRange(t,s,t,l):null}var d,u,h=r?r.row:0,p=r?r.row2:e.rows.length-1;for(d=t;d>h&&this._sameColumnValues(e,t,d-1,i);d--);for(u=t;u<p&&this._sameColumnValues(e,t,u+1,i);u++);return d!=u?new wjcGrid.CellRange(d,i,u,i):null},t.prototype._sameColumnValues=function(e,t,i,r){for(;r>=0;r--)if(e.getCellData(t,r,!1)!=e.getCellData(i,r,!1))return!1;return!0},t.prototype._getMergedColumnHeaderRange=function(e,t,i,r){var n=this._ng._getKey(e.columns[i].binding),o=e.getCellData(t,i,!1),s=this._ng._getColLevel(n);if(s>-1&&t>=s){var l=void 0,a=void 0,c=r?r.row:0,d=r?r.row2:e.rows.length-1;for(l=t;l>c&&e.getCellData(l-1,i,!1)==o;l--);for(a=t;a<d&&e.getCellData(a+1,i,!1)==o;a++);if(l!=a)return new wjcGrid.CellRange(l,i,a,i)}var u,h,p=r?r.col:0,_=r?r.col2:e.columns.length-1;for(u=i;u>p&&this._sameRowValues(e,t,i,u-1);u--);for(h=i;h<_&&this._sameRowValues(e,t,i,h+1);h++);return u!=h?new wjcGrid.CellRange(t,u,t,h):null},t.prototype._sameRowValues=function(e,t,i,r){for(;t>=0;t--)if(e.getCellData(t,i,!1)!=e.getCellData(t,r,!1))return!1;return!0},t}(wjcGrid.MergeManager);exports._PivotMergeManager=_PivotMergeManager;var PivotGrid=function(e){function t(t,i){var r=e.call(this,t)||this;return r._showDetailOnDoubleClick=!0,r._collapsibleSubtotals=!0,r._customCtxMenu=!0,r._showRowFldSort=!1,r._showRowFldHdrs=!0,r._showColFldHdrs=!0,r._centerVert=!0,r._collapsedKeys={},wjcCore.addClass(r.hostElement,"wj-pivotgrid"),r.isReadOnly=!0,r.deferResizing=!0,r.showAlternatingRows=!1,r.autoGenerateColumns=!1,r.allowDragging=wjcGrid.AllowDragging.None,r.mergeManager=new _PivotMergeManager(r),r.customContextMenu=!0,r.initialize(i),r.formatItem.addHandler(r._formatItem,r),r.addEventListener(r.hostElement,"mousedown",r._mousedown.bind(r),!0),r.addEventListener(r.hostElement,"mouseup",r._mouseup.bind(r),!0),r.addEventListener(r.hostElement,"dblclick",r._dblclick.bind(r),!0),r._ctxMenu=new _GridContextMenu,r._ctxMenu.attach(r),r}return __extends(t,e),t.prototype._getProductInfo=function(){return"D6F4,PivotGrid"},Object.defineProperty(t.prototype,"engine",{get:function(){return this._ng},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"showDetailOnDoubleClick",{get:function(){return this._showDetailOnDoubleClick},set:function(e){this._showDetailOnDoubleClick=wjcCore.asBoolean(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"showRowFieldHeaders",{get:function(){return this._showRowFldHdrs},set:function(e){e!=this._showRowFldHdrs&&(this._showRowFldHdrs=wjcCore.asBoolean(e),this._updateFixedContent())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"showColumnFieldHeaders",{get:function(){return this._showColFldHdrs},set:function(e){e!=this._showColFldHdrs&&(this._showColFldHdrs=wjcCore.asBoolean(e),this._updateFixedContent())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"showRowFieldSort",{get:function(){return this._showRowFldSort},set:function(e){e!=this._showRowFldSort&&(this._showRowFldSort=wjcCore.asBoolean(e),this._updateFixedContent())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"customContextMenu",{get:function(){return this._customCtxMenu},set:function(e){this._customCtxMenu=wjcCore.asBoolean(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"collapsibleSubtotals",{get:function(){return this._collapsibleSubtotals},set:function(e){e!=this._collapsibleSubtotals&&(this._collapsibleSubtotals=wjcCore.asBoolean(e),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"centerHeadersVertically",{get:function(){return this._centerVert},set:function(e){e!=this._centerVert&&(this._centerVert=wjcCore.asBoolean(e),this.invalidate())},enumerable:!0,configurable:!0}),t.prototype.getDetail=function(e,t){var i=this.rows[wjcCore.asInt(e)].dataItem,r=this.columns[wjcCore.asInt(t)].binding;return this._ng.getDetail(i,r)},t.prototype.getKeys=function(e,t){var i=this.rows[wjcCore.asInt(e)].dataItem,r=this.columns[wjcCore.asInt(t)].binding;return this._ng.getKeys(i,r)},t.prototype.getDetailView=function(e,t){var i=this.rows[wjcCore.asInt(e)].dataItem,r=this.columns[wjcCore.asInt(t)].binding;return this._ng.getDetailView(i,r)},t.prototype.showDetail=function(e,t){if(this._ng.valueFields.length){var i=new DetailDialog(document.createElement("div"));i.showDetail(this,new wjcGrid.CellRange(e,t));var r=new wjcInput.Popup(document.createElement("div"));r.content=i.hostElement,r.show(!0)}},t.prototype.collapseRowsToLevel=function(e){this._collapseRowsToLevel(e)},t.prototype.collapseColumnsToLevel=function(e){this._collapseColsToLevel(e)},t.prototype._getQuickAutoSize=function(){return wjcCore.isBoolean(this.quickAutoSize)?this.quickAutoSize:this.formatItem.handlerCount<=1&&null==this.itemFormatter},t.prototype._bindGrid=function(t){var i=this;this.deferUpdate(function(){var r=i.preserveOutlineState,n=i._collapsedKeys,o=i.rows,s=i.columns;if(r||(n=i._collapsedKeys={}),e.prototype._bindGrid.call(i,t),i._ng&&r&&!wjcCore.isEmpty(n)){for(var l=i._ng.totalsBeforeData,a=l?o.length-1:0,c=l?-1:o.length,d=l?-1:1,u=a;u!=c;u+=d){var h=o[u].dataItem;(_=h?h[_PivotKey._ROW_KEY_NAME]:null)&&_.level>0&&n[_.toString()]&&i._setRowCollapsed(new wjcGrid.CellRange(u,_.level-1),!0)}a=l?s.length-1:0,c=l?-1:s.length,d=l?-1:1;for(u=a;u!=c;u+=d){var p=s[u].binding,_=i._ng._getKey(p);_&&_.level>0&&n[_.toString()]&&i._setColCollapsed(new wjcGrid.CellRange(_.level-1,u),!0)}}})},t.prototype._getCollectionView=function(e){return e instanceof PivotPanel?e=e.engine.pivotView:e instanceof PivotEngine&&(e=e.pivotView),wjcCore.asCollectionView(e)},t.prototype.refresh=function(t){void 0===t&&(t=!0),this._ctxMenu.refresh(),e.prototype.refresh.call(this,t)},t.prototype.onItemsSourceChanged=function(t){this._ng&&(this._ng.updatedView.removeHandler(this._updatedView,this),this._ng.viewDefinitionChanged.removeHandler(this._viewDefinitionChanged,this)),this._collapsedKeys={};var i=this.collectionView;this._ng=i instanceof PivotCollectionView?i.engine:null,this._ng&&(this._ng.updatedView.addHandler(this._updatedView,this),this._ng.viewDefinitionChanged.addHandler(this._viewDefinitionChanged,this)),this._updateFixedCounts(),this._bindGrid(!0),e.prototype.onItemsSourceChanged.call(this,t)},t.prototype.onResizedColumn=function(t){var i=this._ng;if(i){if(t.panel.columns==this.rowHeaders.columns){var r=i.rowFields;t.col<r.length&&((n=r[t.col]).width=t.panel.columns[t.col].renderWidth)}if(t.panel.columns==this.columnHeaders.columns&&(r=i.valueFields).length>0){var n=r[t.col%r.length];n.width=t.panel.columns[t.col].renderWidth}}e.prototype.onResizedColumn.call(this,t)},t.prototype.onDraggedColumn=function(t){var i=this._ng;if(i&&t.panel.columns==this.topLeftCells.columns){var r=i.rowFields,n=r[t.data.col];i.deferUpdate(function(){r.removeAt(t.data.col),r.insert(t.col,n)})}e.prototype.onDraggedColumn.call(this,t)},t.prototype._updatedView=function(){this._updateFixedCounts(),this.columns.clear(),this.rows.clear()},t.prototype._viewDefinitionChanged=function(){this._collapsedKeys={}},t.prototype.onLoadedRows=function(t){if(0==this.columns.length){var i=this.collectionView,r=i?i.sourceCollection:null;if(r&&r.length){var n=r[0];for(var o in n)if(o!=_PivotKey._ROW_KEY_NAME){var s=new wjcGrid.Column({binding:o,dataType:null!=n[o]?wjcCore.getType(n[o]):wjcCore.DataType.Number});this.columns.push(s)}}}this._updateFixedContent(),e.prototype.onLoadedRows.call(this,t)},t.prototype._updateFixedCounts=function(){var e,t=this._ng,i=t&&t.isViewDefined;e=Math.max(1,i?t.rowFields.length:1),this._setLength(this.topLeftCells.columns,e),e=Math.max(1,i?t.columnFields.length:1),t&&t.columnFields.length&&t.valueFields.length>1&&e++,this._setLength(this.topLeftCells.rows,e)},t.prototype._setLength=function(e,t){for(;e.length<t;)e.push(e instanceof wjcGrid.ColumnCollection?new wjcGrid.Column:new wjcGrid.Row);for(;e.length>t;)e.removeAt(e.length-1)},t.prototype._updateFixedContent=function(){var e=this._ng;if(e&&e.isViewDefined){for(var t=this.topLeftCells,i=0;i<t.rows.length;i++)for(c=0;c<t.columns.length;c++){s="";this.showRowFieldHeaders&&c<e.rowFields.length&&i==t.rows.length-1&&(s=e.rowFields[c].header),this.showColumnFieldHeaders&&!s&&i<e.columnFields.length&&0==c&&(s=e.columnFields[i].header+":"),t.setCellData(i,c,s,!1,!1)}t=this.rowHeaders;for(i=0;i<t.rows.length;i++){r=t.rows[i].dataItem[_PivotKey._ROW_KEY_NAME];wjcCore.assert(r instanceof _PivotKey,"missing PivotKey for row...");for(c=0;c<t.columns.length;c++){s=r.getValue(c,!0);t.setCellData(i,c,s,!1,!1)}}t=this.columnHeaders;for(c=0;c<t.columns.length;c++){var r=e._getKey(t.columns[c].binding),n=e.valueFields,o=n.length>1||0==n.length||r.level>-1;wjcCore.assert(r instanceof _PivotKey,"missing PivotKey for column...");for(i=0;i<t.rows.length;i++){var s=o&&i==t.rows.length-1&&n.length?n[c%n.length].header:r.getValue(i,!0);t.setCellData(i,c,s,!1,!1)}}t=this.topLeftCells;for(c=0;c<t.columns.length;c++){var l=t.columns[c],a=c<e.rowFields.length?e.rowFields[c]:null;l.width=a&&wjcCore.isNumber(a.width)?a.width:this.columns.defaultSize,l.wordWrap=a?a.wordWrap:null,l.align=null}t=this.cells;for(var c=0;c<t.columns.length;c++){var l=t.columns[c],a=e.valueFields.length?e.valueFields[c%e.valueFields.length]:null;l.width=a&&wjcCore.isNumber(a.width)?a.width:this.columns.defaultSize,l.wordWrap=a?a.wordWrap:null,l.format=a?a.format:null}}else this.topLeftCells.setCellData(0,0,null)},t.prototype._formatItem=function(e,t){var i=this._ng;if(i){if(t.panel==this.topLeftCells){t.cell.style.textAlign="";var r=t.row<t.panel.rows.length-1||0==i.rowFields.length;wjcCore.toggleClass(t.cell,"wj-col-field-hdr",r),wjcCore.toggleClass(t.cell,"wj-row-field-hdr",!r)}t.panel==this.columnHeaders&&(i.valueFields.length<2||t.row<t.panel.rows.length-1)&&(t.cell.style.textAlign="");var n=null;t.panel==this.topLeftCells&&t.row==t.panel.rows.length-1&&this.allowDragging&wjcGrid.AllowDragging.Columns&&(n=!0),wjcCore.setAttribute(t.cell,"draggable",n);var o=i._getRowLevel(t.row),s=i._getColLevel(t.panel.columns[t.col].binding);if(wjcCore.toggleClass(t.cell,"wj-aggregate",o>-1||s>-1),this._collapsibleSubtotals){if(t.panel==this.rowHeaders&&i._getShowRowTotals()==ShowTotals.Subtotals){l=this.getMergedRange(t.panel,t.row,t.col,!1)||t.range;t.col<i.rowFields.length-1&&l.rowSpan>1&&(t.cell.innerHTML=this._getCollapsedGlyph(this._getRowCollapsed(l))+t.cell.innerHTML)}if(t.panel==this.columnHeaders&&i._getShowColTotals()==ShowTotals.Subtotals){var l=this.getMergedRange(t.panel,t.row,t.col,!1)||t.range;t.row<i.columnFields.length-1&&l.columnSpan>1&&(t.cell.innerHTML=this._getCollapsedGlyph(this._getColCollapsed(l))+t.cell.innerHTML)}}if(t.panel==this.topLeftCells&&this.showRowFieldSort&&t.col<i.rowFields.length&&t.row==this._getSortRowIndex()){var a=i.rowFields[t.col];wjcCore.toggleClass(t.cell,"wj-sort-asc",!a.descending),wjcCore.toggleClass(t.cell,"wj-sort-desc",a.descending),t.cell.innerHTML+=' <span class="wj-glyph-'+(a.descending?"down":"up")+'"></span>'}if(this._centerVert&&t.cell.hasChildNodes&&(t.panel==this.rowHeaders||t.panel==this.columnHeaders)){var c=wjcCore.createElement('<div style="display:table-cell;vertical-align:middle"></div>');this._docRange||(this._docRange=document.createRange()),this._docRange.selectNodeContents(t.cell),this._docRange.surroundContents(c),wjcCore.setCss(t.cell,{display:"table",tableLayout:"fixed",paddingTop:0,paddingBottom:0})}}},t.prototype._getCollapsedGlyph=function(e){return'<div style="display:inline-block;cursor:pointer" '+t._WJA_COLLAPSE+'><span class="wj-glyph-'+(e?"plus":"minus")+'"></span></div>&nbsp'},t.prototype._mousedown=function(e){if(e.defaultPrevented||0!=e.button)this._htDown=null;else if(this._htDown=this.hitTest(e),null!=wjcCore.closest(e.target,"["+t._WJA_COLLAPSE+"]")&&null!=this._htDown.panel){var i=this._htDown.range,r=void 0;switch(this._htDown.panel.cellType){case wjcGrid.CellType.RowHeader:r=this._getRowCollapsed(i),e.shiftKey||e.ctrlKey?this._collapseRowsToLevel(i.col+(r?2:1)):this._setRowCollapsed(i,!r);break;case wjcGrid.CellType.ColumnHeader:r=this._getColCollapsed(i),e.shiftKey||e.ctrlKey?this._collapseColsToLevel(i.row+(r?2:1)):this._setColCollapsed(i,!r)}this._htDown=null,e.preventDefault()}},t.prototype._mouseup=function(e){if(this._htDown&&!e.defaultPrevented&&"col-resize"!=this.hostElement.style.cursor){var t=this.hitTest(e);if(this._htDown.panel==t.panel&&t.range.equals(this._htDown.range)){var i=this._ng,r=this.topLeftCells;if(t.panel==r&&t.row==r.rows.length-1&&t.col>-1){if(this.allowSorting&&t.panel.columns[t.col].allowSorting){var n=new wjcGrid.CellRangeEventArgs(t.panel,t.range);if(this.onSortingColumn(n)){i.pivotView.sortDescriptions.clear();var o=i.rowFields[t.col];o.descending=!o.descending,this.onSortedColumn(n)}}e.preventDefault()}}}},t.prototype._dblclick=function(e){if(this._ng&&this._ng.fields.length>0&&!(this._ng.fields[0]instanceof CubePivotField)&&!e.defaultPrevented&&this._showDetailOnDoubleClick){var t=this._htDown;t&&t.panel==this.cells&&this.showDetail(t.row,t.col)}},t.prototype._getRowLevel=function(e){return this._ng._getRowLevel(e)},t.prototype._getGroupedRows=function(e){var t,i,r=this._getRowLevel.bind(this),n=e.col+1;if(this._ng.totalsBeforeData){for(i=e.row;i<this.rows.length-1&&!((o=r(i+1))>-1&&o<=n);i++);for(t=i;t>0&&r(t)!=n;t--);}else{for(t=e.row;t>0;t--){var o=r(t-1);if(o>-1&&o<=n)break}for(i=t;i<this.rows.length-1&&r(i)!=n;i++);}return r(t)==n&&t++,r(i)==n&&i--,wjcCore.assert(i>=t,"group end < start?"),i>=t?new wjcGrid.CellRange(t,e.col,i,e.col2):e},t.prototype._toggleRowCollapsed=function(e){this._setRowCollapsed(e,!this._getRowCollapsed(e))},t.prototype._getRowCollapsed=function(e){e=this._getGroupedRows(e);var t=this._ng.totalsBeforeData?e.row-1:e.row2+1,i=this.rows[t]||this.rows[e.row],r=i?i.dataItem[_PivotKey._ROW_KEY_NAME]:null;return!!r&&this._collapsedKeys[r.toString()]},t.prototype._setRowCollapsed=function(e,t){var i=this;e=this._getGroupedRows(e);var r=this._ng.totalsBeforeData?e.row-1:e.row2+1,n=this.rows[r]||this.rows[e.row],o=n?n.dataItem[_PivotKey._ROW_KEY_NAME]:null;o&&(this._collapsedKeys[o.toString()]=t),this.deferUpdate(function(){for(l=e.row;l<=e.row2;l++)i.rows[l].visible=!t;if(n&&(n.visible=!0),!t){for(var o=i._getRowLevel(r),s=[],l=e.row;l<=e.row2;l++)if(i._getRowLevel(l)>-1){var a=i._getGroupedRows(new wjcGrid.CellRange(l,o));wjcCore.assert(a.row>=e.row&&a.row2<=e.row2,"child range overflow"),s.push(a),l++}s.forEach(function(e){var t=i._getRowCollapsed(e);i._setRowCollapsed(e,t)})}})},t.prototype._collapseRowsToLevel=function(e){var t=this;e>=this._ng.rowFields.length&&(e=-1),this.deferUpdate(function(){for(var i=0;i<t.rows.length;i++){var r=t._getRowLevel(i);if(r>0){var n=t.rows[i].dataItem[_PivotKey._ROW_KEY_NAME];t._collapsedKeys[n.toString()]=e>0&&r>=e}if(e<0)t.rows[i].visible=!0;else{var o=r>-1&&r<=e;o||(t._ng.totalsBeforeData?0==i&&(o=!0):i==t.rows.length-1&&(o=!0)),t.rows[i].visible=o}}})},t.prototype._getColLevel=function(e){return this._ng._getColLevel(this.columns[e].binding)},t.prototype._getGroupedCols=function(e){var t,i=this._getColLevel.bind(this),r=e.row+1,n=e.col;if(this._ng.totalsBeforeData)for(n=e.col2;n<this.columns.length&&(o=i(n))==r;n++);for(;n>0&&!((o=i(n-1))>-1&&o<=r);n--);for(t=n;t<this.columns.length-1;t++){var o=i(t+1);if(o>-1&&o<=r)break}return i(n)==r&&n++,i(t)==r&&t--,wjcCore.assert(t>=n,"group end < start?"),t>=n?new wjcGrid.CellRange(e.row,n,e.row2,t):e},t.prototype._toggleColCollapsed=function(e){this._setColCollapsed(e,!this._getColCollapsed(e))},t.prototype._getColCollapsed=function(e){e=this._getGroupedCols(e);var t=this._ng,i=t.totalsBeforeData?e.col-t.valueFields.length:e.col2+1,r=this.columns[i],n=r?r.binding:null;return!!n&&this._collapsedKeys[n.toString()]},t.prototype._setColCollapsed=function(e,t){var i=this;e=this._getGroupedCols(e);var r=this._ng,n=r.totalsBeforeData?e.col-r.valueFields.length:e.col2+1,o=this.columns[n],s=o?o.binding:null;s&&(this._collapsedKeys[s.toString()]=t),this.deferUpdate(function(){for(var o=1;o<=r.valueFields.length;o++)i.columns[r.totalsBeforeData?e.col-o:e.col2+o].visible=!0;for(a=e.col;a<=e.col2;a++)i.columns[a].visible=!t;if(!t){for(var s=i._getColLevel(n),l=[],a=e.col;a<=e.col2;a++)if(i._getColLevel(a)>-1){var c=i._getGroupedCols(new wjcGrid.CellRange(s,a));wjcCore.assert(c.col>=e.col&&c.col2<=e.col2,"child range overflow"),l.push(c),a+=r.valueFields.length-1}l.forEach(function(e){var t=i._getColCollapsed(e);i._setColCollapsed(e,t)})}})},t.prototype._collapseColsToLevel=function(e){var t=this;e>=this._ng.columnFields.length&&(e=-1),this.deferUpdate(function(){for(var i=0;i<t.columns.length;i++){var r=t._getColLevel(i);if(r>0){var n=t._ng._getKey(t.columns[i].binding);t._collapsedKeys[n.toString()]=e>0&&r>=e}if(e<0)t.columns[i].visible=!0;else{var o=r>-1&&r<=e;t.columns[i].visible=o}}})},t._WJA_COLLAPSE="wj-pivot-collapse",t}(wjcGrid.FlexGrid);exports.PivotGrid=PivotGrid,wjcCore.culture.olap=wjcCore.culture.olap||{},wjcCore.culture.olap.DetailDialog=window.wijmo.culture.olap.DetailDialog||{header:"Detail View:",ok:"OK",items:"{cnt:n0} items",item:"{cnt} item",row:"Row",col:"Column"};var DetailDialog=function(e){function t(t,i){var r=e.call(this,t,null,!0)||this,n=r.getTemplate();r.applyTemplate("wj-control wj-content wj-detaildialog",n,{_sCnt:"sp-cnt",_dSummary:"div-summary",_dGrid:"div-grid",_btnOK:"btn-ok",_gHdr:"g-hdr"});var o=wjcCore.culture.olap.DetailDialog;return r._gHdr.textContent=o.header,r._btnOK.textContent=o.ok,r._g=new wjcGrid.FlexGrid(r._dGrid,{isReadOnly:!0}),r.initialize(i),r}return __extends(t,e),t.prototype.showDetail=function(e,t){var i=this,r=e.getDetailView(t.row,t.col);this._g.itemsSource=r;var n=wjcCore.tryCast(r,"IPagedCollectionView");this._updateDetailCount(n?n.totalItemCount:r.items.length),r.collectionChanged.addHandler(function(){i._updateDetailCount(r.items.length)});var o=e.engine,s=wjcCore.culture.olap.DetailDialog,l="",a=e.rows[t.row].dataItem[_PivotKey._ROW_KEY_NAME],c=this._getHeader(a);c&&(l+=s.row+": <b>"+wjcCore.escapeHtml(c)+"</b><br>");var d=o._getKey(e.columns[t.col].binding),u=this._getHeader(d);u&&(l+=s.col+": <b>"+wjcCore.escapeHtml(u)+"</b><br>");var h=o.valueFields,p=h[t.col%h.length].header,_=e.getCellData(t.row,t.col,!0);l+=wjcCore.escapeHtml(p)+": <b>"+wjcCore.escapeHtml(_)+"</b>",this._dSummary.innerHTML=l},t.prototype._updateDetailCount=function(e){var t=wjcCore.culture.olap.DetailDialog;this._sCnt.textContent=wjcCore.format(1==e?t.item:t.items,{cnt:e})},t.prototype._getHeader=function(e){if(e&&e.values&&e.values.length){for(var t=[],i=0;i<e.values.length;i++)t.push(e.getValue(i,!0));return t.join(" - ")}return null},t.controlTemplate='<div><div class="wj-dialog-header"><span wj-part="g-hdr">Detail View:</span> <span wj-part="sp-cnt"></span></div><div class="wj-dialog-body"><div wj-part="div-summary"></div><div wj-part="div-grid"></div></div><div class="wj-dialog-footer"><a wj-part="btn-ok"class="wj-hide wj-btn">OK</a>&nbsp;&nbsp;</div></div>',t}(wjcCore.Control);exports.DetailDialog=DetailDialog,wjcCore.culture.olap=wjcCore.culture.olap||{},wjcCore.culture.olap.PivotChart=window.wijmo.culture.olap.PivotChart||{by:"by",and:"and"};var PivotChartType;!function(e){e[e.Column=0]="Column",e[e.Bar=1]="Bar",e[e.Scatter=2]="Scatter",e[e.Line=3]="Line",e[e.Area=4]="Area",e[e.Pie=5]="Pie"}(PivotChartType=exports.PivotChartType||(exports.PivotChartType={}));var LegendVisibility;!function(e){e[e.Always=0]="Always",e[e.Never=1]="Never",e[e.Auto=2]="Auto"}(LegendVisibility=exports.LegendVisibility||(exports.LegendVisibility={}));var PivotChart=function(e){function t(i,r){var n=e.call(this,i)||this;return n._chartType=PivotChartType.Column,n._showHierarchicalAxes=!0,n._showTotals=!1,n._showTitle=!0,n._showLegend=LegendVisibility.Always,n._legendPosition=wjcChart.Position.Right,n._maxSeries=t.MAX_SERIES,n._maxPoints=t.MAX_POINTS,n._stacking=wjcChart.Stacking.None,n._colItms=[],n._dataItms=[],n._lblsSrc=[],n._grpLblsSrc=[],wjcCore.addClass(n.hostElement,"wj-pivotchart"),n._isPieChart()?n._createFlexPie():n._createFlexChart(),e.prototype.initialize.call(n,r),n}return __extends(t,e),t.prototype._getProductInfo=function(){return"D6F4,PivotChart"},Object.defineProperty(t.prototype,"engine",{get:function(){return this._ng},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"itemsSource",{get:function(){return this._itemsSource},set:function(e){if(e&&this._itemsSource!==e){var t=this._itemsSource;e instanceof PivotPanel?e=e.engine.pivotView:e instanceof PivotEngine&&(e=e.pivotView),this._itemsSource=wjcCore.asCollectionView(e),this._onItemsSourceChanged(t)}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"chartType",{get:function(){return this._chartType},set:function(e){if((e=wjcCore.asEnum(e,PivotChartType))!=this._chartType){var t=this._chartType;this._chartType=e,this._changeChartType(),e!==PivotChartType.Bar&&t!==PivotChartType.Bar||this._updatePivotChart()}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"showHierarchicalAxes",{get:function(){return this._showHierarchicalAxes},set:function(e){e!=this._showHierarchicalAxes&&(this._showHierarchicalAxes=wjcCore.asBoolean(e,!0),!this._isPieChart()&&this._flexChart&&this._updateFlexChart(this._dataItms,this._lblsSrc,this._grpLblsSrc))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"showTotals",{get:function(){return this._showTotals},set:function(e){e!=this._showTotals&&(this._showTotals=wjcCore.asBoolean(e,!0),this._updatePivotChart())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"showTitle",{get:function(){return this._showTitle},set:function(e){e!=this._showTitle&&(this._showTitle=wjcCore.asBoolean(e,!0),this._updatePivotChart())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"showLegend",{get:function(){return this._showLegend},set:function(e){(e=wjcCore.asEnum(e,LegendVisibility))!=this.showLegend&&(this._showLegend=e,this._updatePivotChart())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"legendPosition",{get:function(){return this._legendPosition},set:function(e){(e=wjcCore.asEnum(e,wjcChart.Position))!=this.legendPosition&&(this._legendPosition=e,this._updatePivotChart())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"stacking",{get:function(){return this._stacking},set:function(e){(e=wjcCore.asEnum(e,wjcChart.Stacking))!=this._stacking&&(this._stacking=e,this._flexChart&&(this._flexChart.stacking=this._stacking,this._updatePivotChart()))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"maxSeries",{get:function(){return this._maxSeries},set:function(e){e!=this._maxSeries&&(this._maxSeries=wjcCore.asNumber(e),this._updatePivotChart())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"maxPoints",{get:function(){return this._maxPoints},set:function(e){e!=this._maxPoints&&(this._maxPoints=wjcCore.asNumber(e),this._updatePivotChart())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"flexChart",{get:function(){return this._flexChart},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"flexPie",{get:function(){return this._flexPie},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"header",{get:function(){return this._header},set:function(e){e!=this._header&&(this._header=wjcCore.asString(e,!0),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"footer",{get:function(){return this._footer},set:function(e){e!=this._footer&&(this._footer=wjcCore.asString(e,!0),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"headerStyle",{get:function(){return this._headerStyle},set:function(e){e!=this._headerStyle&&(this._headerStyle=e,this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"footerStyle",{get:function(){return this._footerStyle},set:function(e){e!=this._footerStyle&&(this._footerStyle=e,this.invalidate())},enumerable:!0,configurable:!0}),t.prototype.refresh=function(t){void 0===t&&(t=!0),e.prototype.refresh.call(this,t),this._isPieChart()?this._flexPie&&this._flexPie.refresh(t):this._flexChart&&this._flexChart.refresh(t)},t.prototype.saveImageToDataUrl=function(e,t){this._isPieChart()?this._flexPie&&this._flexPie.saveImageToDataUrl(e,t):this._flexChart&&this._flexChart.saveImageToDataUrl(e,t)},t.prototype.saveImageToFile=function(e){this._isPieChart()?this._flexPie&&this._flexPie.saveImageToFile(e):this._flexChart&&this._flexChart.saveImageToFile(e)},t.prototype._onItemsSourceChanged=function(e){this._ng&&this._ng.updatedView.removeHandler(this._updatePivotChart,this),e&&e.collectionChanged.removeHandler(this._updatePivotChart,this);var t=this._itemsSource;this._ng=t instanceof PivotCollectionView?t.engine:null,this._ng&&this._ng.updatedView.addHandler(this._updatePivotChart,this),this._itemsSource&&this._itemsSource.collectionChanged.addHandler(this._updatePivotChart,this),this._updatePivotChart()},t.prototype._createFlexChart=function(){var e=this,t=document.createElement("div");this.hostElement.appendChild(t),this._flexChart=new wjcChart.FlexChart(t),this._flexChart._bindingSeparator=null,this._flexChart.legend.position=wjcChart.Position.Right,this._flexChart.bindingX=_PivotKey._ROW_KEY_NAME,this._flexChart.stacking=this._stacking,this._flexChart.tooltip.content=function(t){var i=t.name?"<b>"+t.name+"</b> <br/>":"";return i+=e._getLabel(t.x)+" "+e._getValue(t)},this._flexChart.hostElement.style.visibility="hidden"},t.prototype._createFlexPie=function(){var e=this,t=document.createElement("div");this.hostElement.appendChild(t),this._colMenu=new wjcInput.Menu(t),this._colMenu.displayMemberPath="text",this._colMenu.selectedValuePath="prop",this._colMenu.hostElement.style.visibility="hidden";var i=document.createElement("div");this.hostElement.appendChild(i),this._flexPie=new wjcChart.FlexPie(i),this._flexPie.bindingName=_PivotKey._ROW_KEY_NAME,this._flexPie.tooltip.content=function(t){return"<b>"+e._getLabel(e._dataItms[t.pointIndex][_PivotKey._ROW_KEY_NAME])+"</b> <br/>"+e._getValue(t)},this._flexPie.rendering.addHandler(this._updatePieInfo,this)},t.prototype._updatePivotChart=function(){if(this._ng&&this._ng.pivotView){for(var e,t=[],i=[],r=[],n=0,o=this._ng.pivotView,s=this._ng.rowFields,l=0;l<o.items.length;l++){var a=o.items[l],c=a.$rowKey;if(0==l&&this._getColumns(a),t.length>=this._maxPoints)break;if(!this._isTotalRow(a[_PivotKey._ROW_KEY_NAME])){t.push(a),i.push({value:t.length-1,text:this._getLabel(a[_PivotKey._ROW_KEY_NAME])});for(h=0;h<s.length;h++)if(r.length<=h&&r.push([]),this._getMergeIndex(c,e)<h){n=r[h].length-1;var d=r[h][n];if(0===n&&h<s.length-1&&(d.value=(d.width-1)/2),n>0&&h<s.length-1){var u=this._getOffsetWidth(r[h]);d.value=u+(d.width-1)/2}r[h].push({value:t.length-1,text:c.getValue(h,!0),width:1})}else n=r[h].length-1,r[h][n].width++;e=c}}for(var h=0;h<s.length;h++)h<r.length&&(n=r[h].length-1,r[h][n].value=this._getOffsetWidth(r[h])+(r[h][n].width-1)/2);this._dataItms=t,this._lblsSrc=i,this._grpLblsSrc=r,this._updateFlexChartOrPie()}},t.prototype._updateFlexChartOrPie=function(){var e=this._isPieChart();!e&&this._flexChart?this._updateFlexChart(this._dataItms,this._lblsSrc,this._grpLblsSrc):e&&this._flexPie&&this._updateFlexPie(this._dataItms,this._lblsSrc)},t.prototype._updateFlexChart=function(e,t,i){if(this._ng&&this._flexChart){var r,n=this._flexChart,o=n.hostElement;if(n.beginUpdate(),n.itemsSource=e,this._createSeries(),n.series&&n.series.length>0&&e.length>0?o.style.visibility="visible":o.style.visibility="hidden",n.header=this.header||this._getChartTitle(),this.headerStyle&&(n.headerStyle=this.headerStyle),this.footer&&(n.footer=this.footer),this.footerStyle&&(n.footerStyle=this.footerStyle),this._isBarChart()){if(this._showHierarchicalAxes&&i.length>0){if(n.axisY.itemsSource=i[i.length-1],n.axisX.labelAngle=void 0,i.length>=2)for(s=i.length-2;s>=0;s--)this._createGroupAxes(i[s])}else n.axisY.labelAngle=void 0,n.axisY.itemsSource=t;n.axisX.itemsSource=void 0}else{if(this._showHierarchicalAxes&&i.length>0){if(n.axisX.itemsSource=i[i.length-1],i.length>=2)for(var s=i.length-2;s>=0;s--)this._createGroupAxes(i[s])}else n.axisX.labelAngle=void 0,n.axisX.itemsSource=t;n.axisY.itemsSource=void 0}n.axisX.labelPadding=6,n.axisY.labelPadding=6,this.chartType===PivotChartType.Bar?(r=n.axisX,n.axisY.reversed=!0):(r=n.axisY,n.axisY.reversed=!1),n.stacking!==wjcChart.Stacking.Stacked100pc&&this._ng.valueFields.length>0&&this._ng.valueFields[0].format?r.format=this._ng.valueFields[0].format:r.format="",n.legend.position=this._getLegendPosition(),n.endUpdate()}},t.prototype._updateFlexPie=function(e,t){if(this._ng&&this._flexPie){var i=this._flexPie,r=i.hostElement,n=this._colMenu;this._colItms.length>0&&e.length>0?r.style.visibility="visible":r.style.visibility="hidden",i.beginUpdate(),i.itemsSource=e,i.bindingName=_PivotKey._ROW_KEY_NAME,this._colItms&&this._colItms.length>0&&(i.binding=this._colItms[0].prop),i.header=this.header||this._getChartTitle(),this.headerStyle&&(i.headerStyle=this.headerStyle),this.footer&&(i.footer=this.footer),this.footerStyle&&(i.footerStyle=this.footerStyle),i.legend.position=this._getLegendPosition(),i.endUpdate();var o=this._getTitle(this._ng.columnFields);""!==o&&(o="<b>"+o+": </b>"),this._colItms&&this._colItms.length>1&&e.length>0?(n.hostElement.style.visibility="visible",n.header=o+this._colItms[0].text,n.itemsSource=this._colItms,n.command={executeCommand:function(e){var t=n.selectedItem;n.header=o+t.text,i.binding=t.prop}},n.selectedIndex=0,n.invalidate(),n.listBox.invalidate()):n.hostElement.style.visibility="hidden"}},t.prototype._getLegendPosition=function(){var e=this.legendPosition;if(this.showLegend==LegendVisibility.Never)e=wjcChart.Position.None;else if(this.showLegend==LegendVisibility.Auto&&this.flexChart&&this.flexChart.series){var t=0;this.flexChart.series.forEach(function(e){var i=e.visibility;e.name&&i!=wjcChart.SeriesVisibility.Hidden&&i!=wjcChart.SeriesVisibility.Plot&&t++}),t<2&&(e=wjcChart.Position.None)}return e},t.prototype._createSeries=function(){this._flexChart&&(this._flexChart.series.length=0);for(var e=1==this._ng.valueFields.length,t=0;t<this._colItms.length;t++){var i=new wjcChart.Series,r=this._colItms[t].prop,n=this._colItms[t].text;if(e){var o=n.lastIndexOf(";");o>-1&&(n=n.substr(0,o))}i.binding=r,i.name=n,this._flexChart.series.push(i)}},t.prototype._getColumns=function(e){var t,i=0;if(e){this._colItms.length=0;for(var r in e)e.hasOwnProperty(r)&&r!==_PivotKey._ROW_KEY_NAME&&i<this._maxSeries&&(this._showTotals&&this._isTotalColumn(r)||!this._showTotals&&!this._isTotalColumn(r))&&(t=this._ng._getKey(r),this._getLabel(t),this._colItms.push({prop:r,text:this._getLabel(t)}),i++)}},t.prototype._createGroupAxes=function(e){var i,r=this,n=this._flexChart,o=this._isBarChart()?n.axisY:n.axisX;if(e){(i=new wjcChart.Axis).labelAngle=0,i.labelPadding=6,i.position=this._isBarChart()?wjcChart.Position.Left:wjcChart.Position.Bottom,i.majorTickMarks=wjcChart.TickMark.None,i.itemsSource=e,i.reversed=o.reversed,i.itemFormatter=function(n,o){var s=.5*e.filter(function(e){return e.value==o.val})[0].width;if(r._isBarChart()){var l=i.reversed?-1:1,a=i.convert(o.val+s)+5*l,c=i.convert(o.val-s)-5*l,d=i._axrect.left+i._axrect.width-5;n.drawLine(d,a,d,c,t.HRHAXISCSS),n.drawLine(d,a,d+5,a,t.HRHAXISCSS),n.drawLine(d,c,d+5,c,t.HRHAXISCSS),n.drawLine(d,o.pos.y,d-5,o.pos.y,t.HRHAXISCSS)}else{var u=i.convert(o.val-s)+5,h=i.convert(o.val+s)-5,p=i._axrect.top;n.drawLine(u,p,h,p,t.HRHAXISCSS),n.drawLine(u,p,u,p-5,t.HRHAXISCSS),n.drawLine(h,p,h,p-5,t.HRHAXISCSS),n.drawLine(o.pos.x,p,o.pos.x,p+5,t.HRHAXISCSS)}return o},i.min=o.actualMin,i.max=o.actualMax,o.rangeChanged.addHandler(function(){isNaN(i.min)&&isNaN(o.actualMin)||i.min==o.actualMin||(i.min=o.actualMin),isNaN(i.max)&&isNaN(o.actualMax)||i.max==o.actualMax||(i.max=o.actualMax)});var s=new wjcChart.Series;s.visibility=wjcChart.SeriesVisibility.Hidden,this._isBarChart()?s.axisY=i:s.axisX=i,n.series.push(s)}},t.prototype._updateFlexPieBinding=function(){this._flexPie.binding=this._colMenu.selectedValue,this._flexPie.refresh()},t.prototype._updatePieInfo=function(){var e=this;this._flexPie&&(this._flexPie._labels=this._flexPie._labels.map(function(t,i){return e._lblsSrc[i].text}))},t.prototype._changeChartType=function(){var e=null;if(this.chartType===PivotChartType.Pie)this._flexPie||this._createFlexPie(),this._updateFlexPie(this._dataItms,this._lblsSrc),this._swapChartAndPie(!1);else{switch(this.chartType){case PivotChartType.Column:e=wjcChart.ChartType.Column;break;case PivotChartType.Bar:e=wjcChart.ChartType.Bar;break;case PivotChartType.Scatter:e=wjcChart.ChartType.Scatter;break;case PivotChartType.Line:e=wjcChart.ChartType.Line;break;case PivotChartType.Area:e=wjcChart.ChartType.Area}this._flexChart?"none"!==this._flexChart.hostElement.style.display&&e!==PivotChartType.Bar&&this._flexChart.chartType!==wjcChart.ChartType.Bar||this._updateFlexChart(this._dataItms,this._lblsSrc,this._grpLblsSrc):(this._createFlexChart(),this._updateFlexChart(this._dataItms,this._lblsSrc,this._grpLblsSrc)),this._flexChart.chartType=e,this._swapChartAndPie(!0)}},t.prototype._swapChartAndPie=function(e){var t=this;this._flexChart&&(this._flexChart.hostElement.style.display=e?"block":"none"),this._flexPie&&(this._flexPie.hostElement.style.display=e?"none":"block"),this._colMenu&&this._colMenu.hostElement&&(this._colMenu.hostElement.style.display=e?"none":"block",this._colMenu.hostElement.style.top="0",setTimeout(function(){t._colMenu.hostElement.style.top=""},0))},t.prototype._getLabel=function(e){var t="";if(!e||!e.values)return t;var i=e.valueFields?e.valueField:null;switch(e.values.length){case 0:i&&(t+=i.header);break;case 1:t+=e.getValue(0,!0),i&&(t+="; "+i.header);break;default:for(var r=0;r<e.values.length;r++)r>0&&(t+="; "),t+=e.getValue(r,!0);i&&(t+="; "+i.header)}return t},t.prototype._getValue=function(e){var t=this._ng.valueFields,i=e.series?e.series.chart.series.indexOf(e.series):0,r=i<t.length?t[i].format:t.length?t[0].format:"";return r?wjcCore.Globalize.format(e.y,r):e._yfmt},t.prototype._getChartTitle=function(){if(!this.showTitle||!this._ng.valueFields.length)return null;var e=this._ng,t=this._getTitle(e.valueFields),i=this._getTitle(e.rowFields),r=this._getTitle(e.columnFields),n=t,o=wjcCore.culture.olap.PivotChart;return t&&this._dataItms.length>0&&(i&&(n+=wjcCore.format(" {by} {rows}",{by:o.by,rows:i})),r&&(n+=wjcCore.format(" {and} {cols}",{and:i?o.and:o.by,cols:r}))),n},t.prototype._getTitle=function(e){for(var t="",i=0;i<e.length;i++)t.length>0&&(t+="; "),t+=e[i].header;return t},t.prototype._isTotalColumn=function(e){var t=e.split(";");return!!(t&&t.length-2<this._ng.columnFields.length)},t.prototype._isTotalRow=function(e){return e.values.length<this._ng.rowFields.length},t.prototype._isPieChart=function(){return this._chartType==PivotChartType.Pie},t.prototype._isBarChart=function(){return this._chartType==PivotChartType.Bar},t.prototype._getMergeIndex=function(e,t){var i=-1;if(null!=e&&null!=t&&e.values.length==t.values.length&&e.values.length==e.fields.length&&t.values.length==t.fields.length)for(var r=0;r<e.values.length;r++){if(e.getValue(r,!0)!=t.getValue(r,!0))return i;i=r}return i},t.prototype._getOffsetWidth=function(e){var t=0;if(e.length<=1)return t;for(var i=0;i<e.length-1;i++)t+=e[i].width;return t},t.MAX_SERIES=100,t.MAX_POINTS=100,t.HRHAXISCSS="wj-hierarchicalaxes-line",t}(wjcCore.Control);exports.PivotChart=PivotChart;