(function(c){c.fn.extend({tableExport:function(q){function v(b,t,d,e,r){if(-1==c.inArray(d,a.ignoreRow)&&-1==c.inArray(d-e,a.ignoreRow)){var L=c(b).filter(function(){return"none"!=c(this).data("tableexport-display")&&(c(this).is(":visible")||"always"==c(this).data("tableexport-display")||"always"==c(this).closest("table").data("tableexport-display"))}).find(t);L.each(function(b){if(("always"==c(this).data("tableexport-display")||"none"!=c(this).css("display")&&"hidden"!=c(this).css("visibility")&& "none"!=c(this).data("tableexport-display"))&&-1==c.inArray(b,a.ignoreColumn)&&-1==c.inArray(b-L.length,a.ignoreColumn)&&"function"===typeof r){var e,t=0;if("undefined"!=typeof A[d]&&0/gi,"\u2060"),r=c("
").html(f).contents(),f="";c.each(r.text().split("\u2028"),function(b,a){0r?"-":"")+(a.numbers.output.thousandsSeparator?(h?g[0].substr(0,h)+a.numbers.output.thousandsSeparator:"")+g[0].substr(h).replace(/(\d{3})(?=\d)/g,"$1"+a.numbers.output.thousandsSeparator):g[0])+(g[1].length?a.numbers.output.decimalMark+g[1]:"")}}!0===a.escape&&(e=escape(e));"function"===typeof a.onCellData&&(e=a.onCellData(b,t,d,e))}return e}function X(b,a,d){return a+"-"+d.toLowerCase()}function P(b,a){var d=/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/.exec(b), e=a;d&&(e=[parseInt(d[1]),parseInt(d[2]),parseInt(d[3])]);return e}function Q(b){var a=D(b,"text-align"),d=D(b,"font-weight"),e=D(b,"font-style"),f="";"start"==a&&(a="rtl"==D(b,"direction")?"right":"left");700<=d&&(f="bold");"italic"==e&&(f+=e);""==f&&(f="normal");return{style:{align:a,bcolor:P(D(b,"background-color"),[255,255,255]),color:P(D(b,"color"),[0,0,0]),fstyle:f},colspan:parseInt(c(b).attr("colspan"))||0}}function D(b,a){try{return window.getComputedStyle?(a=a.replace(/([a-z])([A-Z])/,X), window.getComputedStyle(b,null).getPropertyValue(a)):b.currentStyle?b.currentStyle[a]:b.style[a]}catch(d){}return""}function J(b,a,d){a=D(b,a).match(/\d+/);if(null!==a){a=a[0];var e=document.createElement("div");e.style.overflow="hidden";e.style.visibility="hidden";b.parentElement.appendChild(e);e.style.width=100+d;d=100/e.offsetWidth;b.parentElement.removeChild(e);return a*d}return 0}function C(a,f){var d=document.createElement("a");if(d){d.style.display="none";d.download=a;d.href=f;document.body.appendChild(d); if(document.createEvent)null==G&&(G=document.createEvent("MouseEvents")),G.initEvent("click",!0,!1),d.dispatchEvent(G);else if(document.createEventObject)d.fireEvent("onclick");else if("function"==typeof d.onclick)d.onclick();document.body.removeChild(d)}}function B(a){var f="",d,e,c,g,h,k,l=0;a=a.replace(/\x0d\x0a/g,"\n");e="";for(c=0;cg?e+=String.fromCharCode(g):(127g?e+=String.fromCharCode(g>>6|192):(e+=String.fromCharCode(g>>12|224),e+=String.fromCharCode(g>> 6&63|128)),e+=String.fromCharCode(g&63|128));for(a=e;l>2,d=(d&3)<<4|e>>4,h=(e&15)<<2|c>>6,k=c&63,isNaN(e)?h=k=64:isNaN(c)&&(k=64),f=f+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(g)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(d)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(k); return f}var a={consoleLog:!1,csvEnclosure:'"',csvSeparator:",",csvUseBOM:!0,displayTableName:!1,escape:!1,excelstyles:["border-bottom","border-top","border-left","border-right"],fileName:"tableExport",htmlContent:!1,ignoreColumn:[],ignoreRow:[],jspdf:{orientation:"p",unit:"pt",format:"a4",margins:{left:20,right:10,top:10,bottom:10},autotable:{styles:{cellPadding:2,rowHeight:12,fontSize:8,fillColor:255,textColor:50,fontStyle:"normal",overflow:"ellipsize",halign:"left",valign:"middle"},headerStyles:{fillColor:[52, 73,94],textColor:255,fontStyle:"bold",halign:"center"},alternateRowStyles:{fillColor:245},tableExport:{onAfterAutotable:null,onBeforeAutotable:null,onTable:null}}},numbers:{html:{decimalMark:".",thousandsSeparator:","},output:{decimalMark:".",thousandsSeparator:","}},onCellData:null,onCellHtmlData:null,outputMode:"file",tbodySelector:"tr",theadSelector:"tr",tableName:"myTableName",type:"csv",worksheetName:"xlsWorksheetName"},G=null,l=[],n=[],m=0,A=[],f="";c.extend(!0,a,q);if("csv"==a.type||"txt"== a.type){var p="",m=0,l=c(this).find("thead").first().find(a.theadSelector);l.each(function(){f="";v(this,"th,td",m,l.length,function(b,c,d){f+=O(b,c,d)+a.csvSeparator});f=c.trim(f).substring(0,f.length-1);0',u=u+"",l=c(this).find("thead").first().find(a.theadSelector); l.each(function(){v(this,"th,td",m,n.length,function(a,c,d){u+=""+w(a,c,d)+""});m++});var u=u+"",T=1,n=c(this).find("tbody").first().find(a.tbodySelector);n.each(function(){var a=1;f="";v(this,"td",m,l.length+n.length,function(c,d,e){f+=""+w(c,d,e)+"";a++});0"!=f&&(u+=''+f+"",T++);m++});u+="";!0===a.consoleLog&&console.log(u);if("string"==a.outputMode)return u;q=B(u); if("base64"==a.outputMode)return q;try{x=new Blob([u],{type:"application/xml;charset=utf-8"}),saveAs(x,a.fileName+".xml")}catch(b){C(a.fileName+".xml","data:application/xml;charset=utf-8;base64,"+q)}}else if("excel"==a.type||"xls"==a.type||"word"==a.type||"doc"==a.type){var z="excel"==a.type||"xls"==a.type?"excel":"word",K="excel"==z?"xls":"doc";q="xls"==K?'xmlns:x="urn:schemas-microsoft-com:office:excel"':'xmlns:w="urn:schemas-microsoft-com:office:word"';var m=0,y="",l=c(this).find("thead").first().find(a.theadSelector); l.each(function(){f="";v(this,"th,td",m,l.length,function(b,g,d){if(null!=b){f+='");m++});n=c(this).find("tbody").first().find(a.tbodySelector);n.each(function(){f="";v(this,"td",m,l.length+n.length,function(b,g,d){if(null!=b){f+='");m++});a.displayTableName&&(y+="");y+="
"}});0"+f+"
"}});0"+f+"
"+w(c("

"+a.tableName+"

"))+"
";!0===a.consoleLog&&console.log(y);var g;g=''+ ('');g+="";"excel"===z&&(g+="\x3c!--[if gte mso 9]>",g+="",g+="",g+="",g+="",g+="",g+=a.worksheetName,g+="",g+="",g+="",g+="",g+="",g+="",g+="",g+="",g+="";g+="";g+=y;g+=""; g+="";if("string"==a.outputMode)return g;q=B(g);if("base64"===a.outputMode)return q;try{x=new Blob([g],{type:"application/vnd.ms-"+a.type}),saveAs(x,a.fileName+"."+K)}catch(b){C(a.fileName+"."+K,"data:application/vnd.ms-"+z+";base64,"+q)}}else if("png"==a.type)html2canvas(c(this)[0],{allowTaint:!0,background:"#fff",onrendered:function(b){b=b.toDataURL();b=b.substring(22);for(var c=atob(b),d=new ArrayBuffer(c.length),e=new Uint8Array(d),f=0;fV){a>E.a0[0]&&(H="a0",F="l");for(var f in E)E.hasOwnProperty(f)&&E[f][1]>a&&(H=f,F="l",E[f][0]>a&&(F="p"));V=a}}});a.jspdf.format=""==H?"a4":H;a.jspdf.orientation=""==F?"w":F}h.doc=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format); c(this).filter(function(){return"none"!=c(this).data("tableexport-display")&&(c(this).is(":visible")||"always"==c(this).data("tableexport-display"))}).each(function(){var b,f=0;h.columns=[];h.rows=[];h.rowoptions={};if("function"===typeof h.onTable&&!1===h.onTable(c(this),a))return!0;a.jspdf.autotable.tableExport=null;var d=c.extend(!0,{},a.jspdf.autotable);a.jspdf.autotable.tableExport=h;d.margin={};c.extend(!0,d.margin,a.jspdf.margins);"function"!==typeof d.beforePageContent&&(d.beforePageContent= function(a){1==a.pageCount&&a.table.rows.concat(a.table.headerRow).forEach(function(b){0