jspdf.autotable.js 100 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219
  1. /*!
  2. * jsPDF AutoTable plugin v2.3.4
  3. * Copyright (c) 2014 Simon Bengtsson, https://github.com/simonbengtsson/jsPDF-AutoTable
  4. *
  5. * Licensed under the MIT License.
  6. * http://opensource.org/licenses/mit-license
  7. *
  8. * * /if (typeof window === 'object') window.jspdfAutoTableVersion = '2.3.4';/*
  9. */
  10. (function webpackUniversalModuleDefinition(root, factory) {
  11. if(typeof exports === 'object' && typeof module === 'object')
  12. module.exports = factory(require("jspdf"));
  13. else if(typeof define === 'function' && define.amd)
  14. define(["jspdf"], factory);
  15. else {
  16. var a = typeof exports === 'object' ? factory(require("jspdf")) : factory(root["jsPDF"]);
  17. for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
  18. }
  19. })(window, function(__WEBPACK_EXTERNAL_MODULE__19__) {
  20. return /******/ (function(modules) { // webpackBootstrap
  21. /******/ // The module cache
  22. /******/ var installedModules = {};
  23. /******/
  24. /******/ // The require function
  25. /******/ function __webpack_require__(moduleId) {
  26. /******/
  27. /******/ // Check if module is in cache
  28. /******/ if(installedModules[moduleId]) {
  29. /******/ return installedModules[moduleId].exports;
  30. /******/ }
  31. /******/ // Create a new module (and put it into the cache)
  32. /******/ var module = installedModules[moduleId] = {
  33. /******/ i: moduleId,
  34. /******/ l: false,
  35. /******/ exports: {}
  36. /******/ };
  37. /******/
  38. /******/ // Execute the module function
  39. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  40. /******/
  41. /******/ // Flag the module as loaded
  42. /******/ module.l = true;
  43. /******/
  44. /******/ // Return the exports of the module
  45. /******/ return module.exports;
  46. /******/ }
  47. /******/
  48. /******/
  49. /******/ // expose the modules object (__webpack_modules__)
  50. /******/ __webpack_require__.m = modules;
  51. /******/
  52. /******/ // expose the module cache
  53. /******/ __webpack_require__.c = installedModules;
  54. /******/
  55. /******/ // define getter function for harmony exports
  56. /******/ __webpack_require__.d = function(exports, name, getter) {
  57. /******/ if(!__webpack_require__.o(exports, name)) {
  58. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  59. /******/ }
  60. /******/ };
  61. /******/
  62. /******/ // define __esModule on exports
  63. /******/ __webpack_require__.r = function(exports) {
  64. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  65. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  66. /******/ }
  67. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  68. /******/ };
  69. /******/
  70. /******/ // create a fake namespace object
  71. /******/ // mode & 1: value is a module id, require it
  72. /******/ // mode & 2: merge all properties of value into the ns
  73. /******/ // mode & 4: return value when already ns object
  74. /******/ // mode & 8|1: behave like require
  75. /******/ __webpack_require__.t = function(value, mode) {
  76. /******/ if(mode & 1) value = __webpack_require__(value);
  77. /******/ if(mode & 8) return value;
  78. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  79. /******/ var ns = Object.create(null);
  80. /******/ __webpack_require__.r(ns);
  81. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  82. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  83. /******/ return ns;
  84. /******/ };
  85. /******/
  86. /******/ // getDefaultExport function for compatibility with non-harmony modules
  87. /******/ __webpack_require__.n = function(module) {
  88. /******/ var getter = module && module.__esModule ?
  89. /******/ function getDefault() { return module['default']; } :
  90. /******/ function getModuleExports() { return module; };
  91. /******/ __webpack_require__.d(getter, 'a', getter);
  92. /******/ return getter;
  93. /******/ };
  94. /******/
  95. /******/ // Object.prototype.hasOwnProperty.call
  96. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  97. /******/
  98. /******/ // __webpack_public_path__
  99. /******/ __webpack_require__.p = "";
  100. /******/
  101. /******/
  102. /******/ // Load entry module and return exports
  103. /******/ return __webpack_require__(__webpack_require__.s = 18);
  104. /******/ })
  105. /************************************************************************/
  106. /******/ ([
  107. /* 0 */
  108. /***/ (function(module, exports, __webpack_require__) {
  109. "use strict";
  110. exports.__esModule = true;
  111. /**
  112. * Ratio between font size and font height. The number comes from jspdf's source code
  113. */
  114. exports.FONT_ROW_RATIO = 1.15;
  115. var models_1 = __webpack_require__(5);
  116. var table = null;
  117. var assign = __webpack_require__(6);
  118. var entries = __webpack_require__(20);
  119. /**
  120. * Styles for the themes (overriding the default styles)
  121. */
  122. exports.getTheme = function (name) {
  123. var themes = {
  124. 'striped': {
  125. table: { fillColor: 255, textColor: 80, fontStyle: 'normal' },
  126. header: { textColor: 255, fillColor: [41, 128, 185], fontStyle: 'bold' },
  127. body: {},
  128. alternateRow: { fillColor: 245 }
  129. },
  130. 'grid': {
  131. table: { fillColor: 255, textColor: 80, fontStyle: 'normal', lineWidth: 0.1 },
  132. header: { textColor: 255, fillColor: [26, 188, 156], fontStyle: 'bold', lineWidth: 0 },
  133. body: {},
  134. alternateRow: {}
  135. },
  136. 'plain': {
  137. header: { fontStyle: 'bold' }
  138. }
  139. };
  140. return themes[name];
  141. };
  142. function getDefaults() {
  143. var scaleFactor = Config.scaleFactor();
  144. return {
  145. // Styling
  146. theme: 'striped',
  147. styles: {},
  148. headerStyles: {},
  149. bodyStyles: {},
  150. alternateRowStyles: {},
  151. columnStyles: {},
  152. // Properties
  153. startY: false,
  154. margin: 40 / scaleFactor,
  155. pageBreak: 'auto',
  156. tableWidth: 'auto',
  157. showHeader: 'everyPage',
  158. tableLineWidth: 0,
  159. tableLineColor: 200,
  160. // Hooks
  161. createdHeaderCell: function (cell, data) { },
  162. createdCell: function (cell, data) { },
  163. drawHeaderRow: function (row, data) { },
  164. drawRow: function (row, data) { },
  165. drawHeaderCell: function (cell, data) { },
  166. drawCell: function (cell, data) { },
  167. addPageContent: function (data) { }
  168. };
  169. }
  170. exports.getDefaults = getDefaults;
  171. // Base style for all themes
  172. function defaultStyles() {
  173. var scaleFactor = Config.scaleFactor();
  174. return {
  175. font: "helvetica",
  176. fontStyle: 'normal',
  177. overflow: 'ellipsize',
  178. fillColor: false,
  179. textColor: 20,
  180. halign: 'left',
  181. valign: 'top',
  182. fontSize: 10,
  183. cellPadding: 5 / scaleFactor,
  184. lineColor: 200,
  185. lineWidth: 0 / scaleFactor,
  186. columnWidth: 'auto'
  187. };
  188. }
  189. var Config = /** @class */ (function () {
  190. function Config() {
  191. }
  192. Config.pageSize = function () {
  193. var pageSize = table.doc.internal.pageSize;
  194. // JSPDF 1.4 uses get functions instead of properties on pageSize
  195. if (pageSize.width == null) {
  196. pageSize = {
  197. width: pageSize.getWidth(),
  198. height: pageSize.getHeight()
  199. };
  200. }
  201. return pageSize;
  202. };
  203. Config.applyUserStyles = function () {
  204. Config.applyStyles(table.userStyles);
  205. };
  206. Config.createTable = function (doc) {
  207. table = new models_1.Table(doc);
  208. return table;
  209. };
  210. Config.tableInstance = function () {
  211. return table;
  212. };
  213. Config.scaleFactor = function () {
  214. return table.doc.internal.scaleFactor;
  215. };
  216. Config.hooksData = function (additionalData) {
  217. if (additionalData === void 0) { additionalData = {}; }
  218. return assign({
  219. pageCount: table.pageCount,
  220. settings: table.settings,
  221. table: table,
  222. doc: table.doc,
  223. cursor: table.cursor
  224. }, additionalData || {});
  225. };
  226. Config.initSettings = function (table, allOptions) {
  227. var _loop_1 = function (styleProp) {
  228. var styles = allOptions.map(function (opts) { return opts[styleProp] || {}; });
  229. table.styles[styleProp] = assign.apply(void 0, [{}].concat(styles));
  230. };
  231. // Merge styles one level deeper
  232. for (var _i = 0, _a = Object.keys(table.styles); _i < _a.length; _i++) {
  233. var styleProp = _a[_i];
  234. _loop_1(styleProp);
  235. }
  236. // Append event handlers instead of replacing them
  237. for (var _b = 0, _c = entries(table.hooks); _b < _c.length; _b++) {
  238. var _d = _c[_b], hookName = _d[0], list = _d[1];
  239. for (var _e = 0, allOptions_1 = allOptions; _e < allOptions_1.length; _e++) {
  240. var opts = allOptions_1[_e];
  241. if (opts && opts[hookName]) {
  242. list.push(opts[hookName]);
  243. }
  244. }
  245. }
  246. // Merge all other options one level
  247. table.settings = assign.apply(void 0, [getDefaults()].concat(allOptions));
  248. };
  249. // This is messy, only keep array and number format the next major version
  250. Config.marginOrPadding = function (value, defaultValue) {
  251. var newValue = {};
  252. if (Array.isArray(value)) {
  253. if (value.length >= 4) {
  254. newValue = { 'top': value[0], 'right': value[1], 'bottom': value[2], 'left': value[3] };
  255. }
  256. else if (value.length === 3) {
  257. newValue = { 'top': value[0], 'right': value[1], 'bottom': value[2], 'left': value[1] };
  258. }
  259. else if (value.length === 2) {
  260. newValue = { 'top': value[0], 'right': value[1], 'bottom': value[0], 'left': value[1] };
  261. }
  262. else if (value.length === 1) {
  263. value = value[0];
  264. }
  265. else {
  266. value = defaultValue;
  267. }
  268. }
  269. else if (typeof value === 'object') {
  270. if (value['vertical']) {
  271. value['top'] = value['vertical'];
  272. value['bottom'] = value['vertical'];
  273. }
  274. else if (value['horizontal']) {
  275. value['right'] = value['horizontal'];
  276. value['left'] = value['horizontal'];
  277. }
  278. for (var _i = 0, _a = ['top', 'right', 'bottom', 'left']; _i < _a.length; _i++) {
  279. var side = _a[_i];
  280. newValue[side] = value[side] || value[side] === 0 ? value[side] : defaultValue;
  281. }
  282. }
  283. if (typeof value === 'number') {
  284. newValue = { 'top': value, 'right': value, 'bottom': value, 'left': value };
  285. }
  286. return newValue;
  287. };
  288. Config.styles = function (styles) {
  289. styles = Array.isArray(styles) ? styles : [styles];
  290. return assign.apply(void 0, [defaultStyles()].concat(styles));
  291. };
  292. Config.applyStyles = function (styles) {
  293. var doc = table.doc;
  294. var styleModifiers = {
  295. fillColor: doc.setFillColor,
  296. textColor: doc.setTextColor,
  297. fontStyle: doc.setFontStyle,
  298. lineColor: doc.setDrawColor,
  299. lineWidth: doc.setLineWidth,
  300. font: doc.setFont,
  301. fontSize: doc.setFontSize
  302. };
  303. Object.keys(styleModifiers).forEach(function (name) {
  304. var style = styles[name];
  305. var modifier = styleModifiers[name];
  306. if (typeof style !== 'undefined') {
  307. if (Array.isArray(style)) {
  308. modifier.apply(this, style);
  309. }
  310. else {
  311. modifier(style);
  312. }
  313. }
  314. });
  315. };
  316. return Config;
  317. }());
  318. exports.Config = Config;
  319. /***/ }),
  320. /* 1 */
  321. /***/ (function(module, exports, __webpack_require__) {
  322. "use strict";
  323. var bind = __webpack_require__(2);
  324. module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
  325. /***/ }),
  326. /* 2 */
  327. /***/ (function(module, exports, __webpack_require__) {
  328. "use strict";
  329. var implementation = __webpack_require__(27);
  330. module.exports = Function.prototype.bind || implementation;
  331. /***/ }),
  332. /* 3 */
  333. /***/ (function(module, exports, __webpack_require__) {
  334. "use strict";
  335. var fnToStr = Function.prototype.toString;
  336. var constructorRegex = /^\s*class\b/;
  337. var isES6ClassFn = function isES6ClassFunction(value) {
  338. try {
  339. var fnStr = fnToStr.call(value);
  340. return constructorRegex.test(fnStr);
  341. } catch (e) {
  342. return false; // not a function
  343. }
  344. };
  345. var tryFunctionObject = function tryFunctionToStr(value) {
  346. try {
  347. if (isES6ClassFn(value)) { return false; }
  348. fnToStr.call(value);
  349. return true;
  350. } catch (e) {
  351. return false;
  352. }
  353. };
  354. var toStr = Object.prototype.toString;
  355. var fnClass = '[object Function]';
  356. var genClass = '[object GeneratorFunction]';
  357. var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
  358. module.exports = function isCallable(value) {
  359. if (!value) { return false; }
  360. if (typeof value !== 'function' && typeof value !== 'object') { return false; }
  361. if (typeof value === 'function' && !value.prototype) { return true; }
  362. if (hasToStringTag) { return tryFunctionObject(value); }
  363. if (isES6ClassFn(value)) { return false; }
  364. var strClass = toStr.call(value);
  365. return strClass === fnClass || strClass === genClass;
  366. };
  367. /***/ }),
  368. /* 4 */
  369. /***/ (function(module, exports, __webpack_require__) {
  370. "use strict";
  371. exports.__esModule = true;
  372. var config_1 = __webpack_require__(0);
  373. var painter_1 = __webpack_require__(17);
  374. function getStringWidth(text, styles) {
  375. var k = config_1.Config.scaleFactor();
  376. var fontSize = styles.fontSize / k;
  377. config_1.Config.applyStyles(styles);
  378. text = Array.isArray(text) ? text : [text];
  379. var maxWidth = 0;
  380. text.forEach(function (line) {
  381. var width = config_1.Config.tableInstance().doc.getStringUnitWidth(line);
  382. if (width > maxWidth) {
  383. maxWidth = width;
  384. }
  385. });
  386. var precision = 10000 * k;
  387. maxWidth = Math.floor(maxWidth * precision) / precision;
  388. return maxWidth * fontSize;
  389. }
  390. exports.getStringWidth = getStringWidth;
  391. /**
  392. * Ellipsize the text to fit in the width
  393. */
  394. function ellipsize(text, width, styles, ellipsizeStr) {
  395. if (ellipsizeStr === void 0) { ellipsizeStr = '...'; }
  396. if (Array.isArray(text)) {
  397. var value_1 = [];
  398. text.forEach(function (str, i) {
  399. value_1[i] = ellipsize(str, width, styles, ellipsizeStr);
  400. });
  401. return value_1;
  402. }
  403. var precision = 10000 * config_1.Config.scaleFactor();
  404. width = Math.ceil(width * precision) / precision;
  405. if (width >= getStringWidth(text, styles)) {
  406. return text;
  407. }
  408. while (width < getStringWidth(text + ellipsizeStr, styles)) {
  409. if (text.length <= 1) {
  410. break;
  411. }
  412. text = text.substring(0, text.length - 1);
  413. }
  414. return text.trim() + ellipsizeStr;
  415. }
  416. exports.ellipsize = ellipsize;
  417. function addTableBorder() {
  418. var table = config_1.Config.tableInstance();
  419. var styles = { lineWidth: table.settings.tableLineWidth, lineColor: table.settings.tableLineColor };
  420. config_1.Config.applyStyles(styles);
  421. var fs = getFillStyle(styles);
  422. if (fs) {
  423. table.doc.rect(table.pageStartX, table.pageStartY, table.width, table.cursor.y - table.pageStartY, fs);
  424. }
  425. }
  426. exports.addTableBorder = addTableBorder;
  427. function addPage() {
  428. var table = config_1.Config.tableInstance();
  429. table.finalY = table.cursor.y;
  430. // Add user content just before adding new page ensure it will
  431. // be drawn above other things on the page
  432. addContentHooks();
  433. addTableBorder();
  434. nextPage(table.doc);
  435. table.pageCount++;
  436. table.cursor = { x: table.margin('left'), y: table.margin('top') };
  437. table.pageStartX = table.cursor.x;
  438. table.pageStartY = table.cursor.y;
  439. if (table.settings.showHeader === true || table.settings.showHeader === 'everyPage') {
  440. painter_1.printRow(table.headerRow, table.hooks.drawHeaderRow, table.hooks.drawHeaderCell);
  441. }
  442. }
  443. exports.addPage = addPage;
  444. function addContentHooks() {
  445. for (var _i = 0, _a = config_1.Config.tableInstance().hooks.addPageContent; _i < _a.length; _i++) {
  446. var hook = _a[_i];
  447. config_1.Config.applyUserStyles();
  448. hook(config_1.Config.hooksData());
  449. }
  450. config_1.Config.applyUserStyles();
  451. }
  452. exports.addContentHooks = addContentHooks;
  453. function getFillStyle(styles) {
  454. var drawLine = styles.lineWidth > 0;
  455. var drawBackground = styles.fillColor || styles.fillColor === 0;
  456. if (drawLine && drawBackground) {
  457. return 'DF'; // Fill then stroke
  458. }
  459. else if (drawLine) {
  460. return 'S'; // Only stroke (transparent background)
  461. }
  462. else if (drawBackground) {
  463. return 'F'; // Only fill, no stroke
  464. }
  465. else {
  466. return false;
  467. }
  468. }
  469. exports.getFillStyle = getFillStyle;
  470. function nextPage(doc) {
  471. var current = doc.internal.getCurrentPageInfo().pageNumber;
  472. doc.setPage(current + 1);
  473. var newCurrent = doc.internal.getCurrentPageInfo().pageNumber;
  474. if (newCurrent === current) {
  475. doc.addPage();
  476. }
  477. }
  478. exports.nextPage = nextPage;
  479. /***/ }),
  480. /* 5 */
  481. /***/ (function(module, exports, __webpack_require__) {
  482. "use strict";
  483. exports.__esModule = true;
  484. var config_1 = __webpack_require__(0);
  485. exports.table = {};
  486. var Table = /** @class */ (function () {
  487. function Table(doc) {
  488. this.height = 0;
  489. this.width = 0;
  490. this.contentWidth = 0;
  491. this.preferredWidth = 0;
  492. this.rows = [];
  493. this.columns = [];
  494. this.headerRow = null;
  495. this.pageCount = 1;
  496. this.hooks = {
  497. createdHeaderCell: [],
  498. createdCell: [],
  499. drawHeaderRow: [],
  500. drawRow: [],
  501. drawHeaderCell: [],
  502. drawCell: [],
  503. addPageContent: []
  504. };
  505. this.styles = {
  506. styles: {},
  507. headerStyles: {},
  508. bodyStyles: {},
  509. alternateRowStyles: {},
  510. columnStyles: {}
  511. };
  512. this.doc = doc;
  513. this.userStyles = {
  514. textColor: 30,
  515. fontSize: doc.internal.getFontSize(),
  516. fontStyle: doc.internal.getFont().fontStyle
  517. };
  518. }
  519. Table.prototype.margin = function (side) {
  520. return config_1.Config.marginOrPadding(this.settings.margin, config_1.getDefaults().margin)[side];
  521. };
  522. return Table;
  523. }());
  524. exports.Table = Table;
  525. var Row = /** @class */ (function () {
  526. function Row(raw, index) {
  527. this.cells = {};
  528. this.spansMultiplePages = false;
  529. this.pageCount = 1;
  530. this.height = 0;
  531. this.y = 0;
  532. this.maxLineCount = 1;
  533. this.raw = raw;
  534. this.index = index;
  535. }
  536. return Row;
  537. }());
  538. exports.Row = Row;
  539. var Cell = /** @class */ (function () {
  540. function Cell(raw) {
  541. this.styles = {};
  542. this.text = '';
  543. this.contentWidth = 0;
  544. this.textPos = {};
  545. this.height = 0;
  546. this.width = 0;
  547. this.x = 0;
  548. this.y = 0;
  549. this.raw = raw;
  550. }
  551. Cell.prototype.padding = function (name) {
  552. var padding = config_1.Config.marginOrPadding(this.styles.cellPadding, config_1.Config.styles([]).cellPadding);
  553. if (name === 'vertical') {
  554. return padding.top + padding.bottom;
  555. }
  556. else if (name === 'horizontal') {
  557. return padding.left + padding.right;
  558. }
  559. else {
  560. return padding[name];
  561. }
  562. };
  563. return Cell;
  564. }());
  565. exports.Cell = Cell;
  566. var Column = /** @class */ (function () {
  567. function Column(dataKey, index) {
  568. this.options = {};
  569. this.contentWidth = 0;
  570. this.preferredWidth = 0;
  571. this.widthStyle = 'auto';
  572. this.width = 0;
  573. this.x = 0;
  574. this.dataKey = dataKey;
  575. this.index = index;
  576. }
  577. return Column;
  578. }());
  579. exports.Column = Column;
  580. /***/ }),
  581. /* 6 */
  582. /***/ (function(module, exports, __webpack_require__) {
  583. "use strict";
  584. /*
  585. object-assign
  586. (c) Sindre Sorhus
  587. @license MIT
  588. */
  589. /* eslint-disable no-unused-vars */
  590. var getOwnPropertySymbols = Object.getOwnPropertySymbols;
  591. var hasOwnProperty = Object.prototype.hasOwnProperty;
  592. var propIsEnumerable = Object.prototype.propertyIsEnumerable;
  593. function toObject(val) {
  594. if (val === null || val === undefined) {
  595. throw new TypeError('Object.assign cannot be called with null or undefined');
  596. }
  597. return Object(val);
  598. }
  599. function shouldUseNative() {
  600. try {
  601. if (!Object.assign) {
  602. return false;
  603. }
  604. // Detect buggy property enumeration order in older V8 versions.
  605. // https://bugs.chromium.org/p/v8/issues/detail?id=4118
  606. var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
  607. test1[5] = 'de';
  608. if (Object.getOwnPropertyNames(test1)[0] === '5') {
  609. return false;
  610. }
  611. // https://bugs.chromium.org/p/v8/issues/detail?id=3056
  612. var test2 = {};
  613. for (var i = 0; i < 10; i++) {
  614. test2['_' + String.fromCharCode(i)] = i;
  615. }
  616. var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
  617. return test2[n];
  618. });
  619. if (order2.join('') !== '0123456789') {
  620. return false;
  621. }
  622. // https://bugs.chromium.org/p/v8/issues/detail?id=3056
  623. var test3 = {};
  624. 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
  625. test3[letter] = letter;
  626. });
  627. if (Object.keys(Object.assign({}, test3)).join('') !==
  628. 'abcdefghijklmnopqrst') {
  629. return false;
  630. }
  631. return true;
  632. } catch (err) {
  633. // We don't expect any of the above to throw, but better to be safe.
  634. return false;
  635. }
  636. }
  637. module.exports = shouldUseNative() ? Object.assign : function (target, source) {
  638. var from;
  639. var to = toObject(target);
  640. var symbols;
  641. for (var s = 1; s < arguments.length; s++) {
  642. from = Object(arguments[s]);
  643. for (var key in from) {
  644. if (hasOwnProperty.call(from, key)) {
  645. to[key] = from[key];
  646. }
  647. }
  648. if (getOwnPropertySymbols) {
  649. symbols = getOwnPropertySymbols(from);
  650. for (var i = 0; i < symbols.length; i++) {
  651. if (propIsEnumerable.call(from, symbols[i])) {
  652. to[symbols[i]] = from[symbols[i]];
  653. }
  654. }
  655. }
  656. }
  657. return to;
  658. };
  659. /***/ }),
  660. /* 7 */
  661. /***/ (function(module, exports, __webpack_require__) {
  662. "use strict";
  663. var keys = __webpack_require__(21);
  664. var foreach = __webpack_require__(23);
  665. var hasSymbols = typeof Symbol === 'function' && typeof Symbol() === 'symbol';
  666. var toStr = Object.prototype.toString;
  667. var isFunction = function (fn) {
  668. return typeof fn === 'function' && toStr.call(fn) === '[object Function]';
  669. };
  670. var arePropertyDescriptorsSupported = function () {
  671. var obj = {};
  672. try {
  673. Object.defineProperty(obj, 'x', { enumerable: false, value: obj });
  674. /* eslint-disable no-unused-vars, no-restricted-syntax */
  675. for (var _ in obj) { return false; }
  676. /* eslint-enable no-unused-vars, no-restricted-syntax */
  677. return obj.x === obj;
  678. } catch (e) { /* this is IE 8. */
  679. return false;
  680. }
  681. };
  682. var supportsDescriptors = Object.defineProperty && arePropertyDescriptorsSupported();
  683. var defineProperty = function (object, name, value, predicate) {
  684. if (name in object && (!isFunction(predicate) || !predicate())) {
  685. return;
  686. }
  687. if (supportsDescriptors) {
  688. Object.defineProperty(object, name, {
  689. configurable: true,
  690. enumerable: false,
  691. value: value,
  692. writable: true
  693. });
  694. } else {
  695. object[name] = value;
  696. }
  697. };
  698. var defineProperties = function (object, map) {
  699. var predicates = arguments.length > 2 ? arguments[2] : {};
  700. var props = keys(map);
  701. if (hasSymbols) {
  702. props = props.concat(Object.getOwnPropertySymbols(map));
  703. }
  704. foreach(props, function (name) {
  705. defineProperty(object, name, map[name], predicates[name]);
  706. });
  707. };
  708. defineProperties.supportsDescriptors = !!supportsDescriptors;
  709. module.exports = defineProperties;
  710. /***/ }),
  711. /* 8 */
  712. /***/ (function(module, exports, __webpack_require__) {
  713. "use strict";
  714. var ES = __webpack_require__(24);
  715. var has = __webpack_require__(1);
  716. var bind = __webpack_require__(2);
  717. var isEnumerable = bind.call(Function.call, Object.prototype.propertyIsEnumerable);
  718. module.exports = function entries(O) {
  719. var obj = ES.RequireObjectCoercible(O);
  720. var entrys = [];
  721. for (var key in obj) {
  722. if (has(obj, key) && isEnumerable(obj, key)) {
  723. entrys.push([key, obj[key]]);
  724. }
  725. }
  726. return entrys;
  727. };
  728. /***/ }),
  729. /* 9 */
  730. /***/ (function(module, exports) {
  731. module.exports = function isPrimitive(value) {
  732. return value === null || (typeof value !== 'function' && typeof value !== 'object');
  733. };
  734. /***/ }),
  735. /* 10 */
  736. /***/ (function(module, exports, __webpack_require__) {
  737. "use strict";
  738. /* globals
  739. Set,
  740. Map,
  741. WeakSet,
  742. WeakMap,
  743. Promise,
  744. Symbol,
  745. Proxy,
  746. Atomics,
  747. SharedArrayBuffer,
  748. ArrayBuffer,
  749. DataView,
  750. Uint8Array,
  751. Float32Array,
  752. Float64Array,
  753. Int8Array,
  754. Int16Array,
  755. Int32Array,
  756. Uint8ClampedArray,
  757. Uint16Array,
  758. Uint32Array,
  759. */
  760. var undefined; // eslint-disable-line no-shadow-restricted-names
  761. var ThrowTypeError = Object.getOwnPropertyDescriptor
  762. ? (function () { return Object.getOwnPropertyDescriptor(arguments, 'callee').get; }())
  763. : function () { throw new TypeError(); };
  764. var hasSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol';
  765. var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto
  766. var generator; // = function * () {};
  767. var generatorFunction = generator ? getProto(generator) : undefined;
  768. var asyncFn; // async function() {};
  769. var asyncFunction = asyncFn ? asyncFn.constructor : undefined;
  770. var asyncGen; // async function * () {};
  771. var asyncGenFunction = asyncGen ? getProto(asyncGen) : undefined;
  772. var asyncGenIterator = asyncGen ? asyncGen() : undefined;
  773. var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);
  774. var INTRINSICS = {
  775. '$ %Array%': Array,
  776. '$ %ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,
  777. '$ %ArrayBufferPrototype%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer.prototype,
  778. '$ %ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,
  779. '$ %ArrayPrototype%': Array.prototype,
  780. '$ %ArrayProto_entries%': Array.prototype.entries,
  781. '$ %ArrayProto_forEach%': Array.prototype.forEach,
  782. '$ %ArrayProto_keys%': Array.prototype.keys,
  783. '$ %ArrayProto_values%': Array.prototype.values,
  784. '$ %AsyncFromSyncIteratorPrototype%': undefined,
  785. '$ %AsyncFunction%': asyncFunction,
  786. '$ %AsyncFunctionPrototype%': asyncFunction ? asyncFunction.prototype : undefined,
  787. '$ %AsyncGenerator%': asyncGen ? getProto(asyncGenIterator) : undefined,
  788. '$ %AsyncGeneratorFunction%': asyncGenFunction,
  789. '$ %AsyncGeneratorPrototype%': asyncGenFunction ? asyncGenFunction.prototype : undefined,
  790. '$ %AsyncIteratorPrototype%': asyncGenIterator && hasSymbols && Symbol.asyncIterator ? asyncGenIterator[Symbol.asyncIterator]() : undefined,
  791. '$ %Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,
  792. '$ %Boolean%': Boolean,
  793. '$ %BooleanPrototype%': Boolean.prototype,
  794. '$ %DataView%': typeof DataView === 'undefined' ? undefined : DataView,
  795. '$ %DataViewPrototype%': typeof DataView === 'undefined' ? undefined : DataView.prototype,
  796. '$ %Date%': Date,
  797. '$ %DatePrototype%': Date.prototype,
  798. '$ %decodeURI%': decodeURI,
  799. '$ %decodeURIComponent%': decodeURIComponent,
  800. '$ %encodeURI%': encodeURI,
  801. '$ %encodeURIComponent%': encodeURIComponent,
  802. '$ %Error%': Error,
  803. '$ %ErrorPrototype%': Error.prototype,
  804. '$ %eval%': eval, // eslint-disable-line no-eval
  805. '$ %EvalError%': EvalError,
  806. '$ %EvalErrorPrototype%': EvalError.prototype,
  807. '$ %Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
  808. '$ %Float32ArrayPrototype%': typeof Float32Array === 'undefined' ? undefined : Float32Array.prototype,
  809. '$ %Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
  810. '$ %Float64ArrayPrototype%': typeof Float64Array === 'undefined' ? undefined : Float64Array.prototype,
  811. '$ %Function%': Function,
  812. '$ %FunctionPrototype%': Function.prototype,
  813. '$ %Generator%': generator ? getProto(generator()) : undefined,
  814. '$ %GeneratorFunction%': generatorFunction,
  815. '$ %GeneratorPrototype%': generatorFunction ? generatorFunction.prototype : undefined,
  816. '$ %Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,
  817. '$ %Int8ArrayPrototype%': typeof Int8Array === 'undefined' ? undefined : Int8Array.prototype,
  818. '$ %Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,
  819. '$ %Int16ArrayPrototype%': typeof Int16Array === 'undefined' ? undefined : Int8Array.prototype,
  820. '$ %Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,
  821. '$ %Int32ArrayPrototype%': typeof Int32Array === 'undefined' ? undefined : Int32Array.prototype,
  822. '$ %isFinite%': isFinite,
  823. '$ %isNaN%': isNaN,
  824. '$ %IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,
  825. '$ %JSON%': JSON,
  826. '$ %JSONParse%': JSON.parse,
  827. '$ %Map%': typeof Map === 'undefined' ? undefined : Map,
  828. '$ %MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),
  829. '$ %MapPrototype%': typeof Map === 'undefined' ? undefined : Map.prototype,
  830. '$ %Math%': Math,
  831. '$ %Number%': Number,
  832. '$ %NumberPrototype%': Number.prototype,
  833. '$ %Object%': Object,
  834. '$ %ObjectPrototype%': Object.prototype,
  835. '$ %ObjProto_toString%': Object.prototype.toString,
  836. '$ %ObjProto_valueOf%': Object.prototype.valueOf,
  837. '$ %parseFloat%': parseFloat,
  838. '$ %parseInt%': parseInt,
  839. '$ %Promise%': typeof Promise === 'undefined' ? undefined : Promise,
  840. '$ %PromisePrototype%': typeof Promise === 'undefined' ? undefined : Promise.prototype,
  841. '$ %PromiseProto_then%': typeof Promise === 'undefined' ? undefined : Promise.prototype.then,
  842. '$ %Promise_all%': typeof Promise === 'undefined' ? undefined : Promise.all,
  843. '$ %Promise_reject%': typeof Promise === 'undefined' ? undefined : Promise.reject,
  844. '$ %Promise_resolve%': typeof Promise === 'undefined' ? undefined : Promise.resolve,
  845. '$ %Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,
  846. '$ %RangeError%': RangeError,
  847. '$ %RangeErrorPrototype%': RangeError.prototype,
  848. '$ %ReferenceError%': ReferenceError,
  849. '$ %ReferenceErrorPrototype%': ReferenceError.prototype,
  850. '$ %Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,
  851. '$ %RegExp%': RegExp,
  852. '$ %RegExpPrototype%': RegExp.prototype,
  853. '$ %Set%': typeof Set === 'undefined' ? undefined : Set,
  854. '$ %SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),
  855. '$ %SetPrototype%': typeof Set === 'undefined' ? undefined : Set.prototype,
  856. '$ %SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,
  857. '$ %SharedArrayBufferPrototype%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer.prototype,
  858. '$ %String%': String,
  859. '$ %StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,
  860. '$ %StringPrototype%': String.prototype,
  861. '$ %Symbol%': hasSymbols ? Symbol : undefined,
  862. '$ %SymbolPrototype%': hasSymbols ? Symbol.prototype : undefined,
  863. '$ %SyntaxError%': SyntaxError,
  864. '$ %SyntaxErrorPrototype%': SyntaxError.prototype,
  865. '$ %ThrowTypeError%': ThrowTypeError,
  866. '$ %TypedArray%': TypedArray,
  867. '$ %TypedArrayPrototype%': TypedArray ? TypedArray.prototype : undefined,
  868. '$ %TypeError%': TypeError,
  869. '$ %TypeErrorPrototype%': TypeError.prototype,
  870. '$ %Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,
  871. '$ %Uint8ArrayPrototype%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array.prototype,
  872. '$ %Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,
  873. '$ %Uint8ClampedArrayPrototype%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray.prototype,
  874. '$ %Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,
  875. '$ %Uint16ArrayPrototype%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array.prototype,
  876. '$ %Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,
  877. '$ %Uint32ArrayPrototype%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array.prototype,
  878. '$ %URIError%': URIError,
  879. '$ %URIErrorPrototype%': URIError.prototype,
  880. '$ %WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,
  881. '$ %WeakMapPrototype%': typeof WeakMap === 'undefined' ? undefined : WeakMap.prototype,
  882. '$ %WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet,
  883. '$ %WeakSetPrototype%': typeof WeakSet === 'undefined' ? undefined : WeakSet.prototype
  884. };
  885. module.exports = function GetIntrinsic(name, allowMissing) {
  886. if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
  887. throw new TypeError('"allowMissing" argument must be a boolean');
  888. }
  889. var key = '$ ' + name;
  890. if (!(key in INTRINSICS)) {
  891. throw new SyntaxError('intrinsic ' + name + ' does not exist!');
  892. }
  893. // istanbul ignore if // hopefully this is impossible to test :-)
  894. if (typeof INTRINSICS[key] === 'undefined' && !allowMissing) {
  895. throw new TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
  896. }
  897. return INTRINSICS[key];
  898. };
  899. /***/ }),
  900. /* 11 */
  901. /***/ (function(module, exports) {
  902. module.exports = Number.isNaN || function isNaN(a) {
  903. return a !== a;
  904. };
  905. /***/ }),
  906. /* 12 */
  907. /***/ (function(module, exports) {
  908. var $isNaN = Number.isNaN || function (a) { return a !== a; };
  909. module.exports = Number.isFinite || function (x) { return typeof x === 'number' && !$isNaN(x) && x !== Infinity && x !== -Infinity; };
  910. /***/ }),
  911. /* 13 */
  912. /***/ (function(module, exports, __webpack_require__) {
  913. var bind = __webpack_require__(2);
  914. var has = bind.call(Function.call, Object.prototype.hasOwnProperty);
  915. var $assign = Object.assign;
  916. module.exports = function assign(target, source) {
  917. if ($assign) {
  918. return $assign(target, source);
  919. }
  920. for (var key in source) {
  921. if (has(source, key)) {
  922. target[key] = source[key];
  923. }
  924. }
  925. return target;
  926. };
  927. /***/ }),
  928. /* 14 */
  929. /***/ (function(module, exports) {
  930. module.exports = function sign(number) {
  931. return number >= 0 ? 1 : -1;
  932. };
  933. /***/ }),
  934. /* 15 */
  935. /***/ (function(module, exports) {
  936. module.exports = function mod(number, modulo) {
  937. var remain = number % modulo;
  938. return Math.floor(remain >= 0 ? remain : remain + modulo);
  939. };
  940. /***/ }),
  941. /* 16 */
  942. /***/ (function(module, exports, __webpack_require__) {
  943. "use strict";
  944. var implementation = __webpack_require__(8);
  945. module.exports = function getPolyfill() {
  946. return typeof Object.entries === 'function' ? Object.entries : implementation;
  947. };
  948. /***/ }),
  949. /* 17 */
  950. /***/ (function(module, exports, __webpack_require__) {
  951. "use strict";
  952. exports.__esModule = true;
  953. var config_1 = __webpack_require__(0);
  954. var common_1 = __webpack_require__(4);
  955. function printFullRow(row, drawRowHooks, drawCellHooks) {
  956. var remainingRowHeight = 0;
  957. var remainingTexts = {};
  958. var table = config_1.Config.tableInstance();
  959. if (!canFitOnPage(row.height)) {
  960. if (row.maxLineCount <= 1) {
  961. common_1.addPage();
  962. }
  963. else {
  964. // Modify the row to fit the current page and calculate text and height of partial row
  965. row.spansMultiplePages = true;
  966. var pageHeight = config_1.Config.pageSize().height;
  967. var maxCellHeight = 0;
  968. for (var j = 0; j < table.columns.length; j++) {
  969. var col = table.columns[j];
  970. var cell = row.cells[col.dataKey];
  971. var fontHeight = cell.styles.fontSize / config_1.Config.scaleFactor() * config_1.FONT_ROW_RATIO;
  972. var vPadding = cell.padding('vertical');
  973. var remainingPageSpace = pageHeight - table.cursor.y - table.margin('bottom');
  974. var remainingLineCount = Math.floor((remainingPageSpace - vPadding) / fontHeight);
  975. // Splice with negative values results in unexpected results, therefore eliminate
  976. // scenarios where less than one line is remaining, but are shown
  977. if (remainingLineCount < 0) {
  978. remainingLineCount = 0;
  979. }
  980. if (Array.isArray(cell.text) && cell.text.length > remainingLineCount) {
  981. var remainingLines = cell.text.splice(remainingLineCount, cell.text.length);
  982. remainingTexts[col.dataKey] = remainingLines;
  983. var cellHeight = cell.text.length * fontHeight + vPadding;
  984. if (cellHeight > maxCellHeight) {
  985. maxCellHeight = cellHeight;
  986. }
  987. var rCellHeight = remainingLines.length * fontHeight + vPadding;
  988. if (rCellHeight > remainingRowHeight) {
  989. remainingRowHeight = rCellHeight;
  990. }
  991. }
  992. }
  993. // Reset row height since text are now removed
  994. row.height = maxCellHeight;
  995. }
  996. }
  997. printRow(row, drawRowHooks, drawCellHooks);
  998. // Parts of the row is now printed. Time for adding a new page, prune
  999. // the text and start over
  1000. if (Object.keys(remainingTexts).length > 0) {
  1001. for (var j = 0; j < table.columns.length; j++) {
  1002. var col = table.columns[j];
  1003. var cell = row.cells[col.dataKey];
  1004. cell.text = remainingTexts[col.dataKey] || '';
  1005. }
  1006. common_1.addPage();
  1007. row.pageCount++;
  1008. row.height = remainingRowHeight;
  1009. printFullRow(row, drawRowHooks, drawCellHooks);
  1010. }
  1011. }
  1012. exports.printFullRow = printFullRow;
  1013. function printRow(row, drawRowHooks, drawCellHooks) {
  1014. var table = config_1.Config.tableInstance();
  1015. row.y = table.cursor.y;
  1016. for (var _i = 0, drawRowHooks_1 = drawRowHooks; _i < drawRowHooks_1.length; _i++) {
  1017. var hook = drawRowHooks_1[_i];
  1018. if (hook(row, config_1.Config.hooksData({ row: row, addPage: common_1.addPage })) === false) {
  1019. return;
  1020. }
  1021. }
  1022. table.cursor.x = table.margin('left');
  1023. for (var i = 0; i < table.columns.length; i++) {
  1024. var column = table.columns[i];
  1025. var cell = row.cells[column.dataKey];
  1026. if (!cell) {
  1027. continue;
  1028. }
  1029. config_1.Config.applyStyles(cell.styles);
  1030. cell.x = table.cursor.x;
  1031. cell.y = table.cursor.y;
  1032. cell.height = row.height;
  1033. cell.width = column.width;
  1034. if (cell.styles.valign === 'top') {
  1035. cell.textPos.y = table.cursor.y + cell.padding('top');
  1036. }
  1037. else if (cell.styles.valign === 'bottom') {
  1038. cell.textPos.y = table.cursor.y + row.height - cell.padding('bottom');
  1039. }
  1040. else {
  1041. cell.textPos.y = table.cursor.y + row.height / 2;
  1042. }
  1043. if (cell.styles.halign === 'right') {
  1044. cell.textPos.x = cell.x + cell.width - cell.padding('right');
  1045. }
  1046. else if (cell.styles.halign === 'center') {
  1047. cell.textPos.x = cell.x + cell.width / 2;
  1048. }
  1049. else {
  1050. cell.textPos.x = cell.x + cell.padding('left');
  1051. }
  1052. var shouldDrawCell = true;
  1053. var data = config_1.Config.hooksData({ column: column, row: row, addPage: common_1.addPage });
  1054. for (var _a = 0, drawCellHooks_1 = drawCellHooks; _a < drawCellHooks_1.length; _a++) {
  1055. var hook = drawCellHooks_1[_a];
  1056. if (hook(cell, data) === false) {
  1057. shouldDrawCell = false;
  1058. }
  1059. }
  1060. if (shouldDrawCell) {
  1061. var fillStyle = common_1.getFillStyle(cell.styles);
  1062. if (fillStyle) {
  1063. table.doc.rect(cell.x, cell.y, cell.width, cell.height, fillStyle);
  1064. }
  1065. table.doc.autoTableText(cell.text, cell.textPos.x, cell.textPos.y, {
  1066. halign: cell.styles.halign,
  1067. valign: cell.styles.valign
  1068. });
  1069. }
  1070. table.cursor.x += cell.width;
  1071. }
  1072. table.cursor.y += row.height;
  1073. }
  1074. exports.printRow = printRow;
  1075. function canFitOnPage(rowHeight) {
  1076. var table = config_1.Config.tableInstance();
  1077. var pos = rowHeight + table.cursor.y + table.margin('bottom');
  1078. return pos < config_1.Config.pageSize().height;
  1079. }
  1080. /***/ }),
  1081. /* 18 */
  1082. /***/ (function(module, exports, __webpack_require__) {
  1083. "use strict";
  1084. exports.__esModule = true;
  1085. var jsPDF = __webpack_require__(19);
  1086. var config_1 = __webpack_require__(0);
  1087. var common_1 = __webpack_require__(4);
  1088. var painter_1 = __webpack_require__(17);
  1089. var calculator_1 = __webpack_require__(36);
  1090. var creator_1 = __webpack_require__(37);
  1091. /**
  1092. * Create a table from a set of rows and columns.
  1093. *
  1094. * @param {Object[]|String[]} headers Either as an array of objects or array of strings
  1095. * @param {Object[][]|String[][]} data Either as an array of objects or array of strings
  1096. * @param {Object} [tableOptions={}] Options that will override the default ones
  1097. */
  1098. jsPDF.API.autoTable = function (headers, data, tableOptions) {
  1099. if (tableOptions === void 0) { tableOptions = {}; }
  1100. this.autoTableState = this.autoTableState || {};
  1101. jsPDF.autoTableState = jsPDF.autoTableState || {};
  1102. var allOptions = [jsPDF.autoTableState.defaults || {}, this.autoTableState.defaults || {}, tableOptions || {}];
  1103. creator_1.validateInput(headers, data, allOptions);
  1104. var table = config_1.Config.createTable(this);
  1105. config_1.Config.initSettings(table, allOptions);
  1106. var settings = table.settings;
  1107. // Create the table model with its columns, rows and cells
  1108. creator_1.createModels(headers, data);
  1109. settings.margin = config_1.Config.marginOrPadding(settings.margin, config_1.getDefaults().margin);
  1110. calculator_1.calculateWidths(this, config_1.Config.pageSize().width);
  1111. table.cursor = {
  1112. x: table.margin('left'),
  1113. y: settings.startY === false ? table.margin('top') : settings.startY
  1114. };
  1115. var minTableBottomPos = settings.startY + table.margin('bottom') + table.headerRow.height;
  1116. if (settings.pageBreak === 'avoid') {
  1117. minTableBottomPos += table.height;
  1118. }
  1119. var pageHeight = config_1.Config.pageSize().height;
  1120. if ((settings.pageBreak === 'always' && settings.startY !== false) ||
  1121. (settings.startY !== false && minTableBottomPos > pageHeight)) {
  1122. common_1.nextPage(table.doc);
  1123. table.cursor.y = table.margin('top');
  1124. }
  1125. table.pageStartX = table.cursor.x;
  1126. table.pageStartY = table.cursor.y;
  1127. config_1.Config.applyUserStyles();
  1128. if (settings.showHeader === true || settings.showHeader === 'firstPage' || settings.showHeader === 'everyPage') {
  1129. painter_1.printRow(table.headerRow, table.hooks.drawHeaderRow, table.hooks.drawHeaderCell);
  1130. }
  1131. config_1.Config.applyUserStyles();
  1132. table.rows.forEach(function (row) {
  1133. painter_1.printFullRow(row, table.hooks.drawRow, table.hooks.drawCell);
  1134. });
  1135. common_1.addTableBorder();
  1136. // Don't call global and document addPageContent more than once for each page
  1137. var pageNumber = this.internal.getCurrentPageInfo().pageNumber;
  1138. if (this.autoTableState.addPageHookPages && this.autoTableState.addPageHookPages[pageNumber]) {
  1139. if (typeof tableOptions['addPageContent'] === 'function') {
  1140. tableOptions['addPageContent'](config_1.Config.hooksData());
  1141. }
  1142. }
  1143. else {
  1144. if (!this.autoTableState.addPageHookPages)
  1145. this.autoTableState.addPageHookPages = {};
  1146. this.autoTableState.addPageHookPages[pageNumber] = true;
  1147. common_1.addContentHooks();
  1148. }
  1149. table.finalY = table.cursor.y;
  1150. this.autoTable.previous = table;
  1151. config_1.Config.applyUserStyles();
  1152. return this;
  1153. };
  1154. // Enables doc.autoTable.previous.finalY || 40;
  1155. jsPDF.API.autoTable.previous = false;
  1156. jsPDF.API.autoTableSetDefaults = function (defaults) {
  1157. if (!this.autoTableState)
  1158. this.autoTableState = {};
  1159. if (defaults && typeof defaults === 'object') {
  1160. this.autoTableState.defaults = defaults;
  1161. }
  1162. else {
  1163. delete this.autoTableState.defaults;
  1164. }
  1165. return this;
  1166. };
  1167. jsPDF.autoTableSetDefaults = function (defaults) {
  1168. if (!jsPDF.autoTableState)
  1169. jsPDF.autoTableState = {};
  1170. if (defaults && typeof defaults === 'object') {
  1171. this.autoTableState.defaults = defaults;
  1172. }
  1173. else {
  1174. delete this.autoTableState.defaults;
  1175. }
  1176. jsPDF.autoTableState.defaults = defaults;
  1177. };
  1178. /**
  1179. * Parses an html table
  1180. *
  1181. * @param tableElem Html table element
  1182. * @param includeHiddenElements If to include hidden rows and columns (defaults to false)
  1183. * @returns Object Object with two properties, columns and rows
  1184. */
  1185. jsPDF.API.autoTableHtmlToJson = function (tableElem, includeHiddenElements) {
  1186. includeHiddenElements = includeHiddenElements || false;
  1187. if (!tableElem || !(tableElem instanceof HTMLTableElement)) {
  1188. console.error("A HTMLTableElement has to be sent to autoTableHtmlToJson");
  1189. return null;
  1190. }
  1191. var columns = {}, rows = [];
  1192. var header = tableElem.rows[0];
  1193. for (var i = 0; i < header.cells.length; i++) {
  1194. var cell = header.cells[i];
  1195. var style = window.getComputedStyle(cell);
  1196. if (includeHiddenElements || style.display !== 'none') {
  1197. columns[i] = cell;
  1198. }
  1199. }
  1200. var _loop_1 = function (i) {
  1201. var tableRow = tableElem.rows[i];
  1202. var style = window.getComputedStyle(tableRow);
  1203. if (includeHiddenElements || style.display !== 'none') {
  1204. var rowData_1 = [];
  1205. Object.keys(columns).forEach(function (key) {
  1206. var cell = tableRow.cells[key];
  1207. rowData_1.push(cell);
  1208. });
  1209. rows.push(rowData_1);
  1210. }
  1211. };
  1212. for (var i = 1; i < tableElem.rows.length; i++) {
  1213. _loop_1(i);
  1214. }
  1215. var values = Object.keys(columns).map(function (key) { return columns[key]; });
  1216. return { columns: values, rows: rows, data: rows };
  1217. };
  1218. /**
  1219. * Improved text function with halign and valign support
  1220. * Inspiration from: http://stackoverflow.com/questions/28327510/align-text-right-using-jspdf/28433113#28433113
  1221. */
  1222. jsPDF.API.autoTableText = function (text, x, y, styles) {
  1223. if (typeof x !== 'number' || typeof y !== 'number') {
  1224. console.error('The x and y parameters are required. Missing for the text: ', text);
  1225. }
  1226. var k = this.internal.scaleFactor;
  1227. var fontSize = this.internal.getFontSize() / k;
  1228. var splitRegex = /\r\n|\r|\n/g;
  1229. var splitText = null;
  1230. var lineCount = 1;
  1231. if (styles.valign === 'middle' || styles.valign === 'bottom' || styles.halign === 'center' || styles.halign === 'right') {
  1232. splitText = typeof text === 'string' ? text.split(splitRegex) : text;
  1233. lineCount = splitText.length || 1;
  1234. }
  1235. // Align the top
  1236. y += fontSize * (2 - config_1.FONT_ROW_RATIO);
  1237. if (styles.valign === 'middle')
  1238. y -= (lineCount / 2) * fontSize * config_1.FONT_ROW_RATIO;
  1239. else if (styles.valign === 'bottom')
  1240. y -= lineCount * fontSize * config_1.FONT_ROW_RATIO;
  1241. if (styles.halign === 'center' || styles.halign === 'right') {
  1242. var alignSize = fontSize;
  1243. if (styles.halign === 'center')
  1244. alignSize *= 0.5;
  1245. if (lineCount >= 1) {
  1246. for (var iLine = 0; iLine < splitText.length; iLine++) {
  1247. this.text(splitText[iLine], x - this.getStringUnitWidth(splitText[iLine]) * alignSize, y);
  1248. y += fontSize;
  1249. }
  1250. return this;
  1251. }
  1252. x -= this.getStringUnitWidth(text) * alignSize;
  1253. }
  1254. this.text(text, x, y);
  1255. return this;
  1256. };
  1257. /**
  1258. * @deprecated Use doc.autoTable.previous.finalY instead
  1259. */
  1260. jsPDF.API.autoTableEndPosY = function () {
  1261. var prev = this.autoTable.previous;
  1262. if (prev.cursor && typeof prev.cursor.y === 'number') {
  1263. return prev.cursor.y;
  1264. }
  1265. else {
  1266. return 0;
  1267. }
  1268. };
  1269. /**
  1270. * @deprecated Use jsPDF.autoTableSetDefaults({addPageContent: function() {}}) instead
  1271. */
  1272. jsPDF.API.autoTableAddPageContent = function (hook) {
  1273. if (!jsPDF.API.autoTable.globalDefaults) {
  1274. jsPDF.API.autoTable.globalDefaults = {};
  1275. }
  1276. jsPDF.API.autoTable.globalDefaults.addPageContent = hook;
  1277. return this;
  1278. };
  1279. /**
  1280. * @deprecated Use data.addPage in hooks instead
  1281. */
  1282. jsPDF.API.autoTableAddPage = function () {
  1283. common_1.addPage();
  1284. return this;
  1285. };
  1286. /***/ }),
  1287. /* 19 */
  1288. /***/ (function(module, exports) {
  1289. module.exports = __WEBPACK_EXTERNAL_MODULE__19__;
  1290. /***/ }),
  1291. /* 20 */
  1292. /***/ (function(module, exports, __webpack_require__) {
  1293. "use strict";
  1294. var define = __webpack_require__(7);
  1295. var implementation = __webpack_require__(8);
  1296. var getPolyfill = __webpack_require__(16);
  1297. var shim = __webpack_require__(35);
  1298. var polyfill = getPolyfill();
  1299. define(polyfill, {
  1300. getPolyfill: getPolyfill,
  1301. implementation: implementation,
  1302. shim: shim
  1303. });
  1304. module.exports = polyfill;
  1305. /***/ }),
  1306. /* 21 */
  1307. /***/ (function(module, exports, __webpack_require__) {
  1308. "use strict";
  1309. // modified from https://github.com/es-shims/es5-shim
  1310. var has = Object.prototype.hasOwnProperty;
  1311. var toStr = Object.prototype.toString;
  1312. var slice = Array.prototype.slice;
  1313. var isArgs = __webpack_require__(22);
  1314. var isEnumerable = Object.prototype.propertyIsEnumerable;
  1315. var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
  1316. var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
  1317. var dontEnums = [
  1318. 'toString',
  1319. 'toLocaleString',
  1320. 'valueOf',
  1321. 'hasOwnProperty',
  1322. 'isPrototypeOf',
  1323. 'propertyIsEnumerable',
  1324. 'constructor'
  1325. ];
  1326. var equalsConstructorPrototype = function (o) {
  1327. var ctor = o.constructor;
  1328. return ctor && ctor.prototype === o;
  1329. };
  1330. var excludedKeys = {
  1331. $applicationCache: true,
  1332. $console: true,
  1333. $external: true,
  1334. $frame: true,
  1335. $frameElement: true,
  1336. $frames: true,
  1337. $innerHeight: true,
  1338. $innerWidth: true,
  1339. $outerHeight: true,
  1340. $outerWidth: true,
  1341. $pageXOffset: true,
  1342. $pageYOffset: true,
  1343. $parent: true,
  1344. $scrollLeft: true,
  1345. $scrollTop: true,
  1346. $scrollX: true,
  1347. $scrollY: true,
  1348. $self: true,
  1349. $webkitIndexedDB: true,
  1350. $webkitStorageInfo: true,
  1351. $window: true
  1352. };
  1353. var hasAutomationEqualityBug = (function () {
  1354. /* global window */
  1355. if (typeof window === 'undefined') { return false; }
  1356. for (var k in window) {
  1357. try {
  1358. if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
  1359. try {
  1360. equalsConstructorPrototype(window[k]);
  1361. } catch (e) {
  1362. return true;
  1363. }
  1364. }
  1365. } catch (e) {
  1366. return true;
  1367. }
  1368. }
  1369. return false;
  1370. }());
  1371. var equalsConstructorPrototypeIfNotBuggy = function (o) {
  1372. /* global window */
  1373. if (typeof window === 'undefined' || !hasAutomationEqualityBug) {
  1374. return equalsConstructorPrototype(o);
  1375. }
  1376. try {
  1377. return equalsConstructorPrototype(o);
  1378. } catch (e) {
  1379. return false;
  1380. }
  1381. };
  1382. var keysShim = function keys(object) {
  1383. var isObject = object !== null && typeof object === 'object';
  1384. var isFunction = toStr.call(object) === '[object Function]';
  1385. var isArguments = isArgs(object);
  1386. var isString = isObject && toStr.call(object) === '[object String]';
  1387. var theKeys = [];
  1388. if (!isObject && !isFunction && !isArguments) {
  1389. throw new TypeError('Object.keys called on a non-object');
  1390. }
  1391. var skipProto = hasProtoEnumBug && isFunction;
  1392. if (isString && object.length > 0 && !has.call(object, 0)) {
  1393. for (var i = 0; i < object.length; ++i) {
  1394. theKeys.push(String(i));
  1395. }
  1396. }
  1397. if (isArguments && object.length > 0) {
  1398. for (var j = 0; j < object.length; ++j) {
  1399. theKeys.push(String(j));
  1400. }
  1401. } else {
  1402. for (var name in object) {
  1403. if (!(skipProto && name === 'prototype') && has.call(object, name)) {
  1404. theKeys.push(String(name));
  1405. }
  1406. }
  1407. }
  1408. if (hasDontEnumBug) {
  1409. var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
  1410. for (var k = 0; k < dontEnums.length; ++k) {
  1411. if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
  1412. theKeys.push(dontEnums[k]);
  1413. }
  1414. }
  1415. }
  1416. return theKeys;
  1417. };
  1418. keysShim.shim = function shimObjectKeys() {
  1419. if (Object.keys) {
  1420. var keysWorksWithArguments = (function () {
  1421. // Safari 5.0 bug
  1422. return (Object.keys(arguments) || '').length === 2;
  1423. }(1, 2));
  1424. if (!keysWorksWithArguments) {
  1425. var originalKeys = Object.keys;
  1426. Object.keys = function keys(object) { // eslint-disable-line func-name-matching
  1427. if (isArgs(object)) {
  1428. return originalKeys(slice.call(object));
  1429. } else {
  1430. return originalKeys(object);
  1431. }
  1432. };
  1433. }
  1434. } else {
  1435. Object.keys = keysShim;
  1436. }
  1437. return Object.keys || keysShim;
  1438. };
  1439. module.exports = keysShim;
  1440. /***/ }),
  1441. /* 22 */
  1442. /***/ (function(module, exports, __webpack_require__) {
  1443. "use strict";
  1444. var toStr = Object.prototype.toString;
  1445. module.exports = function isArguments(value) {
  1446. var str = toStr.call(value);
  1447. var isArgs = str === '[object Arguments]';
  1448. if (!isArgs) {
  1449. isArgs = str !== '[object Array]' &&
  1450. value !== null &&
  1451. typeof value === 'object' &&
  1452. typeof value.length === 'number' &&
  1453. value.length >= 0 &&
  1454. toStr.call(value.callee) === '[object Function]';
  1455. }
  1456. return isArgs;
  1457. };
  1458. /***/ }),
  1459. /* 23 */
  1460. /***/ (function(module, exports) {
  1461. var hasOwn = Object.prototype.hasOwnProperty;
  1462. var toString = Object.prototype.toString;
  1463. module.exports = function forEach (obj, fn, ctx) {
  1464. if (toString.call(fn) !== '[object Function]') {
  1465. throw new TypeError('iterator must be a function');
  1466. }
  1467. var l = obj.length;
  1468. if (l === +l) {
  1469. for (var i = 0; i < l; i++) {
  1470. fn.call(ctx, obj[i], i, obj);
  1471. }
  1472. } else {
  1473. for (var k in obj) {
  1474. if (hasOwn.call(obj, k)) {
  1475. fn.call(ctx, obj[k], k, obj);
  1476. }
  1477. }
  1478. }
  1479. };
  1480. /***/ }),
  1481. /* 24 */
  1482. /***/ (function(module, exports, __webpack_require__) {
  1483. "use strict";
  1484. module.exports = __webpack_require__(25);
  1485. /***/ }),
  1486. /* 25 */
  1487. /***/ (function(module, exports, __webpack_require__) {
  1488. "use strict";
  1489. var ES2015 = __webpack_require__(26);
  1490. var assign = __webpack_require__(13);
  1491. var ES2016 = assign(assign({}, ES2015), {
  1492. // https://github.com/tc39/ecma262/pull/60
  1493. SameValueNonNumber: function SameValueNonNumber(x, y) {
  1494. if (typeof x === 'number' || typeof x !== typeof y) {
  1495. throw new TypeError('SameValueNonNumber requires two non-number values of the same type.');
  1496. }
  1497. return this.SameValue(x, y);
  1498. }
  1499. });
  1500. module.exports = ES2016;
  1501. /***/ }),
  1502. /* 26 */
  1503. /***/ (function(module, exports, __webpack_require__) {
  1504. "use strict";
  1505. var has = __webpack_require__(1);
  1506. var toPrimitive = __webpack_require__(28);
  1507. var GetIntrinsic = __webpack_require__(10);
  1508. var $TypeError = GetIntrinsic('%TypeError%');
  1509. var $SyntaxError = GetIntrinsic('%SyntaxError%');
  1510. var $Array = GetIntrinsic('%Array%');
  1511. var $String = GetIntrinsic('%String%');
  1512. var $Object = GetIntrinsic('%Object%');
  1513. var $Number = GetIntrinsic('%Number%');
  1514. var $Symbol = GetIntrinsic('%Symbol%', true);
  1515. var $RegExp = GetIntrinsic('%RegExp%');
  1516. var hasSymbols = !!$Symbol;
  1517. var $isNaN = __webpack_require__(11);
  1518. var $isFinite = __webpack_require__(12);
  1519. var MAX_SAFE_INTEGER = $Number.MAX_SAFE_INTEGER || Math.pow(2, 53) - 1;
  1520. var assign = __webpack_require__(13);
  1521. var sign = __webpack_require__(14);
  1522. var mod = __webpack_require__(15);
  1523. var isPrimitive = __webpack_require__(31);
  1524. var parseInteger = parseInt;
  1525. var bind = __webpack_require__(2);
  1526. var arraySlice = bind.call(Function.call, $Array.prototype.slice);
  1527. var strSlice = bind.call(Function.call, $String.prototype.slice);
  1528. var isBinary = bind.call(Function.call, $RegExp.prototype.test, /^0b[01]+$/i);
  1529. var isOctal = bind.call(Function.call, $RegExp.prototype.test, /^0o[0-7]+$/i);
  1530. var regexExec = bind.call(Function.call, $RegExp.prototype.exec);
  1531. var nonWS = ['\u0085', '\u200b', '\ufffe'].join('');
  1532. var nonWSregex = new $RegExp('[' + nonWS + ']', 'g');
  1533. var hasNonWS = bind.call(Function.call, $RegExp.prototype.test, nonWSregex);
  1534. var invalidHexLiteral = /^[-+]0x[0-9a-f]+$/i;
  1535. var isInvalidHexLiteral = bind.call(Function.call, $RegExp.prototype.test, invalidHexLiteral);
  1536. var $charCodeAt = bind.call(Function.call, $String.prototype.charCodeAt);
  1537. var toStr = bind.call(Function.call, Object.prototype.toString);
  1538. var $floor = Math.floor;
  1539. var $abs = Math.abs;
  1540. var $ObjectCreate = Object.create;
  1541. var $gOPD = $Object.getOwnPropertyDescriptor;
  1542. var $isExtensible = $Object.isExtensible;
  1543. // whitespace from: http://es5.github.io/#x15.5.4.20
  1544. // implementation from https://github.com/es-shims/es5-shim/blob/v3.4.0/es5-shim.js#L1304-L1324
  1545. var ws = [
  1546. '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003',
  1547. '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028',
  1548. '\u2029\uFEFF'
  1549. ].join('');
  1550. var trimRegex = new RegExp('(^[' + ws + ']+)|([' + ws + ']+$)', 'g');
  1551. var replace = bind.call(Function.call, $String.prototype.replace);
  1552. var trim = function (value) {
  1553. return replace(value, trimRegex, '');
  1554. };
  1555. var ES5 = __webpack_require__(32);
  1556. var hasRegExpMatcher = __webpack_require__(34);
  1557. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-abstract-operations
  1558. var ES6 = assign(assign({}, ES5), {
  1559. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-call-f-v-args
  1560. Call: function Call(F, V) {
  1561. var args = arguments.length > 2 ? arguments[2] : [];
  1562. if (!this.IsCallable(F)) {
  1563. throw new $TypeError(F + ' is not a function');
  1564. }
  1565. return F.apply(V, args);
  1566. },
  1567. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toprimitive
  1568. ToPrimitive: toPrimitive,
  1569. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toboolean
  1570. // ToBoolean: ES5.ToBoolean,
  1571. // https://ecma-international.org/ecma-262/6.0/#sec-tonumber
  1572. ToNumber: function ToNumber(argument) {
  1573. var value = isPrimitive(argument) ? argument : toPrimitive(argument, $Number);
  1574. if (typeof value === 'symbol') {
  1575. throw new $TypeError('Cannot convert a Symbol value to a number');
  1576. }
  1577. if (typeof value === 'string') {
  1578. if (isBinary(value)) {
  1579. return this.ToNumber(parseInteger(strSlice(value, 2), 2));
  1580. } else if (isOctal(value)) {
  1581. return this.ToNumber(parseInteger(strSlice(value, 2), 8));
  1582. } else if (hasNonWS(value) || isInvalidHexLiteral(value)) {
  1583. return NaN;
  1584. } else {
  1585. var trimmed = trim(value);
  1586. if (trimmed !== value) {
  1587. return this.ToNumber(trimmed);
  1588. }
  1589. }
  1590. }
  1591. return $Number(value);
  1592. },
  1593. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tointeger
  1594. // ToInteger: ES5.ToNumber,
  1595. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toint32
  1596. // ToInt32: ES5.ToInt32,
  1597. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint32
  1598. // ToUint32: ES5.ToUint32,
  1599. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toint16
  1600. ToInt16: function ToInt16(argument) {
  1601. var int16bit = this.ToUint16(argument);
  1602. return int16bit >= 0x8000 ? int16bit - 0x10000 : int16bit;
  1603. },
  1604. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint16
  1605. // ToUint16: ES5.ToUint16,
  1606. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toint8
  1607. ToInt8: function ToInt8(argument) {
  1608. var int8bit = this.ToUint8(argument);
  1609. return int8bit >= 0x80 ? int8bit - 0x100 : int8bit;
  1610. },
  1611. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint8
  1612. ToUint8: function ToUint8(argument) {
  1613. var number = this.ToNumber(argument);
  1614. if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; }
  1615. var posInt = sign(number) * $floor($abs(number));
  1616. return mod(posInt, 0x100);
  1617. },
  1618. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint8clamp
  1619. ToUint8Clamp: function ToUint8Clamp(argument) {
  1620. var number = this.ToNumber(argument);
  1621. if ($isNaN(number) || number <= 0) { return 0; }
  1622. if (number >= 0xFF) { return 0xFF; }
  1623. var f = $floor(argument);
  1624. if (f + 0.5 < number) { return f + 1; }
  1625. if (number < f + 0.5) { return f; }
  1626. if (f % 2 !== 0) { return f + 1; }
  1627. return f;
  1628. },
  1629. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tostring
  1630. ToString: function ToString(argument) {
  1631. if (typeof argument === 'symbol') {
  1632. throw new $TypeError('Cannot convert a Symbol value to a string');
  1633. }
  1634. return $String(argument);
  1635. },
  1636. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-toobject
  1637. ToObject: function ToObject(value) {
  1638. this.RequireObjectCoercible(value);
  1639. return $Object(value);
  1640. },
  1641. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-topropertykey
  1642. ToPropertyKey: function ToPropertyKey(argument) {
  1643. var key = this.ToPrimitive(argument, $String);
  1644. return typeof key === 'symbol' ? key : this.ToString(key);
  1645. },
  1646. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength
  1647. ToLength: function ToLength(argument) {
  1648. var len = this.ToInteger(argument);
  1649. if (len <= 0) { return 0; } // includes converting -0 to +0
  1650. if (len > MAX_SAFE_INTEGER) { return MAX_SAFE_INTEGER; }
  1651. return len;
  1652. },
  1653. // https://ecma-international.org/ecma-262/6.0/#sec-canonicalnumericindexstring
  1654. CanonicalNumericIndexString: function CanonicalNumericIndexString(argument) {
  1655. if (toStr(argument) !== '[object String]') {
  1656. throw new $TypeError('must be a string');
  1657. }
  1658. if (argument === '-0') { return -0; }
  1659. var n = this.ToNumber(argument);
  1660. if (this.SameValue(this.ToString(n), argument)) { return n; }
  1661. return void 0;
  1662. },
  1663. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-requireobjectcoercible
  1664. RequireObjectCoercible: ES5.CheckObjectCoercible,
  1665. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isarray
  1666. IsArray: $Array.isArray || function IsArray(argument) {
  1667. return toStr(argument) === '[object Array]';
  1668. },
  1669. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iscallable
  1670. // IsCallable: ES5.IsCallable,
  1671. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isconstructor
  1672. IsConstructor: function IsConstructor(argument) {
  1673. return typeof argument === 'function' && !!argument.prototype; // unfortunately there's no way to truly check this without try/catch `new argument`
  1674. },
  1675. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isextensible-o
  1676. IsExtensible: Object.preventExtensions
  1677. ? function IsExtensible(obj) {
  1678. if (isPrimitive(obj)) {
  1679. return false;
  1680. }
  1681. return $isExtensible(obj);
  1682. }
  1683. : function isExtensible(obj) { return true; }, // eslint-disable-line no-unused-vars
  1684. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-isinteger
  1685. IsInteger: function IsInteger(argument) {
  1686. if (typeof argument !== 'number' || $isNaN(argument) || !$isFinite(argument)) {
  1687. return false;
  1688. }
  1689. var abs = $abs(argument);
  1690. return $floor(abs) === abs;
  1691. },
  1692. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ispropertykey
  1693. IsPropertyKey: function IsPropertyKey(argument) {
  1694. return typeof argument === 'string' || typeof argument === 'symbol';
  1695. },
  1696. // https://ecma-international.org/ecma-262/6.0/#sec-isregexp
  1697. IsRegExp: function IsRegExp(argument) {
  1698. if (!argument || typeof argument !== 'object') {
  1699. return false;
  1700. }
  1701. if (hasSymbols) {
  1702. var isRegExp = argument[$Symbol.match];
  1703. if (typeof isRegExp !== 'undefined') {
  1704. return ES5.ToBoolean(isRegExp);
  1705. }
  1706. }
  1707. return hasRegExpMatcher(argument);
  1708. },
  1709. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevalue
  1710. // SameValue: ES5.SameValue,
  1711. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero
  1712. SameValueZero: function SameValueZero(x, y) {
  1713. return (x === y) || ($isNaN(x) && $isNaN(y));
  1714. },
  1715. /**
  1716. * 7.3.2 GetV (V, P)
  1717. * 1. Assert: IsPropertyKey(P) is true.
  1718. * 2. Let O be ToObject(V).
  1719. * 3. ReturnIfAbrupt(O).
  1720. * 4. Return O.[[Get]](P, V).
  1721. */
  1722. GetV: function GetV(V, P) {
  1723. // 7.3.2.1
  1724. if (!this.IsPropertyKey(P)) {
  1725. throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
  1726. }
  1727. // 7.3.2.2-3
  1728. var O = this.ToObject(V);
  1729. // 7.3.2.4
  1730. return O[P];
  1731. },
  1732. /**
  1733. * 7.3.9 - https://ecma-international.org/ecma-262/6.0/#sec-getmethod
  1734. * 1. Assert: IsPropertyKey(P) is true.
  1735. * 2. Let func be GetV(O, P).
  1736. * 3. ReturnIfAbrupt(func).
  1737. * 4. If func is either undefined or null, return undefined.
  1738. * 5. If IsCallable(func) is false, throw a TypeError exception.
  1739. * 6. Return func.
  1740. */
  1741. GetMethod: function GetMethod(O, P) {
  1742. // 7.3.9.1
  1743. if (!this.IsPropertyKey(P)) {
  1744. throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
  1745. }
  1746. // 7.3.9.2
  1747. var func = this.GetV(O, P);
  1748. // 7.3.9.4
  1749. if (func == null) {
  1750. return void 0;
  1751. }
  1752. // 7.3.9.5
  1753. if (!this.IsCallable(func)) {
  1754. throw new $TypeError(P + 'is not a function');
  1755. }
  1756. // 7.3.9.6
  1757. return func;
  1758. },
  1759. /**
  1760. * 7.3.1 Get (O, P) - https://ecma-international.org/ecma-262/6.0/#sec-get-o-p
  1761. * 1. Assert: Type(O) is Object.
  1762. * 2. Assert: IsPropertyKey(P) is true.
  1763. * 3. Return O.[[Get]](P, O).
  1764. */
  1765. Get: function Get(O, P) {
  1766. // 7.3.1.1
  1767. if (this.Type(O) !== 'Object') {
  1768. throw new $TypeError('Assertion failed: Type(O) is not Object');
  1769. }
  1770. // 7.3.1.2
  1771. if (!this.IsPropertyKey(P)) {
  1772. throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
  1773. }
  1774. // 7.3.1.3
  1775. return O[P];
  1776. },
  1777. Type: function Type(x) {
  1778. if (typeof x === 'symbol') {
  1779. return 'Symbol';
  1780. }
  1781. return ES5.Type(x);
  1782. },
  1783. // https://ecma-international.org/ecma-262/6.0/#sec-speciesconstructor
  1784. SpeciesConstructor: function SpeciesConstructor(O, defaultConstructor) {
  1785. if (this.Type(O) !== 'Object') {
  1786. throw new $TypeError('Assertion failed: Type(O) is not Object');
  1787. }
  1788. var C = O.constructor;
  1789. if (typeof C === 'undefined') {
  1790. return defaultConstructor;
  1791. }
  1792. if (this.Type(C) !== 'Object') {
  1793. throw new $TypeError('O.constructor is not an Object');
  1794. }
  1795. var S = hasSymbols && $Symbol.species ? C[$Symbol.species] : void 0;
  1796. if (S == null) {
  1797. return defaultConstructor;
  1798. }
  1799. if (this.IsConstructor(S)) {
  1800. return S;
  1801. }
  1802. throw new $TypeError('no constructor found');
  1803. },
  1804. // https://ecma-international.org/ecma-262/6.0/#sec-completepropertydescriptor
  1805. CompletePropertyDescriptor: function CompletePropertyDescriptor(Desc) {
  1806. if (!this.IsPropertyDescriptor(Desc)) {
  1807. throw new $TypeError('Desc must be a Property Descriptor');
  1808. }
  1809. if (this.IsGenericDescriptor(Desc) || this.IsDataDescriptor(Desc)) {
  1810. if (!has(Desc, '[[Value]]')) {
  1811. Desc['[[Value]]'] = void 0;
  1812. }
  1813. if (!has(Desc, '[[Writable]]')) {
  1814. Desc['[[Writable]]'] = false;
  1815. }
  1816. } else {
  1817. if (!has(Desc, '[[Get]]')) {
  1818. Desc['[[Get]]'] = void 0;
  1819. }
  1820. if (!has(Desc, '[[Set]]')) {
  1821. Desc['[[Set]]'] = void 0;
  1822. }
  1823. }
  1824. if (!has(Desc, '[[Enumerable]]')) {
  1825. Desc['[[Enumerable]]'] = false;
  1826. }
  1827. if (!has(Desc, '[[Configurable]]')) {
  1828. Desc['[[Configurable]]'] = false;
  1829. }
  1830. return Desc;
  1831. },
  1832. // https://ecma-international.org/ecma-262/6.0/#sec-set-o-p-v-throw
  1833. Set: function Set(O, P, V, Throw) {
  1834. if (this.Type(O) !== 'Object') {
  1835. throw new $TypeError('O must be an Object');
  1836. }
  1837. if (!this.IsPropertyKey(P)) {
  1838. throw new $TypeError('P must be a Property Key');
  1839. }
  1840. if (this.Type(Throw) !== 'Boolean') {
  1841. throw new $TypeError('Throw must be a Boolean');
  1842. }
  1843. if (Throw) {
  1844. O[P] = V;
  1845. return true;
  1846. } else {
  1847. try {
  1848. O[P] = V;
  1849. } catch (e) {
  1850. return false;
  1851. }
  1852. }
  1853. },
  1854. // https://ecma-international.org/ecma-262/6.0/#sec-hasownproperty
  1855. HasOwnProperty: function HasOwnProperty(O, P) {
  1856. if (this.Type(O) !== 'Object') {
  1857. throw new $TypeError('O must be an Object');
  1858. }
  1859. if (!this.IsPropertyKey(P)) {
  1860. throw new $TypeError('P must be a Property Key');
  1861. }
  1862. return has(O, P);
  1863. },
  1864. // https://ecma-international.org/ecma-262/6.0/#sec-hasproperty
  1865. HasProperty: function HasProperty(O, P) {
  1866. if (this.Type(O) !== 'Object') {
  1867. throw new $TypeError('O must be an Object');
  1868. }
  1869. if (!this.IsPropertyKey(P)) {
  1870. throw new $TypeError('P must be a Property Key');
  1871. }
  1872. return P in O;
  1873. },
  1874. // https://ecma-international.org/ecma-262/6.0/#sec-isconcatspreadable
  1875. IsConcatSpreadable: function IsConcatSpreadable(O) {
  1876. if (this.Type(O) !== 'Object') {
  1877. return false;
  1878. }
  1879. if (hasSymbols && typeof $Symbol.isConcatSpreadable === 'symbol') {
  1880. var spreadable = this.Get(O, Symbol.isConcatSpreadable);
  1881. if (typeof spreadable !== 'undefined') {
  1882. return this.ToBoolean(spreadable);
  1883. }
  1884. }
  1885. return this.IsArray(O);
  1886. },
  1887. // https://ecma-international.org/ecma-262/6.0/#sec-invoke
  1888. Invoke: function Invoke(O, P) {
  1889. if (!this.IsPropertyKey(P)) {
  1890. throw new $TypeError('P must be a Property Key');
  1891. }
  1892. var argumentsList = arraySlice(arguments, 2);
  1893. var func = this.GetV(O, P);
  1894. return this.Call(func, O, argumentsList);
  1895. },
  1896. // https://ecma-international.org/ecma-262/6.0/#sec-getiterator
  1897. GetIterator: function GetIterator(obj, method) {
  1898. if (!hasSymbols) {
  1899. throw new SyntaxError('ES.GetIterator depends on native iterator support.');
  1900. }
  1901. var actualMethod = method;
  1902. if (arguments.length < 2) {
  1903. actualMethod = this.GetMethod(obj, $Symbol.iterator);
  1904. }
  1905. var iterator = this.Call(actualMethod, obj);
  1906. if (this.Type(iterator) !== 'Object') {
  1907. throw new $TypeError('iterator must return an object');
  1908. }
  1909. return iterator;
  1910. },
  1911. // https://ecma-international.org/ecma-262/6.0/#sec-iteratornext
  1912. IteratorNext: function IteratorNext(iterator, value) {
  1913. var result = this.Invoke(iterator, 'next', arguments.length < 2 ? [] : [value]);
  1914. if (this.Type(result) !== 'Object') {
  1915. throw new $TypeError('iterator next must return an object');
  1916. }
  1917. return result;
  1918. },
  1919. // https://ecma-international.org/ecma-262/6.0/#sec-iteratorcomplete
  1920. IteratorComplete: function IteratorComplete(iterResult) {
  1921. if (this.Type(iterResult) !== 'Object') {
  1922. throw new $TypeError('Assertion failed: Type(iterResult) is not Object');
  1923. }
  1924. return this.ToBoolean(this.Get(iterResult, 'done'));
  1925. },
  1926. // https://ecma-international.org/ecma-262/6.0/#sec-iteratorvalue
  1927. IteratorValue: function IteratorValue(iterResult) {
  1928. if (this.Type(iterResult) !== 'Object') {
  1929. throw new $TypeError('Assertion failed: Type(iterResult) is not Object');
  1930. }
  1931. return this.Get(iterResult, 'value');
  1932. },
  1933. // https://ecma-international.org/ecma-262/6.0/#sec-iteratorstep
  1934. IteratorStep: function IteratorStep(iterator) {
  1935. var result = this.IteratorNext(iterator);
  1936. var done = this.IteratorComplete(result);
  1937. return done === true ? false : result;
  1938. },
  1939. // https://ecma-international.org/ecma-262/6.0/#sec-iteratorclose
  1940. IteratorClose: function IteratorClose(iterator, completion) {
  1941. if (this.Type(iterator) !== 'Object') {
  1942. throw new $TypeError('Assertion failed: Type(iterator) is not Object');
  1943. }
  1944. if (!this.IsCallable(completion)) {
  1945. throw new $TypeError('Assertion failed: completion is not a thunk for a Completion Record');
  1946. }
  1947. var completionThunk = completion;
  1948. var iteratorReturn = this.GetMethod(iterator, 'return');
  1949. if (typeof iteratorReturn === 'undefined') {
  1950. return completionThunk();
  1951. }
  1952. var completionRecord;
  1953. try {
  1954. var innerResult = this.Call(iteratorReturn, iterator, []);
  1955. } catch (e) {
  1956. // if we hit here, then "e" is the innerResult completion that needs re-throwing
  1957. // if the completion is of type "throw", this will throw.
  1958. completionRecord = completionThunk();
  1959. completionThunk = null; // ensure it's not called twice.
  1960. // if not, then return the innerResult completion
  1961. throw e;
  1962. }
  1963. completionRecord = completionThunk(); // if innerResult worked, then throw if the completion does
  1964. completionThunk = null; // ensure it's not called twice.
  1965. if (this.Type(innerResult) !== 'Object') {
  1966. throw new $TypeError('iterator .return must return an object');
  1967. }
  1968. return completionRecord;
  1969. },
  1970. // https://ecma-international.org/ecma-262/6.0/#sec-createiterresultobject
  1971. CreateIterResultObject: function CreateIterResultObject(value, done) {
  1972. if (this.Type(done) !== 'Boolean') {
  1973. throw new $TypeError('Assertion failed: Type(done) is not Boolean');
  1974. }
  1975. return {
  1976. value: value,
  1977. done: done
  1978. };
  1979. },
  1980. // https://ecma-international.org/ecma-262/6.0/#sec-regexpexec
  1981. RegExpExec: function RegExpExec(R, S) {
  1982. if (this.Type(R) !== 'Object') {
  1983. throw new $TypeError('R must be an Object');
  1984. }
  1985. if (this.Type(S) !== 'String') {
  1986. throw new $TypeError('S must be a String');
  1987. }
  1988. var exec = this.Get(R, 'exec');
  1989. if (this.IsCallable(exec)) {
  1990. var result = this.Call(exec, R, [S]);
  1991. if (result === null || this.Type(result) === 'Object') {
  1992. return result;
  1993. }
  1994. throw new $TypeError('"exec" method must return `null` or an Object');
  1995. }
  1996. return regexExec(R, S);
  1997. },
  1998. // https://ecma-international.org/ecma-262/6.0/#sec-arrayspeciescreate
  1999. ArraySpeciesCreate: function ArraySpeciesCreate(originalArray, length) {
  2000. if (!this.IsInteger(length) || length < 0) {
  2001. throw new $TypeError('Assertion failed: length must be an integer >= 0');
  2002. }
  2003. var len = length === 0 ? 0 : length;
  2004. var C;
  2005. var isArray = this.IsArray(originalArray);
  2006. if (isArray) {
  2007. C = this.Get(originalArray, 'constructor');
  2008. // TODO: figure out how to make a cross-realm normal Array, a same-realm Array
  2009. // if (this.IsConstructor(C)) {
  2010. // if C is another realm's Array, C = undefined
  2011. // Object.getPrototypeOf(Object.getPrototypeOf(Object.getPrototypeOf(Array))) === null ?
  2012. // }
  2013. if (this.Type(C) === 'Object' && hasSymbols && $Symbol.species) {
  2014. C = this.Get(C, $Symbol.species);
  2015. if (C === null) {
  2016. C = void 0;
  2017. }
  2018. }
  2019. }
  2020. if (typeof C === 'undefined') {
  2021. return $Array(len);
  2022. }
  2023. if (!this.IsConstructor(C)) {
  2024. throw new $TypeError('C must be a constructor');
  2025. }
  2026. return new C(len); // this.Construct(C, len);
  2027. },
  2028. CreateDataProperty: function CreateDataProperty(O, P, V) {
  2029. if (this.Type(O) !== 'Object') {
  2030. throw new $TypeError('Assertion failed: Type(O) is not Object');
  2031. }
  2032. if (!this.IsPropertyKey(P)) {
  2033. throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
  2034. }
  2035. var oldDesc = $gOPD(O, P);
  2036. var extensible = oldDesc || (typeof $isExtensible !== 'function' || $isExtensible(O));
  2037. var immutable = oldDesc && (!oldDesc.writable || !oldDesc.configurable);
  2038. if (immutable || !extensible) {
  2039. return false;
  2040. }
  2041. var newDesc = {
  2042. configurable: true,
  2043. enumerable: true,
  2044. value: V,
  2045. writable: true
  2046. };
  2047. Object.defineProperty(O, P, newDesc);
  2048. return true;
  2049. },
  2050. // https://ecma-international.org/ecma-262/6.0/#sec-createdatapropertyorthrow
  2051. CreateDataPropertyOrThrow: function CreateDataPropertyOrThrow(O, P, V) {
  2052. if (this.Type(O) !== 'Object') {
  2053. throw new $TypeError('Assertion failed: Type(O) is not Object');
  2054. }
  2055. if (!this.IsPropertyKey(P)) {
  2056. throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
  2057. }
  2058. var success = this.CreateDataProperty(O, P, V);
  2059. if (!success) {
  2060. throw new $TypeError('unable to create data property');
  2061. }
  2062. return success;
  2063. },
  2064. // https://www.ecma-international.org/ecma-262/6.0/#sec-objectcreate
  2065. ObjectCreate: function ObjectCreate(proto, internalSlotsList) {
  2066. if (proto !== null && this.Type(proto) !== 'Object') {
  2067. throw new $TypeError('Assertion failed: proto must be null or an object');
  2068. }
  2069. var slots = arguments.length < 2 ? [] : internalSlotsList;
  2070. if (slots.length > 0) {
  2071. throw new $SyntaxError('es-abstract does not yet support internal slots');
  2072. }
  2073. if (proto === null && !$ObjectCreate) {
  2074. throw new $SyntaxError('native Object.create support is required to create null objects');
  2075. }
  2076. return $ObjectCreate(proto);
  2077. },
  2078. // https://ecma-international.org/ecma-262/6.0/#sec-advancestringindex
  2079. AdvanceStringIndex: function AdvanceStringIndex(S, index, unicode) {
  2080. if (this.Type(S) !== 'String') {
  2081. throw new $TypeError('S must be a String');
  2082. }
  2083. if (!this.IsInteger(index) || index < 0 || index > MAX_SAFE_INTEGER) {
  2084. throw new $TypeError('Assertion failed: length must be an integer >= 0 and <= 2**53');
  2085. }
  2086. if (this.Type(unicode) !== 'Boolean') {
  2087. throw new $TypeError('Assertion failed: unicode must be a Boolean');
  2088. }
  2089. if (!unicode) {
  2090. return index + 1;
  2091. }
  2092. var length = S.length;
  2093. if ((index + 1) >= length) {
  2094. return index + 1;
  2095. }
  2096. var first = $charCodeAt(S, index);
  2097. if (first < 0xD800 || first > 0xDBFF) {
  2098. return index + 1;
  2099. }
  2100. var second = $charCodeAt(S, index + 1);
  2101. if (second < 0xDC00 || second > 0xDFFF) {
  2102. return index + 1;
  2103. }
  2104. return index + 2;
  2105. }
  2106. });
  2107. delete ES6.CheckObjectCoercible; // renamed in ES6 to RequireObjectCoercible
  2108. module.exports = ES6;
  2109. /***/ }),
  2110. /* 27 */
  2111. /***/ (function(module, exports, __webpack_require__) {
  2112. "use strict";
  2113. /* eslint no-invalid-this: 1 */
  2114. var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
  2115. var slice = Array.prototype.slice;
  2116. var toStr = Object.prototype.toString;
  2117. var funcType = '[object Function]';
  2118. module.exports = function bind(that) {
  2119. var target = this;
  2120. if (typeof target !== 'function' || toStr.call(target) !== funcType) {
  2121. throw new TypeError(ERROR_MESSAGE + target);
  2122. }
  2123. var args = slice.call(arguments, 1);
  2124. var bound;
  2125. var binder = function () {
  2126. if (this instanceof bound) {
  2127. var result = target.apply(
  2128. this,
  2129. args.concat(slice.call(arguments))
  2130. );
  2131. if (Object(result) === result) {
  2132. return result;
  2133. }
  2134. return this;
  2135. } else {
  2136. return target.apply(
  2137. that,
  2138. args.concat(slice.call(arguments))
  2139. );
  2140. }
  2141. };
  2142. var boundLength = Math.max(0, target.length - args.length);
  2143. var boundArgs = [];
  2144. for (var i = 0; i < boundLength; i++) {
  2145. boundArgs.push('$' + i);
  2146. }
  2147. bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
  2148. if (target.prototype) {
  2149. var Empty = function Empty() {};
  2150. Empty.prototype = target.prototype;
  2151. bound.prototype = new Empty();
  2152. Empty.prototype = null;
  2153. }
  2154. return bound;
  2155. };
  2156. /***/ }),
  2157. /* 28 */
  2158. /***/ (function(module, exports, __webpack_require__) {
  2159. "use strict";
  2160. var hasSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol';
  2161. var isPrimitive = __webpack_require__(9);
  2162. var isCallable = __webpack_require__(3);
  2163. var isDate = __webpack_require__(29);
  2164. var isSymbol = __webpack_require__(30);
  2165. var ordinaryToPrimitive = function OrdinaryToPrimitive(O, hint) {
  2166. if (typeof O === 'undefined' || O === null) {
  2167. throw new TypeError('Cannot call method on ' + O);
  2168. }
  2169. if (typeof hint !== 'string' || (hint !== 'number' && hint !== 'string')) {
  2170. throw new TypeError('hint must be "string" or "number"');
  2171. }
  2172. var methodNames = hint === 'string' ? ['toString', 'valueOf'] : ['valueOf', 'toString'];
  2173. var method, result, i;
  2174. for (i = 0; i < methodNames.length; ++i) {
  2175. method = O[methodNames[i]];
  2176. if (isCallable(method)) {
  2177. result = method.call(O);
  2178. if (isPrimitive(result)) {
  2179. return result;
  2180. }
  2181. }
  2182. }
  2183. throw new TypeError('No default value');
  2184. };
  2185. var GetMethod = function GetMethod(O, P) {
  2186. var func = O[P];
  2187. if (func !== null && typeof func !== 'undefined') {
  2188. if (!isCallable(func)) {
  2189. throw new TypeError(func + ' returned for property ' + P + ' of object ' + O + ' is not a function');
  2190. }
  2191. return func;
  2192. }
  2193. };
  2194. // http://www.ecma-international.org/ecma-262/6.0/#sec-toprimitive
  2195. module.exports = function ToPrimitive(input, PreferredType) {
  2196. if (isPrimitive(input)) {
  2197. return input;
  2198. }
  2199. var hint = 'default';
  2200. if (arguments.length > 1) {
  2201. if (PreferredType === String) {
  2202. hint = 'string';
  2203. } else if (PreferredType === Number) {
  2204. hint = 'number';
  2205. }
  2206. }
  2207. var exoticToPrim;
  2208. if (hasSymbols) {
  2209. if (Symbol.toPrimitive) {
  2210. exoticToPrim = GetMethod(input, Symbol.toPrimitive);
  2211. } else if (isSymbol(input)) {
  2212. exoticToPrim = Symbol.prototype.valueOf;
  2213. }
  2214. }
  2215. if (typeof exoticToPrim !== 'undefined') {
  2216. var result = exoticToPrim.call(input, hint);
  2217. if (isPrimitive(result)) {
  2218. return result;
  2219. }
  2220. throw new TypeError('unable to convert exotic object to primitive');
  2221. }
  2222. if (hint === 'default' && (isDate(input) || isSymbol(input))) {
  2223. hint = 'string';
  2224. }
  2225. return ordinaryToPrimitive(input, hint === 'default' ? 'number' : hint);
  2226. };
  2227. /***/ }),
  2228. /* 29 */
  2229. /***/ (function(module, exports, __webpack_require__) {
  2230. "use strict";
  2231. var getDay = Date.prototype.getDay;
  2232. var tryDateObject = function tryDateObject(value) {
  2233. try {
  2234. getDay.call(value);
  2235. return true;
  2236. } catch (e) {
  2237. return false;
  2238. }
  2239. };
  2240. var toStr = Object.prototype.toString;
  2241. var dateClass = '[object Date]';
  2242. var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
  2243. module.exports = function isDateObject(value) {
  2244. if (typeof value !== 'object' || value === null) { return false; }
  2245. return hasToStringTag ? tryDateObject(value) : toStr.call(value) === dateClass;
  2246. };
  2247. /***/ }),
  2248. /* 30 */
  2249. /***/ (function(module, exports, __webpack_require__) {
  2250. "use strict";
  2251. var toStr = Object.prototype.toString;
  2252. var hasSymbols = typeof Symbol === 'function' && typeof Symbol() === 'symbol';
  2253. if (hasSymbols) {
  2254. var symToStr = Symbol.prototype.toString;
  2255. var symStringRegex = /^Symbol\(.*\)$/;
  2256. var isSymbolObject = function isSymbolObject(value) {
  2257. if (typeof value.valueOf() !== 'symbol') { return false; }
  2258. return symStringRegex.test(symToStr.call(value));
  2259. };
  2260. module.exports = function isSymbol(value) {
  2261. if (typeof value === 'symbol') { return true; }
  2262. if (toStr.call(value) !== '[object Symbol]') { return false; }
  2263. try {
  2264. return isSymbolObject(value);
  2265. } catch (e) {
  2266. return false;
  2267. }
  2268. };
  2269. } else {
  2270. module.exports = function isSymbol(value) {
  2271. // this environment does not support Symbols.
  2272. return false;
  2273. };
  2274. }
  2275. /***/ }),
  2276. /* 31 */
  2277. /***/ (function(module, exports) {
  2278. module.exports = function isPrimitive(value) {
  2279. return value === null || (typeof value !== 'function' && typeof value !== 'object');
  2280. };
  2281. /***/ }),
  2282. /* 32 */
  2283. /***/ (function(module, exports, __webpack_require__) {
  2284. "use strict";
  2285. var GetIntrinsic = __webpack_require__(10);
  2286. var $Object = GetIntrinsic('%Object%');
  2287. var $TypeError = GetIntrinsic('%TypeError%');
  2288. var $String = GetIntrinsic('%String%');
  2289. var $isNaN = __webpack_require__(11);
  2290. var $isFinite = __webpack_require__(12);
  2291. var sign = __webpack_require__(14);
  2292. var mod = __webpack_require__(15);
  2293. var IsCallable = __webpack_require__(3);
  2294. var toPrimitive = __webpack_require__(33);
  2295. var has = __webpack_require__(1);
  2296. // https://es5.github.io/#x9
  2297. var ES5 = {
  2298. ToPrimitive: toPrimitive,
  2299. ToBoolean: function ToBoolean(value) {
  2300. return !!value;
  2301. },
  2302. ToNumber: function ToNumber(value) {
  2303. return +value; // eslint-disable-line no-implicit-coercion
  2304. },
  2305. ToInteger: function ToInteger(value) {
  2306. var number = this.ToNumber(value);
  2307. if ($isNaN(number)) { return 0; }
  2308. if (number === 0 || !$isFinite(number)) { return number; }
  2309. return sign(number) * Math.floor(Math.abs(number));
  2310. },
  2311. ToInt32: function ToInt32(x) {
  2312. return this.ToNumber(x) >> 0;
  2313. },
  2314. ToUint32: function ToUint32(x) {
  2315. return this.ToNumber(x) >>> 0;
  2316. },
  2317. ToUint16: function ToUint16(value) {
  2318. var number = this.ToNumber(value);
  2319. if ($isNaN(number) || number === 0 || !$isFinite(number)) { return 0; }
  2320. var posInt = sign(number) * Math.floor(Math.abs(number));
  2321. return mod(posInt, 0x10000);
  2322. },
  2323. ToString: function ToString(value) {
  2324. return $String(value);
  2325. },
  2326. ToObject: function ToObject(value) {
  2327. this.CheckObjectCoercible(value);
  2328. return $Object(value);
  2329. },
  2330. CheckObjectCoercible: function CheckObjectCoercible(value, optMessage) {
  2331. /* jshint eqnull:true */
  2332. if (value == null) {
  2333. throw new $TypeError(optMessage || 'Cannot call method on ' + value);
  2334. }
  2335. return value;
  2336. },
  2337. IsCallable: IsCallable,
  2338. SameValue: function SameValue(x, y) {
  2339. if (x === y) { // 0 === -0, but they are not identical.
  2340. if (x === 0) { return 1 / x === 1 / y; }
  2341. return true;
  2342. }
  2343. return $isNaN(x) && $isNaN(y);
  2344. },
  2345. // https://www.ecma-international.org/ecma-262/5.1/#sec-8
  2346. Type: function Type(x) {
  2347. if (x === null) {
  2348. return 'Null';
  2349. }
  2350. if (typeof x === 'undefined') {
  2351. return 'Undefined';
  2352. }
  2353. if (typeof x === 'function' || typeof x === 'object') {
  2354. return 'Object';
  2355. }
  2356. if (typeof x === 'number') {
  2357. return 'Number';
  2358. }
  2359. if (typeof x === 'boolean') {
  2360. return 'Boolean';
  2361. }
  2362. if (typeof x === 'string') {
  2363. return 'String';
  2364. }
  2365. },
  2366. // https://ecma-international.org/ecma-262/6.0/#sec-property-descriptor-specification-type
  2367. IsPropertyDescriptor: function IsPropertyDescriptor(Desc) {
  2368. if (this.Type(Desc) !== 'Object') {
  2369. return false;
  2370. }
  2371. var allowed = {
  2372. '[[Configurable]]': true,
  2373. '[[Enumerable]]': true,
  2374. '[[Get]]': true,
  2375. '[[Set]]': true,
  2376. '[[Value]]': true,
  2377. '[[Writable]]': true
  2378. };
  2379. // jscs:disable
  2380. for (var key in Desc) { // eslint-disable-line
  2381. if (has(Desc, key) && !allowed[key]) {
  2382. return false;
  2383. }
  2384. }
  2385. // jscs:enable
  2386. var isData = has(Desc, '[[Value]]');
  2387. var IsAccessor = has(Desc, '[[Get]]') || has(Desc, '[[Set]]');
  2388. if (isData && IsAccessor) {
  2389. throw new $TypeError('Property Descriptors may not be both accessor and data descriptors');
  2390. }
  2391. return true;
  2392. },
  2393. // https://ecma-international.org/ecma-262/5.1/#sec-8.10.1
  2394. IsAccessorDescriptor: function IsAccessorDescriptor(Desc) {
  2395. if (typeof Desc === 'undefined') {
  2396. return false;
  2397. }
  2398. if (!this.IsPropertyDescriptor(Desc)) {
  2399. throw new $TypeError('Desc must be a Property Descriptor');
  2400. }
  2401. if (!has(Desc, '[[Get]]') && !has(Desc, '[[Set]]')) {
  2402. return false;
  2403. }
  2404. return true;
  2405. },
  2406. // https://ecma-international.org/ecma-262/5.1/#sec-8.10.2
  2407. IsDataDescriptor: function IsDataDescriptor(Desc) {
  2408. if (typeof Desc === 'undefined') {
  2409. return false;
  2410. }
  2411. if (!this.IsPropertyDescriptor(Desc)) {
  2412. throw new $TypeError('Desc must be a Property Descriptor');
  2413. }
  2414. if (!has(Desc, '[[Value]]') && !has(Desc, '[[Writable]]')) {
  2415. return false;
  2416. }
  2417. return true;
  2418. },
  2419. // https://ecma-international.org/ecma-262/5.1/#sec-8.10.3
  2420. IsGenericDescriptor: function IsGenericDescriptor(Desc) {
  2421. if (typeof Desc === 'undefined') {
  2422. return false;
  2423. }
  2424. if (!this.IsPropertyDescriptor(Desc)) {
  2425. throw new $TypeError('Desc must be a Property Descriptor');
  2426. }
  2427. if (!this.IsAccessorDescriptor(Desc) && !this.IsDataDescriptor(Desc)) {
  2428. return true;
  2429. }
  2430. return false;
  2431. },
  2432. // https://ecma-international.org/ecma-262/5.1/#sec-8.10.4
  2433. FromPropertyDescriptor: function FromPropertyDescriptor(Desc) {
  2434. if (typeof Desc === 'undefined') {
  2435. return Desc;
  2436. }
  2437. if (!this.IsPropertyDescriptor(Desc)) {
  2438. throw new $TypeError('Desc must be a Property Descriptor');
  2439. }
  2440. if (this.IsDataDescriptor(Desc)) {
  2441. return {
  2442. value: Desc['[[Value]]'],
  2443. writable: !!Desc['[[Writable]]'],
  2444. enumerable: !!Desc['[[Enumerable]]'],
  2445. configurable: !!Desc['[[Configurable]]']
  2446. };
  2447. } else if (this.IsAccessorDescriptor(Desc)) {
  2448. return {
  2449. get: Desc['[[Get]]'],
  2450. set: Desc['[[Set]]'],
  2451. enumerable: !!Desc['[[Enumerable]]'],
  2452. configurable: !!Desc['[[Configurable]]']
  2453. };
  2454. } else {
  2455. throw new $TypeError('FromPropertyDescriptor must be called with a fully populated Property Descriptor');
  2456. }
  2457. },
  2458. // https://ecma-international.org/ecma-262/5.1/#sec-8.10.5
  2459. ToPropertyDescriptor: function ToPropertyDescriptor(Obj) {
  2460. if (this.Type(Obj) !== 'Object') {
  2461. throw new $TypeError('ToPropertyDescriptor requires an object');
  2462. }
  2463. var desc = {};
  2464. if (has(Obj, 'enumerable')) {
  2465. desc['[[Enumerable]]'] = this.ToBoolean(Obj.enumerable);
  2466. }
  2467. if (has(Obj, 'configurable')) {
  2468. desc['[[Configurable]]'] = this.ToBoolean(Obj.configurable);
  2469. }
  2470. if (has(Obj, 'value')) {
  2471. desc['[[Value]]'] = Obj.value;
  2472. }
  2473. if (has(Obj, 'writable')) {
  2474. desc['[[Writable]]'] = this.ToBoolean(Obj.writable);
  2475. }
  2476. if (has(Obj, 'get')) {
  2477. var getter = Obj.get;
  2478. if (typeof getter !== 'undefined' && !this.IsCallable(getter)) {
  2479. throw new TypeError('getter must be a function');
  2480. }
  2481. desc['[[Get]]'] = getter;
  2482. }
  2483. if (has(Obj, 'set')) {
  2484. var setter = Obj.set;
  2485. if (typeof setter !== 'undefined' && !this.IsCallable(setter)) {
  2486. throw new $TypeError('setter must be a function');
  2487. }
  2488. desc['[[Set]]'] = setter;
  2489. }
  2490. if ((has(desc, '[[Get]]') || has(desc, '[[Set]]')) && (has(desc, '[[Value]]') || has(desc, '[[Writable]]'))) {
  2491. throw new $TypeError('Invalid property descriptor. Cannot both specify accessors and a value or writable attribute');
  2492. }
  2493. return desc;
  2494. }
  2495. };
  2496. module.exports = ES5;
  2497. /***/ }),
  2498. /* 33 */
  2499. /***/ (function(module, exports, __webpack_require__) {
  2500. "use strict";
  2501. var toStr = Object.prototype.toString;
  2502. var isPrimitive = __webpack_require__(9);
  2503. var isCallable = __webpack_require__(3);
  2504. // https://es5.github.io/#x8.12
  2505. var ES5internalSlots = {
  2506. '[[DefaultValue]]': function (O, hint) {
  2507. var actualHint = hint || (toStr.call(O) === '[object Date]' ? String : Number);
  2508. if (actualHint === String || actualHint === Number) {
  2509. var methods = actualHint === String ? ['toString', 'valueOf'] : ['valueOf', 'toString'];
  2510. var value, i;
  2511. for (i = 0; i < methods.length; ++i) {
  2512. if (isCallable(O[methods[i]])) {
  2513. value = O[methods[i]]();
  2514. if (isPrimitive(value)) {
  2515. return value;
  2516. }
  2517. }
  2518. }
  2519. throw new TypeError('No default value');
  2520. }
  2521. throw new TypeError('invalid [[DefaultValue]] hint supplied');
  2522. }
  2523. };
  2524. // https://es5.github.io/#x9
  2525. module.exports = function ToPrimitive(input, PreferredType) {
  2526. if (isPrimitive(input)) {
  2527. return input;
  2528. }
  2529. return ES5internalSlots['[[DefaultValue]]'](input, PreferredType);
  2530. };
  2531. /***/ }),
  2532. /* 34 */
  2533. /***/ (function(module, exports, __webpack_require__) {
  2534. "use strict";
  2535. var has = __webpack_require__(1);
  2536. var regexExec = RegExp.prototype.exec;
  2537. var gOPD = Object.getOwnPropertyDescriptor;
  2538. var tryRegexExecCall = function tryRegexExec(value) {
  2539. try {
  2540. var lastIndex = value.lastIndex;
  2541. value.lastIndex = 0;
  2542. regexExec.call(value);
  2543. return true;
  2544. } catch (e) {
  2545. return false;
  2546. } finally {
  2547. value.lastIndex = lastIndex;
  2548. }
  2549. };
  2550. var toStr = Object.prototype.toString;
  2551. var regexClass = '[object RegExp]';
  2552. var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
  2553. module.exports = function isRegex(value) {
  2554. if (!value || typeof value !== 'object') {
  2555. return false;
  2556. }
  2557. if (!hasToStringTag) {
  2558. return toStr.call(value) === regexClass;
  2559. }
  2560. var descriptor = gOPD(value, 'lastIndex');
  2561. var hasLastIndexDataProperty = descriptor && has(descriptor, 'value');
  2562. if (!hasLastIndexDataProperty) {
  2563. return false;
  2564. }
  2565. return tryRegexExecCall(value);
  2566. };
  2567. /***/ }),
  2568. /* 35 */
  2569. /***/ (function(module, exports, __webpack_require__) {
  2570. "use strict";
  2571. var getPolyfill = __webpack_require__(16);
  2572. var define = __webpack_require__(7);
  2573. module.exports = function shimEntries() {
  2574. var polyfill = getPolyfill();
  2575. define(Object, { entries: polyfill }, {
  2576. entries: function testEntries() {
  2577. return Object.entries !== polyfill;
  2578. }
  2579. });
  2580. return polyfill;
  2581. };
  2582. /***/ }),
  2583. /* 36 */
  2584. /***/ (function(module, exports, __webpack_require__) {
  2585. "use strict";
  2586. exports.__esModule = true;
  2587. var config_1 = __webpack_require__(0);
  2588. var common_1 = __webpack_require__(4);
  2589. /**
  2590. * Calculate the column widths
  2591. */
  2592. function calculateWidths(doc, pageWidth) {
  2593. var table = config_1.Config.tableInstance();
  2594. // Column and table content width
  2595. var fixedWidth = 0;
  2596. var autoWidth = 0;
  2597. var dynamicColumns = [];
  2598. table.columns.forEach(function (column) {
  2599. column.contentWidth = 0;
  2600. table.rows.concat(table.headerRow).forEach(function (row) {
  2601. var cell = row.cells[column.dataKey];
  2602. cell.contentWidth = cell.padding('horizontal') + common_1.getStringWidth(cell.text, cell.styles);
  2603. if (cell.contentWidth > column.contentWidth) {
  2604. column.contentWidth = cell.contentWidth;
  2605. }
  2606. });
  2607. table.contentWidth += column.contentWidth;
  2608. if (typeof column.widthStyle === 'number') {
  2609. column.preferredWidth = column.widthStyle;
  2610. fixedWidth += column.preferredWidth;
  2611. column.width = column.preferredWidth;
  2612. }
  2613. else if (column.widthStyle === 'wrap') {
  2614. column.preferredWidth = column.contentWidth;
  2615. fixedWidth += column.preferredWidth;
  2616. column.width = column.preferredWidth;
  2617. }
  2618. else {
  2619. column.preferredWidth = column.contentWidth;
  2620. autoWidth += column.contentWidth;
  2621. dynamicColumns.push(column);
  2622. }
  2623. table.preferredWidth += column.preferredWidth;
  2624. });
  2625. if (typeof table.settings.tableWidth === 'number') {
  2626. table.width = table.settings.tableWidth;
  2627. }
  2628. else if (table.settings.tableWidth === 'wrap') {
  2629. table.width = table.preferredWidth;
  2630. }
  2631. else {
  2632. table.width = pageWidth - table.margin('left') - table.margin('right');
  2633. }
  2634. distributeWidth(dynamicColumns, fixedWidth, autoWidth, 0);
  2635. // Row height, table height and text overflow
  2636. var all = table.rows.concat(table.headerRow);
  2637. all.forEach(function (row) {
  2638. table.columns.forEach(function (col) {
  2639. var cell = row.cells[col.dataKey];
  2640. config_1.Config.applyStyles(cell.styles);
  2641. var textSpace = col.width - cell.padding('horizontal');
  2642. var k = config_1.Config.scaleFactor();
  2643. if (cell.styles.overflow === 'linebreak') {
  2644. // Add one pt to textSpace to fix rounding error
  2645. try {
  2646. cell.text = doc.splitTextToSize(cell.text, textSpace + 1 / k, { fontSize: cell.styles.fontSize });
  2647. }
  2648. catch (e) {
  2649. if (e instanceof TypeError && Array.isArray(cell.text)) {
  2650. cell.text = doc.splitTextToSize(cell.text.join(' '), textSpace + 1 / k, { fontSize: cell.styles.fontSize });
  2651. }
  2652. else {
  2653. throw e;
  2654. }
  2655. }
  2656. }
  2657. else if (cell.styles.overflow === 'ellipsize') {
  2658. cell.text = common_1.ellipsize(cell.text, textSpace, cell.styles);
  2659. }
  2660. else if (cell.styles.overflow === 'visible') {
  2661. // Do nothing
  2662. }
  2663. else if (cell.styles.overflow === 'hidden') {
  2664. cell.text = common_1.ellipsize(cell.text, textSpace, cell.styles, '');
  2665. }
  2666. else if (typeof cell.styles.overflow === 'function') {
  2667. cell.text = cell.styles.overflow(cell.text, textSpace);
  2668. }
  2669. else {
  2670. console.error("Unrecognized overflow type: " + cell.styles.overflow);
  2671. }
  2672. var lineCount = Array.isArray(cell.text) ? cell.text.length : 1;
  2673. var fontHeight = cell.styles.fontSize / k * config_1.FONT_ROW_RATIO;
  2674. cell.contentHeight = lineCount * fontHeight + cell.padding('vertical');
  2675. if (cell.contentHeight > row.height) {
  2676. row.height = cell.contentHeight;
  2677. row.maxLineCount = lineCount;
  2678. }
  2679. });
  2680. table.height += row.height;
  2681. });
  2682. }
  2683. exports.calculateWidths = calculateWidths;
  2684. function distributeWidth(dynamicColumns, staticWidth, dynamicColumnsContentWidth, fairWidth) {
  2685. var table = config_1.Config.tableInstance();
  2686. var extraWidth = table.width - staticWidth - dynamicColumnsContentWidth;
  2687. for (var i = 0; i < dynamicColumns.length; i++) {
  2688. var col = dynamicColumns[i];
  2689. var ratio = col.contentWidth / dynamicColumnsContentWidth;
  2690. // A column turned out to be none dynamic, start over recursively
  2691. var isNoneDynamic = col.contentWidth + extraWidth * ratio < fairWidth;
  2692. if (extraWidth < 0 && isNoneDynamic) {
  2693. dynamicColumns.splice(i, 1);
  2694. dynamicColumnsContentWidth -= col.contentWidth;
  2695. col.width = fairWidth;
  2696. staticWidth += col.width;
  2697. distributeWidth(dynamicColumns, staticWidth, dynamicColumnsContentWidth, fairWidth);
  2698. break;
  2699. }
  2700. else {
  2701. col.width = col.contentWidth + extraWidth * ratio;
  2702. }
  2703. }
  2704. }
  2705. /***/ }),
  2706. /* 37 */
  2707. /***/ (function(module, exports, __webpack_require__) {
  2708. "use strict";
  2709. exports.__esModule = true;
  2710. var models_1 = __webpack_require__(5);
  2711. var config_1 = __webpack_require__(0);
  2712. var assign = __webpack_require__(6);
  2713. function validateInput(headers, data, allOptions) {
  2714. if (!headers || typeof headers !== 'object') {
  2715. console.error("The headers should be an object or array, is: " + typeof headers);
  2716. }
  2717. if (!data || typeof data !== 'object') {
  2718. console.error("The data should be an object or array, is: " + typeof data);
  2719. }
  2720. var _loop_1 = function (settings) {
  2721. if (settings && typeof settings !== 'object') {
  2722. console.error("The options parameter should be of type object, is: " + typeof settings);
  2723. }
  2724. if (typeof settings.extendWidth !== 'undefined') {
  2725. settings.tableWidth = settings.extendWidth ? 'auto' : 'wrap';
  2726. console.error("Use of deprecated option: extendWidth, use tableWidth instead.");
  2727. }
  2728. if (typeof settings.margins !== 'undefined') {
  2729. if (typeof settings.margin === 'undefined')
  2730. settings.margin = settings.margins;
  2731. console.error("Use of deprecated option: margins, use margin instead.");
  2732. }
  2733. if (typeof settings.afterPageContent !== 'undefined' || typeof settings.beforePageContent !== 'undefined' || typeof settings.afterPageAdd !== 'undefined') {
  2734. console.error("The afterPageContent, beforePageContent and afterPageAdd hooks are deprecated. Use addPageContent instead");
  2735. if (typeof settings.addPageContent === 'undefined') {
  2736. settings.addPageContent = function (data) {
  2737. config_1.Config.applyUserStyles();
  2738. if (settings.beforePageContent)
  2739. settings.beforePageContent(data);
  2740. config_1.Config.applyUserStyles();
  2741. if (settings.afterPageContent)
  2742. settings.afterPageContent(data);
  2743. config_1.Config.applyUserStyles();
  2744. if (settings.afterPageAdd && data.pageCount > 1) {
  2745. data.afterPageAdd(data);
  2746. }
  2747. config_1.Config.applyUserStyles();
  2748. };
  2749. }
  2750. }
  2751. [['padding', 'cellPadding'], ['lineHeight', 'rowHeight'], 'fontSize', 'overflow'].forEach(function (o) {
  2752. var deprecatedOption = typeof o === 'string' ? o : o[0];
  2753. var style = typeof o === 'string' ? o : o[1];
  2754. if (typeof settings[deprecatedOption] !== 'undefined') {
  2755. if (typeof settings.styles[style] === 'undefined') {
  2756. settings.styles[style] = settings[deprecatedOption];
  2757. }
  2758. console.error("Use of deprecated option: " + deprecatedOption + ", use the style " + style + " instead.");
  2759. }
  2760. });
  2761. for (var _i = 0, _a = ['styles', 'bodyStyles', 'headerStyles', 'columnStyles']; _i < _a.length; _i++) {
  2762. var styleProp = _a[_i];
  2763. if (settings[styleProp] && typeof settings[styleProp] !== 'object') {
  2764. console.error("The " + styleProp + " style should be of type object, is: " + typeof settings[styleProp]);
  2765. }
  2766. else if (settings[styleProp] && settings[styleProp].rowHeight) {
  2767. console.error("Use of deprecated style: rowHeight, use vertical cell padding instead");
  2768. }
  2769. }
  2770. };
  2771. for (var _i = 0, allOptions_1 = allOptions; _i < allOptions_1.length; _i++) {
  2772. var settings = allOptions_1[_i];
  2773. _loop_1(settings);
  2774. }
  2775. }
  2776. exports.validateInput = validateInput;
  2777. /**
  2778. * Create models from the user input
  2779. *
  2780. * @param inputHeaders
  2781. * @param inputData
  2782. */
  2783. function createModels(inputHeaders, inputData) {
  2784. var splitRegex = /\r\n|\r|\n/g;
  2785. var table = config_1.Config.tableInstance();
  2786. var settings = table.settings;
  2787. var theme = config_1.getTheme(settings.theme);
  2788. // Header row and columns
  2789. var headerRow = new models_1.Row(inputHeaders, -1);
  2790. headerRow.index = -1;
  2791. // Columns and header row
  2792. inputHeaders.forEach(function (rawColumn, index) {
  2793. var dataKey = index;
  2794. if (typeof rawColumn.dataKey !== 'undefined') {
  2795. dataKey = rawColumn.dataKey;
  2796. }
  2797. else if (typeof rawColumn.key !== 'undefined') {
  2798. console.error("Deprecation warning: Use dataKey instead of key");
  2799. dataKey = rawColumn.key; // deprecated since 2.x
  2800. }
  2801. var col = new models_1.Column(dataKey, index);
  2802. col.raw = rawColumn;
  2803. col.widthStyle = config_1.Config.styles([theme.table, theme.header, table.styles.styles, table.styles.columnStyles[col.dataKey] || {}]).columnWidth;
  2804. table.columns.push(col);
  2805. var cell = new models_1.Cell(rawColumn);
  2806. cell.styles = config_1.Config.styles([theme.table, theme.header, table.styles.styles, table.styles.headerStyles]);
  2807. if (cell.raw instanceof HTMLElement) {
  2808. cell.text = (cell.raw.innerText || '').trim();
  2809. }
  2810. else {
  2811. var text = typeof cell.raw === 'object' ? cell.raw.title : cell.raw;
  2812. // Stringify 0 and false, but not undefined
  2813. cell.text = typeof cell.raw !== 'undefined' ? '' + text : '';
  2814. }
  2815. cell.text = cell.text.split(splitRegex);
  2816. headerRow.cells[dataKey] = cell;
  2817. for (var _i = 0, _a = table.hooks.createdHeaderCell; _i < _a.length; _i++) {
  2818. var hook = _a[_i];
  2819. hook(cell, { cell: cell, column: col, row: headerRow, settings: settings });
  2820. }
  2821. });
  2822. table.headerRow = headerRow;
  2823. // Rows och cells
  2824. inputData.forEach(function (rawRow, i) {
  2825. var row = new models_1.Row(rawRow, i);
  2826. var rowStyles = i % 2 === 0 ? assign({}, theme.alternateRow, table.styles.alternateRowStyles) : {};
  2827. table.columns.forEach(function (column) {
  2828. var cell = new models_1.Cell(rawRow[column.dataKey]);
  2829. var colStyles = table.styles.columnStyles[column.dataKey] || {};
  2830. cell.styles = config_1.Config.styles([theme.table, theme.body, table.styles.styles, table.styles.bodyStyles, rowStyles, colStyles]);
  2831. if (cell.raw && cell.raw instanceof HTMLElement) {
  2832. cell.text = (cell.raw.innerText || '').trim();
  2833. }
  2834. else {
  2835. // Stringify 0 and false, but not undefined
  2836. cell.text = typeof cell.raw !== 'undefined' ? '' + cell.raw : '';
  2837. }
  2838. cell.text = cell.text.split(splitRegex);
  2839. row.cells[column.dataKey] = cell;
  2840. for (var _i = 0, _a = table.hooks.createdCell; _i < _a.length; _i++) {
  2841. var hook = _a[_i];
  2842. hook(cell, config_1.Config.hooksData({ cell: cell, column: column, row: row }));
  2843. }
  2844. });
  2845. table.rows.push(row);
  2846. });
  2847. }
  2848. exports.createModels = createModels;
  2849. /***/ })
  2850. /******/ ]);
  2851. });