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

*/
!function(e,define){define("kendo.excel.min",["kendo.core.min","kendo.data.min","kendo.ooxml.min"],e)}(function(){return function(e,t){t.ExcelExporter=t.Class.extend({init:function(o){var r,n,a;o.columns=this._trimColumns(o.columns||[]),this.allColumns=e.map(this._leafColumns(o.columns||[]),this._prepareColumn),this.columns=e.grep(this.allColumns,function(e){return!e.hidden}),this.options=o,r=o.dataSource,r instanceof t.data.DataSource?(this.dataSource=new r.constructor(e.extend({},r.options,{page:o.allPages?0:r.page(),filter:r.filter(),pageSize:o.allPages?r.total():r.pageSize(),sort:r.sort(),group:r.group(),aggregate:r.aggregate()})),n=r.data(),n.length>0&&(this.dataSource._data=n,a=this.dataSource.transport,r._isServerGrouped()&&a.options&&a.options.data&&(a.options.data=null))):this.dataSource=t.data.DataSource.create(r)},_trimColumns:function(t){var o=this;return e.grep(t,function(e){var t=!!e.field;return!t&&e.columns&&(t=o._trimColumns(e.columns).length>0),t})},_leafColumns:function(e){var t,o=[];for(t=0;t<e.length;t++)e[t].columns?o=o.concat(this._leafColumns(e[t].columns)):o.push(e[t]);return o},workbook:function(){return e.Deferred(e.proxy(function(t){this.dataSource.fetch().then(e.proxy(function(){var e={sheets:[{columns:this._columns(),rows:this._rows(),freezePane:this._freezePane(),filter:this._filter()}]};t.resolve(e,this.dataSource.view())},this))},this)).promise()},_prepareColumn:function(o){var r,n;if(o.field)return r=function(e){return e.get(o.field)},n=null,o.values&&(n={},e.each(o.values,function(){n[this.value]=this.text}),r=function(e){return n[e.get(o.field)]}),e.extend({},o,{value:r,values:n,groupHeaderTemplate:t.template(o.groupHeaderTemplate||"#= title #: #= value #"),groupFooterTemplate:o.groupFooterTemplate?t.template(o.groupFooterTemplate):null,footerTemplate:o.footerTemplate?t.template(o.footerTemplate):null})},_filter:function(){if(!this.options.filterable)return null;var e=this._depth();return{from:e,to:e+this.columns.length-1}},_dataRow:function(t,o,r){var n,a,l,i,s,u,c,h,f,d;for(this._hierarchical()&&(o=this.dataSource.level(t)+1),n=[],a=0;a<o;a++)n[a]={background:"#dfdfdf",color:"#333"};if(r&&t.items)return l=e.grep(this.allColumns,function(e){return e.field==t.field})[0],i=l&&l.title?l.title:t.field,s=l?l.groupHeaderTemplate:null,u=i+": "+t.value,c=e.extend({title:i,field:t.field,value:l&&l.values?l.values[t.value]:t.value,aggregates:t.aggregates},t.aggregates[t.field]),s&&(u=s(c)),n.push({value:u,background:"#dfdfdf",color:"#333",colSpan:this.columns.length+r-o}),h=this._dataRows(t.items,o+1),h.unshift({type:"group-header",cells:n}),h.concat(this._footer(t));for(f=[],d=0;d<this.columns.length;d++)f[d]=this._cell(t,this.columns[d]);return this._hierarchical()&&(f[0].colSpan=r-o+1),[{type:"data",cells:n.concat(f)}]},_dataRows:function(e,t){var o,r=this._depth(),n=[];for(o=0;o<e.length;o++)n.push.apply(n,this._dataRow(e[o],t,r));return n},_footer:function(t){var o=[],r=!1,n=e.map(this.columns,e.proxy(function(o){return o.groupFooterTemplate?(r=!0,{background:"#dfdfdf",color:"#333",value:o.groupFooterTemplate(e.extend({},this.dataSource.aggregates(),t.aggregates,t.aggregates[o.field]))}):{background:"#dfdfdf",color:"#333"}},this));return r&&o.push({type:"group-footer",cells:e.map(Array(this.dataSource.group().length),function(){return{background:"#dfdfdf",color:"#333"}}).concat(n)}),o},_isColumnVisible:function(e){return this._visibleColumns([e]).length>0&&(e.field||e.columns)},_visibleColumns:function(t){var o=this;return e.grep(t,function(e){var t=!e.hidden;return t&&e.columns&&(t=o._visibleColumns(e.columns).length>0),t})},_headerRow:function(t,o){var r=e.map(t.cells,function(e){return{background:"#7a7a7a",color:"#fff",value:e.title,colSpan:e.colSpan>1?e.colSpan:1,rowSpan:t.rowSpan>1&&!e.colSpan?t.rowSpan:1}});return this._hierarchical()&&(r[0].colSpan=this._depth()+1),{type:"header",cells:e.map(Array(o.length),function(){return{background:"#7a7a7a",color:"#fff"}}).concat(r)}},_prependHeaderRows:function(e){var t,o=this.dataSource.group(),r=[{rowSpan:1,cells:[],index:0}];for(this._prepareHeaderRows(r,this.options.columns),t=r.length-1;t>=0;t--)e.unshift(this._headerRow(r[t],o))},_prepareHeaderRows:function(e,t,o,r){var n,a,l,i=r||e[e.length-1],s=e[i.index+1],u=0;for(l=0;l<t.length;l++)n=t[l],this._isColumnVisible(n)&&(a={title:n.title||n.field,colSpan:0},i.cells.push(a),n.columns&&n.columns.length&&(s||(s={rowSpan:0,cells:[],index:e.length},e.push(s)),a.colSpan=this._trimColumns(this._visibleColumns(n.columns)).length,this._prepareHeaderRows(e,n.columns,a,s),u+=a.colSpan-1,i.rowSpan=e.length-i.index));o&&(o.colSpan+=u)},_rows:function(){var t,o,r=this.dataSource.group(),n=this._dataRows(this.dataSource.view(),0);return this.columns.length&&(this._prependHeaderRows(n),t=!1,o=e.map(this.columns,e.proxy(function(o){if(o.footerTemplate){t=!0;var r=this.dataSource.aggregates();return{background:"#dfdfdf",color:"#333",value:o.footerTemplate(e.extend({},r,r[o.field]))}}return{background:"#dfdfdf",color:"#333"}},this)),t&&n.push({type:"footer",cells:e.map(Array(r.length),function(){return{background:"#dfdfdf",color:"#333"}}).concat(o)})),n},_headerDepth:function(e){var t,o,r=1,n=0;for(t=0;t<e.length;t++)e[t].columns&&(o=this._headerDepth(e[t].columns),o>n&&(n=o));return r+n},_freezePane:function(){var t=this._visibleColumns(this.options.columns||[]),o=this._visibleColumns(this._trimColumns(this._leafColumns(e.grep(t,function(e){return e.locked})))).length;return{rowSplit:this._headerDepth(t),colSplit:o?o+this.dataSource.group().length:0}},_cell:function(e,t){return{value:t.value(e)}},_hierarchical:function(){return this.options.hierarchy&&this.dataSource.level},_depth:function(){var e,t,o,r=this.dataSource,n=0;if(this._hierarchical()){for(e=r.view(),t=0;t<e.length;t++)o=r.level(e[t]),o>n&&(n=o);n++}else n=r.group().length;return n},_columns:function(){var t=this._depth(),o=e.map(Array(t),function(){return{width:20}});return o.concat(e.map(this.columns,function(e){return{width:parseInt(e.width,10),autoWidth:!e.width}}))}}),t.ExcelMixin={extend:function(t){t.events.push("excelExport"),t.options.excel=e.extend(t.options.excel,this.options),t.saveAsExcel=this.saveAsExcel},options:{proxyURL:"",allPages:!1,filterable:!1,fileName:"Export.xlsx"},saveAsExcel:function(){var o=this.options.excel||{},r=new t.ExcelExporter({columns:this.columns,dataSource:this.dataSource,allPages:o.allPages,filterable:o.filterable,hierarchy:o.hierarchy});r.workbook().then(e.proxy(function(e,r){if(!this.trigger("excelExport",{workbook:e,data:r})){var n=new t.ooxml.Workbook(e);t.saveAs({dataURI:n.toDataURL(),fileName:e.fileName||o.fileName,proxyURL:o.proxyURL,forceProxy:o.forceProxy})}},this))}}}(kendo.jQuery,kendo),kendo},"function"==typeof define&&define.amd?define:function(e,t,o){(o||t)()});
//# sourceMappingURL=kendo.excel.min.js.map
