//>>built
define("dojox/grid/enhanced/plugins/exporter/CSVWriter",["dojo/_base/declare","dojo/_base/lang","dojo/_base/array","./_ExportWriter","../Exporter"],function(e,f,c,g,h){h.registerWriter("csv","dojox.grid.enhanced.plugins.exporter.CSVWriter");return e("dojox.grid.enhanced.plugins.exporter.CSVWriter",g,{_separator:",",_newline:"\r\n",constructor:function(a){a&&(this._separator=a.separator?a.separator:this._separator,this._newline=a.newline?a.newline:this._newline);this._headers=[];this._dataRows=[]},
_formatCSVCell:function(a){if(null===a||void 0===a)return"";a=String(a).replace(/"/g,'""');if(0<=a.indexOf(this._separator)||0<=a.search(/[" \t\r\n]/))a='"'+a+'"';return a},beforeContentRow:function(a){var b=[],k=f.hitch(this,this._formatCSVCell);c.forEach(a.grid.layout.cells,function(d){!d.hidden&&0>c.indexOf(a.spCols,d.index)&&b.push(k(this._getExportDataForCell(a.rowIndex,a.row,d,a.grid)))},this);this._dataRows.push(b);return!1},handleCell:function(a){var b=a.cell;a.isHeader&&!b.hidden&&0>c.indexOf(a.spCols,
b.index)&&this._headers.push(b.name||b.field)},toString:function(){for(var a=this._headers.join(this._separator),b=this._dataRows.length-1;0<=b;--b)this._dataRows[b]=this._dataRows[b].join(this._separator);return a+this._newline+this._dataRows.join(this._newline)}})});