pdfmake 0.2.12 → 0.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/pdfmake.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! pdfmake v0.2.12, @license MIT, @link http://pdfmake.org */
1
+ /*! pdfmake v0.2.13, @license MIT, @link http://pdfmake.org */
2
2
  (function webpackUniversalModuleDefinition(root, factory) {
3
3
  if(typeof exports === 'object' && typeof module === 'object')
4
4
  module.exports = factory();
@@ -15135,7 +15135,921 @@ if ( true && module && typeof module.exports !== 'undefined') {
15135
15135
 
15136
15136
  /***/ }),
15137
15137
 
15138
- /***/ 82759:
15138
+ /***/ 8191:
15139
+ /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
15140
+
15141
+ "use strict";
15142
+
15143
+
15144
+ __webpack_require__(49063);
15145
+ __webpack_require__(11765);
15146
+ __webpack_require__(81755);
15147
+ __webpack_require__(80055);
15148
+ __webpack_require__(20731);
15149
+ __webpack_require__(37309);
15150
+ __webpack_require__(14032);
15151
+ __webpack_require__(76014);
15152
+ __webpack_require__(58281);
15153
+ __webpack_require__(28356);
15154
+ __webpack_require__(42437);
15155
+ __webpack_require__(94712);
15156
+ var TraversalTracker = __webpack_require__(2318);
15157
+ var DocPreprocessor = __webpack_require__(98883);
15158
+ var DocMeasure = __webpack_require__(42526);
15159
+ var DocumentContext = __webpack_require__(79178);
15160
+ var PageElementWriter = __webpack_require__(11220);
15161
+ var ColumnCalculator = __webpack_require__(77530);
15162
+ var TableProcessor = __webpack_require__(89836);
15163
+ var Line = __webpack_require__(70770);
15164
+ var isString = (__webpack_require__(91867).isString);
15165
+ var isArray = (__webpack_require__(91867).isArray);
15166
+ var isUndefined = (__webpack_require__(91867).isUndefined);
15167
+ var isNull = (__webpack_require__(91867).isNull);
15168
+ var pack = (__webpack_require__(91867).pack);
15169
+ var offsetVector = (__webpack_require__(91867).offsetVector);
15170
+ var fontStringify = (__webpack_require__(91867).fontStringify);
15171
+ var getNodeId = (__webpack_require__(91867).getNodeId);
15172
+ var isFunction = (__webpack_require__(91867).isFunction);
15173
+ var TextTools = __webpack_require__(11548);
15174
+ var StyleContextStack = __webpack_require__(76442);
15175
+ var isNumber = (__webpack_require__(91867).isNumber);
15176
+ function addAll(target, otherArray) {
15177
+ otherArray.forEach(function (item) {
15178
+ target.push(item);
15179
+ });
15180
+ }
15181
+
15182
+ /**
15183
+ * Creates an instance of LayoutBuilder - layout engine which turns document-definition-object
15184
+ * into a set of pages, lines, inlines and vectors ready to be rendered into a PDF
15185
+ *
15186
+ * @param {Object} pageSize - an object defining page width and height
15187
+ * @param {Object} pageMargins - an object defining top, left, right and bottom margins
15188
+ */
15189
+ function LayoutBuilder(pageSize, pageMargins, imageMeasure, svgMeasure) {
15190
+ this.pageSize = pageSize;
15191
+ this.pageMargins = pageMargins;
15192
+ this.tracker = new TraversalTracker();
15193
+ this.imageMeasure = imageMeasure;
15194
+ this.svgMeasure = svgMeasure;
15195
+ this.tableLayouts = {};
15196
+ this.nestedLevel = 0;
15197
+ }
15198
+ LayoutBuilder.prototype.registerTableLayouts = function (tableLayouts) {
15199
+ this.tableLayouts = pack(this.tableLayouts, tableLayouts);
15200
+ };
15201
+
15202
+ /**
15203
+ * Executes layout engine on document-definition-object and creates an array of pages
15204
+ * containing positioned Blocks, Lines and inlines
15205
+ *
15206
+ * @param {Object} docStructure document-definition-object
15207
+ * @param {Object} fontProvider font provider
15208
+ * @param {Object} styleDictionary dictionary with style definitions
15209
+ * @param {Object} defaultStyle default style definition
15210
+ * @return {Array} an array of pages
15211
+ */
15212
+ LayoutBuilder.prototype.layoutDocument = function (docStructure, fontProvider, styleDictionary, defaultStyle, background, header, footer, images, watermark, pageBreakBeforeFct) {
15213
+ function addPageBreaksIfNecessary(linearNodeList, pages) {
15214
+ if (!isFunction(pageBreakBeforeFct)) {
15215
+ return false;
15216
+ }
15217
+ linearNodeList = linearNodeList.filter(function (node) {
15218
+ return node.positions.length > 0;
15219
+ });
15220
+ linearNodeList.forEach(function (node) {
15221
+ var nodeInfo = {};
15222
+ ['id', 'text', 'ul', 'ol', 'table', 'image', 'qr', 'canvas', 'svg', 'columns', 'headlineLevel', 'style', 'pageBreak', 'pageOrientation', 'width', 'height'].forEach(function (key) {
15223
+ if (node[key] !== undefined) {
15224
+ nodeInfo[key] = node[key];
15225
+ }
15226
+ });
15227
+ nodeInfo.startPosition = node.positions[0];
15228
+ nodeInfo.pageNumbers = Array.from(new Set(node.positions.map(function (node) {
15229
+ return node.pageNumber;
15230
+ })));
15231
+ nodeInfo.pages = pages.length;
15232
+ nodeInfo.stack = isArray(node.stack);
15233
+ node.nodeInfo = nodeInfo;
15234
+ });
15235
+ for (var index = 0; index < linearNodeList.length; index++) {
15236
+ var node = linearNodeList[index];
15237
+ if (node.pageBreak !== 'before' && !node.pageBreakCalculated) {
15238
+ node.pageBreakCalculated = true;
15239
+ var pageNumber = node.nodeInfo.pageNumbers[0];
15240
+ var followingNodesOnPage = [];
15241
+ var nodesOnNextPage = [];
15242
+ var previousNodesOnPage = [];
15243
+ if (pageBreakBeforeFct.length > 1) {
15244
+ for (var ii = index + 1, l = linearNodeList.length; ii < l; ii++) {
15245
+ if (linearNodeList[ii].nodeInfo.pageNumbers.indexOf(pageNumber) > -1) {
15246
+ followingNodesOnPage.push(linearNodeList[ii].nodeInfo);
15247
+ }
15248
+ if (pageBreakBeforeFct.length > 2 && linearNodeList[ii].nodeInfo.pageNumbers.indexOf(pageNumber + 1) > -1) {
15249
+ nodesOnNextPage.push(linearNodeList[ii].nodeInfo);
15250
+ }
15251
+ }
15252
+ }
15253
+ if (pageBreakBeforeFct.length > 3) {
15254
+ for (var ii = 0; ii < index; ii++) {
15255
+ if (linearNodeList[ii].nodeInfo.pageNumbers.indexOf(pageNumber) > -1) {
15256
+ previousNodesOnPage.push(linearNodeList[ii].nodeInfo);
15257
+ }
15258
+ }
15259
+ }
15260
+ if (pageBreakBeforeFct(node.nodeInfo, followingNodesOnPage, nodesOnNextPage, previousNodesOnPage)) {
15261
+ node.pageBreak = 'before';
15262
+ return true;
15263
+ }
15264
+ }
15265
+ }
15266
+ return false;
15267
+ }
15268
+ this.docPreprocessor = new DocPreprocessor();
15269
+ this.docMeasure = new DocMeasure(fontProvider, styleDictionary, defaultStyle, this.imageMeasure, this.svgMeasure, this.tableLayouts, images);
15270
+ function resetXYs(result) {
15271
+ result.linearNodeList.forEach(function (node) {
15272
+ node.resetXY();
15273
+ });
15274
+ }
15275
+ var result = this.tryLayoutDocument(docStructure, fontProvider, styleDictionary, defaultStyle, background, header, footer, images, watermark);
15276
+ while (addPageBreaksIfNecessary(result.linearNodeList, result.pages)) {
15277
+ resetXYs(result);
15278
+ result = this.tryLayoutDocument(docStructure, fontProvider, styleDictionary, defaultStyle, background, header, footer, images, watermark);
15279
+ }
15280
+ return result.pages;
15281
+ };
15282
+ LayoutBuilder.prototype.tryLayoutDocument = function (docStructure, fontProvider, styleDictionary, defaultStyle, background, header, footer, images, watermark, pageBreakBeforeFct) {
15283
+ this.linearNodeList = [];
15284
+ docStructure = this.docPreprocessor.preprocessDocument(docStructure);
15285
+ docStructure = this.docMeasure.measureDocument(docStructure);
15286
+ this.writer = new PageElementWriter(new DocumentContext(this.pageSize, this.pageMargins), this.tracker);
15287
+ var _this = this;
15288
+ this.writer.context().tracker.startTracking('pageAdded', function () {
15289
+ _this.addBackground(background);
15290
+ });
15291
+ this.addBackground(background);
15292
+ this.processNode(docStructure);
15293
+ this.addHeadersAndFooters(header, footer);
15294
+ if (watermark != null) {
15295
+ this.addWatermark(watermark, fontProvider, defaultStyle);
15296
+ }
15297
+ return {
15298
+ pages: this.writer.context().pages,
15299
+ linearNodeList: this.linearNodeList
15300
+ };
15301
+ };
15302
+ LayoutBuilder.prototype.addBackground = function (background) {
15303
+ var backgroundGetter = isFunction(background) ? background : function () {
15304
+ return background;
15305
+ };
15306
+ var context = this.writer.context();
15307
+ var pageSize = context.getCurrentPage().pageSize;
15308
+ var pageBackground = backgroundGetter(context.page + 1, pageSize);
15309
+ if (pageBackground) {
15310
+ this.writer.beginUnbreakableBlock(pageSize.width, pageSize.height);
15311
+ pageBackground = this.docPreprocessor.preprocessDocument(pageBackground);
15312
+ this.processNode(this.docMeasure.measureDocument(pageBackground));
15313
+ this.writer.commitUnbreakableBlock(0, 0);
15314
+ context.backgroundLength[context.page] += pageBackground.positions.length;
15315
+ }
15316
+ };
15317
+ LayoutBuilder.prototype.addStaticRepeatable = function (headerOrFooter, sizeFunction) {
15318
+ this.addDynamicRepeatable(function () {
15319
+ return JSON.parse(JSON.stringify(headerOrFooter)); // copy to new object
15320
+ }, sizeFunction);
15321
+ };
15322
+ LayoutBuilder.prototype.addDynamicRepeatable = function (nodeGetter, sizeFunction) {
15323
+ var pages = this.writer.context().pages;
15324
+ for (var pageIndex = 0, l = pages.length; pageIndex < l; pageIndex++) {
15325
+ this.writer.context().page = pageIndex;
15326
+ var node = nodeGetter(pageIndex + 1, l, this.writer.context().pages[pageIndex].pageSize);
15327
+ if (node) {
15328
+ var sizes = sizeFunction(this.writer.context().getCurrentPage().pageSize, this.pageMargins);
15329
+ this.writer.beginUnbreakableBlock(sizes.width, sizes.height);
15330
+ node = this.docPreprocessor.preprocessDocument(node);
15331
+ this.processNode(this.docMeasure.measureDocument(node));
15332
+ this.writer.commitUnbreakableBlock(sizes.x, sizes.y);
15333
+ }
15334
+ }
15335
+ };
15336
+ LayoutBuilder.prototype.addHeadersAndFooters = function (header, footer) {
15337
+ var headerSizeFct = function headerSizeFct(pageSize, pageMargins) {
15338
+ return {
15339
+ x: 0,
15340
+ y: 0,
15341
+ width: pageSize.width,
15342
+ height: pageMargins.top
15343
+ };
15344
+ };
15345
+ var footerSizeFct = function footerSizeFct(pageSize, pageMargins) {
15346
+ return {
15347
+ x: 0,
15348
+ y: pageSize.height - pageMargins.bottom,
15349
+ width: pageSize.width,
15350
+ height: pageMargins.bottom
15351
+ };
15352
+ };
15353
+ if (isFunction(header)) {
15354
+ this.addDynamicRepeatable(header, headerSizeFct);
15355
+ } else if (header) {
15356
+ this.addStaticRepeatable(header, headerSizeFct);
15357
+ }
15358
+ if (isFunction(footer)) {
15359
+ this.addDynamicRepeatable(footer, footerSizeFct);
15360
+ } else if (footer) {
15361
+ this.addStaticRepeatable(footer, footerSizeFct);
15362
+ }
15363
+ };
15364
+ LayoutBuilder.prototype.addWatermark = function (watermark, fontProvider, defaultStyle) {
15365
+ if (isString(watermark)) {
15366
+ watermark = {
15367
+ 'text': watermark
15368
+ };
15369
+ }
15370
+ if (!watermark.text) {
15371
+ // empty watermark text
15372
+ return;
15373
+ }
15374
+ watermark.font = watermark.font || defaultStyle.font || 'Roboto';
15375
+ watermark.fontSize = watermark.fontSize || 'auto';
15376
+ watermark.color = watermark.color || 'black';
15377
+ watermark.opacity = isNumber(watermark.opacity) ? watermark.opacity : 0.6;
15378
+ watermark.bold = watermark.bold || false;
15379
+ watermark.italics = watermark.italics || false;
15380
+ watermark.angle = !isUndefined(watermark.angle) && !isNull(watermark.angle) ? watermark.angle : null;
15381
+ if (watermark.angle === null) {
15382
+ watermark.angle = Math.atan2(this.pageSize.height, this.pageSize.width) * -180 / Math.PI;
15383
+ }
15384
+ if (watermark.fontSize === 'auto') {
15385
+ watermark.fontSize = getWatermarkFontSize(this.pageSize, watermark, fontProvider);
15386
+ }
15387
+ var watermarkObject = {
15388
+ text: watermark.text,
15389
+ font: fontProvider.provideFont(watermark.font, watermark.bold, watermark.italics),
15390
+ fontSize: watermark.fontSize,
15391
+ color: watermark.color,
15392
+ opacity: watermark.opacity,
15393
+ angle: watermark.angle
15394
+ };
15395
+ watermarkObject._size = getWatermarkSize(watermark, fontProvider);
15396
+ var pages = this.writer.context().pages;
15397
+ for (var i = 0, l = pages.length; i < l; i++) {
15398
+ pages[i].watermark = watermarkObject;
15399
+ }
15400
+ function getWatermarkSize(watermark, fontProvider) {
15401
+ var textTools = new TextTools(fontProvider);
15402
+ var styleContextStack = new StyleContextStack(null, {
15403
+ font: watermark.font,
15404
+ bold: watermark.bold,
15405
+ italics: watermark.italics
15406
+ });
15407
+ styleContextStack.push({
15408
+ fontSize: watermark.fontSize
15409
+ });
15410
+ var size = textTools.sizeOfString(watermark.text, styleContextStack);
15411
+ var rotatedSize = textTools.sizeOfRotatedText(watermark.text, watermark.angle, styleContextStack);
15412
+ return {
15413
+ size: size,
15414
+ rotatedSize: rotatedSize
15415
+ };
15416
+ }
15417
+ function getWatermarkFontSize(pageSize, watermark, fontProvider) {
15418
+ var textTools = new TextTools(fontProvider);
15419
+ var styleContextStack = new StyleContextStack(null, {
15420
+ font: watermark.font,
15421
+ bold: watermark.bold,
15422
+ italics: watermark.italics
15423
+ });
15424
+ var rotatedSize;
15425
+
15426
+ /**
15427
+ * Binary search the best font size.
15428
+ * Initial bounds [0, 1000]
15429
+ * Break when range < 1
15430
+ */
15431
+ var a = 0;
15432
+ var b = 1000;
15433
+ var c = (a + b) / 2;
15434
+ while (Math.abs(a - b) > 1) {
15435
+ styleContextStack.push({
15436
+ fontSize: c
15437
+ });
15438
+ rotatedSize = textTools.sizeOfRotatedText(watermark.text, watermark.angle, styleContextStack);
15439
+ if (rotatedSize.width > pageSize.width) {
15440
+ b = c;
15441
+ c = (a + b) / 2;
15442
+ } else if (rotatedSize.width < pageSize.width) {
15443
+ if (rotatedSize.height > pageSize.height) {
15444
+ b = c;
15445
+ c = (a + b) / 2;
15446
+ } else {
15447
+ a = c;
15448
+ c = (a + b) / 2;
15449
+ }
15450
+ }
15451
+ styleContextStack.pop();
15452
+ }
15453
+ /*
15454
+ End binary search
15455
+ */
15456
+ return c;
15457
+ }
15458
+ };
15459
+ function decorateNode(node) {
15460
+ var x = node.x,
15461
+ y = node.y;
15462
+ node.positions = [];
15463
+ if (isArray(node.canvas)) {
15464
+ node.canvas.forEach(function (vector) {
15465
+ var x = vector.x,
15466
+ y = vector.y,
15467
+ x1 = vector.x1,
15468
+ y1 = vector.y1,
15469
+ x2 = vector.x2,
15470
+ y2 = vector.y2;
15471
+ vector.resetXY = function () {
15472
+ vector.x = x;
15473
+ vector.y = y;
15474
+ vector.x1 = x1;
15475
+ vector.y1 = y1;
15476
+ vector.x2 = x2;
15477
+ vector.y2 = y2;
15478
+ };
15479
+ });
15480
+ }
15481
+ node.resetXY = function () {
15482
+ node.x = x;
15483
+ node.y = y;
15484
+ if (isArray(node.canvas)) {
15485
+ node.canvas.forEach(function (vector) {
15486
+ vector.resetXY();
15487
+ });
15488
+ }
15489
+ };
15490
+ }
15491
+ LayoutBuilder.prototype.processNode = function (node) {
15492
+ var self = this;
15493
+ this.linearNodeList.push(node);
15494
+ decorateNode(node);
15495
+ applyMargins(function () {
15496
+ var unbreakable = node.unbreakable;
15497
+ if (unbreakable) {
15498
+ self.writer.beginUnbreakableBlock();
15499
+ }
15500
+ var absPosition = node.absolutePosition;
15501
+ if (absPosition) {
15502
+ self.writer.context().beginDetachedBlock();
15503
+ self.writer.context().moveTo(absPosition.x || 0, absPosition.y || 0);
15504
+ }
15505
+ var relPosition = node.relativePosition;
15506
+ if (relPosition) {
15507
+ self.writer.context().beginDetachedBlock();
15508
+ self.writer.context().moveToRelative(relPosition.x || 0, relPosition.y || 0);
15509
+ }
15510
+ if (node.stack) {
15511
+ self.processVerticalContainer(node);
15512
+ } else if (node.columns) {
15513
+ self.processColumns(node);
15514
+ } else if (node.ul) {
15515
+ self.processList(false, node);
15516
+ } else if (node.ol) {
15517
+ self.processList(true, node);
15518
+ } else if (node.table) {
15519
+ self.processTable(node);
15520
+ } else if (node.text !== undefined) {
15521
+ self.processLeaf(node);
15522
+ } else if (node.toc) {
15523
+ self.processToc(node);
15524
+ } else if (node.image) {
15525
+ self.processImage(node);
15526
+ } else if (node.svg) {
15527
+ self.processSVG(node);
15528
+ } else if (node.canvas) {
15529
+ self.processCanvas(node);
15530
+ } else if (node.qr) {
15531
+ self.processQr(node);
15532
+ } else if (!node._span) {
15533
+ throw 'Unrecognized document structure: ' + JSON.stringify(node, fontStringify);
15534
+ }
15535
+ if (absPosition || relPosition) {
15536
+ self.writer.context().endDetachedBlock();
15537
+ }
15538
+ if (unbreakable) {
15539
+ self.writer.commitUnbreakableBlock();
15540
+ }
15541
+ });
15542
+ function applyMargins(callback) {
15543
+ var margin = node._margin;
15544
+ if (node.pageBreak === 'before') {
15545
+ self.writer.moveToNextPage(node.pageOrientation);
15546
+ } else if (node.pageBreak === 'beforeOdd') {
15547
+ self.writer.moveToNextPage(node.pageOrientation);
15548
+ if ((self.writer.context().page + 1) % 2 === 1) {
15549
+ self.writer.moveToNextPage(node.pageOrientation);
15550
+ }
15551
+ } else if (node.pageBreak === 'beforeEven') {
15552
+ self.writer.moveToNextPage(node.pageOrientation);
15553
+ if ((self.writer.context().page + 1) % 2 === 0) {
15554
+ self.writer.moveToNextPage(node.pageOrientation);
15555
+ }
15556
+ }
15557
+ var isDetachedBlock = node.relativePosition || node.absolutePosition;
15558
+
15559
+ // Detached nodes have no margins, their position is only determined by 'x' and 'y'
15560
+ if (margin && !isDetachedBlock) {
15561
+ var availableHeight = self.writer.context().availableHeight;
15562
+ // If top margin is bigger than available space, move to next page
15563
+ // Necessary for nodes inside tables
15564
+ if (availableHeight - margin[1] < 0) {
15565
+ // Consume the whole available space
15566
+ self.writer.context().moveDown(availableHeight);
15567
+ self.writer.moveToNextPage(node.pageOrientation);
15568
+ /**
15569
+ * TODO - Something to consider:
15570
+ * Right now the node starts at the top of next page (after header)
15571
+ * Another option would be to apply just the top margin that has not been consumed in the page before
15572
+ * It would something like: this.write.context().moveDown(margin[1] - availableHeight)
15573
+ */
15574
+ } else {
15575
+ self.writer.context().moveDown(margin[1]);
15576
+ }
15577
+
15578
+ // Apply lateral margins
15579
+ self.writer.context().addMargin(margin[0], margin[2]);
15580
+ }
15581
+ callback();
15582
+
15583
+ // Detached nodes have no margins, their position is only determined by 'x' and 'y'
15584
+ if (margin && !isDetachedBlock) {
15585
+ var _availableHeight = self.writer.context().availableHeight;
15586
+ // If bottom margin is bigger than available space, move to next page
15587
+ // Necessary for nodes inside tables
15588
+ if (_availableHeight - margin[3] < 0) {
15589
+ self.writer.context().moveDown(_availableHeight);
15590
+ self.writer.moveToNextPage(node.pageOrientation);
15591
+ /**
15592
+ * TODO - Something to consider:
15593
+ * Right now next node starts at the top of next page (after header)
15594
+ * Another option would be to apply the bottom margin that has not been consumed in the next page?
15595
+ * It would something like: this.write.context().moveDown(margin[3] - availableHeight)
15596
+ */
15597
+ } else {
15598
+ self.writer.context().moveDown(margin[3]);
15599
+ }
15600
+
15601
+ // Apply lateral margins
15602
+ self.writer.context().addMargin(-margin[0], -margin[2]);
15603
+ }
15604
+ if (node.pageBreak === 'after') {
15605
+ self.writer.moveToNextPage(node.pageOrientation);
15606
+ } else if (node.pageBreak === 'afterOdd') {
15607
+ self.writer.moveToNextPage(node.pageOrientation);
15608
+ if ((self.writer.context().page + 1) % 2 === 1) {
15609
+ self.writer.moveToNextPage(node.pageOrientation);
15610
+ }
15611
+ } else if (node.pageBreak === 'afterEven') {
15612
+ self.writer.moveToNextPage(node.pageOrientation);
15613
+ if ((self.writer.context().page + 1) % 2 === 0) {
15614
+ self.writer.moveToNextPage(node.pageOrientation);
15615
+ }
15616
+ }
15617
+ }
15618
+ };
15619
+
15620
+ // vertical container
15621
+ LayoutBuilder.prototype.processVerticalContainer = function (node) {
15622
+ var self = this;
15623
+ node.stack.forEach(function (item) {
15624
+ self.processNode(item);
15625
+ addAll(node.positions, item.positions);
15626
+
15627
+ //TODO: paragraph gap
15628
+ });
15629
+ };
15630
+
15631
+ // columns
15632
+ LayoutBuilder.prototype.processColumns = function (columnNode) {
15633
+ this.nestedLevel++;
15634
+ var columns = columnNode.columns;
15635
+ var availableWidth = this.writer.context().availableWidth;
15636
+ var gaps = gapArray(columnNode._gap);
15637
+ if (gaps) {
15638
+ availableWidth -= (gaps.length - 1) * columnNode._gap;
15639
+ }
15640
+ ColumnCalculator.buildColumnWidths(columns, availableWidth);
15641
+ var result = this.processRow({
15642
+ marginX: columnNode._margin ? [columnNode._margin[0], columnNode._margin[2]] : [0, 0],
15643
+ cells: columns,
15644
+ widths: columns,
15645
+ gaps: gaps
15646
+ });
15647
+ addAll(columnNode.positions, result.positions);
15648
+ this.nestedLevel--;
15649
+ if (this.nestedLevel === 0) {
15650
+ this.writer.context().resetMarginXTopParent();
15651
+ }
15652
+ function gapArray(gap) {
15653
+ if (!gap) {
15654
+ return null;
15655
+ }
15656
+ var gaps = [];
15657
+ gaps.push(0);
15658
+ for (var i = columns.length - 1; i > 0; i--) {
15659
+ gaps.push(gap);
15660
+ }
15661
+ return gaps;
15662
+ }
15663
+ };
15664
+ LayoutBuilder.prototype.findStartingSpanCell = function (arr, i) {
15665
+ var requiredColspan = 1;
15666
+ for (var index = i - 1; index >= 0; index--) {
15667
+ if (!arr[index]._span) {
15668
+ if (arr[index].rowSpan > 1 && (arr[index].colSpan || 1) === requiredColspan) {
15669
+ return arr[index];
15670
+ } else {
15671
+ return null;
15672
+ }
15673
+ }
15674
+ requiredColspan++;
15675
+ }
15676
+ return null;
15677
+ };
15678
+ LayoutBuilder.prototype.processRow = function (_ref) {
15679
+ var _ref$marginX = _ref.marginX,
15680
+ marginX = _ref$marginX === void 0 ? [0, 0] : _ref$marginX,
15681
+ _ref$dontBreakRows = _ref.dontBreakRows,
15682
+ dontBreakRows = _ref$dontBreakRows === void 0 ? false : _ref$dontBreakRows,
15683
+ _ref$rowsWithoutPageB = _ref.rowsWithoutPageBreak,
15684
+ rowsWithoutPageBreak = _ref$rowsWithoutPageB === void 0 ? 0 : _ref$rowsWithoutPageB,
15685
+ cells = _ref.cells,
15686
+ widths = _ref.widths,
15687
+ gaps = _ref.gaps,
15688
+ tableBody = _ref.tableBody,
15689
+ rowIndex = _ref.rowIndex,
15690
+ height = _ref.height;
15691
+ var self = this;
15692
+ var isUnbreakableRow = dontBreakRows || rowIndex <= rowsWithoutPageBreak - 1;
15693
+ var pageBreaks = [];
15694
+ var positions = [];
15695
+ var willBreakByHeight = false;
15696
+ this.tracker.auto('pageChanged', storePageBreakData, function () {
15697
+ // Check if row should break by height
15698
+ if (!isUnbreakableRow && height > self.writer.context().availableHeight) {
15699
+ willBreakByHeight = true;
15700
+ }
15701
+ widths = widths || cells;
15702
+ // Use the marginX if we are in a top level table/column (not nested)
15703
+ var marginXParent = self.nestedLevel === 1 ? marginX : null;
15704
+ self.writer.context().beginColumnGroup(marginXParent);
15705
+ for (var i = 0, l = cells.length; i < l; i++) {
15706
+ var column = cells[i];
15707
+ var width = widths[i]._calcWidth;
15708
+ var leftOffset = colLeftOffset(i);
15709
+ if (column.colSpan && column.colSpan > 1) {
15710
+ for (var j = 1; j < column.colSpan; j++) {
15711
+ width += widths[++i]._calcWidth + gaps[i];
15712
+ }
15713
+ }
15714
+
15715
+ // if rowspan starts in this cell, we retrieve the last cell affected by the rowspan
15716
+ var endingCell = getEndingCell(column, i);
15717
+ if (endingCell) {
15718
+ // We store a reference of the ending cell in the first cell of the rowspan
15719
+ column._endingCell = endingCell;
15720
+ column._endingCell._startingRowSpanY = column._startingRowSpanY;
15721
+ }
15722
+
15723
+ // Check if exists and retrieve the cell that started the rowspan in case we are in the cell just after
15724
+ var startingSpanCell = self.findStartingSpanCell(cells, i);
15725
+ var endingSpanCell = null;
15726
+ if (startingSpanCell && startingSpanCell._endingCell) {
15727
+ // Reference to the last cell of the rowspan
15728
+ endingSpanCell = startingSpanCell._endingCell;
15729
+ // Store if we are in an unbreakable block when we save the context and the originalX
15730
+ if (self.writer.transactionLevel > 0) {
15731
+ endingSpanCell._isUnbreakableContext = true;
15732
+ endingSpanCell._originalXOffset = self.writer.originalX;
15733
+ }
15734
+ }
15735
+
15736
+ // We pass the endingSpanCell reference to store the context just after processing rowspan cell
15737
+ self.writer.context().beginColumn(width, leftOffset, endingSpanCell);
15738
+ if (!column._span) {
15739
+ self.processNode(column);
15740
+ addAll(positions, column.positions);
15741
+ } else if (column._columnEndingContext) {
15742
+ var discountY = 0;
15743
+ if (dontBreakRows) {
15744
+ // Calculate how many points we have to discount to Y when dontBreakRows and rowSpan are combined
15745
+ var ctxBeforeRowSpanLastRow = self.writer.contextStack[self.writer.contextStack.length - 1];
15746
+ discountY = ctxBeforeRowSpanLastRow.y - column._startingRowSpanY;
15747
+ }
15748
+ var originalXOffset = 0;
15749
+ // If context was saved from an unbreakable block and we are not in an unbreakable block anymore
15750
+ // We have to sum the originalX (X before starting unbreakable block) to X
15751
+ if (column._isUnbreakableContext && !self.writer.transactionLevel) {
15752
+ originalXOffset = column._originalXOffset;
15753
+ }
15754
+ // row-span ending
15755
+ // Recover the context after processing the rowspanned cell
15756
+ self.writer.context().markEnding(column, originalXOffset, discountY);
15757
+ }
15758
+ }
15759
+
15760
+ // Check if last cell is part of a span
15761
+ var endingSpanCell = null;
15762
+ var lastColumn = cells.length > 0 ? cells[cells.length - 1] : null;
15763
+ if (lastColumn) {
15764
+ // Previous column cell has a rowspan
15765
+ if (lastColumn._endingCell) {
15766
+ endingSpanCell = lastColumn._endingCell;
15767
+ // Previous column cell is part of a span
15768
+ } else if (lastColumn._span === true) {
15769
+ // We get the cell that started the span where we set a reference to the ending cell
15770
+ var startingSpanCell = self.findStartingSpanCell(cells, cells.length);
15771
+ if (startingSpanCell) {
15772
+ // Context will be stored here (ending cell)
15773
+ endingSpanCell = startingSpanCell._endingCell;
15774
+ // Store if we are in an unbreakable block when we save the context and the originalX
15775
+ if (self.writer.transactionLevel > 0) {
15776
+ endingSpanCell._isUnbreakableContext = true;
15777
+ endingSpanCell._originalXOffset = self.writer.originalX;
15778
+ }
15779
+ }
15780
+ }
15781
+ }
15782
+
15783
+ // If there are page breaks in this row, update data with prevY of last cell
15784
+ updatePageBreakData(self.writer.context().page, self.writer.context().y);
15785
+
15786
+ // If content did not break page, check if we should break by height
15787
+ if (!isUnbreakableRow && pageBreaks.length === 0 && willBreakByHeight) {
15788
+ self.writer.context().moveDown(self.writer.context().availableHeight);
15789
+ self.writer.moveToNextPage();
15790
+ }
15791
+ self.writer.context().completeColumnGroup(height, endingSpanCell);
15792
+ });
15793
+ return {
15794
+ pageBreaks: pageBreaks,
15795
+ positions: positions
15796
+ };
15797
+ function updatePageBreakData(page, prevY) {
15798
+ var pageDesc;
15799
+ // Find page break data for this row and page
15800
+ for (var i = 0, l = pageBreaks.length; i < l; i++) {
15801
+ var desc = pageBreaks[i];
15802
+ if (desc.prevPage === page) {
15803
+ pageDesc = desc;
15804
+ break;
15805
+ }
15806
+ }
15807
+ // If row has page break in this page, update prevY
15808
+ if (pageDesc) {
15809
+ pageDesc.prevY = Math.max(pageDesc.prevY, prevY);
15810
+ }
15811
+ }
15812
+ function storePageBreakData(data) {
15813
+ var pageDesc;
15814
+ for (var i = 0, l = pageBreaks.length; i < l; i++) {
15815
+ var desc = pageBreaks[i];
15816
+ if (desc.prevPage === data.prevPage) {
15817
+ pageDesc = desc;
15818
+ break;
15819
+ }
15820
+ }
15821
+ if (!pageDesc) {
15822
+ pageDesc = data;
15823
+ pageBreaks.push(pageDesc);
15824
+ }
15825
+ pageDesc.prevY = Math.max(pageDesc.prevY, data.prevY);
15826
+ pageDesc.y = Math.min(pageDesc.y, data.y);
15827
+ }
15828
+ function colLeftOffset(i) {
15829
+ if (gaps && gaps.length > i) {
15830
+ return gaps[i];
15831
+ }
15832
+ return 0;
15833
+ }
15834
+ function getEndingCell(column, columnIndex) {
15835
+ if (column.rowSpan && column.rowSpan > 1) {
15836
+ var endingRow = rowIndex + column.rowSpan - 1;
15837
+ if (endingRow >= tableBody.length) {
15838
+ throw 'Row span for column ' + columnIndex + ' (with indexes starting from 0) exceeded row count';
15839
+ }
15840
+ return tableBody[endingRow][columnIndex];
15841
+ }
15842
+ return null;
15843
+ }
15844
+ };
15845
+
15846
+ // lists
15847
+ LayoutBuilder.prototype.processList = function (orderedList, node) {
15848
+ var self = this,
15849
+ items = orderedList ? node.ol : node.ul,
15850
+ gapSize = node._gapSize;
15851
+ this.writer.context().addMargin(gapSize.width);
15852
+ var nextMarker;
15853
+ this.tracker.auto('lineAdded', addMarkerToFirstLeaf, function () {
15854
+ items.forEach(function (item) {
15855
+ nextMarker = item.listMarker;
15856
+ self.processNode(item);
15857
+ addAll(node.positions, item.positions);
15858
+ });
15859
+ });
15860
+ this.writer.context().addMargin(-gapSize.width);
15861
+ function addMarkerToFirstLeaf(line) {
15862
+ // I'm not very happy with the way list processing is implemented
15863
+ // (both code and algorithm should be rethinked)
15864
+ if (nextMarker) {
15865
+ var marker = nextMarker;
15866
+ nextMarker = null;
15867
+ if (marker.canvas) {
15868
+ var vector = marker.canvas[0];
15869
+ offsetVector(vector, -marker._minWidth, 0);
15870
+ self.writer.addVector(vector);
15871
+ } else if (marker._inlines) {
15872
+ var markerLine = new Line(self.pageSize.width);
15873
+ markerLine.addInline(marker._inlines[0]);
15874
+ markerLine.x = -marker._minWidth;
15875
+ markerLine.y = line.getAscenderHeight() - markerLine.getAscenderHeight();
15876
+ self.writer.addLine(markerLine, true);
15877
+ }
15878
+ }
15879
+ }
15880
+ };
15881
+
15882
+ // tables
15883
+ LayoutBuilder.prototype.processTable = function (tableNode) {
15884
+ var _this2 = this;
15885
+ this.nestedLevel++;
15886
+ var processor = new TableProcessor(tableNode);
15887
+ processor.beginTable(this.writer);
15888
+ var rowHeights = tableNode.table.heights;
15889
+ for (var i = 0, l = tableNode.table.body.length; i < l; i++) {
15890
+ // if dontBreakRows and row starts a rowspan
15891
+ // we store the 'y' of the beginning of each rowSpan
15892
+ if (processor.dontBreakRows) {
15893
+ tableNode.table.body[i].forEach(function (cell) {
15894
+ if (cell.rowSpan && cell.rowSpan > 1) {
15895
+ cell._startingRowSpanY = _this2.writer.context().y;
15896
+ }
15897
+ });
15898
+ }
15899
+ processor.beginRow(i, this.writer);
15900
+ var height;
15901
+ if (isFunction(rowHeights)) {
15902
+ height = rowHeights(i);
15903
+ } else if (isArray(rowHeights)) {
15904
+ height = rowHeights[i];
15905
+ } else {
15906
+ height = rowHeights;
15907
+ }
15908
+ if (height === 'auto') {
15909
+ height = undefined;
15910
+ }
15911
+ var result = this.processRow({
15912
+ marginX: tableNode._margin ? [tableNode._margin[0], tableNode._margin[2]] : [0, 0],
15913
+ dontBreakRows: processor.dontBreakRows,
15914
+ rowsWithoutPageBreak: processor.rowsWithoutPageBreak,
15915
+ cells: tableNode.table.body[i],
15916
+ widths: tableNode.table.widths,
15917
+ gaps: tableNode._offsets.offsets,
15918
+ tableBody: tableNode.table.body,
15919
+ rowIndex: i,
15920
+ height: height
15921
+ });
15922
+ addAll(tableNode.positions, result.positions);
15923
+ processor.endRow(i, this.writer, result.pageBreaks);
15924
+ }
15925
+ processor.endTable(this.writer);
15926
+ this.nestedLevel--;
15927
+ if (this.nestedLevel === 0) {
15928
+ this.writer.context().resetMarginXTopParent();
15929
+ }
15930
+ };
15931
+
15932
+ // leafs (texts)
15933
+ LayoutBuilder.prototype.processLeaf = function (node) {
15934
+ var line = this.buildNextLine(node);
15935
+ if (line && (node.tocItem || node.id)) {
15936
+ line._node = node;
15937
+ }
15938
+ var currentHeight = line ? line.getHeight() : 0;
15939
+ var maxHeight = node.maxHeight || -1;
15940
+ if (line) {
15941
+ var nodeId = getNodeId(node);
15942
+ if (nodeId) {
15943
+ line.id = nodeId;
15944
+ }
15945
+ }
15946
+ if (node._tocItemRef) {
15947
+ line._pageNodeRef = node._tocItemRef;
15948
+ }
15949
+ if (node._pageRef) {
15950
+ line._pageNodeRef = node._pageRef._nodeRef;
15951
+ }
15952
+ if (line && line.inlines && isArray(line.inlines)) {
15953
+ for (var i = 0, l = line.inlines.length; i < l; i++) {
15954
+ if (line.inlines[i]._tocItemRef) {
15955
+ line.inlines[i]._pageNodeRef = line.inlines[i]._tocItemRef;
15956
+ }
15957
+ if (line.inlines[i]._pageRef) {
15958
+ line.inlines[i]._pageNodeRef = line.inlines[i]._pageRef._nodeRef;
15959
+ }
15960
+ }
15961
+ }
15962
+ while (line && (maxHeight === -1 || currentHeight < maxHeight)) {
15963
+ var positions = this.writer.addLine(line);
15964
+ node.positions.push(positions);
15965
+ line = this.buildNextLine(node);
15966
+ if (line) {
15967
+ currentHeight += line.getHeight();
15968
+ }
15969
+ }
15970
+ };
15971
+ LayoutBuilder.prototype.processToc = function (node) {
15972
+ if (node.toc.title) {
15973
+ this.processNode(node.toc.title);
15974
+ }
15975
+ if (node.toc._table) {
15976
+ this.processNode(node.toc._table);
15977
+ }
15978
+ };
15979
+ LayoutBuilder.prototype.buildNextLine = function (textNode) {
15980
+ function cloneInline(inline) {
15981
+ var newInline = inline.constructor();
15982
+ for (var key in inline) {
15983
+ newInline[key] = inline[key];
15984
+ }
15985
+ return newInline;
15986
+ }
15987
+ if (!textNode._inlines || textNode._inlines.length === 0) {
15988
+ return null;
15989
+ }
15990
+ var line = new Line(this.writer.context().availableWidth);
15991
+ var textTools = new TextTools(null);
15992
+ var isForceContinue = false;
15993
+ while (textNode._inlines && textNode._inlines.length > 0 && (line.hasEnoughSpaceForInline(textNode._inlines[0], textNode._inlines.slice(1)) || isForceContinue)) {
15994
+ var isHardWrap = false;
15995
+ var inline = textNode._inlines.shift();
15996
+ isForceContinue = false;
15997
+ if (!inline.noWrap && inline.text.length > 1 && inline.width > line.getAvailableWidth()) {
15998
+ var widthPerChar = inline.width / inline.text.length;
15999
+ var maxChars = Math.floor(line.getAvailableWidth() / widthPerChar);
16000
+ if (maxChars < 1) {
16001
+ maxChars = 1;
16002
+ }
16003
+ if (maxChars < inline.text.length) {
16004
+ var newInline = cloneInline(inline);
16005
+ newInline.text = inline.text.substr(maxChars);
16006
+ inline.text = inline.text.substr(0, maxChars);
16007
+ newInline.width = textTools.widthOfString(newInline.text, newInline.font, newInline.fontSize, newInline.characterSpacing, newInline.fontFeatures);
16008
+ inline.width = textTools.widthOfString(inline.text, inline.font, inline.fontSize, inline.characterSpacing, inline.fontFeatures);
16009
+ textNode._inlines.unshift(newInline);
16010
+ isHardWrap = true;
16011
+ }
16012
+ }
16013
+ line.addInline(inline);
16014
+ isForceContinue = inline.noNewLine && !isHardWrap;
16015
+ }
16016
+ line.lastLineInParagraph = textNode._inlines.length === 0;
16017
+ return line;
16018
+ };
16019
+
16020
+ // images
16021
+ LayoutBuilder.prototype.processImage = function (node) {
16022
+ var position = this.writer.addImage(node);
16023
+ node.positions.push(position);
16024
+ };
16025
+ LayoutBuilder.prototype.processSVG = function (node) {
16026
+ var position = this.writer.addSVG(node);
16027
+ node.positions.push(position);
16028
+ };
16029
+ LayoutBuilder.prototype.processCanvas = function (node) {
16030
+ var height = node._minHeight;
16031
+ if (node.absolutePosition === undefined && this.writer.context().availableHeight < height) {
16032
+ // TODO: support for canvas larger than a page
16033
+ // TODO: support for other overflow methods
16034
+
16035
+ this.writer.moveToNextPage();
16036
+ }
16037
+ this.writer.alignCanvas(node);
16038
+ node.canvas.forEach(function (vector) {
16039
+ var position = this.writer.addVector(vector);
16040
+ node.positions.push(position);
16041
+ }, this);
16042
+ this.writer.context().moveDown(height);
16043
+ };
16044
+ LayoutBuilder.prototype.processQr = function (node) {
16045
+ var position = this.writer.addQr(node);
16046
+ node.positions.push(position);
16047
+ };
16048
+ module.exports = LayoutBuilder;
16049
+
16050
+ /***/ }),
16051
+
16052
+ /***/ 2500:
15139
16053
  /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
15140
16054
 
15141
16055
  "use strict";
@@ -33595,6 +34509,26 @@ collection('Set', function (init) {
33595
34509
  }, collectionStrong);
33596
34510
 
33597
34511
 
34512
+ /***/ }),
34513
+
34514
+ /***/ 28356:
34515
+ /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
34516
+
34517
+ "use strict";
34518
+
34519
+ var $ = __webpack_require__(56475);
34520
+ var createHTML = __webpack_require__(91159);
34521
+ var forcedStringHTMLMethod = __webpack_require__(7452);
34522
+
34523
+ // `String.prototype.bold` method
34524
+ // https://tc39.es/ecma262/#sec-string.prototype.bold
34525
+ $({ target: 'String', proto: true, forced: forcedStringHTMLMethod('bold') }, {
34526
+ bold: function bold() {
34527
+ return createHTML(this, 'b', '', '');
34528
+ }
34529
+ });
34530
+
34531
+
33598
34532
  /***/ }),
33599
34533
 
33600
34534
  /***/ 26663:
@@ -54401,7 +55335,7 @@ URLBrowserResolver.prototype.resolve = function (url, headers) {
54401
55335
  }
54402
55336
 
54403
55337
  return this.resolving[url];
54404
- }
55338
+ };
54405
55339
 
54406
55340
  URLBrowserResolver.prototype.resolved = function () {
54407
55341
  var _this = this;
@@ -54412,7 +55346,7 @@ URLBrowserResolver.prototype.resolved = function () {
54412
55346
  reject(result);
54413
55347
  });
54414
55348
  });
54415
- }
55349
+ };
54416
55350
 
54417
55351
  module.exports = URLBrowserResolver;
54418
55352
 
@@ -54429,7 +55363,7 @@ module.exports = URLBrowserResolver;
54429
55363
  var isFunction = (__webpack_require__(91867).isFunction);
54430
55364
  var isUndefined = (__webpack_require__(91867).isUndefined);
54431
55365
  var isNull = (__webpack_require__(91867).isNull);
54432
- var FileSaver = __webpack_require__(42616);
55366
+ var FileSaver = __webpack_require__(65209);
54433
55367
  var saveAs = FileSaver.saveAs;
54434
55368
 
54435
55369
  var defaultClientFonts = {
@@ -54451,13 +55385,13 @@ function Document(docDefinition, tableLayouts, fonts, vfs) {
54451
55385
  function canCreatePdf() {
54452
55386
  // Ensure the browser provides the level of support needed
54453
55387
  try {
54454
- var arr = new Uint8Array(1)
54455
- var proto = { foo: function () { return 42 } }
54456
- Object.setPrototypeOf(proto, Uint8Array.prototype)
54457
- Object.setPrototypeOf(arr, proto)
54458
- return arr.foo() === 42
55388
+ var arr = new Uint8Array(1);
55389
+ var proto = { foo: function () { return 42; } };
55390
+ Object.setPrototypeOf(proto, Uint8Array.prototype);
55391
+ Object.setPrototypeOf(arr, proto);
55392
+ return arr.foo() === 42;
54459
55393
  } catch (e) {
54460
- return false
55394
+ return false;
54461
55395
  }
54462
55396
  }
54463
55397
 
@@ -54774,7 +55708,7 @@ VirtualFileSystem.prototype.existsSync = function (filename) {
54774
55708
  filename = fixFilename(filename);
54775
55709
  return typeof this.fileSystem[filename] !== 'undefined'
54776
55710
  || typeof this.dataSystem[filename] !== 'undefined';
54777
- }
55711
+ };
54778
55712
 
54779
55713
  VirtualFileSystem.prototype.readFileSync = function (filename, options) {
54780
55714
  filename = fixFilename(filename);
@@ -56062,7 +56996,7 @@ DocPreprocessor.prototype._getNodeForNodeRef = function (node) {
56062
56996
  }
56063
56997
 
56064
56998
  return node;
56065
- }
56999
+ };
56066
57000
 
56067
57001
  module.exports = DocPreprocessor;
56068
57002
 
@@ -56101,7 +57035,7 @@ function DocumentContext(pageSize, pageMargins) {
56101
57035
  this.addPage(pageSize);
56102
57036
  }
56103
57037
 
56104
- DocumentContext.prototype.beginColumnGroup = function () {
57038
+ DocumentContext.prototype.beginColumnGroup = function (marginXTopParent) {
56105
57039
  this.snapshots.push({
56106
57040
  x: this.x,
56107
57041
  y: this.y,
@@ -56119,6 +57053,13 @@ DocumentContext.prototype.beginColumnGroup = function () {
56119
57053
  });
56120
57054
 
56121
57055
  this.lastColumnWidth = 0;
57056
+ if (marginXTopParent) {
57057
+ this.marginXTopParent = marginXTopParent;
57058
+ }
57059
+ };
57060
+
57061
+ DocumentContext.prototype.resetMarginXTopParent = function () {
57062
+ this.marginXTopParent = null;
56122
57063
  };
56123
57064
 
56124
57065
  DocumentContext.prototype.beginColumn = function (width, offset, endingCell) {
@@ -56143,10 +57084,10 @@ DocumentContext.prototype.calculateBottomMost = function (destContext, endingCel
56143
57084
  }
56144
57085
  };
56145
57086
 
56146
- DocumentContext.prototype.markEnding = function (endingCell) {
57087
+ DocumentContext.prototype.markEnding = function (endingCell, originalXOffset, discountY) {
56147
57088
  this.page = endingCell._columnEndingContext.page;
56148
- this.x = endingCell._columnEndingContext.x;
56149
- this.y = endingCell._columnEndingContext.y;
57089
+ this.x = endingCell._columnEndingContext.x + originalXOffset;
57090
+ this.y = endingCell._columnEndingContext.y - discountY;
56150
57091
  this.availableWidth = endingCell._columnEndingContext.availableWidth;
56151
57092
  this.availableHeight = endingCell._columnEndingContext.availableHeight;
56152
57093
  this.lastColumnWidth = endingCell._columnEndingContext.lastColumnWidth;
@@ -56206,14 +57147,19 @@ DocumentContext.prototype.moveDown = function (offset) {
56206
57147
  DocumentContext.prototype.initializePage = function () {
56207
57148
  this.y = this.pageMargins.top;
56208
57149
  this.availableHeight = this.getCurrentPage().pageSize.height - this.pageMargins.top - this.pageMargins.bottom;
56209
- this.pageSnapshot().availableWidth = this.getCurrentPage().pageSize.width - this.pageMargins.left - this.pageMargins.right;
57150
+ const { pageCtx, isSnapshot } = this.pageSnapshot();
57151
+ pageCtx.availableWidth = this.getCurrentPage().pageSize.width - this.pageMargins.left - this.pageMargins.right;
57152
+ if (isSnapshot && this.marginXTopParent) {
57153
+ pageCtx.availableWidth -= this.marginXTopParent[0];
57154
+ pageCtx.availableWidth -= this.marginXTopParent[1];
57155
+ }
56210
57156
  };
56211
57157
 
56212
57158
  DocumentContext.prototype.pageSnapshot = function () {
56213
57159
  if (this.snapshots[0]) {
56214
- return this.snapshots[0];
57160
+ return { pageCtx: this.snapshots[0], isSnapshot: true };
56215
57161
  } else {
56216
- return this;
57162
+ return { pageCtx: this, isSnapshot: false };
56217
57163
  }
56218
57164
  };
56219
57165
 
@@ -56296,6 +57242,16 @@ DocumentContext.prototype.moveToNextPage = function (pageOrientation) {
56296
57242
  var prevPage = this.page;
56297
57243
  var prevY = this.y;
56298
57244
 
57245
+ // If we are in a column group
57246
+ if (this.snapshots.length > 0) {
57247
+ var lastSnapshot = this.snapshots[this.snapshots.length - 1];
57248
+ // We have to update prevY accordingly by also taking into consideration
57249
+ // the 'y' of cells that don't break page
57250
+ if (lastSnapshot.bottomMost && lastSnapshot.bottomMost.y) {
57251
+ prevY = Math.max(this.y, lastSnapshot.bottomMost.y);
57252
+ }
57253
+ }
57254
+
56299
57255
  var createNewPage = nextPageIndex >= this.pages.length;
56300
57256
  if (createNewPage) {
56301
57257
  var currentAvailableWidth = this.availableWidth;
@@ -56505,7 +57461,7 @@ ElementWriter.prototype.addImage = function (image, index, type) {
56505
57461
  };
56506
57462
 
56507
57463
  ElementWriter.prototype.addSVG = function (image, index) {
56508
- return this.addImage(image, index, 'svg')
57464
+ return this.addImage(image, index, 'svg');
56509
57465
  };
56510
57466
 
56511
57467
  ElementWriter.prototype.addQr = function (qr, index) {
@@ -56650,10 +57606,21 @@ ElementWriter.prototype.addFragment = function (block, useBlockXOffset, useBlock
56650
57606
  var v = pack(item.item);
56651
57607
 
56652
57608
  offsetVector(v, useBlockXOffset ? (block.xOffset || 0) : ctx.x, useBlockYOffset ? (block.yOffset || 0) : ctx.y);
56653
- page.items.push({
56654
- type: 'vector',
56655
- item: v
56656
- });
57609
+ if (v._isFillColorFromUnbreakable) {
57610
+ // If the item is a fillColor from an unbreakable block
57611
+ // We have to add it at the beginning of the items body array of the page
57612
+ delete v._isFillColorFromUnbreakable;
57613
+ const endOfBackgroundItemsIndex = ctx.backgroundLength[ctx.page];
57614
+ page.items.splice(endOfBackgroundItemsIndex, 0, {
57615
+ type: 'vector',
57616
+ item: v
57617
+ });
57618
+ } else {
57619
+ page.items.push({
57620
+ type: 'vector',
57621
+ item: v
57622
+ });
57623
+ }
56657
57624
  break;
56658
57625
 
56659
57626
  case 'image':
@@ -56754,7 +57721,7 @@ function FontProvider(fontDescriptors, pdfKitDoc) {
56754
57721
 
56755
57722
  FontProvider.prototype.getFontType = function (bold, italics) {
56756
57723
  return typeName(bold, italics);
56757
- }
57724
+ };
56758
57725
 
56759
57726
  FontProvider.prototype.getFontFile = function (familyName, bold, italics) {
56760
57727
  var type = this.getFontType(bold, italics);
@@ -56763,7 +57730,7 @@ FontProvider.prototype.getFontFile = function (familyName, bold, italics) {
56763
57730
  }
56764
57731
 
56765
57732
  return this.fonts[familyName][type];
56766
- }
57733
+ };
56767
57734
 
56768
57735
  FontProvider.prototype.provideFont = function (familyName, bold, italics) {
56769
57736
  var type = this.getFontType(bold, italics);
@@ -56833,7 +57800,7 @@ function isUndefined(variable) {
56833
57800
  */
56834
57801
  function isPositiveInteger(variable) {
56835
57802
  if (!isNumber(variable) || !Number.isInteger(variable) || variable <= 0) {
56836
- return false;
57803
+ return false;
56837
57804
  }
56838
57805
  return true;
56839
57806
  }
@@ -56940,926 +57907,61 @@ module.exports = {
56940
57907
 
56941
57908
  "use strict";
56942
57909
  /* provided dependency */ var Buffer = __webpack_require__(50621)["Buffer"];
56943
-
56944
-
56945
- var fs = __webpack_require__(48181);
56946
-
56947
- function ImageMeasure(pdfKitDoc, imageDictionary) {
56948
- this.pdfKitDoc = pdfKitDoc;
56949
- this.imageDictionary = imageDictionary || {};
56950
- }
56951
-
56952
- ImageMeasure.prototype.measureImage = function (src) {
56953
- var image;
56954
- var that = this;
56955
-
56956
- if (!this.pdfKitDoc._imageRegistry[src]) {
56957
- try {
56958
- image = this.pdfKitDoc.openImage(realImageSrc(src));
56959
- if (!image) {
56960
- throw 'No image';
56961
- }
56962
- } catch (error) {
56963
- throw 'Invalid image: ' + error.toString() + '\nImages dictionary should contain dataURL entries (or local file paths in node.js)';
56964
- }
56965
- image.embed(this.pdfKitDoc);
56966
- this.pdfKitDoc._imageRegistry[src] = image;
56967
- } else {
56968
- image = this.pdfKitDoc._imageRegistry[src];
56969
- }
56970
-
56971
- return { width: image.width, height: image.height };
56972
-
56973
- function realImageSrc(src) {
56974
- var img = that.imageDictionary[src];
56975
-
56976
- if (!img) {
56977
- return src;
56978
- }
56979
-
56980
- if (typeof img === 'object') {
56981
- throw 'Not supported image definition: ' + JSON.stringify(img);
56982
- }
56983
-
56984
- if (fs.existsSync(img)) {
56985
- return fs.readFileSync(img);
56986
- }
56987
-
56988
- var index = img.indexOf('base64,');
56989
- if (index < 0) {
56990
- return that.imageDictionary[src];
56991
- }
56992
-
56993
- return Buffer.from(img.substring(index + 7), 'base64');
56994
- }
56995
- };
56996
-
56997
- module.exports = ImageMeasure;
56998
-
56999
-
57000
- /***/ }),
57001
-
57002
- /***/ 25235:
57003
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
57004
-
57005
- "use strict";
57006
57910
 
57007
57911
 
57008
- var TraversalTracker = __webpack_require__(2318);
57009
- var DocPreprocessor = __webpack_require__(98883);
57010
- var DocMeasure = __webpack_require__(42526);
57011
- var DocumentContext = __webpack_require__(79178);
57012
- var PageElementWriter = __webpack_require__(11220);
57013
- var ColumnCalculator = __webpack_require__(77530);
57014
- var TableProcessor = __webpack_require__(89836);
57015
- var Line = __webpack_require__(70770);
57016
- var isString = (__webpack_require__(91867).isString);
57017
- var isArray = (__webpack_require__(91867).isArray);
57018
- var isUndefined = (__webpack_require__(91867).isUndefined);
57019
- var isNull = (__webpack_require__(91867).isNull);
57020
- var pack = (__webpack_require__(91867).pack);
57021
- var offsetVector = (__webpack_require__(91867).offsetVector);
57022
- var fontStringify = (__webpack_require__(91867).fontStringify);
57023
- var getNodeId = (__webpack_require__(91867).getNodeId);
57024
- var isFunction = (__webpack_require__(91867).isFunction);
57025
- var TextTools = __webpack_require__(11548);
57026
- var StyleContextStack = __webpack_require__(76442);
57027
- var isNumber = (__webpack_require__(91867).isNumber);
57028
-
57029
- function addAll(target, otherArray) {
57030
- otherArray.forEach(function (item) {
57031
- target.push(item);
57032
- });
57033
- }
57912
+ var fs = __webpack_require__(48181);
57034
57913
 
57035
- /**
57036
- * Creates an instance of LayoutBuilder - layout engine which turns document-definition-object
57037
- * into a set of pages, lines, inlines and vectors ready to be rendered into a PDF
57038
- *
57039
- * @param {Object} pageSize - an object defining page width and height
57040
- * @param {Object} pageMargins - an object defining top, left, right and bottom margins
57041
- */
57042
- function LayoutBuilder(pageSize, pageMargins, imageMeasure, svgMeasure) {
57043
- this.pageSize = pageSize;
57044
- this.pageMargins = pageMargins;
57045
- this.tracker = new TraversalTracker();
57046
- this.imageMeasure = imageMeasure;
57047
- this.svgMeasure = svgMeasure;
57048
- this.tableLayouts = {};
57049
- }
57050
-
57051
- LayoutBuilder.prototype.registerTableLayouts = function (tableLayouts) {
57052
- this.tableLayouts = pack(this.tableLayouts, tableLayouts);
57053
- };
57054
-
57055
- /**
57056
- * Executes layout engine on document-definition-object and creates an array of pages
57057
- * containing positioned Blocks, Lines and inlines
57058
- *
57059
- * @param {Object} docStructure document-definition-object
57060
- * @param {Object} fontProvider font provider
57061
- * @param {Object} styleDictionary dictionary with style definitions
57062
- * @param {Object} defaultStyle default style definition
57063
- * @return {Array} an array of pages
57064
- */
57065
- LayoutBuilder.prototype.layoutDocument = function (docStructure, fontProvider, styleDictionary, defaultStyle, background, header, footer, images, watermark, pageBreakBeforeFct) {
57066
-
57067
- function addPageBreaksIfNecessary(linearNodeList, pages) {
57068
-
57069
- if (!isFunction(pageBreakBeforeFct)) {
57070
- return false;
57071
- }
57072
-
57073
- linearNodeList = linearNodeList.filter(function (node) {
57074
- return node.positions.length > 0;
57075
- });
57076
-
57077
- linearNodeList.forEach(function (node) {
57078
- var nodeInfo = {};
57079
- [
57080
- 'id', 'text', 'ul', 'ol', 'table', 'image', 'qr', 'canvas', 'svg', 'columns',
57081
- 'headlineLevel', 'style', 'pageBreak', 'pageOrientation',
57082
- 'width', 'height'
57083
- ].forEach(function (key) {
57084
- if (node[key] !== undefined) {
57085
- nodeInfo[key] = node[key];
57086
- }
57087
- });
57088
- nodeInfo.startPosition = node.positions[0];
57089
- nodeInfo.pageNumbers = Array.from(new Set(node.positions.map(function (node) { return node.pageNumber; })));
57090
- nodeInfo.pages = pages.length;
57091
- nodeInfo.stack = isArray(node.stack);
57092
-
57093
- node.nodeInfo = nodeInfo;
57094
- });
57095
-
57096
- for (var index = 0; index < linearNodeList.length; index++) {
57097
- var node = linearNodeList[index];
57098
- if (node.pageBreak !== 'before' && !node.pageBreakCalculated) {
57099
- node.pageBreakCalculated = true;
57100
- var pageNumber = node.nodeInfo.pageNumbers[0];
57101
- var followingNodesOnPage = [];
57102
- var nodesOnNextPage = [];
57103
- var previousNodesOnPage = [];
57104
- if (pageBreakBeforeFct.length > 1) {
57105
- for (var ii = index + 1, l = linearNodeList.length; ii < l; ii++) {
57106
- if (linearNodeList[ii].nodeInfo.pageNumbers.indexOf(pageNumber) > -1) {
57107
- followingNodesOnPage.push(linearNodeList[ii].nodeInfo);
57108
- }
57109
- if (pageBreakBeforeFct.length > 2 && linearNodeList[ii].nodeInfo.pageNumbers.indexOf(pageNumber + 1) > -1) {
57110
- nodesOnNextPage.push(linearNodeList[ii].nodeInfo);
57111
- }
57112
- }
57113
- }
57114
- if (pageBreakBeforeFct.length > 3) {
57115
- for (var ii = 0; ii < index; ii++) {
57116
- if (linearNodeList[ii].nodeInfo.pageNumbers.indexOf(pageNumber) > -1) {
57117
- previousNodesOnPage.push(linearNodeList[ii].nodeInfo);
57118
- }
57119
- }
57120
- }
57121
- if (pageBreakBeforeFct(node.nodeInfo, followingNodesOnPage, nodesOnNextPage, previousNodesOnPage)) {
57122
- node.pageBreak = 'before';
57123
- return true;
57124
- }
57125
- }
57126
- }
57127
-
57128
- return false;
57129
- }
57130
-
57131
- this.docPreprocessor = new DocPreprocessor();
57132
- this.docMeasure = new DocMeasure(fontProvider, styleDictionary, defaultStyle, this.imageMeasure, this.svgMeasure, this.tableLayouts, images);
57133
-
57134
-
57135
- function resetXYs(result) {
57136
- result.linearNodeList.forEach(function (node) {
57137
- node.resetXY();
57138
- });
57139
- }
57140
-
57141
- var result = this.tryLayoutDocument(docStructure, fontProvider, styleDictionary, defaultStyle, background, header, footer, images, watermark);
57142
- while (addPageBreaksIfNecessary(result.linearNodeList, result.pages)) {
57143
- resetXYs(result);
57144
- result = this.tryLayoutDocument(docStructure, fontProvider, styleDictionary, defaultStyle, background, header, footer, images, watermark);
57145
- }
57146
-
57147
- return result.pages;
57148
- };
57149
-
57150
- LayoutBuilder.prototype.tryLayoutDocument = function (docStructure, fontProvider, styleDictionary, defaultStyle, background, header, footer, images, watermark, pageBreakBeforeFct) {
57151
-
57152
- this.linearNodeList = [];
57153
- docStructure = this.docPreprocessor.preprocessDocument(docStructure);
57154
- docStructure = this.docMeasure.measureDocument(docStructure);
57155
-
57156
- this.writer = new PageElementWriter(
57157
- new DocumentContext(this.pageSize, this.pageMargins), this.tracker);
57158
-
57159
- var _this = this;
57160
- this.writer.context().tracker.startTracking('pageAdded', function () {
57161
- _this.addBackground(background);
57162
- });
57163
-
57164
- this.addBackground(background);
57165
- this.processNode(docStructure);
57166
- this.addHeadersAndFooters(header, footer);
57167
- if (watermark != null) {
57168
- this.addWatermark(watermark, fontProvider, defaultStyle);
57169
- }
57170
-
57171
- return { pages: this.writer.context().pages, linearNodeList: this.linearNodeList };
57172
- };
57173
-
57174
-
57175
- LayoutBuilder.prototype.addBackground = function (background) {
57176
- var backgroundGetter = isFunction(background) ? background : function () {
57177
- return background;
57178
- };
57179
-
57180
- var context = this.writer.context();
57181
- var pageSize = context.getCurrentPage().pageSize;
57182
-
57183
- var pageBackground = backgroundGetter(context.page + 1, pageSize);
57184
-
57185
- if (pageBackground) {
57186
- this.writer.beginUnbreakableBlock(pageSize.width, pageSize.height);
57187
- pageBackground = this.docPreprocessor.preprocessDocument(pageBackground);
57188
- this.processNode(this.docMeasure.measureDocument(pageBackground));
57189
- this.writer.commitUnbreakableBlock(0, 0);
57190
- context.backgroundLength[context.page] += pageBackground.positions.length;
57191
- }
57192
- };
57193
-
57194
- LayoutBuilder.prototype.addStaticRepeatable = function (headerOrFooter, sizeFunction) {
57195
- this.addDynamicRepeatable(function () {
57196
- return JSON.parse(JSON.stringify(headerOrFooter)); // copy to new object
57197
- }, sizeFunction);
57198
- };
57199
-
57200
- LayoutBuilder.prototype.addDynamicRepeatable = function (nodeGetter, sizeFunction) {
57201
- var pages = this.writer.context().pages;
57202
-
57203
- for (var pageIndex = 0, l = pages.length; pageIndex < l; pageIndex++) {
57204
- this.writer.context().page = pageIndex;
57205
-
57206
- var node = nodeGetter(pageIndex + 1, l, this.writer.context().pages[pageIndex].pageSize);
57207
-
57208
- if (node) {
57209
- var sizes = sizeFunction(this.writer.context().getCurrentPage().pageSize, this.pageMargins);
57210
- this.writer.beginUnbreakableBlock(sizes.width, sizes.height);
57211
- node = this.docPreprocessor.preprocessDocument(node);
57212
- this.processNode(this.docMeasure.measureDocument(node));
57213
- this.writer.commitUnbreakableBlock(sizes.x, sizes.y);
57214
- }
57215
- }
57216
- };
57217
-
57218
- LayoutBuilder.prototype.addHeadersAndFooters = function (header, footer) {
57219
- var headerSizeFct = function (pageSize, pageMargins) {
57220
- return {
57221
- x: 0,
57222
- y: 0,
57223
- width: pageSize.width,
57224
- height: pageMargins.top
57225
- };
57226
- };
57227
-
57228
- var footerSizeFct = function (pageSize, pageMargins) {
57229
- return {
57230
- x: 0,
57231
- y: pageSize.height - pageMargins.bottom,
57232
- width: pageSize.width,
57233
- height: pageMargins.bottom
57234
- };
57235
- };
57236
-
57237
- if (isFunction(header)) {
57238
- this.addDynamicRepeatable(header, headerSizeFct);
57239
- } else if (header) {
57240
- this.addStaticRepeatable(header, headerSizeFct);
57241
- }
57242
-
57243
- if (isFunction(footer)) {
57244
- this.addDynamicRepeatable(footer, footerSizeFct);
57245
- } else if (footer) {
57246
- this.addStaticRepeatable(footer, footerSizeFct);
57247
- }
57248
- };
57249
-
57250
- LayoutBuilder.prototype.addWatermark = function (watermark, fontProvider, defaultStyle) {
57251
- if (isString(watermark)) {
57252
- watermark = { 'text': watermark };
57253
- }
57254
-
57255
- if (!watermark.text) { // empty watermark text
57256
- return;
57257
- }
57258
-
57259
- watermark.font = watermark.font || defaultStyle.font || 'Roboto';
57260
- watermark.fontSize = watermark.fontSize || 'auto';
57261
- watermark.color = watermark.color || 'black';
57262
- watermark.opacity = isNumber(watermark.opacity) ? watermark.opacity : 0.6;
57263
- watermark.bold = watermark.bold || false;
57264
- watermark.italics = watermark.italics || false;
57265
- watermark.angle = !isUndefined(watermark.angle) && !isNull(watermark.angle) ? watermark.angle : null;
57266
-
57267
- if (watermark.angle === null) {
57268
- watermark.angle = Math.atan2(this.pageSize.height, this.pageSize.width) * -180 / Math.PI;
57269
- }
57270
-
57271
- if (watermark.fontSize === 'auto') {
57272
- watermark.fontSize = getWatermarkFontSize(this.pageSize, watermark, fontProvider);
57273
- }
57274
-
57275
- var watermarkObject = {
57276
- text: watermark.text,
57277
- font: fontProvider.provideFont(watermark.font, watermark.bold, watermark.italics),
57278
- fontSize: watermark.fontSize,
57279
- color: watermark.color,
57280
- opacity: watermark.opacity,
57281
- angle: watermark.angle
57282
- };
57283
-
57284
- watermarkObject._size = getWatermarkSize(watermark, fontProvider);
57285
-
57286
- var pages = this.writer.context().pages;
57287
- for (var i = 0, l = pages.length; i < l; i++) {
57288
- pages[i].watermark = watermarkObject;
57289
- }
57290
-
57291
- function getWatermarkSize(watermark, fontProvider) {
57292
- var textTools = new TextTools(fontProvider);
57293
- var styleContextStack = new StyleContextStack(null, { font: watermark.font, bold: watermark.bold, italics: watermark.italics });
57294
-
57295
- styleContextStack.push({
57296
- fontSize: watermark.fontSize
57297
- });
57298
-
57299
- var size = textTools.sizeOfString(watermark.text, styleContextStack);
57300
- var rotatedSize = textTools.sizeOfRotatedText(watermark.text, watermark.angle, styleContextStack);
57301
-
57302
- return { size: size, rotatedSize: rotatedSize };
57303
- }
57304
-
57305
- function getWatermarkFontSize(pageSize, watermark, fontProvider) {
57306
- var textTools = new TextTools(fontProvider);
57307
- var styleContextStack = new StyleContextStack(null, { font: watermark.font, bold: watermark.bold, italics: watermark.italics });
57308
- var rotatedSize;
57309
-
57310
- /**
57311
- * Binary search the best font size.
57312
- * Initial bounds [0, 1000]
57313
- * Break when range < 1
57314
- */
57315
- var a = 0;
57316
- var b = 1000;
57317
- var c = (a + b) / 2;
57318
- while (Math.abs(a - b) > 1) {
57319
- styleContextStack.push({
57320
- fontSize: c
57321
- });
57322
- rotatedSize = textTools.sizeOfRotatedText(watermark.text, watermark.angle, styleContextStack);
57323
- if (rotatedSize.width > pageSize.width) {
57324
- b = c;
57325
- c = (a + b) / 2;
57326
- } else if (rotatedSize.width < pageSize.width) {
57327
- if (rotatedSize.height > pageSize.height) {
57328
- b = c;
57329
- c = (a + b) / 2;
57330
- } else {
57331
- a = c;
57332
- c = (a + b) / 2;
57333
- }
57334
- }
57335
- styleContextStack.pop();
57336
- }
57337
- /*
57338
- End binary search
57339
- */
57340
- return c;
57341
- }
57342
- };
57343
-
57344
- function decorateNode(node) {
57345
- var x = node.x, y = node.y;
57346
- node.positions = [];
57347
-
57348
- if (isArray(node.canvas)) {
57349
- node.canvas.forEach(function (vector) {
57350
- var x = vector.x, y = vector.y, x1 = vector.x1, y1 = vector.y1, x2 = vector.x2, y2 = vector.y2;
57351
- vector.resetXY = function () {
57352
- vector.x = x;
57353
- vector.y = y;
57354
- vector.x1 = x1;
57355
- vector.y1 = y1;
57356
- vector.x2 = x2;
57357
- vector.y2 = y2;
57358
- };
57359
- });
57360
- }
57361
-
57362
- node.resetXY = function () {
57363
- node.x = x;
57364
- node.y = y;
57365
- if (isArray(node.canvas)) {
57366
- node.canvas.forEach(function (vector) {
57367
- vector.resetXY();
57368
- });
57369
- }
57370
- };
57371
- }
57372
-
57373
- LayoutBuilder.prototype.processNode = function (node) {
57374
- var self = this;
57375
-
57376
- this.linearNodeList.push(node);
57377
- decorateNode(node);
57378
-
57379
- applyMargins(function () {
57380
- var unbreakable = node.unbreakable;
57381
- if (unbreakable) {
57382
- self.writer.beginUnbreakableBlock();
57383
- }
57384
-
57385
- var absPosition = node.absolutePosition;
57386
- if (absPosition) {
57387
- self.writer.context().beginDetachedBlock();
57388
- self.writer.context().moveTo(absPosition.x || 0, absPosition.y || 0);
57389
- }
57390
-
57391
- var relPosition = node.relativePosition;
57392
- if (relPosition) {
57393
- self.writer.context().beginDetachedBlock();
57394
- self.writer.context().moveToRelative(relPosition.x || 0, relPosition.y || 0);
57395
- }
57396
-
57397
- if (node.stack) {
57398
- self.processVerticalContainer(node);
57399
- } else if (node.columns) {
57400
- self.processColumns(node);
57401
- } else if (node.ul) {
57402
- self.processList(false, node);
57403
- } else if (node.ol) {
57404
- self.processList(true, node);
57405
- } else if (node.table) {
57406
- self.processTable(node);
57407
- } else if (node.text !== undefined) {
57408
- self.processLeaf(node);
57409
- } else if (node.toc) {
57410
- self.processToc(node);
57411
- } else if (node.image) {
57412
- self.processImage(node);
57413
- } else if (node.svg) {
57414
- self.processSVG(node);
57415
- } else if (node.canvas) {
57416
- self.processCanvas(node);
57417
- } else if (node.qr) {
57418
- self.processQr(node);
57419
- } else if (!node._span) {
57420
- throw 'Unrecognized document structure: ' + JSON.stringify(node, fontStringify);
57421
- }
57422
-
57423
- if (absPosition || relPosition) {
57424
- self.writer.context().endDetachedBlock();
57425
- }
57426
-
57427
- if (unbreakable) {
57428
- self.writer.commitUnbreakableBlock();
57429
- }
57430
- });
57431
-
57432
- function applyMargins(callback) {
57433
- var margin = node._margin;
57434
-
57435
- if (node.pageBreak === 'before') {
57436
- self.writer.moveToNextPage(node.pageOrientation);
57437
- } else if (node.pageBreak === 'beforeOdd') {
57438
- self.writer.moveToNextPage(node.pageOrientation);
57439
- if ((self.writer.context().page + 1) % 2 === 1) {
57440
- self.writer.moveToNextPage(node.pageOrientation);
57441
- }
57442
- } else if (node.pageBreak === 'beforeEven') {
57443
- self.writer.moveToNextPage(node.pageOrientation);
57444
- if ((self.writer.context().page + 1) % 2 === 0) {
57445
- self.writer.moveToNextPage(node.pageOrientation);
57446
- }
57447
- }
57448
-
57449
- if (margin) {
57450
- self.writer.context().moveDown(margin[1]);
57451
- self.writer.context().addMargin(margin[0], margin[2]);
57452
- }
57453
-
57454
- callback();
57455
-
57456
- if (margin) {
57457
- self.writer.context().addMargin(-margin[0], -margin[2]);
57458
- self.writer.context().moveDown(margin[3]);
57459
- }
57460
-
57461
- if (node.pageBreak === 'after') {
57462
- self.writer.moveToNextPage(node.pageOrientation);
57463
- } else if (node.pageBreak === 'afterOdd') {
57464
- self.writer.moveToNextPage(node.pageOrientation);
57465
- if ((self.writer.context().page + 1) % 2 === 1) {
57466
- self.writer.moveToNextPage(node.pageOrientation);
57467
- }
57468
- } else if (node.pageBreak === 'afterEven') {
57469
- self.writer.moveToNextPage(node.pageOrientation);
57470
- if ((self.writer.context().page + 1) % 2 === 0) {
57471
- self.writer.moveToNextPage(node.pageOrientation);
57472
- }
57473
- }
57474
- }
57475
- };
57476
-
57477
- // vertical container
57478
- LayoutBuilder.prototype.processVerticalContainer = function (node) {
57479
- var self = this;
57480
- node.stack.forEach(function (item) {
57481
- self.processNode(item);
57482
- addAll(node.positions, item.positions);
57483
-
57484
- //TODO: paragraph gap
57485
- });
57486
- };
57487
-
57488
- // columns
57489
- LayoutBuilder.prototype.processColumns = function (columnNode) {
57490
- var columns = columnNode.columns;
57491
- var availableWidth = this.writer.context().availableWidth;
57492
- var gaps = gapArray(columnNode._gap);
57493
-
57494
- if (gaps) {
57495
- availableWidth -= (gaps.length - 1) * columnNode._gap;
57496
- }
57497
-
57498
- ColumnCalculator.buildColumnWidths(columns, availableWidth);
57499
- var result = this.processRow(columns, columns, gaps);
57500
- addAll(columnNode.positions, result.positions);
57501
-
57502
-
57503
- function gapArray(gap) {
57504
- if (!gap) {
57505
- return null;
57506
- }
57507
-
57508
- var gaps = [];
57509
- gaps.push(0);
57510
-
57511
- for (var i = columns.length - 1; i > 0; i--) {
57512
- gaps.push(gap);
57513
- }
57514
-
57515
- return gaps;
57516
- }
57517
- };
57518
-
57519
- LayoutBuilder.prototype.findStartingSpanCell = function (arr, i) {
57520
- let requiredColspan = 1;
57521
- for (let index = i - 1; index >= 0; index--) {
57522
- if (!arr[index]._span) {
57523
- if (arr[index].rowSpan > 1 && (arr[index].colSpan || 1) === requiredColspan) {
57524
- return arr[index];
57525
- } else {
57526
- return null;
57527
- }
57528
- }
57529
- requiredColspan++;
57530
- }
57531
- return null;
57914
+ function ImageMeasure(pdfKitDoc, imageDictionary) {
57915
+ this.pdfKitDoc = pdfKitDoc;
57916
+ this.imageDictionary = imageDictionary || {};
57532
57917
  }
57533
57918
 
57534
- LayoutBuilder.prototype.processRow = function (columns, widths, gaps, tableBody, tableRow, height) {
57535
- var self = this;
57536
- var pageBreaks = [], positions = [];
57537
-
57538
- this.tracker.auto('pageChanged', storePageBreakData, function () {
57539
- widths = widths || columns;
57540
-
57541
- self.writer.context().beginColumnGroup();
57542
-
57543
- for (var i = 0, l = columns.length; i < l; i++) {
57544
- var column = columns[i];
57545
- var width = widths[i]._calcWidth;
57546
- var leftOffset = colLeftOffset(i);
57547
-
57548
- if (column.colSpan && column.colSpan > 1) {
57549
- for (var j = 1; j < column.colSpan; j++) {
57550
- width += widths[++i]._calcWidth + gaps[i];
57551
- }
57552
- }
57553
-
57554
- // if rowspan starts in this cell, we retrieve the last cell affected by the rowspan
57555
- var endingCell = getEndingCell(column, i);
57556
- if (endingCell) {
57557
- // We store a reference of the ending cell in the first cell of the rowspan
57558
- column._endingCell = endingCell;
57559
- }
57560
-
57561
- // Check if exists and retrieve the cell that started the rowspan in case we are in the cell just after
57562
- var startingSpanCell = self.findStartingSpanCell(columns, i);
57563
- var endingSpanCell = null;
57564
- if (startingSpanCell && startingSpanCell._endingCell) {
57565
- // Reference to the last cell of the rowspan
57566
- endingSpanCell = startingSpanCell._endingCell;
57567
- }
57568
-
57569
- // We pass the endingSpanCell reference to store the context just after processing rowspan cell
57570
- self.writer.context().beginColumn(width, leftOffset, endingSpanCell);
57571
- if (!column._span) {
57572
- self.processNode(column);
57573
- addAll(positions, column.positions);
57574
- } else if (column._columnEndingContext) {
57575
- // row-span ending
57576
- // Recover the context after processing the rowspanned cell
57577
- self.writer.context().markEnding(column);
57578
- }
57579
- }
57580
-
57581
- // Check if last cell is part of a span
57582
- var endingSpanCell = null;
57583
- var lastColumn = columns.length > 0 ? columns[columns.length - 1] : null;
57584
- if (lastColumn) {
57585
- // Previous column cell has a rowspan
57586
- if (lastColumn._endingCell) {
57587
- endingSpanCell = lastColumn._endingCell;
57588
- // Previous column cell is part of a span
57589
- } else if (lastColumn._span === true) {
57590
- // We get the cell that started the span where we set a reference to the ending cell
57591
- var startingSpanCell = self.findStartingSpanCell(columns, columns.length);
57592
- if (startingSpanCell) {
57593
- // Context will be stored here (ending cell)
57594
- endingSpanCell = startingSpanCell._endingCell;
57595
- }
57596
- }
57597
- }
57598
-
57599
- self.writer.context().completeColumnGroup(height, endingSpanCell);
57600
- });
57601
-
57602
- return { pageBreaks: pageBreaks, positions: positions };
57603
-
57604
- function storePageBreakData(data) {
57605
- var pageDesc;
57606
-
57607
- for (var i = 0, l = pageBreaks.length; i < l; i++) {
57608
- var desc = pageBreaks[i];
57609
- if (desc.prevPage === data.prevPage) {
57610
- pageDesc = desc;
57611
- break;
57612
- }
57613
- }
57614
-
57615
- if (!pageDesc) {
57616
- pageDesc = data;
57617
- pageBreaks.push(pageDesc);
57618
- }
57619
- pageDesc.prevY = Math.max(pageDesc.prevY, data.prevY);
57620
- pageDesc.y = Math.min(pageDesc.y, data.y);
57621
- }
57622
-
57623
- function colLeftOffset(i) {
57624
- if (gaps && gaps.length > i) {
57625
- return gaps[i];
57626
- }
57627
- return 0;
57628
- }
57629
-
57630
- function getEndingCell(column, columnIndex) {
57631
- if (column.rowSpan && column.rowSpan > 1) {
57632
- var endingRow = tableRow + column.rowSpan - 1;
57633
- if (endingRow >= tableBody.length) {
57634
- throw 'Row span for column ' + columnIndex + ' (with indexes starting from 0) exceeded row count';
57635
- }
57636
- return tableBody[endingRow][columnIndex];
57637
- }
57638
-
57639
- return null;
57640
- }
57641
- };
57642
-
57643
- // lists
57644
- LayoutBuilder.prototype.processList = function (orderedList, node) {
57645
- var self = this,
57646
- items = orderedList ? node.ol : node.ul,
57647
- gapSize = node._gapSize;
57648
-
57649
- this.writer.context().addMargin(gapSize.width);
57650
-
57651
- var nextMarker;
57652
- this.tracker.auto('lineAdded', addMarkerToFirstLeaf, function () {
57653
- items.forEach(function (item) {
57654
- nextMarker = item.listMarker;
57655
- self.processNode(item);
57656
- addAll(node.positions, item.positions);
57657
- });
57658
- });
57919
+ ImageMeasure.prototype.measureImage = function (src) {
57920
+ var image;
57921
+ var that = this;
57659
57922
 
57660
- this.writer.context().addMargin(-gapSize.width);
57661
-
57662
- function addMarkerToFirstLeaf(line) {
57663
- // I'm not very happy with the way list processing is implemented
57664
- // (both code and algorithm should be rethinked)
57665
- if (nextMarker) {
57666
- var marker = nextMarker;
57667
- nextMarker = null;
57668
-
57669
- if (marker.canvas) {
57670
- var vector = marker.canvas[0];
57671
-
57672
- offsetVector(vector, -marker._minWidth, 0);
57673
- self.writer.addVector(vector);
57674
- } else if (marker._inlines) {
57675
- var markerLine = new Line(self.pageSize.width);
57676
- markerLine.addInline(marker._inlines[0]);
57677
- markerLine.x = -marker._minWidth;
57678
- markerLine.y = line.getAscenderHeight() - markerLine.getAscenderHeight();
57679
- self.writer.addLine(markerLine, true);
57923
+ if (!this.pdfKitDoc._imageRegistry[src]) {
57924
+ try {
57925
+ image = this.pdfKitDoc.openImage(realImageSrc(src));
57926
+ if (!image) {
57927
+ throw 'No image';
57680
57928
  }
57929
+ } catch (error) {
57930
+ throw 'Invalid image: ' + error.toString() + '\nImages dictionary should contain dataURL entries (or local file paths in node.js)';
57681
57931
  }
57682
- }
57683
- };
57684
-
57685
- // tables
57686
- LayoutBuilder.prototype.processTable = function (tableNode) {
57687
- var processor = new TableProcessor(tableNode);
57688
-
57689
- processor.beginTable(this.writer);
57690
-
57691
- var rowHeights = tableNode.table.heights;
57692
- for (var i = 0, l = tableNode.table.body.length; i < l; i++) {
57693
- processor.beginRow(i, this.writer);
57694
-
57695
- var height;
57696
- if (isFunction(rowHeights)) {
57697
- height = rowHeights(i);
57698
- } else if (isArray(rowHeights)) {
57699
- height = rowHeights[i];
57700
- } else {
57701
- height = rowHeights;
57702
- }
57703
-
57704
- if (height === 'auto') {
57705
- height = undefined;
57706
- }
57707
-
57708
- var result = this.processRow(tableNode.table.body[i], tableNode.table.widths, tableNode._offsets.offsets, tableNode.table.body, i, height);
57709
- addAll(tableNode.positions, result.positions);
57710
-
57711
- processor.endRow(i, this.writer, result.pageBreaks);
57712
- }
57713
-
57714
- processor.endTable(this.writer);
57715
- };
57716
-
57717
- // leafs (texts)
57718
- LayoutBuilder.prototype.processLeaf = function (node) {
57719
- var line = this.buildNextLine(node);
57720
- if (line && (node.tocItem || node.id)) {
57721
- line._node = node;
57722
- }
57723
- var currentHeight = (line) ? line.getHeight() : 0;
57724
- var maxHeight = node.maxHeight || -1;
57725
-
57726
- if (line) {
57727
- var nodeId = getNodeId(node);
57728
- if (nodeId) {
57729
- line.id = nodeId;
57730
- }
57932
+ image.embed(this.pdfKitDoc);
57933
+ this.pdfKitDoc._imageRegistry[src] = image;
57934
+ } else {
57935
+ image = this.pdfKitDoc._imageRegistry[src];
57731
57936
  }
57732
57937
 
57733
- if (node._tocItemRef) {
57734
- line._pageNodeRef = node._tocItemRef;
57735
- }
57938
+ return { width: image.width, height: image.height };
57736
57939
 
57737
- if (node._pageRef) {
57738
- line._pageNodeRef = node._pageRef._nodeRef;
57739
- }
57940
+ function realImageSrc(src) {
57941
+ var img = that.imageDictionary[src];
57740
57942
 
57741
- if (line && line.inlines && isArray(line.inlines)) {
57742
- for (var i = 0, l = line.inlines.length; i < l; i++) {
57743
- if (line.inlines[i]._tocItemRef) {
57744
- line.inlines[i]._pageNodeRef = line.inlines[i]._tocItemRef;
57745
- }
57746
-
57747
- if (line.inlines[i]._pageRef) {
57748
- line.inlines[i]._pageNodeRef = line.inlines[i]._pageRef._nodeRef;
57749
- }
57943
+ if (!img) {
57944
+ return src;
57750
57945
  }
57751
- }
57752
57946
 
57753
- while (line && (maxHeight === -1 || currentHeight < maxHeight)) {
57754
- var positions = this.writer.addLine(line);
57755
- node.positions.push(positions);
57756
- line = this.buildNextLine(node);
57757
- if (line) {
57758
- currentHeight += line.getHeight();
57947
+ if (typeof img === 'object') {
57948
+ throw 'Not supported image definition: ' + JSON.stringify(img);
57759
57949
  }
57760
- }
57761
- };
57762
-
57763
- LayoutBuilder.prototype.processToc = function (node) {
57764
- if (node.toc.title) {
57765
- this.processNode(node.toc.title);
57766
- }
57767
- if (node.toc._table) {
57768
- this.processNode(node.toc._table);
57769
- }
57770
- };
57771
-
57772
- LayoutBuilder.prototype.buildNextLine = function (textNode) {
57773
57950
 
57774
- function cloneInline(inline) {
57775
- var newInline = inline.constructor();
57776
- for (var key in inline) {
57777
- newInline[key] = inline[key];
57951
+ if (fs.existsSync(img)) {
57952
+ return fs.readFileSync(img);
57778
57953
  }
57779
- return newInline;
57780
- }
57781
57954
 
57782
- if (!textNode._inlines || textNode._inlines.length === 0) {
57783
- return null;
57784
- }
57785
-
57786
- var line = new Line(this.writer.context().availableWidth);
57787
- var textTools = new TextTools(null);
57788
-
57789
- var isForceContinue = false;
57790
- while (textNode._inlines && textNode._inlines.length > 0 &&
57791
- (line.hasEnoughSpaceForInline(textNode._inlines[0], textNode._inlines.slice(1)) || isForceContinue)) {
57792
- var isHardWrap = false;
57793
- var inline = textNode._inlines.shift();
57794
- isForceContinue = false;
57795
-
57796
- if (!inline.noWrap && inline.text.length > 1 && inline.width > line.getAvailableWidth()) {
57797
- var widthPerChar = inline.width / inline.text.length;
57798
- var maxChars = Math.floor(line.getAvailableWidth() / widthPerChar);
57799
- if (maxChars < 1) {
57800
- maxChars = 1;
57801
- }
57802
- if (maxChars < inline.text.length) {
57803
- var newInline = cloneInline(inline);
57804
-
57805
- newInline.text = inline.text.substr(maxChars);
57806
- inline.text = inline.text.substr(0, maxChars);
57807
-
57808
- newInline.width = textTools.widthOfString(newInline.text, newInline.font, newInline.fontSize, newInline.characterSpacing, newInline.fontFeatures);
57809
- inline.width = textTools.widthOfString(inline.text, inline.font, inline.fontSize, inline.characterSpacing, inline.fontFeatures);
57810
-
57811
- textNode._inlines.unshift(newInline);
57812
- isHardWrap = true;
57813
- }
57955
+ var index = img.indexOf('base64,');
57956
+ if (index < 0) {
57957
+ return that.imageDictionary[src];
57814
57958
  }
57815
57959
 
57816
- line.addInline(inline);
57817
-
57818
- isForceContinue = inline.noNewLine && !isHardWrap;
57819
- }
57820
-
57821
- line.lastLineInParagraph = textNode._inlines.length === 0;
57822
-
57823
- return line;
57824
- };
57825
-
57826
- // images
57827
- LayoutBuilder.prototype.processImage = function (node) {
57828
- var position = this.writer.addImage(node);
57829
- node.positions.push(position);
57830
- };
57831
-
57832
- LayoutBuilder.prototype.processSVG = function (node) {
57833
- var position = this.writer.addSVG(node);
57834
- node.positions.push(position);
57835
- };
57836
-
57837
- LayoutBuilder.prototype.processCanvas = function (node) {
57838
- var height = node._minHeight;
57839
-
57840
- if (node.absolutePosition === undefined && this.writer.context().availableHeight < height) {
57841
- // TODO: support for canvas larger than a page
57842
- // TODO: support for other overflow methods
57843
-
57844
- this.writer.moveToNextPage();
57960
+ return Buffer.from(img.substring(index + 7), 'base64');
57845
57961
  }
57846
-
57847
- this.writer.alignCanvas(node);
57848
-
57849
- node.canvas.forEach(function (vector) {
57850
- var position = this.writer.addVector(vector);
57851
- node.positions.push(position);
57852
- }, this);
57853
-
57854
- this.writer.context().moveDown(height);
57855
57962
  };
57856
57963
 
57857
- LayoutBuilder.prototype.processQr = function (node) {
57858
- var position = this.writer.addQr(node);
57859
- node.positions.push(position);
57860
- };
57861
-
57862
- module.exports = LayoutBuilder;
57964
+ module.exports = ImageMeasure;
57863
57965
 
57864
57966
 
57865
57967
  /***/ }),
@@ -58155,7 +58257,7 @@ function _interopDefault(ex) {
58155
58257
  return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex;
58156
58258
  }
58157
58259
 
58158
- var PdfKit = _interopDefault(__webpack_require__(82759));
58260
+ var PdfKit = _interopDefault(__webpack_require__(2500));
58159
58261
 
58160
58262
  function getEngineInstance() {
58161
58263
  return PdfKit;
@@ -58183,7 +58285,7 @@ module.exports = {
58183
58285
 
58184
58286
  var PdfKitEngine = __webpack_require__(85208);
58185
58287
  var FontProvider = __webpack_require__(28284);
58186
- var LayoutBuilder = __webpack_require__(25235);
58288
+ var LayoutBuilder = __webpack_require__(8191);
58187
58289
  var sizes = __webpack_require__(70098);
58188
58290
  var ImageMeasure = __webpack_require__(93415);
58189
58291
  var SVGMeasure = __webpack_require__(89638);
@@ -58305,7 +58407,7 @@ PdfPrinter.prototype.createPdfKitDocument = function (docDefinition, options) {
58305
58407
  userPassword: docDefinition.userPassword,
58306
58408
  ownerPassword: docDefinition.ownerPassword,
58307
58409
  permissions: docDefinition.permissions,
58308
- lang: docDefinition.language,
58410
+ lang: docDefinition.language,
58309
58411
  fontLayoutCache: isBoolean(options.fontLayoutCache) ? options.fontLayoutCache : true,
58310
58412
  bufferPages: options.bufferPages || false,
58311
58413
  autoFirstPage: false,
@@ -60025,7 +60127,7 @@ TableProcessor.prototype.beginTable = function (writer) {
60025
60127
  const keepWithHeaderRows = tableNode.table.keepWithHeaderRows;
60026
60128
 
60027
60129
  if (isPositiveInteger(keepWithHeaderRows)) {
60028
- this.rowsWithoutPageBreak += keepWithHeaderRows;
60130
+ this.rowsWithoutPageBreak += keepWithHeaderRows;
60029
60131
  }
60030
60132
  }
60031
60133
 
@@ -60458,7 +60560,9 @@ TableProcessor.prototype.endRow = function (rowIndex, writer, pageBreaks) {
60458
60560
  h: bgHeight,
60459
60561
  lineWidth: 0,
60460
60562
  color: fillColor,
60461
- fillOpacity: fillOpacity
60563
+ fillOpacity: fillOpacity,
60564
+ // mark if we are in an unbreakable block
60565
+ _isFillColorFromUnbreakable: !!writer.transactionLevel
60462
60566
  }, false, true, writer.context().backgroundLength[writer.context().page]);
60463
60567
  }
60464
60568
 
@@ -60849,7 +60953,7 @@ TextTools.prototype.sizeOfRotatedText = function (text, angle, styleContextStack
60849
60953
  width: Math.abs(size.height * Math.sin(angleRad)) + Math.abs(size.width * Math.cos(angleRad)),
60850
60954
  height: Math.abs(size.width * Math.sin(angleRad)) + Math.abs(size.height * Math.cos(angleRad))
60851
60955
  };
60852
- }
60956
+ };
60853
60957
 
60854
60958
  TextTools.prototype.widthOfString = function (text, font, fontSize, characterSpacing, fontFeatures) {
60855
60959
  return widthOfString(text, font, fontSize, characterSpacing, fontFeatures);
@@ -61057,7 +61161,7 @@ function measure(fontProvider, textArray, styleContextStack) {
61057
61161
 
61058
61162
  if ((sup || sub) && item.fontSize === undefined) {
61059
61163
  // font size reduction taken from here: https://en.wikipedia.org/wiki/Subscript_and_superscript#Desktop_publishing
61060
- fontSize *= 0.58
61164
+ fontSize *= 0.58;
61061
61165
  }
61062
61166
 
61063
61167
  var font = fontProvider.provideFont(fontName, bold, italics);
@@ -61167,7 +61271,7 @@ module.exports = TraversalTracker;
61167
61271
 
61168
61272
  /***/ }),
61169
61273
 
61170
- /***/ 42616:
61274
+ /***/ 65209:
61171
61275
  /***/ (function(module, exports, __webpack_require__) {
61172
61276
 
61173
61277
  var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function(a,b){if(true)!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (b),
@@ -65186,7 +65290,7 @@ var CmapProcessor = (_class = /*#__PURE__*/function () {
65186
65290
  }
65187
65291
  };
65188
65292
  return CmapProcessor;
65189
- }(), (_applyDecoratedDescriptor(_class.prototype, "getCharacterSet", [cache], Object.getOwnPropertyDescriptor(_class.prototype, "getCharacterSet"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "codePointsForGlyph", [cache], Object.getOwnPropertyDescriptor(_class.prototype, "codePointsForGlyph"), _class.prototype)), _class);
65293
+ }(), _applyDecoratedDescriptor(_class.prototype, "getCharacterSet", [cache], Object.getOwnPropertyDescriptor(_class.prototype, "getCharacterSet"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "codePointsForGlyph", [cache], Object.getOwnPropertyDescriptor(_class.prototype, "codePointsForGlyph"), _class.prototype), _class);
65190
65294
  var KernProcessor = /*#__PURE__*/function () {
65191
65295
  function KernProcessor(font) {
65192
65296
  this.kern = font.kern;
@@ -70744,7 +70848,7 @@ var Glyph = (_class$3 = /*#__PURE__*/function () {
70744
70848
  return this._getName();
70745
70849
  }
70746
70850
  }]);
70747
- }(), (_applyDecoratedDescriptor(_class$3.prototype, "cbox", [cache], Object.getOwnPropertyDescriptor(_class$3.prototype, "cbox"), _class$3.prototype), _applyDecoratedDescriptor(_class$3.prototype, "bbox", [cache], Object.getOwnPropertyDescriptor(_class$3.prototype, "bbox"), _class$3.prototype), _applyDecoratedDescriptor(_class$3.prototype, "path", [cache], Object.getOwnPropertyDescriptor(_class$3.prototype, "path"), _class$3.prototype), _applyDecoratedDescriptor(_class$3.prototype, "advanceWidth", [cache], Object.getOwnPropertyDescriptor(_class$3.prototype, "advanceWidth"), _class$3.prototype), _applyDecoratedDescriptor(_class$3.prototype, "advanceHeight", [cache], Object.getOwnPropertyDescriptor(_class$3.prototype, "advanceHeight"), _class$3.prototype), _applyDecoratedDescriptor(_class$3.prototype, "name", [cache], Object.getOwnPropertyDescriptor(_class$3.prototype, "name"), _class$3.prototype)), _class$3);
70851
+ }(), _applyDecoratedDescriptor(_class$3.prototype, "cbox", [cache], Object.getOwnPropertyDescriptor(_class$3.prototype, "cbox"), _class$3.prototype), _applyDecoratedDescriptor(_class$3.prototype, "bbox", [cache], Object.getOwnPropertyDescriptor(_class$3.prototype, "bbox"), _class$3.prototype), _applyDecoratedDescriptor(_class$3.prototype, "path", [cache], Object.getOwnPropertyDescriptor(_class$3.prototype, "path"), _class$3.prototype), _applyDecoratedDescriptor(_class$3.prototype, "advanceWidth", [cache], Object.getOwnPropertyDescriptor(_class$3.prototype, "advanceWidth"), _class$3.prototype), _applyDecoratedDescriptor(_class$3.prototype, "advanceHeight", [cache], Object.getOwnPropertyDescriptor(_class$3.prototype, "advanceHeight"), _class$3.prototype), _applyDecoratedDescriptor(_class$3.prototype, "name", [cache], Object.getOwnPropertyDescriptor(_class$3.prototype, "name"), _class$3.prototype), _class$3);
70748
70852
  var GlyfHeader = new r.Struct({
70749
70853
  numberOfContours: r.int16,
70750
70854
  // if negative, this is a composite glyph
@@ -73136,7 +73240,7 @@ var TTFFont = (_class$4 = /*#__PURE__*/function () {
73136
73240
  return new GlyphVariationProcessor(this, variationCoords);
73137
73241
  }
73138
73242
  }]);
73139
- }(), (_applyDecoratedDescriptor(_class$4.prototype, "bbox", [cache], Object.getOwnPropertyDescriptor(_class$4.prototype, "bbox"), _class$4.prototype), _applyDecoratedDescriptor(_class$4.prototype, "_cmapProcessor", [cache], Object.getOwnPropertyDescriptor(_class$4.prototype, "_cmapProcessor"), _class$4.prototype), _applyDecoratedDescriptor(_class$4.prototype, "characterSet", [cache], Object.getOwnPropertyDescriptor(_class$4.prototype, "characterSet"), _class$4.prototype), _applyDecoratedDescriptor(_class$4.prototype, "_layoutEngine", [cache], Object.getOwnPropertyDescriptor(_class$4.prototype, "_layoutEngine"), _class$4.prototype), _applyDecoratedDescriptor(_class$4.prototype, "variationAxes", [cache], Object.getOwnPropertyDescriptor(_class$4.prototype, "variationAxes"), _class$4.prototype), _applyDecoratedDescriptor(_class$4.prototype, "namedVariations", [cache], Object.getOwnPropertyDescriptor(_class$4.prototype, "namedVariations"), _class$4.prototype), _applyDecoratedDescriptor(_class$4.prototype, "_variationProcessor", [cache], Object.getOwnPropertyDescriptor(_class$4.prototype, "_variationProcessor"), _class$4.prototype)), _class$4);
73243
+ }(), _applyDecoratedDescriptor(_class$4.prototype, "bbox", [cache], Object.getOwnPropertyDescriptor(_class$4.prototype, "bbox"), _class$4.prototype), _applyDecoratedDescriptor(_class$4.prototype, "_cmapProcessor", [cache], Object.getOwnPropertyDescriptor(_class$4.prototype, "_cmapProcessor"), _class$4.prototype), _applyDecoratedDescriptor(_class$4.prototype, "characterSet", [cache], Object.getOwnPropertyDescriptor(_class$4.prototype, "characterSet"), _class$4.prototype), _applyDecoratedDescriptor(_class$4.prototype, "_layoutEngine", [cache], Object.getOwnPropertyDescriptor(_class$4.prototype, "_layoutEngine"), _class$4.prototype), _applyDecoratedDescriptor(_class$4.prototype, "variationAxes", [cache], Object.getOwnPropertyDescriptor(_class$4.prototype, "variationAxes"), _class$4.prototype), _applyDecoratedDescriptor(_class$4.prototype, "namedVariations", [cache], Object.getOwnPropertyDescriptor(_class$4.prototype, "namedVariations"), _class$4.prototype), _applyDecoratedDescriptor(_class$4.prototype, "_variationProcessor", [cache], Object.getOwnPropertyDescriptor(_class$4.prototype, "_variationProcessor"), _class$4.prototype), _class$4);
73140
73244
  var WOFFDirectoryEntry = new r.Struct({
73141
73245
  tag: new r.String(4),
73142
73246
  offset: new r.Pointer(r.uint32, 'void', {