text: (function(c){c.fn.extend({tableExport:function(q){function z(b,m,d,g,k){if(-1==c.inArray(d,a.ignoreRow)&&-1==c.inArray(d-g,a.ignoreRow)){var M=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(m),e=0;M.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-M.length,a.ignoreColumn)&&"function"===typeof k){var m,g=0,f,h=0;if("undefined"!=typeof B[d]&&0<B[d].length)for(m=0;m<=b;m++)"undefined"!=typeof B[d][m]&&(k(null,d,m),delete B[d][m],b++);c(this).is("[colspan]")&&(g=parseInt(c(this).attr("colspan")),e+=0<g?g-1:0);c(this).is("[rowspan]")&&(h=parseInt(c(this).attr("rowspan")));k(this,d,b);for(m=0;m<g-1;m++)k(null,d,b+m);if(h)for(f=1;f<h;f++)for("undefined"==
  typeof B[d+f]&&(B[d+f]=[]),B[d+f][b+e]="",m=1;m<g;m++)B[d+f][b+e-m]=""}})}}function N(b){!0===a.consoleLog&&console.log(b.output());if("string"==a.outputMode)return b.output();if("base64"==a.outputMode)return C(b.output());try{var m=b.output("blob");saveAs(m,a.fileName+".pdf")}catch(d){D(a.fileName+".pdf","data:application/pdf;base64,"+C(b.output()))}}function O(b,a,d){var g=0;"undefined"!=typeof d&&(g=d.colspan);if(0<=g){for(var k=b.width,c=b.textPos.x,f=a.table.columns.indexOf(a.column),e=1;e<g;e++)k+=
  a.table.columns[f+e].width;1<g&&("right"===b.styles.halign?c=b.textPos.x+k-b.width:"center"===b.styles.halign&&(c=b.textPos.x+(k-b.width)/2));b.width=k;b.textPos.x=c;1<d.rowspan&&("middle"===b.styles.valign?b.textPos.y+=b.height*(d.rowspan-1)/2:"bottom"===b.styles.valign&&(b.textPos.y+=(d.rowspan-1)*b.height),b.height*=d.rowspan);if("middle"===b.styles.valign||"bottom"===b.styles.valign)d=("string"===typeof b.text?b.text.split(/\r\n|\r|\n/g):b.text).length||1,2<d&&(b.textPos.y-=(2-1.15)/2*a.row.styles.fontSize*
  (d-2)/3);return!0}return!1}function J(b,a,d){return b.replace(new RegExp(a.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"g"),d)}function W(b){b=J(b||"0",a.numbers.html.decimalMark,".");b=J(b,a.numbers.html.thousandsSeparator,"");return"number"===typeof b||!1!==jQuery.isNumeric(b)?b:!1}function w(b,m,d){var g="";if(null!=b){b=c(b);var k=b.html();"function"===typeof a.onCellHtmlData&&(k=a.onCellHtmlData(b,m,d,k));if(!0===a.htmlContent)g=c.trim(k);else{var e=k.replace(/\n/g,"\u2028").replace(/<br\s*[\/]?>/gi,
  "\u2060"),k=c("<div/>").html(e).contents(),e="";c.each(k.text().split("\u2028"),function(b,a){0<b&&(e+=" ");e+=c.trim(a)});c.each(e.split("\u2060"),function(b,a){0<b&&(g+="\n");g+=c.trim(a).replace(/\u00AD/g,"")});if(a.numbers.html.decimalMark!=a.numbers.output.decimalMark||a.numbers.html.thousandsSeparator!=a.numbers.output.thousandsSeparator)if(k=W(g),!1!==k){var f=(""+k).split(".");1==f.length&&(f[1]="");var h=3<f[0].length?f[0].length%3:0,g=(0>k?"-":"")+(a.numbers.output.thousandsSeparator?(h?
  f[0].substr(0,h)+a.numbers.output.thousandsSeparator:"")+f[0].substr(h).replace(/(\d{3})(?=\d)/g,"$1"+a.numbers.output.thousandsSeparator):f[0])+(f[1].length?a.numbers.output.decimalMark+f[1]:"")}}!0===a.escape&&(g=escape(g));"function"===typeof a.onCellData&&(g=a.onCellData(b,m,d,g))}return g}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),g=a;d&&(g=[parseInt(d[1]),parseInt(d[2]),parseInt(d[3])]);return g}function Q(b){var a=
  E(b,"text-align"),d=E(b,"font-weight"),g=E(b,"font-style"),k="";"start"==a&&(a="rtl"==E(b,"direction")?"right":"left");700<=d&&(k="bold");"italic"==g&&(k+=g);""==k&&(k="normal");return{style:{align:a,bcolor:P(E(b,"background-color"),[255,255,255]),color:P(E(b,"color"),[0,0,0]),fstyle:k},colspan:parseInt(c(b).attr("colspan"))||0,rowspan:parseInt(c(b).attr("rowspan"))||0}}function E(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 K(b,a,d){a=E(b,a).match(/\d+/);if(null!==a){a=a[0];var g=document.createElement("div");g.style.overflow="hidden";g.style.visibility="hidden";b.parentElement.appendChild(g);g.style.width=100+d;d=100/g.offsetWidth;b.parentElement.removeChild(g);return a*d}return 0}function D(b,a){var d=document.createElement("a");if(d){d.style.display="none";d.download=b;d.href=a;document.body.appendChild(d);if(document.createEvent)null==H&&(H=
  document.createEvent("MouseEvents")),H.initEvent("click",!0,!1),d.dispatchEvent(H);else if(document.createEventObject)d.fireEvent("onclick");else if("function"==typeof d.onclick)d.onclick();document.body.removeChild(d)}}function C(b){var a="",d,g,k,c,f,e,h=0;b=b.replace(/\x0d\x0a/g,"\n");g="";for(k=0;k<b.length;k++)c=b.charCodeAt(k),128>c?g+=String.fromCharCode(c):(127<c&&2048>c?g+=String.fromCharCode(c>>6|192):(g+=String.fromCharCode(c>>12|224),g+=String.fromCharCode(c>>6&63|128)),g+=String.fromCharCode(c&
  63|128));for(b=g;h<b.length;)d=b.charCodeAt(h++),g=b.charCodeAt(h++),k=b.charCodeAt(h++),c=d>>2,d=(d&3)<<4|g>>4,f=(g&15)<<2|k>>6,e=k&63,isNaN(g)?f=e=64:isNaN(k)&&(e=64),a=a+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(c)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(d)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(f)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e);return a}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"},u=this,H=null,r=[],p=[],n=0,B=[],f="";c.extend(!0,a,q);if("csv"==a.type||"txt"==a.type){q=function(b,
  e,d,g){p=c(u).find(b).first().find(e);p.each(function(){f="";z(this,d,n,g+p.length,function(b,d,c){var g=f,e="";if(null!=b)if(b=w(b,d,c),d=null===b||""==b?"":b.toString(),b instanceof Date)e=a.csvEnclosure+b.toLocaleString()+a.csvEnclosure;else if(e=J(d,a.csvEnclosure,a.csvEnclosure+a.csvEnclosure),0<=e.indexOf(a.csvSeparator)||/[\r\n ]/g.test(e))e=a.csvEnclosure+e+a.csvEnclosure;f=g+(e+a.csvSeparator)});f=c.trim(f).substring(0,f.length-1);0<f.length&&(0<x.length&&(x+="\n"),x+=f);n++});return p.length};
  var x="",t=0,n=0,t=t+q("thead",a.theadSelector,"th,td",t),t=t+q("tbody",a.tbodySelector,"td",t);q("tfoot",a.tbodySelector,"td",t);x+="\n";!0===a.consoleLog&&console.log(x);if("string"===a.outputMode)return x;if("base64"===a.outputMode)return C(x);try{var A=new Blob([x],{type:"text/"+("csv"==a.type?"csv":"plain")+";charset=utf-8"});saveAs(A,a.fileName+"."+a.type,"csv"!=a.type||!1===a.csvUseBOM)}catch(b){D(a.fileName+"."+a.type,"data:text/"+("csv"==a.type?"csv":"plain")+";charset=utf-8,"+encodeURIComponent(x))}}else if("sql"==
  a.type){var n=0,l="INSERT INTO `"+a.tableName+"` (",r=c(u).find("thead").first().find(a.theadSelector);r.each(function(){z(this,"th,td",n,r.length,function(b,a,d){l+="'"+w(b,a,d)+"',"});n++;l=c.trim(l);l=c.trim(l).substring(0,l.length-1)});l+=") VALUES ";p=c(u).find("tbody").first().find(a.tbodySelector);p.each(function(){f="";z(this,"td",n,r.length+p.length,function(b,a,d){f+="'"+w(b,a,d)+"',"});3<f.length&&(l+="("+f,l=c.trim(l).substring(0,l.length-1),l+="),");n++});l=c.trim(l).substring(0,l.length-
  1);l+=";";!0===a.consoleLog&&console.log(l);if("string"==a.outputMode)return l;if("base64"==a.outputMode)return C(l);try{A=new Blob([l],{type:"text/plain;charset=utf-8"}),saveAs(A,a.fileName+".sql")}catch(b){D(a.fileName+".sql","data:application/sql;charset=utf-8,"+encodeURIComponent(l))}}else if("json"==a.type){var R=[],r=c(u).find("thead").first().find(a.theadSelector);r.each(function(){var b=[];z(this,"th,td",n,r.length,function(a,d,c){b.push(w(a,d,c))});R.push(b)});var S=[],p=c(u).find("tbody").first().find(a.tbodySelector);
  p.each(function(){var a=[];z(this,"td",n,r.length+p.length,function(c,d,e){a.push(w(c,d,e))});0<a.length&&(1!=a.length||""!=a[0])&&S.push(a);n++});q=[];q.push({header:R,data:S});t=JSON.stringify(q);!0===a.consoleLog&&console.log(t);if("string"==a.outputMode)return t;q=C(t);if("base64"==a.outputMode)return q;try{A=new Blob([t],{type:"application/json;charset=utf-8"}),saveAs(A,a.fileName+".json")}catch(b){D(a.fileName+".json","data:application/json;charset=utf-8;base64,"+q)}}else if("xml"===a.type){var n=
  0,v='<?xml version="1.0" encoding="utf-8"?>',v=v+"<tabledata><fields>",r=c(u).find("thead").first().find(a.theadSelector);r.each(function(){z(this,"th,td",n,p.length,function(a,c,d){v+="<field>"+w(a,c,d)+"</field>"});n++});var v=v+"</fields><data>",T=1,p=c(u).find("tbody").first().find(a.tbodySelector);p.each(function(){var a=1;f="";z(this,"td",n,r.length+p.length,function(c,d,e){f+="<column-"+a+">"+w(c,d,e)+"</column-"+a+">";a++});0<f.length&&"<column-1></column-1>"!=f&&(v+='<row id="'+T+'">'+f+
  "</row>",T++);n++});v+="</data></tabledata>";!0===a.consoleLog&&console.log(v);if("string"==a.outputMode)return v;q=C(v);if("base64"==a.outputMode)return q;try{A=new Blob([v],{type:"application/xml;charset=utf-8"}),saveAs(A,a.fileName+".xml")}catch(b){D(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 t="excel"==a.type||"xls"==a.type?"excel":"word",L="excel"==t?"xls":"doc";q="xls"==L?'xmlns:x="urn:schemas-microsoft-com:office:excel"':
  'xmlns:w="urn:schemas-microsoft-com:office:word"';var n=0,y="<table><thead>",r=c(u).find("thead").first().find(a.theadSelector);r.each(function(){f="";z(this,"th,td",n,r.length,function(b,e,d){if(null!=b){f+='<th style="';for(var g in a.excelstyles)a.excelstyles.hasOwnProperty(g)&&(f+=a.excelstyles[g]+": "+c(b).css(a.excelstyles[g])+";");c(b).is("[colspan]")&&(f+='" colspan="'+c(b).attr("colspan"));c(b).is("[rowspan]")&&(f+='" rowspan="'+c(b).attr("rowspan"));f+='">'+w(b,e,d)+"</th>"}});0<f.length&&
  (y+="<tr>"+f+"</tr>");n++});y+="</thead><tbody>";p=c(u).find("tbody").first().find(a.tbodySelector);p.each(function(){f="";z(this,"td",n,r.length+p.length,function(b,e,d){if(null!=b){f+='<td style="';for(var g in a.excelstyles)a.excelstyles.hasOwnProperty(g)&&(f+=a.excelstyles[g]+": "+c(b).css(a.excelstyles[g])+";");c(b).is("[colspan]")&&(f+='" colspan="'+c(b).attr("colspan"));c(b).is("[rowspan]")&&(f+='" rowspan="'+c(b).attr("rowspan"));f+='">'+w(b,e,d)+"</td>"}});0<f.length&&(y+="<tr>"+f+"</tr>");
  n++});a.displayTableName&&(y+="<tr><td></td></tr><tr><td></td></tr><tr><td>"+w(c("<p>"+a.tableName+"</p>"))+"</td></tr>");y+="</tbody></table>";!0===a.consoleLog&&console.log(y);var e;e='<html xmlns:o="urn:schemas-microsoft-com:office:office" '+q+' xmlns="http://www.w3.org/TR/REC-html40">'+('<meta http-equiv="content-type" content="application/vnd.ms-'+t+'; charset=UTF-8">');e+="<head>";"excel"===t&&(e+="\x3c!--[if gte mso 9]>",e+="<xml>",e+="<x:ExcelWorkbook>",e+="<x:ExcelWorksheets>",e+="<x:ExcelWorksheet>",
  e+="<x:Name>",e+=a.worksheetName,e+="</x:Name>",e+="<x:WorksheetOptions>",e+="<x:DisplayGridlines/>",e+="</x:WorksheetOptions>",e+="</x:ExcelWorksheet>",e+="</x:ExcelWorksheets>",e+="</x:ExcelWorkbook>",e+="</xml>",e+="<![endif]--\x3e");e+="</head>";e+="<body>";e+=y;e+="</body>";e+="</html>";if("string"==a.outputMode)return e;q=C(e);if("base64"===a.outputMode)return q;try{A=new Blob([e],{type:"application/vnd.ms-"+a.type}),saveAs(A,a.fileName+"."+L)}catch(b){D(a.fileName+"."+L,"data:application/vnd.ms-"+
  t+";base64,"+q)}}else if("png"==a.type)html2canvas(c(u)[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;f<c.length;f++)e[f]=c.charCodeAt(f);try{var h=new Blob([d],{type:"image/png"});saveAs(h,a.fileName+".png")}catch(l){D(a.fileName+".png","data:image/png;base64,"+b)}}});else if("pdf"==a.type)if(!1===a.jspdf.autotable){var A={dim:{w:K(c(u).first().get(0),"width","mm"),h:K(c(u).first().get(0),
  "height","mm")},pagesplit:!1},U=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format);U.addHTML(c(u).first(),a.jspdf.margins.left,a.jspdf.margins.top,A,function(){N(U)})}else{var h=a.jspdf.autotable.tableExport;if("string"===typeof a.jspdf.format&&"bestfit"===a.jspdf.format.toLowerCase()){var F={a0:[2383.94,3370.39],a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89]},I="",G="",V=0;c(u).filter(":visible").each(function(){if("none"!=c(this).css("display")){var a=K(c(this).get(0),
  "width","pt");if(a>V){a>F.a0[0]&&(I="a0",G="l");for(var e in F)F.hasOwnProperty(e)&&F[e][1]>a&&(I=e,G="l",F[e][0]>a&&(G="p"));V=a}}});a.jspdf.format=""==I?"a4":I;a.jspdf.orientation=""==G?"w":G}h.doc=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format);c(u).filter(function(){return"none"!=c(this).data("tableexport-display")&&(c(this).is(":visible")||"always"==c(this).data("tableexport-display"))}).each(function(){var b,e=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);d.tableExport=h;"function"!==typeof d.beforePageContent&&(d.beforePageContent=function(a){1==a.pageCount&&a.table.rows.concat(a.table.headerRow).forEach(function(b){0<b.height&&(b.height+=(2-1.15)/2*b.styles.fontSize,a.table.height+=(2-1.15)/2*b.styles.fontSize)})});"function"!==typeof d.createdHeaderCell&&(d.createdHeaderCell=
  function(a,b){if("undefined"!=typeof h.columns[b.column.dataKey]){var c=h.columns[b.column.dataKey];a.styles.halign=c.style.align;"inherit"===d.styles.fillColor&&(a.styles.fillColor=c.style.bcolor);"inherit"===d.styles.textColor&&(a.styles.textColor=c.style.color);"inherit"===d.styles.fontStyle&&(a.styles.fontStyle=c.style.fstyle)}});"function"!==typeof d.createdCell&&(d.createdCell=function(a,b){var c=h.rowoptions[b.row.index+":"+b.column.dataKey];"undefined"!=typeof c&&"undefined"!=typeof c.style&&
  (a.styles.halign=c.style.align,"inherit"===d.styles.fillColor&&(a.styles.fillColor=c.style.bcolor),"inherit"===d.styles.textColor&&(a.styles.textColor=c.style.color),"inherit"===d.styles.fontStyle&&(a.styles.fontStyle=c.style.fstyle))});"function"!==typeof d.drawHeaderCell&&(d.drawHeaderCell=function(a,b){var c=h.columns[b.column.dataKey];return 1!=c.style.hasOwnProperty("hidden")||!0!==c.style.hidden?O(a,b,c):!1});"function"!==typeof d.drawCell&&(d.drawCell=function(a,b){return O(a,b,h.rowoptions[b.row.index+
  ":"+b.column.dataKey])});r=c(this).find("thead").find(a.theadSelector);r.each(function(){b=0;z(this,"th,td",e,r.length,function(a,c,d){var e=Q(a);e.title=w(a,c,d);e.key=b++;h.columns.push(e)});e++});var f=0;p=c(this).find("tbody").find(a.tbodySelector);p.each(function(){var a=[];b=0;z(this,"td",e,r.length+p.length,function(d,e,l){if("undefined"===typeof h.columns[b]){var m={title:"",key:b,style:{hidden:!0}};h.columns.push(m)}null!==d?h.rowoptions[f+":"+b++]=Q(d):(m=c.extend(!0,{},h.rowoptions[f+":"+
  (b-1)]),m.colspan=-1,h.rowoptions[f+":"+b++]=m);a.push(w(d,e,l))});a.length&&(h.rows.push(a),f++);e++});if("function"===typeof h.onBeforeAutotable)h.onBeforeAutotable(c(this),h.columns,h.rows,d);h.doc.autoTable(h.columns,h.rows,d);if("function"===typeof h.onAfterAutotable)h.onAfterAutotable(c(this),d);a.jspdf.autotable.startY=h.doc.autoTableEndPosY()+d.margin.top});N(h.doc);h.columns.length=0;h.rows.length=0;delete h.doc;h.doc=null}return this}})})(jQuery);
  