EVOLUTION-NINJA
Edit File: tableExport.js
"use strict";!function(t){t.fn.tableExport=function(e){var o,n={csvEnclosure:'"',csvSeparator:",",csvUseBOM:!0,displayTableName:!1,escape:!1,exportHiddenCells:!1,fileName:"tableExport",htmlContent:!1,ignoreColumn:[],ignoreRow:[],jsonScope:"all",jspdf:{orientation:"p",unit:"pt",format:"a4",margins:{left:20,right:10,top:10,bottom:10},onDocCreated:null,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:{doc:null,onAfterAutotable:null,onBeforeAutotable:null,onAutotableText:null,onTable:null,outputImages:!0}}},maxNestedTables:1,mso:{fileFormat:"xlshtml",onMsoNumberFormat:null,pageFormat:"a4",pageOrientation:"portrait",rtl:!1,styles:[],worksheetName:""},numbers:{html:{decimalMark:".",thousandsSeparator:","},output:{decimalMark:".",thousandsSeparator:","}},onCellData:null,onCellHtmlData:null,onIgnoreRow:null,outputMode:"file",pdfmake:{enabled:!1,docDefinition:{pageOrientation:"portrait",defaultStyle:{font:"Roboto"}},fonts:{}},preventInjection:!0,tbodySelector:"tr",tfootSelector:"tr",theadSelector:"tr",tableName:"Table",type:"csv"},r={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],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]},i=1.15,a=this,s=null,l=[],c=[],d=0,h="",f=[],u=[],p=[],m=!1;if(t.extend(!0,n,e),"xlsx"===n.type&&(n.mso.fileFormat=n.type,n.type="excel"),void 0!==n.excelFileFormat&&"undefined"===n.mso.fileFormat&&(n.mso.fileFormat=n.excelFileFormat),void 0!==n.excelPageFormat&&"undefined"===n.mso.pageFormat&&(n.mso.pageFormat=n.excelPageFormat),void 0!==n.excelPageOrientation&&"undefined"===n.mso.pageOrientation&&(n.mso.pageOrientation=n.excelPageOrientation),void 0!==n.excelRTL&&"undefined"===n.mso.rtl&&(n.mso.rtl=n.excelRTL),void 0!==n.excelstyles&&"undefined"===n.mso.styles&&(n.mso.styles=n.excelstyles),void 0!==n.onMsoNumberFormat&&"undefined"===n.mso.onMsoNumberFormat&&(n.mso.onMsoNumberFormat=n.onMsoNumberFormat),void 0!==n.worksheetName&&"undefined"===n.mso.worksheetName&&(n.mso.worksheetName=n.worksheetName),n.mso.pageOrientation="l"===n.mso.pageOrientation.substr(0,1)?"landscape":"portrait",n.maxNestedTables=n.maxNestedTables>=0?n.maxNestedTables:1,f=st(a),"csv"===n.type||"tsv"===n.type||"txt"===n.type){var g="",v=0;u=[],d=0;var y=function(e,o,r){return e.each(function(){h="",ct(this,o,d,r+e.length,function(t,e,o){h+=function(t,e,o){var r="";if(null!==t){var i=mt(t,e,o),a=null===i||""===i?"":i.toString();"tsv"===n.type?(i instanceof Date&&i.toLocaleString(),r=ut(a,"\t"," ")):i instanceof Date?r=n.csvEnclosure+i.toLocaleString()+n.csvEnclosure:((r=ut(r=gt(a),n.csvEnclosure,n.csvEnclosure+n.csvEnclosure)).indexOf(n.csvSeparator)>=0||/[\r\n ]/g.test(r))&&(r=n.csvEnclosure+r+n.csvEnclosure)}return r}(t,e,o)+("tsv"===n.type?"\t":n.csvSeparator)}),(h=t.trim(h).substring(0,h.length-1)).length>0&&(g.length>0&&(g+="\n"),g+=h),d++}),e.length};if(v+=y(t(a).find("thead").first().find(n.theadSelector),"th,td",v),it(t(a),"tbody").each(function(){v+=y(at(t(this),n.tbodySelector),"td,th",v)}),n.tfootSelector.length&&y(t(a).find("tfoot").first().find(n.tfootSelector),"td,th",v),g+="\n","string"===n.outputMode)return g;if("base64"===n.outputMode)return Ft(g);if("window"===n.outputMode)return void Tt(!1,"data:text/"+("csv"===n.type?"csv":"plain")+";charset=utf-8,",g);try{o=new Blob([g],{type:"text/"+("csv"===n.type?"csv":"plain")+";charset=utf-8"}),saveAs(o,n.fileName+"."+n.type,"csv"!==n.type||!1===n.csvUseBOM)}catch(t){Tt(n.fileName+"."+n.type,"data:text/"+("csv"===n.type?"csv":"plain")+";charset=utf-8,"+("csv"===n.type&&n.csvUseBOM?"\ufeff":""),g)}}else if("sql"===n.type){d=0,u=[];var b="INSERT INTO `"+n.tableName+"` (";if((l=t(a).find("thead").first().find(n.theadSelector)).each(function(){ct(this,"th,td",d,l.length,function(t,e,o){b+="'"+mt(t,e,o)+"',"}),d++,b=t.trim(b).substring(0,b.length-1)}),b+=") VALUES ",c=rt(t(a)),t(c).each(function(){h="",ct(this,"td,th",d,l.length+c.length,function(t,e,o){h+="'"+mt(t,e,o)+"',"}),h.length>3&&(b+="("+h,b=t.trim(b).substring(0,b.length-1),b+="),"),d++}),b=t.trim(b).substring(0,b.length-1),b+=";","string"===n.outputMode)return b;if("base64"===n.outputMode)return Ft(b);try{o=new Blob([b],{type:"text/plain;charset=utf-8"}),saveAs(o,n.fileName+".sql")}catch(t){Tt(n.fileName+".sql","data:application/sql;charset=utf-8,",b)}}else if("json"===n.type){var w=[];u=[],(l=t(a).find("thead").first().find(n.theadSelector)).each(function(){var t=[];ct(this,"th,td",d,l.length,function(e,o,n){t.push(mt(e,o,n))}),w.push(t)});var x=[];c=rt(t(a)),t(c).each(function(){var e={},o=0;ct(this,"td,th",d,l.length+c.length,function(t,n,r){w.length?e[w[w.length-1][o]]=mt(t,n,r):e[o]=mt(t,n,r),o++}),!1===t.isEmptyObject(e)&&x.push(e),d++});var S="";if(S="head"===n.jsonScope?JSON.stringify(w):"data"===n.jsonScope?JSON.stringify(x):JSON.stringify({header:w,data:x}),"string"===n.outputMode)return S;if("base64"===n.outputMode)return Ft(S);try{o=new Blob([S],{type:"application/json;charset=utf-8"}),saveAs(o,n.fileName+".json")}catch(t){Tt(n.fileName+".json","data:application/json;charset=utf-8;base64,",S)}}else if("xml"===n.type){d=0,u=[];var C='<?xml version="1.0" encoding="utf-8"?>';C+="<tabledata><fields>",(l=t(a).find("thead").first().find(n.theadSelector)).each(function(){ct(this,"th,td",d,l.length,function(t,e,o){C+="<field>"+mt(t,e,o)+"</field>"}),d++}),C+="</fields><data>";var N=1;if(c=rt(t(a)),t(c).each(function(){var t=1;h="",ct(this,"td,th",d,l.length+c.length,function(e,o,n){h+="<column-"+t+">"+mt(e,o,n)+"</column-"+t+">",t++}),h.length>0&&"<column-1></column-1>"!==h&&(C+='<row id="'+N+'">'+h+"</row>",N++),d++}),C+="</data></tabledata>","string"===n.outputMode)return C;if("base64"===n.outputMode)return Ft(C);try{o=new Blob([C],{type:"application/xml;charset=utf-8"}),saveAs(o,n.fileName+".xml")}catch(t){Tt(n.fileName+".xml","data:application/xml;charset=utf-8;base64,",C)}}else if("excel"===n.type&&"xmlss"===n.mso.fileFormat){var k=[],A=[];t(a).filter(function(){return lt(t(this))}).each(function(){var e=t(this),o="";function r(e,o,n){var r=[];return t(e).each(function(){var o=0,i=0;h="",ct(this,"td,th",d,n+e.length,function(e,n,a){if(null!==e){var s="",l=mt(e,n,a),c="String";if(!1!==jQuery.isNumeric(l))c="Number";else{var f=function(t){t.indexOf("%")>-1?!1!==(t=pt(t.replace(/%/g,"")))&&(t/=100):t=!1;return t}(l);!1!==f&&(l=f,c="Number",s+=' ss:StyleID="pct1"')}"Number"!==c&&(l=l.replace(/\n/g,"<br>"));var u=wt(e),p=xt(e);t.each(r,function(){if(d>=this.s.r&&d<=this.e.r&&i>=this.s.c&&i<=this.e.c)for(var t=0;t<=this.e.c-this.s.c;++t)i++,o++}),(p||u)&&(p=p||1,u=u||1,r.push({s:{r:d,c:i},e:{r:d+p-1,c:i+u-1}})),u>1&&(s+=' ss:MergeAcross="'+(u-1)+'"',i+=u-1),p>1&&(s+=' ss:MergeDown="'+(p-1)+'" ss:StyleID="rsp1"'),o>0&&(s+=' ss:Index="'+(i+1)+'"',o=0),h+="<Cell"+s+'><Data ss:Type="'+c+'">'+t("<div />").text(l).html()+"</Data></Cell>\r",i++}}),h.length>0&&(X+='<Row ss:AutoFitHeight="0">\r'+h+"</Row>\r"),d++}),e.length}"string"==typeof n.mso.worksheetName&&n.mso.worksheetName.length?o=n.mso.worksheetName+" "+(A.length+1):void 0!==n.mso.worksheetName[A.length]&&(o=n.mso.worksheetName[A.length]),o.length||(o=e.find("caption").text()||""),o.length||(o="Table "+(A.length+1)),o=t.trim(o.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31)),A.push(t("<div />").text(o).html()),!1===n.exportHiddenCells&&(p=e.find("tr, th, td").filter(":hidden"),m=p.length>0),d=0,f=st(this),X="<Table>\r";var i=0;i+=r(e.find("thead").first().find(n.theadSelector),0,i),r(rt(e),0,i),X+="</Table>\r",k.push(X)});for(var T,F,O={},j={},R=0,M=A.length;R<M;R++)F=O[T=A[R]],2===(F=O[T]=null==F?1:F+1)&&(A[j[T]]=A[j[T]].substring(0,29)+"-1"),O[T]>1?A[R]=A[R].substring(0,29)+"-"+O[T]:j[T]=R;for(var P='<?xml version="1.0" encoding="UTF-8"?>\r<?mso-application progid="Excel.Sheet"?>\r<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"\r xmlns:o="urn:schemas-microsoft-com:office:office"\r xmlns:x="urn:schemas-microsoft-com:office:excel"\r xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"\r xmlns:html="http://www.w3.org/TR/REC-html40">\r<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">\r <Created>'+(new Date).toISOString()+'</Created>\r</DocumentProperties>\r<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">\r <AllowPNG/>\r</OfficeDocumentSettings>\r<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">\r <WindowHeight>9000</WindowHeight>\r <WindowWidth>13860</WindowWidth>\r <WindowTopX>0</WindowTopX>\r <WindowTopY>0</WindowTopY>\r <ProtectStructure>False</ProtectStructure>\r <ProtectWindows>False</ProtectWindows>\r</ExcelWorkbook>\r<Styles>\r <Style ss:ID="Default" ss:Name="Normal">\r <Alignment ss:Vertical="Bottom"/>\r <Borders/>\r <Font/>\r <Interior/>\r <NumberFormat/>\r <Protection/>\r </Style>\r <Style ss:ID="rsp1">\r <Alignment ss:Vertical="Center"/>\r </Style>\r <Style ss:ID="pct1">\r <NumberFormat ss:Format="Percent"/>\r </Style>\r</Styles>\r',D=0;D<k.length;D++)P+='<Worksheet ss:Name="'+A[D]+'" ss:RightToLeft="'+(n.mso.rtl?"1":"0")+'">\r'+k[D],n.mso.rtl?P+='<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">\r<DisplayRightToLeft/>\r</WorksheetOptions>\r':P+='<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel"/>\r',P+="</Worksheet>\r";if(P+="</Workbook>\r","string"===n.outputMode)return P;if("base64"===n.outputMode)return Ft(P);try{o=new Blob([P],{type:"application/xml;charset=utf-8"}),saveAs(o,n.fileName+".xml")}catch(t){Tt(n.fileName+".xml","data:application/xml;charset=utf-8;base64,",P)}}else if("excel"===n.type&&"xlsx"===n.mso.fileFormat){var I=[],E=[];d=0,(c=t(a).find("thead").first().find(n.theadSelector).toArray()).push.apply(c,rt(t(a))),t(c).each(function(){var e=[];ct(this,"th,td",d,c.length,function(o,r,i){if(null!=o){var a=mt(o,r,i),s=wt(o),l=xt(o);if(t.each(E,function(){if(d>=this.s.r&&d<=this.e.r&&e.length>=this.s.c&&e.length<=this.e.c)for(var t=0;t<=this.e.c-this.s.c;++t)e.push(null)}),(l||s)&&(l=l||1,s=s||1,E.push({s:{r:d,c:e.length},e:{r:d+l-1,c:e.length+s-1}})),"function"!=typeof n.onCellData&&""!==a&&a===+a&&(a=+a),e.push(""!==a?a:null),s)for(var c=0;c<s-1;++c)e.push(null)}}),I.push(e),d++});var W=new function t(){if(!(this instanceof t))return new t;this.SheetNames=[];this.Sheets={}},L=function(t){for(var e={},o={s:{c:1e7,r:1e7},e:{c:0,r:0}},n=0;n!==t.length;++n)for(var r=0;r!==t[n].length;++r){o.s.r>n&&(o.s.r=n),o.s.c>r&&(o.s.c=r),o.e.r<n&&(o.e.r=n),o.e.c<r&&(o.e.c=r);var i={v:t[n][r]};if(null!==i.v){var a=XLSX.utils.encode_cell({c:r,r:n});"number"==typeof i.v?i.t="n":"boolean"==typeof i.v?i.t="b":i.v instanceof Date?(i.t="n",i.z=XLSX.SSF._table[14],i.v=kt(i.v)):i.t="s",e[a]=i}}o.s.c<1e7&&(e["!ref"]=XLSX.utils.encode_range(o));return e}(I);L["!merges"]=E,XLSX.utils.book_append_sheet(W,L,n.mso.worksheetName);var U=XLSX.write(W,{type:"binary",bookType:n.mso.fileFormat,bookSST:!1});try{o=new Blob([Nt(U)],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8"}),saveAs(o,n.fileName+"."+n.mso.fileFormat)}catch(t){Tt(n.fileName+"."+n.mso.fileFormat,"data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8,",Nt(U))}}else if("excel"===n.type||"xls"===n.type||"word"===n.type||"doc"===n.type){var B="excel"===n.type||"xls"===n.type?"excel":"word",H="excel"===B?"xls":"doc",z='xmlns:x="urn:schemas-microsoft-com:office:'+B+'"',X="",K="";t(a).filter(function(){return lt(t(this))}).each(function(){var e=t(this);""===K&&(K=n.mso.worksheetName||e.find("caption").text()||"Table",K=t.trim(K.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31))),!1===n.exportHiddenCells&&(p=e.find("tr, th, td").filter(":hidden"),m=p.length>0),d=0,u=[],f=st(this),X+="<table><thead>",(l=e.find("thead").first().find(n.theadSelector)).each(function(){h="",ct(this,"th,td",d,l.length,function(e,o,r){if(null!==e){var i="";for(var a in h+="<th",n.mso.styles)if(n.mso.styles.hasOwnProperty(a)){var s=t(e).css(n.mso.styles[a]);""!==s&&"0px none rgb(0, 0, 0)"!==s&&"rgba(0, 0, 0, 0)"!==s&&(i+=""===i?'style="':";",i+=n.mso.styles[a]+":"+s)}""!==i&&(h+=" "+i+'"');var l=wt(e);l>0&&(h+=' colspan="'+l+'"');var c=xt(e);c>0&&(h+=' rowspan="'+c+'"'),h+=">"+mt(e,o,r)+"</th>"}}),h.length>0&&(X+="<tr>"+h+"</tr>"),d++}),X+="</thead><tbody>",c=rt(e),t(c).each(function(){var e=t(this);h="",ct(this,"td,th",d,l.length+c.length,function(o,r,i){if(null!==o){var a=mt(o,r,i),s="",l=t(o).data("tableexport-msonumberformat");for(var c in void 0===l&&"function"==typeof n.mso.onMsoNumberFormat&&(l=n.mso.onMsoNumberFormat(o,r,i)),void 0!==l&&""!==l&&(s="style=\"mso-number-format:'"+l+"'"),n.mso.styles)n.mso.styles.hasOwnProperty(c)&&(""===(l=t(o).css(n.mso.styles[c]))&&(l=e.css(n.mso.styles[c])),""!==l&&"0px none rgb(0, 0, 0)"!==l&&"rgba(0, 0, 0, 0)"!==l&&(s+=""===s?'style="':";",s+=n.mso.styles[c]+":"+l));h+="<td",""!==s&&(h+=" "+s+'"');var d=wt(o);d>0&&(h+=' colspan="'+d+'"');var f=xt(o);f>0&&(h+=' rowspan="'+f+'"'),"string"==typeof a&&""!==a&&(a=(a=gt(a)).replace(/\n/g,"<br>")),h+=">"+a+"</td>"}}),h.length>0&&(X+="<tr>"+h+"</tr>"),d++}),n.displayTableName&&(X+="<tr><td></td></tr><tr><td></td></tr><tr><td>"+mt(t("<p>"+n.tableName+"</p>"))+"</td></tr>"),X+="</tbody></table>"});var q='<html xmlns:o="urn:schemas-microsoft-com:office:office" '+z+' xmlns="http://www.w3.org/TR/REC-html40">';if(q+='<meta http-equiv="content-type" content="application/vnd.ms-'+B+'; charset=UTF-8">',q+="<head>","excel"===B&&(q+="\x3c!--[if gte mso 9]>",q+="<xml>",q+="<x:ExcelWorkbook>",q+="<x:ExcelWorksheets>",q+="<x:ExcelWorksheet>",q+="<x:Name>",q+=K,q+="</x:Name>",q+="<x:WorksheetOptions>",q+="<x:DisplayGridlines/>",n.mso.rtl&&(q+="<x:DisplayRightToLeft/>"),q+="</x:WorksheetOptions>",q+="</x:ExcelWorksheet>",q+="</x:ExcelWorksheets>",q+="</x:ExcelWorkbook>",q+="</xml>",q+="<![endif]--\x3e"),q+="<style>",q+="@page { size:"+n.mso.pageOrientation+"; mso-page-orientation:"+n.mso.pageOrientation+"; }",q+="@page Section1 {size:"+r[n.mso.pageFormat][0]+"pt "+r[n.mso.pageFormat][1]+"pt",q+="; margin:1.0in 1.25in 1.0in 1.25in;mso-header-margin:.5in;mso-footer-margin:.5in;mso-paper-source:0;}",q+="div.Section1 {page:Section1;}",q+="@page Section2 {size:"+r[n.mso.pageFormat][1]+"pt "+r[n.mso.pageFormat][0]+"pt",q+=";mso-page-orientation:"+n.mso.pageOrientation+";margin:1.25in 1.0in 1.25in 1.0in;mso-header-margin:.5in;mso-footer-margin:.5in;mso-paper-source:0;}",q+="div.Section2 {page:Section2;}",q+="br {mso-data-placement:same-cell;}",q+="</style>",q+="</head>",q+="<body>",q+='<div class="Section'+("landscape"===n.mso.pageOrientation?"2":"1")+'">',q+=X,q+="</div>",q+="</body>",q+="</html>","string"===n.outputMode)return q;if("base64"===n.outputMode)return Ft(q);try{o=new Blob([q],{type:"application/vnd.ms-"+n.type}),saveAs(o,n.fileName+"."+H)}catch(t){Tt(n.fileName+"."+H,"data:application/vnd.ms-"+B+";base64,",q)}}else if("png"===n.type)html2canvas(t(a)[0]).then(function(t){for(var e=t.toDataURL(),r=atob(e.substring(22)),i=new ArrayBuffer(r.length),a=new Uint8Array(i),s=0;s<r.length;s++)a[s]=r.charCodeAt(s);if("string"===n.outputMode)return r;if("base64"===n.outputMode)return Ft(e);if("window"!==n.outputMode)try{o=new Blob([i],{type:"image/png"}),saveAs(o,n.fileName+".png")}catch(t){Tt(n.fileName+".png","data:image/png,",o)}else window.open(e)});else if("pdf"===n.type)if(!0===n.pdfmake.enabled){var Q=[],_=[];d=0,u=[];for(var V=function(e,o,n){var r=0;return t(e).each(function(){var t=[];ct(this,o,d,n,function(e,o,n){if(null!=e){var r=wt(e),i=xt(e),a=mt(e,o,n)||" ";r>1||i>1?(r=r||1,i=i||1,t.push({colSpan:r,rowSpan:i,text:a})):t.push(a)}else t.push(" ")}),t.length&&_.push(t),r<t.length&&(r=t.length),d++}),r},Y=V(l=t(this).find("thead").first().find(n.theadSelector),"th,td",l.length),J=Q.length;J<Y;J++)Q.push("*");V(c=rt(t(this)),"th,td",l.length+c.length);var $={content:[{table:{headerRows:l.length,widths:Q,body:_}}]};t.extend(!0,$,n.pdfmake.docDefinition),pdfMake.fonts={Roboto:{normal:"Roboto-Regular.ttf",bold:"Roboto-Medium.ttf",italics:"Roboto-Italic.ttf",bolditalics:"Roboto-MediumItalic.ttf"}},t.extend(!0,pdfMake.fonts,n.pdfmake.fonts),pdfMake.createPdf($).getBuffer(function(t){try{var e=new Blob([t],{type:"application/pdf"});saveAs(e,n.fileName+".pdf")}catch(e){Tt(n.fileName+".pdf","data:application/pdf;base64,",t)}})}else if(!1===n.jspdf.autotable){var G={dim:{w:Ct(t(a).first().get(0),"width","mm"),h:Ct(t(a).first().get(0),"height","mm")},pagesplit:!1},Z=new jsPDF(n.jspdf.orientation,n.jspdf.unit,n.jspdf.format);Z.addHTML(t(a).first(),n.jspdf.margins.left,n.jspdf.margins.top,G,function(){dt(Z,!1)})}else{var tt=n.jspdf.autotable.tableExport;if("string"==typeof n.jspdf.format&&"bestfit"===n.jspdf.format.toLowerCase()){var et="",ot="",nt=0;t(a).each(function(){if(lt(t(this))){var e=Ct(t(this).get(0),"width","pt");if(e>nt){for(var o in e>r.a0[0]&&(et="a0",ot="l"),r)r.hasOwnProperty(o)&&r[o][1]>e&&(et=o,ot="l",r[o][0]>e&&(ot="p"));nt=e}}}),n.jspdf.format=""===et?"a4":et,n.jspdf.orientation=""===ot?"w":ot}null==tt.doc&&(tt.doc=new jsPDF(n.jspdf.orientation,n.jspdf.unit,n.jspdf.format),"function"==typeof n.jspdf.onDocCreated&&n.jspdf.onDocCreated(tt.doc)),!0===tt.outputImages&&(tt.images={}),void 0!==tt.images&&(t(a).filter(function(){return lt(t(this))}).each(function(){var e=0;u=[],!1===n.exportHiddenCells&&(p=t(this).find("tr, th, td").filter(":hidden"),m=p.length>0),l=t(this).find("thead").find(n.theadSelector),c=rt(t(this)),t(c).each(function(){ct(this,"td,th",l.length+e,l.length+c.length,function(e){if(null!=e){var o=t(e).children();void 0!==o&&o.length>0&&function e(o,n,r){void 0!==r.images&&n.each(function(){var n=t(this).children();if(t(this).is("img")){var i=At(this.src);r.images[i]={url:this.src,src:this.src}}void 0!==n&&n.length>0&&e(o,n,r)})}(e,o,tt)}}),e++})}),l=[],c=[]),function(t,e){var o,n=0,r=0;function i(){e(n)}function a(t){if(t.url){var e=new Image;n=++r,e.crossOrigin="Anonymous",e.onerror=e.onload=function(){if(e.complete&&(0===e.src.indexOf("data:image/")&&(e.width=t.width||e.width||0,e.height=t.height||e.height||0),e.width+e.height)){var o=document.createElement("canvas"),n=o.getContext("2d");o.width=e.width,o.height=e.height,n.drawImage(e,0,0),t.src=o.toDataURL("image/jpeg")}--r||i()},e.src=t.url}}if(void 0!==t.images)for(o in t.images)t.images.hasOwnProperty(o)&&a(t.images[o]);r||i()}(tt,function(){t(a).filter(function(){return lt(t(this))}).each(function(){var e;if(d=0,u=[],!1===n.exportHiddenCells&&(p=t(this).find("tr, th, td").filter(":hidden"),m=p.length>0),f=st(this),tt.columns=[],tt.rows=[],tt.rowoptions={},"function"==typeof tt.onTable&&!1===tt.onTable(t(this),n))return!0;n.jspdf.autotable.tableExport=null;var o=t.extend(!0,{},n.jspdf.autotable);if(n.jspdf.autotable.tableExport=tt,o.margin={},t.extend(!0,o.margin,n.jspdf.margins),o.tableExport=tt,"function"!=typeof o.beforePageContent&&(o.beforePageContent=function(e){if(1===e.pageCount){var o=e.table.rows.concat(e.table.headerRow);t.each(o,function(){this.height>0&&(this.height+=(2-i)/2*this.styles.fontSize,e.table.height+=(2-i)/2*this.styles.fontSize)})}}),"function"!=typeof o.createdHeaderCell&&(o.createdHeaderCell=function(e,n){if(e.styles=t.extend({},n.row.styles),void 0!==tt.columns[n.column.dataKey]){var r,i=tt.columns[n.column.dataKey];if(void 0!==i.rect)e.contentWidth=i.rect.width,void 0!==tt.heightRatio&&0!==tt.heightRatio||(r=n.row.raw[n.column.dataKey].rowspan?n.row.raw[n.column.dataKey].rect.height/n.row.raw[n.column.dataKey].rowspan:n.row.raw[n.column.dataKey].rect.height,tt.heightRatio=e.styles.rowHeight/r),(r=n.row.raw[n.column.dataKey].rect.height*tt.heightRatio)>e.styles.rowHeight&&(e.styles.rowHeight=r);void 0!==i.style&&!0!==i.style.hidden&&(e.styles.halign=i.style.align,"inherit"===o.styles.fillColor&&(e.styles.fillColor=i.style.bcolor),"inherit"===o.styles.textColor&&(e.styles.textColor=i.style.color),"inherit"===o.styles.fontStyle&&(e.styles.fontStyle=i.style.fstyle))}}),"function"!=typeof o.createdCell&&(o.createdCell=function(t,e){var n=tt.rowoptions[e.row.index+":"+e.column.dataKey];void 0!==n&&void 0!==n.style&&!0!==n.style.hidden&&(t.styles.halign=n.style.align,"inherit"===o.styles.fillColor&&(t.styles.fillColor=n.style.bcolor),"inherit"===o.styles.textColor&&(t.styles.textColor=n.style.color),"inherit"===o.styles.fontStyle&&(t.styles.fontStyle=n.style.fstyle))}),"function"!=typeof o.drawHeaderCell&&(o.drawHeaderCell=function(t,e){var o=tt.columns[e.column.dataKey];return(!0!==o.style.hasOwnProperty("hidden")||!0!==o.style.hidden)&&o.rowIndex>=0&&ht(t,e,o)}),"function"!=typeof o.drawCell&&(o.drawCell=function(e,o){var r=tt.rowoptions[o.row.index+":"+o.column.dataKey];if(ht(e,o,r))if(tt.doc.rect(e.x,e.y,e.width,e.height,e.styles.fillStyle),void 0!==r&&void 0!==r.kids&&r.kids.length>0){var i=e.height/r.rect.height;(i>tt.dh||void 0===tt.dh)&&(tt.dh=i),tt.dw=e.width/r.rect.width;var a=e.textPos.y;!function e(o,r,i){r.each(function(){var r=t(this).children(),a=0;if(t(this).is("div")){var s=yt(St(this,"background-color"),[255,255,255]),l=yt(St(this,"border-top-color"),[0,0,0]),c=Ct(this,"border-top-width",n.jspdf.unit),d=this.getBoundingClientRect(),h=this.offsetLeft*i.dw;a=this.offsetTop*i.dh;var f=d.width*i.dw,u=d.height*i.dh;i.doc.setDrawColor.apply(void 0,l),i.doc.setFillColor.apply(void 0,s),i.doc.setLineWidth(c),i.doc.rect(o.x+h,o.y+a,f,u,c?"FD":"F")}else if(t(this).is("img")&&void 0!==i.images){var p=At(this.src),m=i.images[p];if(void 0!==m){var g=o.width/o.height,v=this.width/this.height,y=o.width,b=o.height;v<=g?(b=Math.min(o.height,this.height),y=this.width*b/this.height):v>g&&(y=Math.min(o.width,this.width),b=this.height*y/this.width),y*=19.049976/25.4,(b*=19.049976/25.4)<o.height&&(a=(o.height-b)/2);try{i.doc.addImage(m.src,o.textPos.x,o.y+a,y,b)}catch(t){}o.textPos.x+=y}}void 0!==r&&r.length>0&&e(o,r,i)})}(e,r.kids,tt),e.textPos.y=a,ft(e,r.kids,tt)}else ft(e,{},tt);return!1}),tt.headerrows=[],(l=t(this).find("thead").find(n.theadSelector)).each(function(){e=0,tt.headerrows[d]=[],ct(this,"th,td",d,l.length,function(t,o,n){var r=bt(t);r.title=mt(t,o,n),r.key=e++,r.rowIndex=d,tt.headerrows[d].push(r)}),d++}),d>0)for(var r=d-1;r>=0;)t.each(tt.headerrows[r],function(){var t=this;r>0&&null===this.rect&&(t=tt.headerrows[r-1][this.key]),null!==t&&t.rowIndex>=0&&(!0!==t.style.hasOwnProperty("hidden")||!0!==t.style.hidden)&&tt.columns.push(t)}),r=tt.columns.length>0?-1:r-1;var a=0;c=[],c=rt(t(this)),t(c).each(function(){var o=[];e=0,ct(this,"td,th",d,l.length+c.length,function(n,r,i){var s;void 0===tt.columns[e]&&(s={title:"",key:e,style:{hidden:!0}},tt.columns.push(s)),null!=n?((s=bt(n)).kids=t(n).children(),tt.rowoptions[a+":"+e++]=s):((s=t.extend(!0,{},tt.rowoptions[a+":"+(e-1)])).colspan=-1,tt.rowoptions[a+":"+e++]=s),o.push(mt(n,r,i))}),o.length&&(tt.rows.push(o),a++),d++}),"function"==typeof tt.onBeforeAutotable&&tt.onBeforeAutotable(t(this),tt.columns,tt.rows,o),tt.doc.autoTable(tt.columns,tt.rows,o),"function"==typeof tt.onAfterAutotable&&tt.onAfterAutotable(t(this),o),n.jspdf.autotable.startY=tt.doc.autoTableEndPosY()+o.margin.top}),dt(tt.doc,void 0!==tt.images&&!1===jQuery.isEmptyObject(tt.images)),void 0!==tt.headerrows&&(tt.headerrows.length=0),void 0!==tt.columns&&(tt.columns.length=0),void 0!==tt.rows&&(tt.rows.length=0),delete tt.doc,tt.doc=null})}function rt(e){var o=[];return it(e,"tbody").each(function(){o.push.apply(o,at(t(this),n.tbodySelector).toArray())}),n.tfootSelector.length&&it(e,"tfoot").each(function(){o.push.apply(o,at(t(this),n.tfootSelector).toArray())}),o}function it(e,o){var n=e.parents("table").length;return e.find(o).filter(function(){return t(this).closest("table").parents("table").length===n})}function at(e,o){return e.find(o).filter(function(){return 0===n.maxNestedTables||t(this).find("table").length<n.maxNestedTables&&t(this).parents("table").length<=n.maxNestedTables})}function st(e){var o=[];return t(e).find("thead").first().find("th").each(function(e,n){void 0!==t(n).attr("data-field")?o[e]=t(n).attr("data-field"):o[e]=e.toString()}),o}function lt(e){var o=void 0!==e[0].cellIndex,n=void 0!==e[0].rowIndex,r=o||n?function(t){var e=[];m&&(e=p.filter(function(){var e=!1;return this.nodeType===t[0].nodeType&&(void 0!==this.rowIndex&&this.rowIndex===t[0].rowIndex?e=!0:void 0!==this.cellIndex&&this.cellIndex===t[0].cellIndex&&void 0!==this.parentNode.rowIndex&&void 0!==t[0].parentNode.rowIndex&&this.parentNode.rowIndex===t[0].parentNode.rowIndex&&(e=!0)),e}));return!1===m||0===e.length}(e):e.is(":visible"),i=e.data("tableexport-display");return o&&"none"!==i&&"always"!==i&&(n=void 0!==(e=t(e[0].parentNode))[0].rowIndex,i=e.data("tableexport-display")),n&&"none"!==i&&"always"!==i&&(i=e.closest("table").data("tableexport-display")),"none"!==i&&(!0===r||"always"===i)}function ct(e,o,r,i,a){if("function"==typeof a){var s=!1;if("function"==typeof n.onIgnoreRow&&(s=n.onIgnoreRow(t(e),r)),!1===s&&-1===t.inArray(r,n.ignoreRow)&&-1===t.inArray(r-i,n.ignoreRow)&<(t(e))){var l=t(e).find(o),c=0;l.each(function(e){var o,i=t(this),s=wt(this),d=xt(this);if(t.each(u,function(){if(r>=this.s.r&&r<=this.e.r&&c>=this.s.c&&c<=this.e.c)for(o=0;o<=this.e.c-this.s.c;++o)a(null,r,c++)}),!1===function(e,o,r){var i=!1;return lt(e)?n.ignoreColumn.length>0&&(-1!==t.inArray(r,n.ignoreColumn)||-1!==t.inArray(r-o,n.ignoreColumn)||f.length>r&&void 0!==f[r]&&-1!==t.inArray(f[r],n.ignoreColumn))&&(i=!0):i=!0,i}(i,l.length,e)&&((d||s)&&(d=d||1,s=s||1,u.push({s:{r:r,c:c},e:{r:r+d-1,c:c+s-1}})),a(this,r,c++)),s)for(o=0;o<s-1;++o)a(null,r,c++)}),t.each(u,function(){if(r>=this.s.r&&r<=this.e.r&&c>=this.s.c&&c<=this.e.c)for(M=0;M<=this.e.c-this.s.c;++M)a(null,r,c++)})}}}function dt(t,e){if("string"===n.outputMode)return t.output();if("base64"===n.outputMode)return Ft(t.output());if("window"===n.outputMode)return window.URL=window.URL||window.webkitURL,void window.open(window.URL.createObjectURL(t.output("blob")));try{var o=t.output("blob");saveAs(o,n.fileName+".pdf")}catch(o){Tt(n.fileName+".pdf","data:application/pdf"+(e?"":";base64")+",",e?t.output("blob"):t.output())}}function ht(t,e,o){var n=0;if(void 0!==o&&(n=o.colspan),n>=0){for(var r=t.width,a=t.textPos.x,s=e.table.columns.indexOf(e.column),l=1;l<n;l++){r+=e.table.columns[s+l].width}if(n>1&&("right"===t.styles.halign?a=t.textPos.x+r-t.width:"center"===t.styles.halign&&(a=t.textPos.x+(r-t.width)/2)),t.width=r,t.textPos.x=a,void 0!==o&&o.rowspan>1&&(t.height=t.height*o.rowspan),"middle"===t.styles.valign||"bottom"===t.styles.valign){var c=("string"==typeof t.text?t.text.split(/\r\n|\r|\n/g):t.text).length||1;c>2&&(t.textPos.y-=(2-i)/2*e.row.styles.fontSize*(c-2)/3)}return!0}return!1}function ft(e,o,n){if("function"==typeof n.onAutotableText)n.onAutotableText(n.doc,e,o);else{var r=e.textPos.x,i=e.textPos.y,a={halign:e.styles.halign,valign:e.styles.valign};if(o.length){for(var s=o[0];s.previousSibling;)s=s.previousSibling;for(var l=!1,c=!1;s;){var d=s.innerText||s.textContent||"";d=(d.length&&" "===d[0]?" ":"")+t.trim(d)+(d.length>1&&" "===d[d.length-1]?" ":""),t(s).is("br")&&(r=e.textPos.x,i+=n.doc.internal.getFontSize()),t(s).is("b")?l=!0:t(s).is("i")&&(c=!0),(l||c)&&n.doc.setFontType(l&&c?"bolditalic":l?"bold":"italic");var h=n.doc.getStringUnitWidth(d)*n.doc.internal.getFontSize();if(h){if("linebreak"===e.styles.overflow&&r>e.textPos.x&&r+h>e.textPos.x+e.width){if(".,!%*;:=-".indexOf(d.charAt(0))>=0){var f=d.charAt(0);r+(h=n.doc.getStringUnitWidth(f)*n.doc.internal.getFontSize())<=e.textPos.x+e.width&&(n.doc.autoTableText(f,r,i,a),d=d.substring(1,d.length)),h=n.doc.getStringUnitWidth(d)*n.doc.internal.getFontSize()}r=e.textPos.x,i+=n.doc.internal.getFontSize()}if("visible"!==e.styles.overflow)for(;d.length&&r+h>e.textPos.x+e.width;)d=d.substring(0,d.length-1),h=n.doc.getStringUnitWidth(d)*n.doc.internal.getFontSize();n.doc.autoTableText(d,r,i,a),r+=h}(l||c)&&(t(s).is("b")?l=!1:t(s).is("i")&&(c=!1),n.doc.setFontType(l||c?l?"bold":"italic":"normal")),s=s.nextSibling}e.textPos.x=r,e.textPos.y=i}else n.doc.autoTableText(e.text,e.textPos.x,e.textPos.y,a)}}function ut(t,e,o){return t.replace(new RegExp(function(t){return t.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")}(e),"g"),o)}function pt(t){return t=ut(t=t||"0",n.numbers.html.thousandsSeparator,""),("number"==typeof(t=ut(t,n.numbers.html.decimalMark,"."))||!1!==jQuery.isNumeric(t))&&t}function mt(e,o,r){var i="";if(null!==e){var a,s=t(e);if(s[0].hasAttribute("data-tableexport-value"))a=(a=s.data("tableexport-value"))?a+"":"";else if(a=s.html(),"function"==typeof n.onCellHtmlData)a=n.onCellHtmlData(s,o,r,a);else if(""!==a){var l=t.parseHTML(a),c=0,d=0;a="",t.each(l,function(){t(this).is("input")?a+=s.find("input").eq(c++).val():t(this).is("select")?a+=s.find("select option:selected").eq(d++).text():void 0===t(this).html()?a+=t(this).text():(void 0===jQuery().bootstrapTable||!0!==t(this).hasClass("filterControl")&&0===t(e).parents(".detail-view").length)&&(a+=t(this).html())})}if(!0===n.htmlContent)i=t.trim(a);else if(a&&""!==a){if(""!==t(e).data("tableexport-cellformat")){var h=a.replace(/\n/g,"\u2028").replace(/<br\s*[\/]?>/gi,""),f=t("<div/>").html(h).contents(),u=!1;if(h="",t.each(f.text().split("\u2028"),function(e,o){e>0&&(h+=" "),h+=t.trim(o)}),t.each(h.split(""),function(e,o){e>0&&(i+="\n"),i+=t.trim(o).replace(/\u00AD/g,"")}),"json"===n.type||"excel"===n.type&&"xmlss"===n.mso.fileFormat||!1===n.numbers.output)!1!==(u=pt(i))&&(i=Number(u));else if((n.numbers.html.decimalMark!==n.numbers.output.decimalMark||n.numbers.html.thousandsSeparator!==n.numbers.output.thousandsSeparator)&&!1!==(u=pt(i))){var p=(""+u.substr(u<0?1:0)).split(".");1===p.length&&(p[1]="");var m=p[0].length>3?p[0].length%3:0;i=(u<0?"-":"")+(n.numbers.output.thousandsSeparator?(m?p[0].substr(0,m)+n.numbers.output.thousandsSeparator:"")+p[0].substr(m).replace(/(\d{3})(?=\d)/g,"$1"+n.numbers.output.thousandsSeparator):p[0])+(p[1].length?n.numbers.output.decimalMark+p[1]:"")}}else i=a}!0===n.escape&&(i=escape(i)),"function"==typeof n.onCellData&&(i=n.onCellData(s,o,r,i))}return i}function gt(t){if(!0===n.preventInjection){if("=+-@".indexOf(t.charAt(0))>=0)return"'"+t}return t}function vt(t,e,o){return e+"-"+o.toLowerCase()}function yt(t,e){var o=/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/.exec(t),n=e;return o&&(n=[parseInt(o[1]),parseInt(o[2]),parseInt(o[3])]),n}function bt(t){var e=St(t,"text-align"),o=St(t,"font-weight"),n=St(t,"font-style"),r="";"start"===e&&(e="rtl"===St(t,"direction")?"right":"left"),o>=700&&(r="bold"),"italic"===n&&(r+=n),""===r&&(r="normal");var i={style:{align:e,bcolor:yt(St(t,"background-color"),[255,255,255]),color:yt(St(t,"color"),[0,0,0]),fstyle:r},colspan:wt(t),rowspan:xt(t)};if(null!==t){var a=t.getBoundingClientRect();i.rect={width:a.width,height:a.height}}return i}function wt(e){var o=t(e).data("tableexport-colspan");return void 0===o&&t(e).is("[colspan]")&&(o=t(e).attr("colspan")),parseInt(o)||0}function xt(e){var o=t(e).data("tableexport-rowspan");return void 0===o&&t(e).is("[rowspan]")&&(o=t(e).attr("rowspan")),parseInt(o)||0}function St(t,e){try{return window.getComputedStyle?(e=e.replace(/([a-z])([A-Z])/,vt),window.getComputedStyle(t,null).getPropertyValue(e)):t.currentStyle?t.currentStyle[e]:t.style[e]}catch(t){}return""}function Ct(t,e,o){var n=St(t,e).match(/\d+/);return null!==n?(n=n[0],function(t,e,o){var n=document.createElement("div");n.style.overflow="hidden",n.style.visibility="hidden",t.appendChild(n),n.style.width=100+o;var r=100/n.offsetWidth;return t.removeChild(n),e*r}(t.parentElement,n,o)):0}function Nt(t){for(var e=new ArrayBuffer(t.length),o=new Uint8Array(e),n=0;n!==t.length;++n)o[n]=255&t.charCodeAt(n);return e}function kt(t,e){return e&&(t+=1462),(Date.parse(t)-new Date(Date.UTC(1899,11,30)))/864e5}function At(t){var e,o,n=0;if(0===t.length)return n;for(e=0,o=t.length;e<o;e++)n=(n<<5)-n+t.charCodeAt(e),n|=0;return n}function Tt(t,e,o){var n=window.navigator.userAgent;if(!1!==t&&window.navigator.msSaveOrOpenBlob)window.navigator.msSaveOrOpenBlob(new Blob([o]),t);else if(!1!==t&&(n.indexOf("MSIE ")>0||n.match(/Trident.*rv\:11\./))){var r=document.createElement("iframe");if(r){switch(document.body.appendChild(r),r.setAttribute("style","display:none"),r.contentDocument.open("txt/plain","replace"),r.contentDocument.write(o),r.contentDocument.close(),r.contentDocument.focus(),t.substr(t.lastIndexOf(".")+1)){case"doc":case"json":case"png":case"pdf":case"xls":case"xlsx":t+=".txt"}r.contentDocument.execCommand("SaveAs",!0,t),document.body.removeChild(r)}}else{var i=document.createElement("a");if(i){var a=null;i.style.display="none",!1!==t?i.download=t:i.target="_blank","object"==typeof o?(window.URL=window.URL||window.webkitURL,a=window.URL.createObjectURL(o),i.href=a):e.toLowerCase().indexOf("base64,")>=0?i.href=e+Ft(o):i.href=e+encodeURIComponent(o),document.body.appendChild(i),document.createEvent?(null===s&&(s=document.createEvent("MouseEvents")),s.initEvent("click",!0,!1),i.dispatchEvent(s)):document.createEventObject?i.fireEvent("onclick"):"function"==typeof i.onclick&&i.onclick(),setTimeout(function(){a&&window.URL.revokeObjectURL(a),document.body.removeChild(i)},100)}}}function Ft(t){var e,o,n,r,i,a,s,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c="",d=0;for(t=function(t){if("string"==typeof t){t=t.replace(/\x0d\x0a/g,"\n");for(var e="",o=0;o<t.length;o++){var n=t.charCodeAt(o);n<128?e+=String.fromCharCode(n):n>127&&n<2048?(e+=String.fromCharCode(n>>6|192),e+=String.fromCharCode(63&n|128)):(e+=String.fromCharCode(n>>12|224),e+=String.fromCharCode(n>>6&63|128),e+=String.fromCharCode(63&n|128))}return e}return t}(t);d<t.length;)r=(e=t.charCodeAt(d++))>>2,i=(3&e)<<4|(o=t.charCodeAt(d++))>>4,a=(15&o)<<2|(n=t.charCodeAt(d++))>>6,s=63&n,isNaN(o)?a=s=64:isNaN(n)&&(s=64),c=c+l.charAt(r)+l.charAt(i)+l.charAt(a)+l.charAt(s);return c}return this}}(jQuery);