"use strict";function _classCallCheck(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");}(function(n){function b(n){var t=e(w(),n),i;return typeof t.extendWidth!="undefined"&&(t.tableWidth=t.extendWidth?"auto":"wrap",console.error("Use of deprecated option: extendWidth, use tableWidth instead.")),typeof t.margins!="undefined"&&(typeof t.margin=="undefined"&&(t.margin=t.margins),console.error("Use of deprecated option: margins, use margin instead.")),[["padding","cellPadding"],["lineHeight","rowHeight"],"fontSize","overflow"].forEach(function(n){var i=typeof n=="string"?n:n[0],r=typeof n=="string"?n:n[1];typeof t[i]!="undefined"&&(typeof t.styles[r]=="undefined"&&(t.styles[r]=t[i]),console.error("Use of deprecated option: "+i+", use the style "+r+" instead."))}),i=t.margin,t.margin={},typeof i.horizontal=="number"&&(i.right=i.horizontal,i.left=i.horizontal),typeof i.vertical=="number"&&(i.top=i.vertical,i.bottom=i.vertical),["top","right","bottom","left"].forEach(function(n,r){if(typeof i=="number")t.margin[n]=i;else{var u=Array.isArray(i)?r:n;t.margin[n]=typeof i[u]=="number"?i[u]:40}}),t}function k(n,r){var o,u,c;i=new Table;i.x=t.margin.left;o=/\r\n|\r|\n/g;u=new Row(n);u.index=-1;c=e(l,s[t.theme].table,s[t.theme].header);u.styles=e(c,t.styles,t.headerStyles);n.forEach(function(n,r){var e,f;typeof n=="object"&&(r=typeof n.dataKey!="undefined"?n.dataKey:n.key);typeof n.width!="undefined"&&console.error("Use of deprecated option: column.width, use column.styles.columnWidth instead.");e=new Column(r);e.styles=t.columnStyles[e.dataKey]||{};i.columns.push(e);f=new Cell;f.raw=typeof n=="object"?n.title:n;f.styles=u.styles;f.text=""+f.raw;f.contentWidth=f.styles.cellPadding*2+h(f.text,f.styles);f.text=f.text.split(o);u.cells[r]=f;t.createdHeaderCell(f,{column:e,row:u,settings:t})});i.headerRow=u;r.forEach(function(n,r){var u=new Row(n),c=r%2==0,a=e(l,s[t.theme].table,c?s[t.theme].alternateRow:{}),v=e(t.styles,t.bodyStyles,c?t.alternateRowStyles:{});u.styles=e(a,v);u.index=r;i.columns.forEach(function(i){var r=new Cell;r.raw=n[i.dataKey];r.styles=e(u.styles,i.styles);r.text=typeof r.raw!="undefined"?""+r.raw:"";u.cells[i.dataKey]=r;t.createdCell(r,f({column:i,row:u}));r.contentWidth=r.styles.cellPadding*2+h(r.text,r.styles);r.text=r.text.split(o)});i.rows.push(u)})}function d(){var f=0,u,n,b;i.columns.forEach(function(n){n.contentWidth=i.headerRow.cells[n.dataKey].contentWidth;i.rows.forEach(function(t){var i=t.cells[n.dataKey].contentWidth;i>n.contentWidth&&(n.contentWidth=i)});n.width=n.contentWidth;f+=n.contentWidth});i.contentWidth=f;u=r.internal.pageSize.width-t.margin.left-t.margin.right;n=u;typeof t.tableWidth=="number"?n=t.tableWidth:t.tableWidth==="wrap"&&(n=i.contentWidth);i.width=n<u?n:u;var h=[],c=0,a=i.width/i.columns.length,w=0;i.columns.forEach(function(n){var r=e(l,s[t.theme].table,t.styles,n.styles);r.columnWidth==="wrap"?n.width=n.contentWidth:typeof r.columnWidth=="number"?n.width=r.columnWidth:(r.columnWidth==="auto"||!0)&&(n.contentWidth<=a&&i.contentWidth>i.width?n.width=n.contentWidth:(h.push(n),c+=n.contentWidth,n.width=0));w+=n.width});p(h,w,c,a);i.height=0;b=i.rows.concat(i.headerRow);b.forEach(function(n){var t=0,u=i.x;i.columns.forEach(function(i){var f=n.cells[i.dataKey],e,s;i.x=u;o(f.styles);e=i.width-f.styles.cellPadding*2;f.styles.overflow==="linebreak"?f.text=r.splitTextToSize(f.text,e+1,{fontSize:f.styles.fontSize}):f.styles.overflow==="ellipsize"?f.text=v(f.text,e,f.styles):f.styles.overflow==="visible"||(f.styles.overflow==="hidden"?f.text=v(f.text,e,f.styles,""):typeof f.styles.overflow=="function"?f.text=f.styles.overflow(f.text,e):console.error("Unrecognized overflow type: "+f.styles.overflow));s=Array.isArray(f.text)?f.text.length-1:0;s>t&&(t=s);u+=i.width});n.heightStyle=n.styles.rowHeight;n.height=n.heightStyle+t*n.styles.fontSize*y;i.height+=n.height})}function p(n,t,r,u){for(var o=i.width-t-r,e=0;e<n.length;e++){var f=n[e],s=f.contentWidth/r,h=f.contentWidth+o*s<u;if(o<0&&h){n.splice(e,1);r-=f.contentWidth;f.width=u;t+=f.width;p(n,t,r,u);break}else f.width=f.contentWidth+o*s}}function g(){i.rows.forEach(function(n){if(tt(n.height))nt();n.y=u.y;t.drawRow(n,f({row:n}))!==!1&&a(n,t.drawCell)})}function nt(){t.afterPageContent(f());r.addPage();c++;u={x:t.margin.left,y:t.margin.top};t.beforePageContent(f());t.drawHeaderRow(i.headerRow,f({row:i.headerRow}))!==!1&&a(i.headerRow,t.drawHeaderCell)}function tt(n){var i=u.y+n+t.margin.bottom;return i>=r.internal.pageSize.height}function a(n,t){for(var s,e,c,h=0;h<i.columns.length;h++)(s=i.columns[h],e=n.cells[s.dataKey],e)&&(o(e.styles),e.x=s.x,e.y=u.y,e.height=n.height,e.width=s.width,e.textPos.y=e.styles.valign==="top"?u.y+e.styles.cellPadding:e.styles.valign==="bottom"?u.y+n.height-e.styles.cellPadding:u.y+n.height/2,e.textPos.x=e.styles.halign==="right"?e.x+e.width-e.styles.cellPadding:e.styles.halign==="center"?e.x+e.width/2:e.x+e.styles.cellPadding,c=f({column:s,row:n}),t(e,c)!==!1&&(r.rect(e.x,e.y,e.width,e.height,e.styles.fillStyle),r.autoTableText(e.text,e.textPos.x,e.textPos.y,{halign:e.styles.halign,valign:e.styles.valign})));u.y+=n.height}function o(n){var t=[{func:r.setFillColor,value:n.fillColor},{func:r.setTextColor,value:n.textColor},{func:r.setFontStyle,value:n.fontStyle},{func:r.setDrawColor,value:n.lineColor},{func:r.setLineWidth,value:n.lineWidth},{func:r.setFont,value:n.font},{func:r.setFontSize,value:n.fontSize}];t.forEach(function(n){typeof n.value!="undefined"&&(n.value.constructor===Array?n.func.apply(this,n.value):n.func(n.value))})}function f(n){var f,r;n=n||{};f={pageCount:c,settings:t,table:i,cursor:u};for(r in n)n.hasOwnProperty(r)&&(f[r]=n[r]);return f}function v(n,t,i,r){if(r=typeof r!="undefined"?r:"...",Array.isArray(n))return n.forEach(function(u,f){n[f]=v(u,t,i,r)}),n;if(t>=h(n,i))return n;while(t<h(n+r,i)){if(n.length<2)break;n=n.substring(0,n.length-1)}return n.trim()+r}function h(n,t){o(t);var i=r.getStringUnitWidth(n);return i*t.fontSize}function e(n){var u={},t,r,i;for(t in n)n.hasOwnProperty(t)&&(u[t]=n[t]);for(r=1;r<arguments.length;r++){i=arguments[r];for(t in i)i.hasOwnProperty(t)&&(u[t]=typeof i[t]!="object"||Array.isArray(i[t])?i[t]:i[t])}return u}var y=1.15,r,u,t,c,i,l={cellPadding:5,fontSize:10,font:"helvetica",lineColor:200,lineWidth:.1,fontStyle:"normal",overflow:"ellipsize",fillColor:255,textColor:20,halign:"left",valign:"top",fillStyle:"F",rowHeight:20,columnWidth:"auto"},s={striped:{table:{fillColor:255,textColor:80,fontStyle:"normal",fillStyle:"F"},header:{textColor:255,fillColor:[41,128,185],rowHeight:23,fontStyle:"bold"},body:{},alternateRow:{fillColor:245}},grid:{table:{fillColor:255,textColor:80,fontStyle:"normal",lineWidth:.1,fillStyle:"DF"},header:{textColor:255,fillColor:[26,188,156],rowHeight:23,fillStyle:"F",fontStyle:"bold"},body:{},alternateRow:{}},plain:{header:{fontStyle:"bold"}}},w=function(){return{theme:"striped",styles:{},headerStyles:{},bodyStyles:{},alternateRowStyles:{},columnStyles:{},startY:!1,margin:40,pageBreak:"auto",tableWidth:"auto",createdHeaderCell:function(){},createdCell:function(){},drawHeaderRow:function(){},drawRow:function(){},drawHeaderCell:function(){},drawCell:function(){},beforePageContent:function(){},afterPageContent:function(){}}};n.autoTable=function(n,e,s){var h,v,l;return r=this,t=b(s||{}),c=1,u={y:t.startY===!1?t.margin.top:t.startY},h={textColor:30,fontSize:r.internal.getFontSize(),fontStyle:r.internal.getFont().fontStyle},k(n,e),d(),v=i.rows[0]&&t.pageBreak==="auto"?i.rows[0].height:0,l=t.startY+t.margin.bottom+i.headerRow.height+v,t.pageBreak==="avoid"&&(l+=i.height),(t.pageBreak==="always"&&t.startY!==!1||t.startY!==!1&&l>r.internal.pageSize.height)&&(r.addPage(),u.y=t.margin.top),o(h),t.beforePageContent(f()),t.drawHeaderRow(i.headerRow,f({row:i.headerRow}))!==!1&&a(i.headerRow,t.drawHeaderCell),o(h),g(),t.afterPageContent(f()),o(h),this};n.autoTableEndPosY=function(){return typeof u=="undefined"||typeof u.y=="undefined"?0:u.y};n.autoTableHtmlToJson=function(n){for(var u=[],o=[],r=n.rows[0],f,e,i,t=0;t<r.cells.length;t++)o.push(typeof r.cells[t]!="undefined"?r.cells[t].textContent:"");for(t=1;t<n.rows.length;t++){for(f=n.rows[t],e=[],i=0;i<r.cells.length;i++)e.push(typeof f.cells[i]!="undefined"?f.cells[i].textContent:"");u.push(e)}return{columns:o,data:u,rows:u}};n.autoTableText=function(n,t,i,u){var h,o;(typeof t!="number"||typeof i!="number")&&console.error("The x and y parameters are required. Missing for the text: ",n);var f=r.internal.getFontSize()/r.internal.scaleFactor,c=y,e=null,s=1;if((u.valign==="middle"||u.valign==="bottom"||u.halign==="center"||u.halign==="right")&&(e=typeof n=="string"?n.split(/\r\n|\r|\n/g):n,s=e.length||1),i+=f*(2-c),u.valign==="middle"?i-=s/2*f:u.valign==="bottom"&&(i-=s*f),u.halign==="center"||u.halign==="right"){if(h=f,u.halign==="center"&&(h*=.5),s>=1){for(o=0;o<e.length;o++)r.text(e[o],t-r.getStringUnitWidth(e[o])*h,i),i+=f;return r}t-=r.getStringUnitWidth(n)*h}return r.text(n,t,i),r}})(jsPDF.API);var Table=function Table(){_classCallCheck(this,Table);this.height=0;this.width=0;this.x=0;this.y=0;this.contentWidth=0;this.rows=[];this.columns=[];this.headerRow=null;this.settings={}},Row=function Row(n){_classCallCheck(this,Row);this.raw=n||{};this.index=0;this.styles={};this.cells={};this.height=0;this.y=0},Cell=function Cell(n){_classCallCheck(this,Cell);this.raw=n;this.styles={};this.text="";this.contentWidth=0;this.textPos={};this.height=0;this.width=0;this.x=0;this.y=0},Column=function Column(n){_classCallCheck(this,Column);this.dataKey=n;this.options={};this.styles={};this.contentWidth=0;this.width=0;this.x=0}