UNPKG

jspdf

Version:

PDF Document creation from JavaScript

70 lines (65 loc) 271 kB
"use strict"; /** @license * jsPDF - PDF Document creation from JavaScript * Version 1.5.2 Built on 2018-12-20T15:49:08.058Z * CommitID 81f5c40ca4 * * Copyright (c) 2010-2016 James Hall <james@parall.ax>, https://github.com/MrRio/jsPDF * 2010 Aaron Spike, https://github.com/acspike * 2012 Willow Systems Corporation, willow-systems.com * 2012 Pablo Hess, https://github.com/pablohess * 2012 Florian Jenett, https://github.com/fjenett * 2013 Warren Weckesser, https://github.com/warrenweckesser * 2013 Youssef Beddad, https://github.com/lifof * 2013 Lee Driscoll, https://github.com/lsdriscoll * 2013 Stefan Slonevskiy, https://github.com/stefslon * 2013 Jeremy Morel, https://github.com/jmorel * 2013 Christoph Hartmann, https://github.com/chris-rock * 2014 Juan Pablo Gaviria, https://github.com/juanpgaviria * 2014 James Makes, https://github.com/dollaruw * 2014 Diego Casorran, https://github.com/diegocr * 2014 Steven Spungin, https://github.com/Flamenco * 2014 Kenneth Glassey, https://github.com/Gavvers * * Licensed under the MIT License * * Contributor(s): * siefkenj, ahwolf, rickygu, Midnith, saintclair, eaparango, * kim3er, mfo, alnorth, Flamenco */ function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(exports,"__esModule",{value:!0});var jsPDF=function(ie){function oe(o){if("object"!==_typeof(o))throw new Error("Invalid Context passed to initialize PubSub (jsPDF-module)");var s={};this.subscribe=function(t,e,n){if(n=n||!1,"string"!=typeof t||"function"!=typeof e||"boolean"!=typeof n)throw new Error("Invalid arguments passed to PubSub.subscribe (jsPDF-module)");s.hasOwnProperty(t)||(s[t]={});var r=Math.random().toString(35);return s[t][r]=[e,!!n],r},this.unsubscribe=function(t){for(var e in s)if(s[e][t])return delete s[e][t],0===Object.keys(s[e]).length&&delete s[e],!0;return!1},this.publish=function(t){if(s.hasOwnProperty(t)){var e=Array.prototype.slice.call(arguments,1),n=[];for(var r in s[t]){var i=s[t][r];try{i[0].apply(o,e)}catch(t){ie.console&&console.error("jsPDF PubSub Error",t.message,t)}i[1]&&n.push(r)}n.length&&n.forEach(this.unsubscribe)}},this.getTopics=function(){return s}}function se(t,e,i,n){var r={},o=[],s=1;"object"===_typeof(t)&&(t=(r=t).orientation,e=r.unit||e,i=r.format||i,n=r.compress||r.compressPdf||n,o=r.filters||(!0===n?["FlateEncode"]:o),s="number"==typeof r.userUnit?Math.abs(r.userUnit):1),e=e||"mm",t=(""+(t||"P")).toLowerCase();var a=r.putOnlyUsedFonts||!0,K={},u={internal:{},__private__:{}};u.__private__.PubSub=oe;var h="1.3",c=u.__private__.getPdfVersion=function(){return h},l=(u.__private__.setPdfVersion=function(t){h=t},{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]}),f=(u.__private__.getPageFormats=function(){return l},u.__private__.getPageFormat=function(t){return l[t]});"string"==typeof i&&(i=f(i)),i=i||f("a4");var p,Z=u.f2=u.__private__.f2=function(t){if(isNaN(t))throw new Error("Invalid argument passed to jsPDF.f2");return t.toFixed(2)},Q=u.__private__.f3=function(t){if(isNaN(t))throw new Error("Invalid argument passed to jsPDF.f3");return t.toFixed(3)},d="00000000000000000000000000000000",g=u.__private__.getFileId=function(){return d},m=u.__private__.setFileId=function(t){return t=t||"12345678901234567890123456789012".split("").map(function(){return"ABCDEF0123456789".charAt(Math.floor(16*Math.random()))}).join(""),d=t};u.setFileId=function(t){return m(t),this},u.getFileId=function(){return g()};var y=u.__private__.convertDateToPDFDate=function(t){var e=t.getTimezoneOffset(),n=e<0?"+":"-",r=Math.floor(Math.abs(e/60)),i=Math.abs(e%60),o=[n,F(r),"'",F(i),"'"].join("");return["D:",t.getFullYear(),F(t.getMonth()+1),F(t.getDate()),F(t.getHours()),F(t.getMinutes()),F(t.getSeconds()),o].join("")},v=u.__private__.convertPDFDateToDate=function(t){var e=parseInt(t.substr(2,4),10),n=parseInt(t.substr(6,2),10)-1,r=parseInt(t.substr(8,2),10),i=parseInt(t.substr(10,2),10),o=parseInt(t.substr(12,2),10),s=parseInt(t.substr(14,2),10);parseInt(t.substr(16,2),10),parseInt(t.substr(20,2),10);return new Date(e,n,r,i,o,s,0)},w=u.__private__.setCreationDate=function(t){var e;if(void 0===t&&(t=new Date),"object"===_typeof(t)&&"[object Date]"===Object.prototype.toString.call(t))e=y(t);else{if(!/^D:(20[0-2][0-9]|203[0-7]|19[7-9][0-9])(0[0-9]|1[0-2])([0-2][0-9]|3[0-1])(0[0-9]|1[0-9]|2[0-3])(0[0-9]|[1-5][0-9])(0[0-9]|[1-5][0-9])(\+0[0-9]|\+1[0-4]|\-0[0-9]|\-1[0-1])\'(0[0-9]|[1-5][0-9])\'?$/.test(t))throw new Error("Invalid argument passed to jsPDF.setCreationDate");e=t}return p=e},b=u.__private__.getCreationDate=function(t){var e=p;return"jsDate"===t&&(e=v(p)),e};u.setCreationDate=function(t){return w(t),this},u.getCreationDate=function(t){return b(t)};var N,L,x,A,S,$,_,P,F=u.__private__.padd2=function(t){return("0"+parseInt(t)).slice(-2)},k=!1,I=[],C=[],B=0,tt=(u.__private__.setCustomOutputDestination=function(t){L=t},u.__private__.resetCustomOutputDestination=function(t){L=void 0},u.__private__.out=function(t){var e;return t="string"==typeof t?t:t.toString(),(e=void 0===L?k?I[N]:C:L).push(t),k||(B+=t.length+1),e}),j=u.__private__.write=function(t){return tt(1===arguments.length?t.toString():Array.prototype.join.call(arguments," "))},q=u.__private__.getArrayBuffer=function(t){for(var e=t.length,n=new ArrayBuffer(e),r=new Uint8Array(n);e--;)r[e]=t.charCodeAt(e);return n},E=[["Helvetica","helvetica","normal","WinAnsiEncoding"],["Helvetica-Bold","helvetica","bold","WinAnsiEncoding"],["Helvetica-Oblique","helvetica","italic","WinAnsiEncoding"],["Helvetica-BoldOblique","helvetica","bolditalic","WinAnsiEncoding"],["Courier","courier","normal","WinAnsiEncoding"],["Courier-Bold","courier","bold","WinAnsiEncoding"],["Courier-Oblique","courier","italic","WinAnsiEncoding"],["Courier-BoldOblique","courier","bolditalic","WinAnsiEncoding"],["Times-Roman","times","normal","WinAnsiEncoding"],["Times-Bold","times","bold","WinAnsiEncoding"],["Times-Italic","times","italic","WinAnsiEncoding"],["Times-BoldItalic","times","bolditalic","WinAnsiEncoding"],["ZapfDingbats","zapfdingbats","normal",null],["Symbol","symbol","normal",null]],et=(u.__private__.getStandardFonts=function(t){return E},r.fontSize||16),M=(u.__private__.setFontSize=u.setFontSize=function(t){return et=t,this},u.__private__.getFontSize=u.getFontSize=function(){return et}),nt=r.R2L||!1,D=(u.__private__.setR2L=u.setR2L=function(t){return nt=t,this},u.__private__.getR2L=u.getR2L=function(t){return nt},u.__private__.setZoomMode=function(t){var e=[void 0,null,"fullwidth","fullheight","fullpage","original"];if(/^\d*\.?\d*\%$/.test(t))x=t;else if(isNaN(t)){if(-1===e.indexOf(t))throw new Error('zoom must be Integer (e.g. 2), a percentage Value (e.g. 300%) or fullwidth, fullheight, fullpage, original. "'+t+'" is not recognized.');x=t}else x=parseInt(t,10)}),O=(u.__private__.getZoomMode=function(){return x},u.__private__.setPageMode=function(t){if(-1==[void 0,null,"UseNone","UseOutlines","UseThumbs","FullScreen"].indexOf(t))throw new Error('Page mode must be one of UseNone, UseOutlines, UseThumbs, or FullScreen. "'+t+'" is not recognized.');A=t}),T=(u.__private__.getPageMode=function(){return A},u.__private__.setLayoutMode=function(t){if(-1==[void 0,null,"continuous","single","twoleft","tworight","two"].indexOf(t))throw new Error('Layout mode must be one of continuous, single, twoleft, tworight. "'+t+'" is not recognized.');S=t}),R=(u.__private__.getLayoutMode=function(){return S},u.__private__.setDisplayMode=u.setDisplayMode=function(t,e,n){return D(t),T(e),O(n),this},{title:"",subject:"",author:"",keywords:"",creator:""}),z=(u.__private__.getDocumentProperty=function(t){if(-1===Object.keys(R).indexOf(t))throw new Error("Invalid argument passed to jsPDF.getDocumentProperty");return R[t]},u.__private__.getDocumentProperties=function(t){return R},u.__private__.setDocumentProperties=u.setProperties=u.setDocumentProperties=function(t){for(var e in R)R.hasOwnProperty(e)&&t[e]&&(R[e]=t[e]);return this},u.__private__.setDocumentProperty=function(t,e){if(-1===Object.keys(R).indexOf(t))throw new Error("Invalid arguments passed to jsPDF.setDocumentProperty");return R[t]=e},0),U=[],rt={},H={},W=0,V=[],G=[],it=new oe(u),Y=r.hotfixes||[],J=u.__private__.newObject=function(){var t=X();return ot(t,!0),t},X=u.__private__.newObjectDeferred=function(){return U[++z]=function(){return B},z},ot=function(t,e){return e="boolean"==typeof e&&e,U[t]=B,e&&tt(t+" 0 obj"),t},st=u.__private__.newAdditionalObject=function(){var t={objId:X(),content:""};return G.push(t),t},at=X(),ut=X(),ht=u.__private__.decodeColorString=function(t){var e=t.split(" ");if(2===e.length&&("g"===e[1]||"G"===e[1])){var n=parseFloat(e[0]);e=[n,n,n,"r"]}for(var r="#",i=0;i<3;i++)r+=("0"+Math.floor(255*parseFloat(e[i])).toString(16)).slice(-2);return r},ct=u.__private__.encodeColorString=function(t){var e;"string"==typeof t&&(t={ch1:t});var n=t.ch1,r=t.ch2,i=t.ch3,o=t.ch4,s=(t.precision,"draw"===t.pdfColorType?["G","RG","K"]:["g","rg","k"]);if("string"==typeof n&&"#"!==n.charAt(0)){var a=new RGBColor(n);if(a.ok)n=a.toHex();else if(!/^\d*\.?\d*$/.test(n))throw new Error('Invalid color "'+n+'" passed to jsPDF.encodeColorString.')}if("string"==typeof n&&/^#[0-9A-Fa-f]{3}$/.test(n)&&(n="#"+n[1]+n[1]+n[2]+n[2]+n[3]+n[3]),"string"==typeof n&&/^#[0-9A-Fa-f]{6}$/.test(n)){var u=parseInt(n.substr(1),16);n=u>>16&255,r=u>>8&255,i=255&u}if(void 0===r||void 0===o&&n===r&&r===i)if("string"==typeof n)e=n+" "+s[0];else switch(t.precision){case 2:e=Z(n/255)+" "+s[0];break;case 3:default:e=Q(n/255)+" "+s[0]}else if(void 0===o||"object"===_typeof(o)){if(o&&!isNaN(o.a)&&0===o.a)return e=["1.000","1.000","1.000",s[1]].join(" ");if("string"==typeof n)e=[n,r,i,s[1]].join(" ");else switch(t.precision){case 2:e=[Z(n/255),Z(r/255),Z(i/255),s[1]].join(" ");break;default:case 3:e=[Q(n/255),Q(r/255),Q(i/255),s[1]].join(" ")}}else if("string"==typeof n)e=[n,r,i,o,s[2]].join(" ");else switch(t.precision){case 2:e=[Z(n/255),Z(r/255),Z(i/255),Z(o/255),s[2]].join(" ");break;case 3:default:e=[Q(n/255),Q(r/255),Q(i/255),Q(o/255),s[2]].join(" ")}return e},lt=u.__private__.getFilters=function(){return o},ft=u.__private__.putStream=function(t){var e=(t=t||{}).data||"",n=t.filters||lt(),r=t.alreadyAppliedFilters||[],i=t.addLength1||!1,o=e.length,s={};!0===n&&(n=["FlateEncode"]);var a=t.additionalKeyValues||[],u=(s=void 0!==se.API.processDataByFilters?se.API.processDataByFilters(e,n):{data:e,reverseChain:[]}).reverseChain+(Array.isArray(r)?r.join(" "):r.toString());0!==s.data.length&&(a.push({key:"Length",value:s.data.length}),!0===i&&a.push({key:"Length1",value:o})),0!=u.length&&(u.split("/").length-1==1?a.push({key:"Filter",value:u}):a.push({key:"Filter",value:"["+u+"]"})),tt("<<");for(var h=0;h<a.length;h++)tt("/"+a[h].key+" "+a[h].value);tt(">>"),0!==s.data.length&&(tt("stream"),tt(s.data),tt("endstream"))},pt=u.__private__.putPage=function(t){t.mediaBox;var e=t.number,n=t.data,r=t.objId,i=t.contentsObjId;ot(r,!0);V[N].mediaBox.topRightX,V[N].mediaBox.bottomLeftX,V[N].mediaBox.topRightY,V[N].mediaBox.bottomLeftY;tt("<</Type /Page"),tt("/Parent "+t.rootDictionaryObjId+" 0 R"),tt("/Resources "+t.resourceDictionaryObjId+" 0 R"),tt("/MediaBox ["+parseFloat(Z(t.mediaBox.bottomLeftX))+" "+parseFloat(Z(t.mediaBox.bottomLeftY))+" "+Z(V[N].mediaBox.topRightX)+" "+Z(V[N].mediaBox.topRightY)+"]"),null!==t.cropBox&&tt("/CropBox ["+Z(t.cropBox.bottomLeftX)+" "+Z(t.cropBox.bottomLeftY)+" "+Z(t.cropBox.topRightX)+" "+Z(t.cropBox.topRightY)+"]"),null!==t.bleedBox&&tt("/BleedBox ["+Z(t.bleedBox.bottomLeftX)+" "+Z(t.bleedBox.bottomLeftY)+" "+Z(t.bleedBox.topRightX)+" "+Z(t.bleedBox.topRightY)+"]"),null!==t.trimBox&&tt("/TrimBox ["+Z(t.trimBox.bottomLeftX)+" "+Z(t.trimBox.bottomLeftY)+" "+Z(t.trimBox.topRightX)+" "+Z(t.trimBox.topRightY)+"]"),null!==t.artBox&&tt("/ArtBox ["+Z(t.artBox.bottomLeftX)+" "+Z(t.artBox.bottomLeftY)+" "+Z(t.artBox.topRightX)+" "+Z(t.artBox.topRightY)+"]"),"number"==typeof t.userUnit&&1!==t.userUnit&&tt("/UserUnit "+t.userUnit),it.publish("putPage",{objId:r,pageContext:V[e],pageNumber:e,page:n}),tt("/Contents "+i+" 0 R"),tt(">>"),tt("endobj");var o=n.join("\n");return ot(i,!0),ft({data:o,filters:lt()}),tt("endobj"),r},dt=u.__private__.putPages=function(){var t,e,n=[];for(t=1;t<=W;t++)V[t].objId=X(),V[t].contentsObjId=X();for(t=1;t<=W;t++)n.push(pt({number:t,data:I[t],objId:V[t].objId,contentsObjId:V[t].contentsObjId,mediaBox:V[t].mediaBox,cropBox:V[t].cropBox,bleedBox:V[t].bleedBox,trimBox:V[t].trimBox,artBox:V[t].artBox,userUnit:V[t].userUnit,rootDictionaryObjId:at,resourceDictionaryObjId:ut}));ot(at,!0),tt("<</Type /Pages");var r="/Kids [";for(e=0;e<W;e++)r+=n[e]+" 0 R ";tt(r+"]"),tt("/Count "+W),tt(">>"),tt("endobj"),it.publish("postPutPages")},gt=function(){!function(){for(var t in rt)rt.hasOwnProperty(t)&&(!1===a||!0===a&&K.hasOwnProperty(t))&&(e=rt[t],it.publish("putFont",{font:e,out:tt,newObject:J,putStream:ft}),!0!==e.isAlreadyPutted&&(e.objectNumber=J(),tt("<<"),tt("/Type /Font"),tt("/BaseFont /"+e.postScriptName),tt("/Subtype /Type1"),"string"==typeof e.encoding&&tt("/Encoding /"+e.encoding),tt("/FirstChar 32"),tt("/LastChar 255"),tt(">>"),tt("endobj")));var e}(),it.publish("putResources"),ot(ut,!0),tt("<<"),function(){for(var t in tt("/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]"),tt("/Font <<"),rt)rt.hasOwnProperty(t)&&(!1===a||!0===a&&K.hasOwnProperty(t))&&tt("/"+t+" "+rt[t].objectNumber+" 0 R");tt(">>"),tt("/XObject <<"),it.publish("putXobjectDict"),tt(">>")}(),tt(">>"),tt("endobj"),it.publish("postPutResources")},mt=function(t,e,n){H.hasOwnProperty(e)||(H[e]={}),H[e][n]=t},yt=function(t,e,n,r,i){i=i||!1;var o="F"+(Object.keys(rt).length+1).toString(10),s={id:o,postScriptName:t,fontName:e,fontStyle:n,encoding:r,isStandardFont:i,metadata:{}};return it.publish("addFont",{font:s,instance:this}),void 0!==o&&(rt[o]=s,mt(o,e,n)),o},vt=u.__private__.pdfEscape=u.pdfEscape=function(t,e){return function(t,e){var n,r,i,o,s,a,u,h,c;if(i=(e=e||{}).sourceEncoding||"Unicode",s=e.outputEncoding,(e.autoencode||s)&&rt[$].metadata&&rt[$].metadata[i]&&rt[$].metadata[i].encoding&&(o=rt[$].metadata[i].encoding,!s&&rt[$].encoding&&(s=rt[$].encoding),!s&&o.codePages&&(s=o.codePages[0]),"string"==typeof s&&(s=o[s]),s)){for(u=!1,a=[],n=0,r=t.length;n<r;n++)(h=s[t.charCodeAt(n)])?a.push(String.fromCharCode(h)):a.push(t[n]),a[n].charCodeAt(0)>>8&&(u=!0);t=a.join("")}for(n=t.length;void 0===u&&0!==n;)t.charCodeAt(n-1)>>8&&(u=!0),n--;if(!u)return t;for(a=e.noBOM?[]:[254,255],n=0,r=t.length;n<r;n++){if((c=(h=t.charCodeAt(n))>>8)>>8)throw new Error("Character at position "+n+" of string '"+t+"' exceeds 16bits. Cannot be encoded into UCS-2 BE");a.push(c),a.push(h-(c<<8))}return String.fromCharCode.apply(void 0,a)}(t,e).replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},wt=u.__private__.beginPage=function(t,e){var n,r="string"==typeof e&&e.toLowerCase();if("string"==typeof t&&f(t.toLowerCase())&&(t=f(t.toLowerCase())[0],e=f(t.toLowerCase())[1]),Array.isArray(t)&&(e=t[1],t=t[0]),(isNaN(t)||isNaN(e))&&(t=i[0],e=i[1]),r){switch(r.substr(0,1)){case"l":t<e&&(r="s");break;case"p":e<t&&(r="s")}"s"===r&&(n=t,t=e,e=n)}(14400<t||14400<e)&&(console.warn("A page in a PDF can not be wider or taller than 14400 userUnit. jsPDF limits the width/height to 14400"),t=Math.min(14400,t),e=Math.min(14400,e)),i=[t,e],k=!0,I[++W]=[],V[W]={objId:0,contentsObjId:0,userUnit:Number(s),artBox:null,bleedBox:null,cropBox:null,trimBox:null,mediaBox:{bottomLeftX:0,bottomLeftY:0,topRightX:Number(t),topRightY:Number(e)}},Nt(W)},bt=function(){wt.apply(this,arguments),Rt(Tt),tt(Jt),0!==te&&tt(te+" J"),0!==ne&&tt(ne+" j"),it.publish("addPage",{pageNumber:W})},Nt=function(t){0<t&&t<=W&&(N=t)},Lt=u.__private__.getNumberOfPages=u.getNumberOfPages=function(){return I.length-1},xt=function(t,e,n){var r,i=void 0;return n=n||{},t=void 0!==t?t:rt[$].fontName,e=void 0!==e?e:rt[$].fontStyle,r=t.toLowerCase(),void 0!==H[r]&&void 0!==H[r][e]?i=H[r][e]:void 0!==H[t]&&void 0!==H[t][e]?i=H[t][e]:!1===n.disableWarning&&console.warn("Unable to look up font label for font '"+t+"', '"+e+"'. Refer to getFontList() for available fonts."),i||n.noFallback||null==(i=H.times[e])&&(i=H.times.normal),i},At=u.__private__.putInfo=function(){for(var t in J(),tt("<<"),tt("/Producer (jsPDF "+se.version+")"),R)R.hasOwnProperty(t)&&R[t]&&tt("/"+t.substr(0,1).toUpperCase()+t.substr(1)+" ("+vt(R[t])+")");tt("/CreationDate ("+p+")"),tt(">>"),tt("endobj")},St=u.__private__.putCatalog=function(t){var e=(t=t||{}).rootDictionaryObjId||at;switch(J(),tt("<<"),tt("/Type /Catalog"),tt("/Pages "+e+" 0 R"),x||(x="fullwidth"),x){case"fullwidth":tt("/OpenAction [3 0 R /FitH null]");break;case"fullheight":tt("/OpenAction [3 0 R /FitV null]");break;case"fullpage":tt("/OpenAction [3 0 R /Fit]");break;case"original":tt("/OpenAction [3 0 R /XYZ null null 1]");break;default:var n=""+x;"%"===n.substr(n.length-1)&&(x=parseInt(x)/100),"number"==typeof x&&tt("/OpenAction [3 0 R /XYZ null null "+Z(x)+"]")}switch(S||(S="continuous"),S){case"continuous":tt("/PageLayout /OneColumn");break;case"single":tt("/PageLayout /SinglePage");break;case"two":case"twoleft":tt("/PageLayout /TwoColumnLeft");break;case"tworight":tt("/PageLayout /TwoColumnRight")}A&&tt("/PageMode /"+A),it.publish("putCatalog"),tt(">>"),tt("endobj")},_t=u.__private__.putTrailer=function(){tt("trailer"),tt("<<"),tt("/Size "+(z+1)),tt("/Root "+z+" 0 R"),tt("/Info "+(z-1)+" 0 R"),tt("/ID [ <"+d+"> <"+d+"> ]"),tt(">>")},Pt=u.__private__.putHeader=function(){tt("%PDF-"+h),tt("%ºß¬à")},Ft=u.__private__.putXRef=function(){var t=1,e="0000000000";for(tt("xref"),tt("0 "+(z+1)),tt("0000000000 65535 f "),t=1;t<=z;t++){"function"==typeof U[t]?tt((e+U[t]()).slice(-10)+" 00000 n "):void 0!==U[t]?tt((e+U[t]).slice(-10)+" 00000 n "):tt("0000000000 00000 n ")}},kt=u.__private__.buildDocument=function(){k=!1,B=z=0,C=[],U=[],G=[],at=X(),ut=X(),it.publish("buildDocument"),Pt(),dt(),function(){it.publish("putAdditionalObjects");for(var t=0;t<G.length;t++){var e=G[t];ot(e.objId,!0),tt(e.content),tt("endobj")}it.publish("postPutAdditionalObjects")}(),gt(),At(),St();var t=B;return Ft(),_t(),tt("startxref"),tt(""+t),tt("%%EOF"),k=!0,C.join("\n")},It=u.__private__.getBlob=function(t){return new Blob([q(t)],{type:"application/pdf"})},Ct=u.output=u.__private__.output=((P=function(t,e){e=e||{};var n=kt();switch("string"==typeof e?e={filename:e}:e.filename=e.filename||"generated.pdf",t){case void 0:return n;case"save":u.save(e.filename);break;case"arraybuffer":return q(n);case"blob":return It(n);case"bloburi":case"bloburl":return ie.URL&&ie.URL.createObjectURL(It(n))||void 0;case"datauristring":case"dataurlstring":return"data:application/pdf;filename="+e.filename+";base64,"+btoa(n);case"dataurlnewwindow":var r='<html><style>html, body { padding: 0; margin: 0; } iframe { width: 100%; height: 100%; border: 0;} </style><body><iframe src="'+this.output("datauristring")+'"></iframe></body></html>',i=ie.open();if(null!==i&&i.document.write(r),i||"undefined"==typeof safari)return i;case"datauri":case"dataurl":return ie.document.location.href="data:application/pdf;filename="+e.filename+";base64,"+btoa(n);default:return null}}).foo=function(){try{return P.apply(this,arguments)}catch(t){var e=t.stack||"";~e.indexOf(" at ")&&(e=e.split(" at ")[1]);var n="Error in function "+e.split("\n")[0].split("<")[0]+": "+t.message;if(!ie.console)throw new Error(n);ie.console.error(n,t),ie.alert&&alert(n)}},(P.foo.bar=P).foo),Bt=function(t){return!0===Array.isArray(Y)&&-1<Y.indexOf(t)};switch(e){case"pt":_=1;break;case"mm":_=72/25.4;break;case"cm":_=72/2.54;break;case"in":_=72;break;case"px":_=1==Bt("px_scaling")?.75:96/72;break;case"pc":case"em":_=12;break;case"ex":_=6;break;default:throw new Error("Invalid unit: "+e)}w(),m();var jt=u.__private__.getPageInfo=function(t){if(isNaN(t)||t%1!=0)throw new Error("Invalid argument passed to jsPDF.getPageInfo");return{objId:V[t].objId,pageNumber:t,pageContext:V[t]}},qt=u.__private__.getPageInfoByObjId=function(t){for(var e in V)if(V[e].objId===t)break;if(isNaN(t)||t%1!=0)throw new Error("Invalid argument passed to jsPDF.getPageInfoByObjId");return jt(e)},Et=u.__private__.getCurrentPageInfo=function(){return{objId:V[N].objId,pageNumber:N,pageContext:V[N]}};u.addPage=function(){return bt.apply(this,arguments),this},u.setPage=function(){return Nt.apply(this,arguments),this},u.insertPage=function(t){return this.addPage(),this.movePage(N,t),this},u.movePage=function(t,e){if(e<t){for(var n=I[t],r=V[t],i=t;e<i;i--)I[i]=I[i-1],V[i]=V[i-1];I[e]=n,V[e]=r,this.setPage(e)}else if(t<e){for(n=I[t],r=V[t],i=t;i<e;i++)I[i]=I[i+1],V[i]=V[i+1];I[e]=n,V[e]=r,this.setPage(e)}return this},u.deletePage=function(){return function(t){0<t&&t<=W&&(I.splice(t,1),--W<N&&(N=W),this.setPage(N))}.apply(this,arguments),this};u.__private__.text=u.text=function(t,e,n,i){var r;"number"!=typeof t||"number"!=typeof e||"string"!=typeof n&&!Array.isArray(n)||(r=n,n=e,e=t,t=r);var o=arguments[3],s=arguments[4],a=arguments[5];if("object"===_typeof(o)&&null!==o||("string"==typeof s&&(a=s,s=null),"string"==typeof o&&(a=o,o=null),"number"==typeof o&&(s=o,o=null),i={flags:o,angle:s,align:a}),(o=o||{}).noBOM=o.noBOM||!0,o.autoencode=o.autoencode||!0,isNaN(e)||isNaN(n)||null==t)throw new Error("Invalid arguments passed to jsPDF.text");if(0===t.length)return l;var u,h="",c="number"==typeof i.lineHeightFactor?i.lineHeightFactor:Ot,l=i.scope||this;function f(t){for(var e,n=t.concat(),r=[],i=n.length;i--;)"string"==typeof(e=n.shift())?r.push(e):Array.isArray(t)&&1===e.length?r.push(e[0]):r.push([e[0],e[1],e[2]]);return r}function p(t,e){var n;if("string"==typeof t)n=e(t)[0];else if(Array.isArray(t)){for(var r,i,o=t.concat(),s=[],a=o.length;a--;)"string"==typeof(r=o.shift())?s.push(e(r)[0]):Array.isArray(r)&&"string"===r[0]&&(i=e(r[0],r[1],r[2]),s.push([i[0],i[1],i[2]]));n=s}return n}var d=!1,g=!0;if("string"==typeof t)d=!0;else if(Array.isArray(t)){for(var m,y=t.concat(),v=[],w=y.length;w--;)("string"!=typeof(m=y.shift())||Array.isArray(m)&&"string"!=typeof m[0])&&(g=!1);d=g}if(!1===d)throw new Error('Type of text must be string or Array. "'+t+'" is not recognized.');var b=rt[$].encoding;"WinAnsiEncoding"!==b&&"StandardEncoding"!==b||(t=p(t,function(t,e,n){return[(r=t,r=r.split("\t").join(Array(i.TabLen||9).join(" ")),vt(r,o)),e,n];var r})),"string"==typeof t&&(t=t.match(/[\r?\n]/)?t.split(/\r\n|\r|\n/g):[t]);var N=et/l.internal.scaleFactor,L=N*(Ot-1);switch(i.baseline){case"bottom":n-=L;break;case"top":n+=N-L;break;case"hanging":n+=N-2*L;break;case"middle":n+=N/2-L}0<(M=i.maxWidth||0)&&("string"==typeof t?t=l.splitTextToSize(t,M):"[object Array]"===Object.prototype.toString.call(t)&&(t=l.splitTextToSize(t.join(" "),M)));var x={text:t,x:e,y:n,options:i,mutex:{pdfEscape:vt,activeFontKey:$,fonts:rt,activeFontSize:et}};it.publish("preProcessText",x),t=x.text;s=(i=x.options).angle;var A=l.internal.scaleFactor,S=[];if(s){s*=Math.PI/180;var _=Math.cos(s),P=Math.sin(s);S=[Z(_),Z(P),Z(-1*P),Z(_)]}void 0!==(E=i.charSpace)&&(h+=Q(E*A)+" Tc\n");i.lang;var F=-1,k=void 0!==i.renderingMode?i.renderingMode:i.stroke,I=l.internal.getCurrentPageInfo().pageContext;switch(k){case 0:case!1:case"fill":F=0;break;case 1:case!0:case"stroke":F=1;break;case 2:case"fillThenStroke":F=2;break;case 3:case"invisible":F=3;break;case 4:case"fillAndAddForClipping":F=4;break;case 5:case"strokeAndAddPathForClipping":F=5;break;case 6:case"fillThenStrokeAndAddToPathForClipping":F=6;break;case 7:case"addToPathForClipping":F=7}var C=void 0!==I.usedRenderingMode?I.usedRenderingMode:-1;-1!==F?h+=F+" Tr\n":-1!==C&&(h+="0 Tr\n"),-1!==F&&(I.usedRenderingMode=F);a=i.align||"left";var B=et*c,j=l.internal.pageSize.getWidth(),q=(A=l.internal.scaleFactor,rt[$]),E=i.charSpace||Qt,M=i.maxWidth||0,D=(o={},[]);if("[object Array]"===Object.prototype.toString.call(t)){var O,T;v=f(t);"left"!==a&&(T=v.map(function(t){return l.getStringUnitWidth(t,{font:q,charSpace:E,fontSize:et})*et/A}));var R,z=Math.max.apply(Math,T),U=0;if("right"===a){e-=T[0],t=[];var H=0;for(w=v.length;H<w;H++)z-T[H],O=0===H?(R=Wt(e),Vt(n)):(R=(U-T[H])*A,-B),t.push([v[H],R,O]),U=T[H]}else if("center"===a){e-=T[0]/2,t=[];for(H=0,w=v.length;H<w;H++)(z-T[H])/2,O=0===H?(R=Wt(e),Vt(n)):(R=(U-T[H])/2*A,-B),t.push([v[H],R,O]),U=T[H]}else if("left"===a){t=[];for(H=0,w=v.length;H<w;H++)O=0===H?Vt(n):-B,R=0===H?Wt(e):0,t.push(v[H])}else{if("justify"!==a)throw new Error('Unrecognized alignment option, use "left", "center", "right" or "justify".');t=[];for(M=0!==M?M:j,H=0,w=v.length;H<w;H++)O=0===H?Vt(n):-B,R=0===H?Wt(e):0,H<w-1&&D.push(((M-T[H])/(v[H].split(" ").length-1)*A).toFixed(2)),t.push([v[H],R,O])}}!0===("boolean"==typeof i.R2L?i.R2L:nt)&&(t=p(t,function(t,e,n){return[t.split("").reverse().join(""),e,n]}));x={text:t,x:e,y:n,options:i,mutex:{pdfEscape:vt,activeFontKey:$,fonts:rt,activeFontSize:et}};it.publish("postProcessText",x),t=x.text,u=x.mutex.isHex;v=f(t);t=[];var W,V,G,Y=0,J=(w=v.length,"");for(H=0;H<w;H++)J="",Array.isArray(v[H])?(W=parseFloat(v[H][1]),V=parseFloat(v[H][2]),G=(u?"<":"(")+v[H][0]+(u?">":")"),Y=1):(W=Wt(e),V=Vt(n),G=(u?"<":"(")+v[H]+(u?">":")")),void 0!==D&&void 0!==D[H]&&(J=D[H]+" Tw\n"),0!==S.length&&0===H?t.push(J+S.join(" ")+" "+W.toFixed(2)+" "+V.toFixed(2)+" Tm\n"+G):1===Y||0===Y&&0===H?t.push(J+W.toFixed(2)+" "+V.toFixed(2)+" Td\n"+G):t.push(J+G);t=0===Y?t.join(" Tj\nT* "):t.join(" Tj\n"),t+=" Tj\n";var X="BT\n/"+$+" "+et+" Tf\n"+(et*c).toFixed(2)+" TL\n"+Kt+"\n";return X+=h,X+=t,tt(X+="ET"),K[$]=!0,l},u.__private__.lstext=u.lstext=function(t,e,n,r){return console.warn("jsPDF.lstext is deprecated"),this.text(t,e,n,{charSpace:r})},u.__private__.clip=u.clip=function(t){tt("evenodd"===t?"W*":"W"),tt("n")},u.__private__.clip_fixed=u.clip_fixed=function(t){console.log("clip_fixed is deprecated"),u.clip(t)};var Mt=u.__private__.isValidStyle=function(t){var e=!1;return-1!==[void 0,null,"S","F","DF","FD","f","f*","B","B*"].indexOf(t)&&(e=!0),e},Dt=u.__private__.getStyle=function(t){var e="S";return"F"===t?e="f":"FD"===t||"DF"===t?e="B":"f"!==t&&"f*"!==t&&"B"!==t&&"B*"!==t||(e=t),e};u.__private__.line=u.line=function(t,e,n,r){if(isNaN(t)||isNaN(e)||isNaN(n)||isNaN(r))throw new Error("Invalid arguments passed to jsPDF.line");return this.lines([[n-t,r-e]],t,e)},u.__private__.lines=u.lines=function(t,e,n,r,i,o){var s,a,u,h,c,l,f,p,d,g,m,y;if("number"==typeof t&&(y=n,n=e,e=t,t=y),r=r||[1,1],o=o||!1,isNaN(e)||isNaN(n)||!Array.isArray(t)||!Array.isArray(r)||!Mt(i)||"boolean"!=typeof o)throw new Error("Invalid arguments passed to jsPDF.lines");for(tt(Q(Wt(e))+" "+Q(Vt(n))+" m "),s=r[0],a=r[1],h=t.length,g=e,m=n,u=0;u<h;u++)2===(c=t[u]).length?(g=c[0]*s+g,m=c[1]*a+m,tt(Q(Wt(g))+" "+Q(Vt(m))+" l")):(l=c[0]*s+g,f=c[1]*a+m,p=c[2]*s+g,d=c[3]*a+m,g=c[4]*s+g,m=c[5]*a+m,tt(Q(Wt(l))+" "+Q(Vt(f))+" "+Q(Wt(p))+" "+Q(Vt(d))+" "+Q(Wt(g))+" "+Q(Vt(m))+" c"));return o&&tt(" h"),null!==i&&tt(Dt(i)),this},u.__private__.rect=u.rect=function(t,e,n,r,i){if(isNaN(t)||isNaN(e)||isNaN(n)||isNaN(r)||!Mt(i))throw new Error("Invalid arguments passed to jsPDF.rect");return tt([Z(Wt(t)),Z(Vt(e)),Z(n*_),Z(-r*_),"re"].join(" ")),null!==i&&tt(Dt(i)),this},u.__private__.triangle=u.triangle=function(t,e,n,r,i,o,s){if(isNaN(t)||isNaN(e)||isNaN(n)||isNaN(r)||isNaN(i)||isNaN(o)||!Mt(s))throw new Error("Invalid arguments passed to jsPDF.triangle");return this.lines([[n-t,r-e],[i-n,o-r],[t-i,e-o]],t,e,[1,1],s,!0),this},u.__private__.roundedRect=u.roundedRect=function(t,e,n,r,i,o,s){if(isNaN(t)||isNaN(e)||isNaN(n)||isNaN(r)||isNaN(i)||isNaN(o)||!Mt(s))throw new Error("Invalid arguments passed to jsPDF.roundedRect");var a=4/3*(Math.SQRT2-1);return this.lines([[n-2*i,0],[i*a,0,i,o-o*a,i,o],[0,r-2*o],[0,o*a,-i*a,o,-i,o],[2*i-n,0],[-i*a,0,-i,-o*a,-i,-o],[0,2*o-r],[0,-o*a,i*a,-o,i,-o]],t+i,e,[1,1],s),this},u.__private__.ellipse=u.ellipse=function(t,e,n,r,i){if(isNaN(t)||isNaN(e)||isNaN(n)||isNaN(r)||!Mt(i))throw new Error("Invalid arguments passed to jsPDF.ellipse");var o=4/3*(Math.SQRT2-1)*n,s=4/3*(Math.SQRT2-1)*r;return tt([Z(Wt(t+n)),Z(Vt(e)),"m",Z(Wt(t+n)),Z(Vt(e-s)),Z(Wt(t+o)),Z(Vt(e-r)),Z(Wt(t)),Z(Vt(e-r)),"c"].join(" ")),tt([Z(Wt(t-o)),Z(Vt(e-r)),Z(Wt(t-n)),Z(Vt(e-s)),Z(Wt(t-n)),Z(Vt(e)),"c"].join(" ")),tt([Z(Wt(t-n)),Z(Vt(e+s)),Z(Wt(t-o)),Z(Vt(e+r)),Z(Wt(t)),Z(Vt(e+r)),"c"].join(" ")),tt([Z(Wt(t+o)),Z(Vt(e+r)),Z(Wt(t+n)),Z(Vt(e+s)),Z(Wt(t+n)),Z(Vt(e)),"c"].join(" ")),null!==i&&tt(Dt(i)),this},u.__private__.circle=u.circle=function(t,e,n,r){if(isNaN(t)||isNaN(e)||isNaN(n)||!Mt(r))throw new Error("Invalid arguments passed to jsPDF.circle");return this.ellipse(t,e,n,n,r)};u.setFont=function(t,e){return $=xt(t,e,{disableWarning:!1}),this},u.setFontStyle=u.setFontType=function(t){return $=xt(void 0,t),this};u.__private__.getFontList=u.getFontList=function(){var t,e,n,r={};for(t in H)if(H.hasOwnProperty(t))for(e in r[t]=n=[],H[t])H[t].hasOwnProperty(e)&&n.push(e);return r};u.addFont=function(t,e,n,r){yt.call(this,t,e,n,r=r||"Identity-H")};var Ot,Tt=r.lineWidth||.200025,Rt=u.__private__.setLineWidth=u.setLineWidth=function(t){return tt((t*_).toFixed(2)+" w"),this},zt=(u.__private__.setLineDash=se.API.setLineDash=function(t,e){if(t=t||[],e=e||0,isNaN(e)||!Array.isArray(t))throw new Error("Invalid arguments passed to jsPDF.setLineDash");return t=t.map(function(t){return(t*_).toFixed(3)}).join(" "),e=parseFloat((e*_).toFixed(3)),tt("["+t+"] "+e+" d"),this},u.__private__.getLineHeight=u.getLineHeight=function(){return et*Ot}),Ut=(zt=u.__private__.getLineHeight=u.getLineHeight=function(){return et*Ot},u.__private__.setLineHeightFactor=u.setLineHeightFactor=function(t){return"number"==typeof(t=t||1.15)&&(Ot=t),this}),Ht=u.__private__.getLineHeightFactor=u.getLineHeightFactor=function(){return Ot};Ut(r.lineHeight);var Wt=u.__private__.getHorizontalCoordinate=function(t){return t*_},Vt=u.__private__.getVerticalCoordinate=function(t){return V[N].mediaBox.topRightY-V[N].mediaBox.bottomLeftY-t*_},Gt=u.__private__.getHorizontalCoordinateString=function(t){return Z(t*_)},Yt=u.__private__.getVerticalCoordinateString=function(t){return Z(V[N].mediaBox.topRightY-V[N].mediaBox.bottomLeftY-t*_)},Jt=r.strokeColor||"0 G",Xt=(u.__private__.getStrokeColor=u.getDrawColor=function(){return ht(Jt)},u.__private__.setStrokeColor=u.setDrawColor=function(t,e,n,r){return Jt=ct({ch1:t,ch2:e,ch3:n,ch4:r,pdfColorType:"draw",precision:2}),tt(Jt),this},r.fillColor||"0 g"),Kt=(u.__private__.getFillColor=u.getFillColor=function(){return ht(Xt)},u.__private__.setFillColor=u.setFillColor=function(t,e,n,r){return Xt=ct({ch1:t,ch2:e,ch3:n,ch4:r,pdfColorType:"fill",precision:2}),tt(Xt),this},r.textColor||"0 g"),Zt=u.__private__.getTextColor=u.getTextColor=function(){return ht(Kt)},Qt=(u.__private__.setTextColor=u.setTextColor=function(t,e,n,r){return Kt=ct({ch1:t,ch2:e,ch3:n,ch4:r,pdfColorType:"text",precision:3}),this},r.charSpace||0),$t=u.__private__.getCharSpace=u.getCharSpace=function(){return Qt},te=(u.__private__.setCharSpace=u.setCharSpace=function(t){if(isNaN(t))throw new Error("Invalid argument passed to jsPDF.setCharSpace");return Qt=t,this},0);u.CapJoinStyles={0:0,butt:0,but:0,miter:0,1:1,round:1,rounded:1,circle:1,2:2,projecting:2,project:2,square:2,bevel:2};u.__private__.setLineCap=u.setLineCap=function(t){var e=u.CapJoinStyles[t];if(void 0===e)throw new Error("Line cap style of '"+t+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return tt((te=e)+" J"),this};var ee,ne=0;u.__private__.setLineJoin=u.setLineJoin=function(t){var e=u.CapJoinStyles[t];if(void 0===e)throw new Error("Line join style of '"+t+"' is not recognized. See or extend .CapJoinStyles property for valid styles");return tt((ne=e)+" j"),this},u.__private__.setMiterLimit=u.setMiterLimit=function(t){if(t=t||0,isNaN(t))throw new Error("Invalid argument passed to jsPDF.setMiterLimit");return ee=parseFloat(Z(t*_)),tt(ee+" M"),this};for(var re in u.save=function(r,t){if(r=r||"generated.pdf",(t=t||{}).returnPromise=t.returnPromise||!1,!1!==t.returnPromise)return new Promise(function(t,e){try{var n=saveAs(It(kt()),r);"function"==typeof saveAs.unload&&ie.setTimeout&&setTimeout(saveAs.unload,911),t(n)}catch(t){e(t.message)}});saveAs(It(kt()),r),"function"==typeof saveAs.unload&&ie.setTimeout&&setTimeout(saveAs.unload,911)},se.API)se.API.hasOwnProperty(re)&&("events"===re&&se.API.events.length?function(t,e){var n,r,i;for(i=e.length-1;-1!==i;i--)n=e[i][0],r=e[i][1],t.subscribe.apply(t,[n].concat("function"==typeof r?[r]:r))}(it,se.API.events):u[re]=se.API[re]);return u.internal={pdfEscape:vt,getStyle:Dt,getFont:function(){return rt[xt.apply(u,arguments)]},getFontSize:M,getCharSpace:$t,getTextColor:Zt,getLineHeight:zt,getLineHeightFactor:Ht,write:j,getHorizontalCoordinate:Wt,getVerticalCoordinate:Vt,getCoordinateString:Gt,getVerticalCoordinateString:Yt,collections:{},newObject:J,newAdditionalObject:st,newObjectDeferred:X,newObjectDeferredBegin:ot,getFilters:lt,putStream:ft,events:it,scaleFactor:_,pageSize:{getWidth:function(){return(V[N].mediaBox.topRightX-V[N].mediaBox.bottomLeftX)/_},setWidth:function(t){V[N].mediaBox.topRightX=t*_+V[N].mediaBox.bottomLeftX},getHeight:function(){return(V[N].mediaBox.topRightY-V[N].mediaBox.bottomLeftY)/_},setHeight:function(t){V[N].mediaBox.topRightY=t*_+V[N].mediaBox.bottomLeftY}},output:Ct,getNumberOfPages:Lt,pages:I,out:tt,f2:Z,f3:Q,getPageInfo:jt,getPageInfoByObjId:qt,getCurrentPageInfo:Et,getPDFVersion:c,hasHotfix:Bt},Object.defineProperty(u.internal.pageSize,"width",{get:function(){return(V[N].mediaBox.topRightX-V[N].mediaBox.bottomLeftX)/_},set:function(t){V[N].mediaBox.topRightX=t*_+V[N].mediaBox.bottomLeftX},enumerable:!0,configurable:!0}),Object.defineProperty(u.internal.pageSize,"height",{get:function(){return(V[N].mediaBox.topRightY-V[N].mediaBox.bottomLeftY)/_},set:function(t){V[N].mediaBox.topRightY=t*_+V[N].mediaBox.bottomLeftY},enumerable:!0,configurable:!0}),function(t){for(var e=0,n=E.length;e<n;e++){var r=yt(t[e][0],t[e][1],t[e][2],E[e][3],!0);K[r]=!0;var i=t[e][0].split("-");mt(r,i[0],i[1]||"")}it.publish("addFonts",{fonts:rt,dictionary:H})}(E),$="F1",bt(i,t),it.publish("initialized"),u}return se.API={events:[]},se.version="1.5.2","function"==typeof define&&define.amd?define("jsPDF",function(){return se}):"undefined"!=typeof module&&module.exports?(module.exports=se,module.exports.jsPDF=se):ie.jsPDF=se,se}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||"undefined"!=typeof global&&global||Function('return typeof this === "object" && this.content')()||Function("return this")()); /* Copyright (c) 2008, Adobe Systems Incorporated All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Adobe Systems Incorporated nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ function JPEGEncoder(t){var L,x,A,S,e,l=Math.floor,_=new Array(64),P=new Array(64),F=new Array(64),k=new Array(64),y=new Array(65535),v=new Array(65535),Z=new Array(64),w=new Array(64),I=[],C=0,B=7,j=new Array(64),q=new Array(64),E=new Array(64),n=new Array(256),M=new Array(2048),b=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],D=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],O=[0,1,2,3,4,5,6,7,8,9,10,11],T=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],R=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],z=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],U=[0,1,2,3,4,5,6,7,8,9,10,11],H=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],W=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];function r(t,e){for(var n=0,r=0,i=new Array,o=1;o<=16;o++){for(var s=1;s<=t[o];s++)i[e[r]]=[],i[e[r]][0]=n,i[e[r]][1]=o,r++,n++;n*=2}return i}function V(t){for(var e=t[0],n=t[1]-1;0<=n;)e&1<<n&&(C|=1<<B),n--,--B<0&&(255==C?(G(255),G(0)):G(C),B=7,C=0)}function G(t){I.push(t)}function Y(t){G(t>>8&255),G(255&t)}function J(t,e,n,r,i){for(var o,s=i[0],a=i[240],u=function(t,e){var n,r,i,o,s,a,u,h,c,l,f=0;for(c=0;c<8;++c){n=t[f],r=t[f+1],i=t[f+2],o=t[f+3],s=t[f+4],a=t[f+5],u=t[f+6];var p=n+(h=t[f+7]),d=n-h,g=r+u,m=r-u,y=i+a,v=i-a,w=o+s,b=o-s,N=p+w,L=p-w,x=g+y,A=g-y;t[f]=N+x,t[f+4]=N-x;var S=.707106781*(A+L);t[f+2]=L+S,t[f+6]=L-S;var _=.382683433*((N=b+v)-(A=m+d)),P=.5411961*N+_,F=1.306562965*A+_,k=.707106781*(x=v+m),I=d+k,C=d-k;t[f+5]=C+P,t[f+3]=C-P,t[f+1]=I+F,t[f+7]=I-F,f+=8}for(c=f=0;c<8;++c){n=t[f],r=t[f+8],i=t[f+16],o=t[f+24],s=t[f+32],a=t[f+40],u=t[f+48];var B=n+(h=t[f+56]),j=n-h,q=r+u,E=r-u,M=i+a,D=i-a,O=o+s,T=o-s,R=B+O,z=B-O,U=q+M,H=q-M;t[f]=R+U,t[f+32]=R-U;var W=.707106781*(H+z);t[f+16]=z+W,t[f+48]=z-W;var V=.382683433*((R=T+D)-(H=E+j)),G=.5411961*R+V,Y=1.306562965*H+V,J=.707106781*(U=D+E),X=j+J,K=j-J;t[f+40]=K+G,t[f+24]=K-G,t[f+8]=X+Y,t[f+56]=X-Y,f++}for(c=0;c<64;++c)l=t[c]*e[c],Z[c]=0<l?l+.5|0:l-.5|0;return Z}(t,e),h=0;h<64;++h)w[b[h]]=u[h];var c=w[0]-n;n=w[0],0==c?V(r[0]):(V(r[v[o=32767+c]]),V(y[o]));for(var l=63;0<l&&0==w[l];l--);if(0==l)return V(s),n;for(var f,p=1;p<=l;){for(var d=p;0==w[p]&&p<=l;++p);var g=p-d;if(16<=g){f=g>>4;for(var m=1;m<=f;++m)V(a);g&=15}o=32767+w[p],V(i[(g<<4)+v[o]]),V(y[o]),p++}return 63!=l&&V(s),n}function X(t){if(t<=0&&(t=1),100<t&&(t=100),e!=t){(function(t){for(var e=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],n=0;n<64;n++){var r=l((e[n]*t+50)/100);r<1?r=1:255<r&&(r=255),_[b[n]]=r}for(var i=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],o=0;o<64;o++){var s=l((i[o]*t+50)/100);s<1?s=1:255<s&&(s=255),P[b[o]]=s}for(var a=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],u=0,h=0;h<8;h++)for(var c=0;c<8;c++)F[u]=1/(_[b[u]]*a[h]*a[c]*8),k[u]=1/(P[b[u]]*a[h]*a[c]*8),u++})(t<50?Math.floor(5e3/t):Math.floor(200-2*t)),e=t}}this.encode=function(t,e){var n,r;(new Date).getTime();e&&X(e),I=new Array,C=0,B=7,Y(65496),Y(65504),Y(16),G(74),G(70),G(73),G(70),G(0),G(1),G(1),G(0),Y(1),Y(1),G(0),G(0),function(){Y(65499),Y(132),G(0);for(var t=0;t<64;t++)G(_[t]);G(1);for(var e=0;e<64;e++)G(P[e])}(),n=t.width,r=t.height,Y(65472),Y(17),G(8),Y(r),Y(n),G(3),G(1),G(17),G(0),G(2),G(17),G(1),G(3),G(17),G(1),function(){Y(65476),Y(418),G(0);for(var t=0;t<16;t++)G(D[t+1]);for(var e=0;e<=11;e++)G(O[e]);G(16);for(var n=0;n<16;n++)G(T[n+1]);for(var r=0;r<=161;r++)G(R[r]);G(1);for(var i=0;i<16;i++)G(z[i+1]);for(var o=0;o<=11;o++)G(U[o]);G(17);for(var s=0;s<16;s++)G(H[s+1]);for(var a=0;a<=161;a++)G(W[a])}(),Y(65498),Y(12),G(3),G(1),G(0),G(2),G(17),G(3),G(17),G(0),G(63),G(0);var i=0,o=0,s=0;C=0,B=7,this.encode.displayName="_encode_";for(var a,u,h,c,l,f,p,d,g,m=t.data,y=t.width,v=t.height,w=4*y,b=0;b<v;){for(a=0;a<w;){for(f=l=w*b+a,p=-1,g=d=0;g<64;g++)f=l+(d=g>>3)*w+(p=4*(7&g)),v<=b+d&&(f-=w*(b+1+d-v)),w<=a+p&&(f-=a+p-w+4),u=m[f++],h=m[f++],c=m[f++],j[g]=(M[u]+M[h+256>>0]+M[c+512>>0]>>16)-128,q[g]=(M[u+768>>0]+M[h+1024>>0]+M[c+1280>>0]>>16)-128,E[g]=(M[u+1280>>0]+M[h+1536>>0]+M[c+1792>>0]>>16)-128;i=J(j,F,i,L,A),o=J(q,k,o,x,S),s=J(E,k,s,x,S),a+=32}b+=8}if(0<=B){var N=[];N[1]=B+1,N[0]=(1<<B+1)-1,V(N)}return Y(65497),new Uint8Array(I)},function(){(new Date).getTime();t||(t=50),function(){for(var t=String.fromCharCode,e=0;e<256;e++)n[e]=t(e)}(),L=r(D,O),x=r(z,U),A=r(T,R),S=r(H,W),function(){for(var t=1,e=2,n=1;n<=15;n++){for(var r=t;r<e;r++)v[32767+r]=n,y[32767+r]=[],y[32767+r][1]=n,y[32767+r][0]=r;for(var i=-(e-1);i<=-t;i++)v[32767+i]=n,y[32767+i]=[],y[32767+i][1]=n,y[32767+i][0]=e-1+i;t<<=1,e<<=1}}(),function(){for(var t=0;t<256;t++)M[t]=19595*t,M[t+256>>0]=38470*t,M[t+512>>0]=7471*t+32768,M[t+768>>0]=-11059*t,M[t+1024>>0]=-21709*t,M[t+1280>>0]=32768*t+8421375,M[t+1536>>0]=-27439*t,M[t+1792>>0]=-5329*t}(),X(t),(new Date).getTime()}()} /** * @license * Copyright (c) 2016 Alexander Weidt, * https://github.com/BiggA94 * * Licensed under the MIT License. http://opensource.org/licenses/mit-license */ (function(t,e){var A,n=1,S=function(t){return t.replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")},y=function(t){return t.replace(/\\\\/g,"\\").replace(/\\\(/g,"(").replace(/\\\)/g,")")},_=function(t){if(isNaN(t))throw new Error("Invalid argument passed to jsPDF.f2");return t.toFixed(2)},a=function(t){if(isNaN(t))throw new Error("Invalid argument passed to jsPDF.f2");return t.toFixed(5)};t.__acroform__={};var r=function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t},v=function(t){return t*n},w=function(t){return t/n},u=function(t){var e=new j,n=Y.internal.getHeight(t)||0,r=Y.internal.getWidth(t)||0;return e.BBox=[0,0,Number(_(r)),Number(_(n))],e},i=t.__acroform__.setBit=function(t,e){if(t=t||0,e=e||0,isNaN(t)||isNaN(e))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.setBit");return t|=1<<e},o=t.__acroform__.clearBit=function(t,e){if(t=t||0,e=e||0,isNaN(t)||isNaN(e))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.clearBit");return t&=~(1<<e)},s=t.__acroform__.getBit=function(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.getBit");return 0==(t&1<<e)?0:1},b=t.__acroform__.getBitForPdf=function(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.getBitForPdf");return s(t,e-1)},N=t.__acroform__.setBitForPdf=function(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.setBitForPdf");return i(t,e-1)},L=t.__acroform__.clearBitForPdf=function(t,e,n){if(isNaN(t)||isNaN(e))throw new Error("Invalid arguments passed to jsPDF.API.__acroform__.clearBitForPdf");return o(t,e-1)},l=t.__acroform__.calculateCoordinates=function(t){var e=this.internal.getHorizontalCoordinate,n=this.internal.getVerticalCoordinate,r=t[0],i=t[1],o=t[2],s=t[3],a={};return a.lowerLeft_X=e(r)||0,a.lowerLeft_Y=n(i+s)||0,a.upperRight_X=e(r+o)||0,a.upperRight_Y=n(i)||0,[Number(_(a.lowerLeft_X)),Number(_(a.lowerLeft_Y)),Number(_(a.upperRight_X)),Number(_(a.upperRight_Y))]},f=function(t){if(t.appearanceStreamContent)return t.appearanceStreamContent;if(t.V||t.DV){var e=[],n=t.V||t.DV,r=h(t,n),i=A.internal.getFont(t.fontName,t.fontStyle).id;e.push("/Tx BMC"),e.push("q"),e.push("BT"),e.push(A.__private__.encodeColorString(t.color)),e.push("/"+i+" "+_(r.fontSize)+" Tf"),e.push("1 0 0 1 0 0 Tm"),e.push(r.text),e.push("ET"),e.push("Q"),e.push("EMC");var o=new u(t);return o.stream=e.join("\n"),o}},h=function(i,t){var e=i.maxFontSize||12,n=(i.fontName,{text:"",fontSize:""}),o=(t=")"==(t="("==t.substr(0,1)?t.substr(1):t).substr(t.length-1)?t.substr(0,t.length-1):t).split(" "),r=(A.__private__.encodeColorString(i.color),e),s=Y.internal.getHeight(i)||0;s=s<0?-s:s;var a=Y.internal.getWidth(i)||0;a=a<0?-a:a;var u=function(t,e,n){if(t+1<o.length){var r=e+" "+o[t+1];return P(r,i,n).width<=a-4}return!1};r++;t:for(;;){t="";var h=P("3",i,--r).height,c=i.multiline?s-r:(s-h)/2,l=-2,f=c+=2,p=0,d=0,g=0;if(r<=0){t="(...) Tj\n",t+="% Width of Text: "+P(t,i,r=12).width+", FieldWidth:"+a+"\n";break}g=P(o[0]+" ",i,r).width;var m="",y=0;for(var v in o)if(o.hasOwnProperty(v)){m=" "==(m+=o[v]+" ").substr(m.length-1)?m.substr(0,m.length-1):m;var w=parseInt(v);g=P(m+" ",i,r).width;var b=u(w,m,r),N=v>=o.length-1;if(b&&!N){m+=" ";continue}if(b||N){if(N)d=w;else if(i.multiline&&s<(h+2)*(y+2)+2)continue t}else{if(!i.multiline)continue t;if(s<(h+2)*(y+2)+2)continue t;d=w}for(var L="",x=p;x<=d;x++)L+=o[x]+" ";switch(L=" "==L.substr(L.length-1)?L.substr(0,L.length-1):L,g=P(L,i,r).width,i.textAlign){case"right":l=a-g-2;break;case"center":l=(a-g)/2;break;case"left":default:l=2}t+=_(l)+" "+_(f)+" Td\n",t+="("+S(L)+") Tj\n",t+=-_(l)+" 0 Td\n",f=-(r+2),g=0,p=d+1,y++,m=""}else;break}return n.text=t,n.fontSize=r,n},P=function(t,e,n){var r=A.internal.getFont(e.fontName,e.fontStyle),i=A.getStringUnitWidth(t,{font:r,fontSize:parseFloat(n),charSpace:0})*parseFloat(n);return{height:A.getStringUnitWidth("3",{font:r,fontSize:parseFloat(n),charSpace:0})*parseFloat(n)*1.5,width:i}},c={fields:[],xForms:[],acroFormDictionaryRoot:null,printedOut:!1,internal:null,isInitialized:!1},p=function(){A.internal.acroformPlugin.acroFormDictionaryRoot.objId=void 0;var t=A.internal.acroformPlugin.acroFormDictionaryRoot.Fields;for(var e in t)if(t.hasOwnProperty(e)){var n=t[e];n.objId=void 0,n.hasAnnotation&&d.call(A,n)}},d=function(t){var e={type:"reference",object:t};void 0===A.internal.getPageInfo(t.page).pageContext.annotations.find(function(t){return t.type===e.type&&t.object===e.object})&&A.internal.getPageInfo(t.page).pageContext.annotations.push(e)},g=function(){if(void 0===A.internal.acroformPlugin.acroFormDictionaryRoot)throw new Error("putCatalogCallback: Root missing.");A.internal.write("/AcroForm "+A.internal.acroformPlugin.acroFormDictionaryRoot.objId+" 0 R")},m=function(){A.internal.events.unsubscribe(A.internal.acroformPlugin.acroFormDictionaryRoot._eventID),delete A.internal.acroformPlugin.acroFormDictionaryRoot._eventID,A.internal.acroformPlugin.printedOut=!0},x=function(t){var e=!t;t||(A.internal.newObjectDeferredBegin(A.internal.acroformPlugin.acroFormDictionaryRoot.objId,!0),A.internal.acroformPlugin.acroFormDictionaryRoot.putStream());t=t||A.internal.acroformPlugin.acroFormDictionaryRoot.Kids;for(var n in t)if(t.hasOwnProperty(n)){var r=t[n],i=[],o=r.Rect;if(r.Rect&&(r.Rect=l.call(this,r.Rect)),A.internal.newObjectDeferredBegin(r.objId,!0),r.DA=Y.createDefaultAppearanceStream(r),"object"===_typeof(r)&&"function"==typeof r.getKeyValueListForStream&&(i=r.getKeyValueListForStream()),r.Rect=o,r.hasAppearanceStream&&!r.appearanceStreamContent){var s=f.call(this,r);i.push({key:"AP",value:"<</N "+s+">>"}),A.internal.acroformPlugin.xForms.push(s)}if(r.appearanceStreamContent){var a="";for(var u in r.appearanceStreamContent)if(r.appearanceStreamContent.hasOwnProperty(u)){var h=r.appearanceStreamContent[u];if(a+="/"+u+" ",a+="<<",1<=Object.keys(h).length||Array.isArray(h))for(var n in h){var c;if(h.hasOwnProperty(n))"function"==typeof(c=h[n])&&(c=c.call(this,r)),a+="/"+n+" "+c+" ",0<=A.internal.acroformPlugin.xForms.indexOf(c)||A.internal.acroformPlugin.xForms.push(c)}else"function"==typeof(c=h)&&(c=c.call(this,r)),a+="/"+n+" "+c,0<=A.internal.acroformPlugin.xForms.indexOf(c)||A.internal.acroformPlugin.xForms.push(c);a+=">>"}i.push({key:"AP",value:"<<\n"+a+">>"})}A.internal.putStream({additionalKeyValues:i}),A