@hmcts/media-viewer 2.9.3 → 2.9.4-RC.7

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.
Files changed (105) hide show
  1. package/assets/images/icon-bookmarks-custom.png +0 -0
  2. package/assets/images/icon-bookmarks-position.png +0 -0
  3. package/assets/images/toolbarButton-bookmarkDark.png +0 -0
  4. package/assets/sass/comment-set-panel.scss +1 -0
  5. package/assets/sass/comment.scss +4 -6
  6. package/assets/sass/image-viewer.scss +2 -1
  7. package/assets/sass/pdf-viewer.scss +4 -0
  8. package/assets/sass/toolbar/buttons.scss +24 -0
  9. package/assets/sass/toolbar/main-toolbar.scss +20 -7
  10. package/assets/sass/toolbar/side-bar.scss +17 -17
  11. package/bundles/hmcts-media-viewer.umd.js +744 -324
  12. package/bundles/hmcts-media-viewer.umd.js.map +1 -1
  13. package/bundles/hmcts-media-viewer.umd.min.js +1 -1
  14. package/bundles/hmcts-media-viewer.umd.min.js.map +1 -1
  15. package/esm2015/hmcts-media-viewer.js +53 -52
  16. package/esm2015/lib/annotations/annotation-set/annotation-create/box-highlight-create/box-highlight-create.component.js +2 -2
  17. package/esm2015/lib/annotations/annotation-set/annotation-create/highlight-create/highlight-create.directive.js +2 -2
  18. package/esm2015/lib/annotations/annotation-set/annotation-create/highlight-create/highlight-create.service.js +2 -2
  19. package/esm2015/lib/annotations/annotation-set/annotation-view/annotation-view.component.js +1 -1
  20. package/esm2015/lib/annotations/annotation-set/metadata-layer/metadata-layer.component.js +3 -2
  21. package/esm2015/lib/annotations/annotations.module.js +3 -1
  22. package/esm2015/lib/annotations/comment-set/comment/comment.component.js +3 -2
  23. package/esm2015/lib/annotations/comment-set/comment/comment.service.js +6 -2
  24. package/esm2015/lib/annotations/comment-set/comment-set-header/comment-set-header.component.js +13 -2
  25. package/esm2015/lib/media-viewer.component.js +4 -2
  26. package/esm2015/lib/print.service.js +4 -2
  27. package/esm2015/lib/redaction/components/redaction.component.js +2 -2
  28. package/esm2015/lib/redaction/services/redaction-api.service.js +7 -1
  29. package/esm2015/lib/redaction/services/redaction.model.js +1 -1
  30. package/esm2015/lib/store/actions/redaction.actions.js +22 -1
  31. package/esm2015/lib/store/effects/redaction.effects.js +18 -4
  32. package/esm2015/lib/store/reducers/bookmarks.reducer.js +3 -2
  33. package/esm2015/lib/store/reducers/redaction.reducer.js +9 -1
  34. package/esm2015/lib/store/selectors/bookmark.selectors.js +2 -2
  35. package/esm2015/lib/toolbar/main-toolbar/main-toolbar.component.js +19 -4
  36. package/esm2015/lib/toolbar/redaction-search-bar/redaction-search-bar.component.js +201 -0
  37. package/esm2015/lib/toolbar/redaction-search-bar/redaction-search.model.js +2 -0
  38. package/esm2015/lib/toolbar/redaction-toolbar/redaction-toolbar.component.js +18 -6
  39. package/esm2015/lib/toolbar/toolbar-event.service.js +9 -1
  40. package/esm2015/lib/toolbar/toolbar.module.js +6 -3
  41. package/esm2015/lib/viewers/image-viewer/image-viewer.component.js +2 -2
  42. package/esm2015/lib/viewers/pdf-viewer/pdf-js/pdf-js-wrapper.js +15 -4
  43. package/esm2015/lib/viewers/pdf-viewer/pdf-viewer.component.js +3 -2
  44. package/esm2015/lib/viewers/pdf-viewer/side-bar/bookmarks/bookmarks.component.js +70 -5
  45. package/esm2015/lib/viewers/pdf-viewer/side-bar/outline-item/outline-item.component.js +4 -1
  46. package/esm2015/lib/viewers/pdf-viewer/side-bar/side-bar.component.js +24 -19
  47. package/fesm2015/hmcts-media-viewer.js +586 -204
  48. package/fesm2015/hmcts-media-viewer.js.map +1 -1
  49. package/hmcts-media-viewer.d.ts +56 -55
  50. package/hmcts-media-viewer.d.ts.map +1 -1
  51. package/hmcts-media-viewer.metadata.json +1 -1
  52. package/lib/annotations/annotation-set/annotation-create/box-highlight-create/box-highlight-create.component.d.ts.map +1 -1
  53. package/lib/annotations/annotation-set/annotation-create/highlight-create/highlight-create.service.d.ts.map +1 -1
  54. package/lib/annotations/annotation-set/annotation-view/annotation-view.component.d.ts.map +1 -1
  55. package/lib/annotations/annotation-set/metadata-layer/metadata-layer.component.d.ts.map +1 -1
  56. package/lib/annotations/annotations.module.d.ts.map +1 -1
  57. package/lib/annotations/comment-set/comment/comment.component.d.ts +2 -0
  58. package/lib/annotations/comment-set/comment/comment.component.d.ts.map +1 -1
  59. package/lib/annotations/comment-set/comment/comment.service.d.ts +3 -1
  60. package/lib/annotations/comment-set/comment/comment.service.d.ts.map +1 -1
  61. package/lib/annotations/comment-set/comment-set-header/comment-set-header.component.d.ts +4 -1
  62. package/lib/annotations/comment-set/comment-set-header/comment-set-header.component.d.ts.map +1 -1
  63. package/lib/media-viewer.component.d.ts +1 -0
  64. package/lib/media-viewer.component.d.ts.map +1 -1
  65. package/lib/media-viewer.module.ngfactory.d.ts.map +1 -1
  66. package/lib/print.service.d.ts.map +1 -1
  67. package/lib/redaction/components/redaction.component.d.ts.map +1 -1
  68. package/lib/redaction/services/redaction-api.service.d.ts +3 -1
  69. package/lib/redaction/services/redaction-api.service.d.ts.map +1 -1
  70. package/lib/redaction/services/redaction.model.d.ts +3 -0
  71. package/lib/redaction/services/redaction.model.d.ts.map +1 -1
  72. package/lib/store/actions/redaction.actions.d.ts +20 -2
  73. package/lib/store/actions/redaction.actions.d.ts.map +1 -1
  74. package/lib/store/effects/redaction.effects.d.ts +4 -1
  75. package/lib/store/effects/redaction.effects.d.ts.map +1 -1
  76. package/lib/store/reducers/bookmarks.reducer.d.ts.map +1 -1
  77. package/lib/store/reducers/redaction.reducer.d.ts.map +1 -1
  78. package/lib/store/selectors/annotation.selectors.d.ts +5 -5
  79. package/lib/store/selectors/redaction.selectors.d.ts +1 -1
  80. package/lib/store/selectors/tag.selectors.d.ts +2 -2
  81. package/lib/toolbar/main-toolbar/main-toolbar.component.d.ts +3 -1
  82. package/lib/toolbar/main-toolbar/main-toolbar.component.d.ts.map +1 -1
  83. package/lib/toolbar/redaction-search-bar/redaction-search-bar.component.d.ts +51 -0
  84. package/lib/toolbar/redaction-search-bar/redaction-search-bar.component.d.ts.map +1 -0
  85. package/lib/toolbar/redaction-search-bar/redaction-search-bar.component.ngfactory.d.ts.map +1 -0
  86. package/lib/toolbar/redaction-search-bar/redaction-search-bar.component.scss.shim.ngstyle.d.ts.map +1 -0
  87. package/lib/toolbar/redaction-search-bar/redaction-search.model.d.ts +12 -0
  88. package/lib/toolbar/redaction-search-bar/redaction-search.model.d.ts.map +1 -0
  89. package/lib/toolbar/redaction-toolbar/redaction-toolbar.component.d.ts +4 -2
  90. package/lib/toolbar/redaction-toolbar/redaction-toolbar.component.d.ts.map +1 -1
  91. package/lib/toolbar/toolbar-event.service.d.ts +6 -0
  92. package/lib/toolbar/toolbar-event.service.d.ts.map +1 -1
  93. package/lib/toolbar/toolbar.module.d.ts.map +1 -1
  94. package/lib/toolbar/toolbar.module.ngfactory.d.ts.map +1 -1
  95. package/lib/viewers/pdf-viewer/pdf-js/pdf-js-wrapper.d.ts +1 -0
  96. package/lib/viewers/pdf-viewer/pdf-js/pdf-js-wrapper.d.ts.map +1 -1
  97. package/lib/viewers/pdf-viewer/pdf-viewer.component.d.ts +1 -0
  98. package/lib/viewers/pdf-viewer/pdf-viewer.component.d.ts.map +1 -1
  99. package/lib/viewers/pdf-viewer/side-bar/bookmarks/bookmarks.component.d.ts +17 -4
  100. package/lib/viewers/pdf-viewer/side-bar/bookmarks/bookmarks.component.d.ts.map +1 -1
  101. package/lib/viewers/pdf-viewer/side-bar/outline-item/outline-item.component.d.ts.map +1 -1
  102. package/lib/viewers/pdf-viewer/side-bar/side-bar.component.d.ts +7 -4
  103. package/lib/viewers/pdf-viewer/side-bar/side-bar.component.d.ts.map +1 -1
  104. package/package.json +5 -4
  105. package/hmcts-media-viewer-v2.9.3.tgz +0 -0
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('@angular/common/http'), require('rxjs'), require('rxjs/operators'), require('@ngrx/store'), require('pdfjs-dist/web/pdf_viewer'), require('pdfjs-dist'), require('pdfjs-dist/build/pdf.worker'), require('uuid/v4'), require('moment-timezone'), require('hammerjs'), require('@angular/cdk/overlay'), require('@angular/router'), require('@angular/cdk/a11y'), require('mutable-div'), require('ngx-chips'), require('@swimlane/ngx-datatable'), require('uuid'), require('@ngrx/effects'), require('@circlon/angular-tree-component')) :
3
- typeof define === 'function' && define.amd ? define('@hmcts/media-viewer', ['exports', '@angular/core', '@angular/common', '@angular/forms', '@angular/common/http', 'rxjs', 'rxjs/operators', '@ngrx/store', 'pdfjs-dist/web/pdf_viewer', 'pdfjs-dist', 'pdfjs-dist/build/pdf.worker', 'uuid/v4', 'moment-timezone', 'hammerjs', '@angular/cdk/overlay', '@angular/router', '@angular/cdk/a11y', 'mutable-div', 'ngx-chips', '@swimlane/ngx-datatable', 'uuid', '@ngrx/effects', '@circlon/angular-tree-component'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.hmcts = global.hmcts || {}, global.hmcts["media-viewer"] = {}), global.ng.core, global.ng.common, global.ng.forms, global.ng.common.http, global.rxjs, global.rxjs.operators, global.store, global.pdfjsViewer, global.pdfjsLib, null, global.uuid, global.moment, null, global.ng.cdk.overlay, global.ng.router, global.ng.cdk.a11y, global.mutableDiv, global.ngxChips, global.ngxDatatable, global.uuid$1, global.effects$1, global.angularTreeComponent));
5
- })(this, (function (exports, i0, common, forms, i1, rxjs, operators, store, pdfjsViewer, pdfjsLib, pdf_worker, uuid, moment, hammerjs, overlay, router, a11y, mutableDiv, ngxChips, ngxDatatable, uuid$1, effects$1, angularTreeComponent) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('@angular/common/http'), require('rxjs'), require('rxjs/operators'), require('@ngrx/store'), require('pdfjs-dist/web/pdf_viewer'), require('pdfjs-dist'), require('pdfjs-dist/build/pdf.worker'), require('uuid/v4'), require('moment-timezone'), require('hammerjs'), require('uuid'), require('@angular/cdk/overlay'), require('@angular/router'), require('@angular/cdk/a11y'), require('mutable-div'), require('ngx-chips'), require('@swimlane/ngx-datatable'), require('@circlon/angular-tree-component'), require('@ngrx/effects')) :
3
+ typeof define === 'function' && define.amd ? define('@hmcts/media-viewer', ['exports', '@angular/core', '@angular/common', '@angular/forms', '@angular/common/http', 'rxjs', 'rxjs/operators', '@ngrx/store', 'pdfjs-dist/web/pdf_viewer', 'pdfjs-dist', 'pdfjs-dist/build/pdf.worker', 'uuid/v4', 'moment-timezone', 'hammerjs', 'uuid', '@angular/cdk/overlay', '@angular/router', '@angular/cdk/a11y', 'mutable-div', 'ngx-chips', '@swimlane/ngx-datatable', '@circlon/angular-tree-component', '@ngrx/effects'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.hmcts = global.hmcts || {}, global.hmcts["media-viewer"] = {}), global.ng.core, global.ng.common, global.ng.forms, global.ng.common.http, global.rxjs, global.rxjs.operators, global.store, global.pdfjsViewer, global.pdfjsLib, null, global.uuid, global.moment, null, global.uuid$1, global.ng.cdk.overlay, global.ng.router, global.ng.cdk.a11y, global.mutableDiv, global.ngxChips, global.ngxDatatable, global.angularTreeComponent, global.effects$1));
5
+ })(this, (function (exports, i0, common, forms, i1, rxjs, operators, store, pdfjsViewer, pdfjsLib, pdf_worker, uuid, moment, hammerjs, uuid$1, overlay, router, a11y, mutableDiv, ngxChips, ngxDatatable, angularTreeComponent, effects$1) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -391,15 +391,26 @@
391
391
  this.pdfViewer.eventBus.on('scalechanging', function (e) { return _this.emitDocumentInfo(e); });
392
392
  this.pdfViewer.eventBus.on('rotationchanging', function (e) { return _this.emitDocumentInfo(e); });
393
393
  this.pdfViewer.eventBus.on('updatefindcontrolstate', function (event) {
394
- if (event.state !== FindState.PENDING) {
395
- _this.toolbarEvents.searchResultsCountSubject.next(event.matchesCount);
396
- }
394
+ _this.sendSearchDetails(event);
397
395
  });
398
396
  this.pdfViewer.eventBus.on('updatefindmatchescount', function (event) {
399
397
  _this.toolbarEvents.searchResultsCountSubject.next(event.matchesCount);
400
398
  });
401
399
  this.zoomValue = 1;
402
400
  }
401
+ PdfJsWrapper.prototype.sendSearchDetails = function (event) {
402
+ var _a, _b, _c, _d, _e, _f;
403
+ if (event.state !== FindState.PENDING) {
404
+ this.toolbarEvents.searchResultsCountSubject.next(event.matchesCount);
405
+ if (((_b = (_a = event === null || event === void 0 ? void 0 : event.source) === null || _a === void 0 ? void 0 : _a.selected) === null || _b === void 0 ? void 0 : _b.pageIdx) !== -1 && event.matchesCount.total > 0) {
406
+ this.toolbarEvents.redactionSerachSubject.next({
407
+ page: (_d = (_c = event === null || event === void 0 ? void 0 : event.source) === null || _c === void 0 ? void 0 : _c.selected) === null || _d === void 0 ? void 0 : _d.pageIdx,
408
+ matchedIndex: (_f = (_e = event === null || event === void 0 ? void 0 : event.source) === null || _e === void 0 ? void 0 : _e.selected) === null || _f === void 0 ? void 0 : _f.matchIdx,
409
+ matchesCount: event.matchesCount.total
410
+ });
411
+ }
412
+ }
413
+ };
403
414
  PdfJsWrapper.prototype.emitDocumentInfo = function (e) {
404
415
  var allPages = __spread(this.pdfViewer._pages).map(function (page) {
405
416
  return {
@@ -416,43 +427,43 @@
416
427
  return __awaiter(this, void 0, void 0, function () {
417
428
  var loadingTask, pdfDocument, outline, pdfMetaData, e_1;
418
429
  var _this = this;
419
- return __generator(this, function (_a) {
420
- switch (_a.label) {
430
+ return __generator(this, function (_g) {
431
+ switch (_g.label) {
421
432
  case 0:
422
433
  loadingTask = this.createLoadingTask(documentUrl);
423
- loadingTask.onProgress = function (_a) {
424
- var loaded = _a.loaded, total = _a.total;
434
+ loadingTask.onProgress = function (_g) {
435
+ var loaded = _g.loaded, total = _g.total;
425
436
  _this.documentLoadProgress.next({ loaded: loaded, total: total });
426
437
  };
427
438
  this.documentLoadInit.next(documentUrl);
428
- _a.label = 1;
439
+ _g.label = 1;
429
440
  case 1:
430
- _a.trys.push([1, 7, , 8]);
441
+ _g.trys.push([1, 7, , 8]);
431
442
  return [4 /*yield*/, loadingTask.promise];
432
443
  case 2:
433
- pdfDocument = _a.sent();
444
+ pdfDocument = _g.sent();
434
445
  this.documentLoaded.next(pdfDocument);
435
446
  this.toolbarEvents.pageCountSubject.next(pdfDocument.numPages);
436
447
  this.pdfViewer.setDocument(pdfDocument);
437
448
  this.pdfViewer.linkService.setDocument(pdfDocument, null);
438
449
  return [4 /*yield*/, pdfDocument.getOutline()];
439
450
  case 3:
440
- outline = _a.sent();
451
+ outline = _g.sent();
441
452
  if (!outline) return [3 /*break*/, 5];
442
453
  return [4 /*yield*/, this.setOutlinePageNumbers(pdfDocument, outline)];
443
454
  case 4:
444
- _a.sent();
445
- _a.label = 5;
455
+ _g.sent();
456
+ _g.label = 5;
446
457
  case 5:
447
458
  this.documentOutline = outline;
448
459
  this.outlineLoaded.next(this.documentOutline);
449
460
  return [4 /*yield*/, pdfDocument.getMetadata()];
450
461
  case 6:
451
- pdfMetaData = _a.sent();
462
+ pdfMetaData = _g.sent();
452
463
  this.setCurrentPDFTitle(pdfMetaData.info.Title);
453
464
  return [3 /*break*/, 8];
454
465
  case 7:
455
- e_1 = _a.sent();
466
+ e_1 = _g.sent();
456
467
  this.documentLoadFailed.next(e_1);
457
468
  return [3 /*break*/, 8];
458
469
  case 8: return [2 /*return*/];
@@ -471,13 +482,13 @@
471
482
  PdfJsWrapper.prototype.setOutlinePageNumbers = function (pdfDocument, outlineArray) {
472
483
  return __awaiter(this, void 0, void 0, function () {
473
484
  var _this = this;
474
- return __generator(this, function (_a) {
485
+ return __generator(this, function (_g) {
475
486
  outlineArray.forEach(function (outline) { return __awaiter(_this, void 0, void 0, function () {
476
- return __generator(this, function (_a) {
477
- switch (_a.label) {
487
+ return __generator(this, function (_g) {
488
+ switch (_g.label) {
478
489
  case 0: return [4 /*yield*/, this.setNestedOutlinePageNumbers(pdfDocument, outline)];
479
490
  case 1:
480
- _a.sent();
491
+ _g.sent();
481
492
  return [2 /*return*/];
482
493
  }
483
494
  });
@@ -488,24 +499,24 @@
488
499
  };
489
500
  PdfJsWrapper.prototype.setNestedOutlinePageNumbers = function (pdfDocument, outline) {
490
501
  return __awaiter(this, void 0, void 0, function () {
491
- var _a;
502
+ var _g;
492
503
  var _this = this;
493
- return __generator(this, function (_b) {
494
- switch (_b.label) {
504
+ return __generator(this, function (_h) {
505
+ switch (_h.label) {
495
506
  case 0:
496
- _a = outline;
507
+ _g = outline;
497
508
  return [4 /*yield*/, this.getOutlinePageNumber(pdfDocument, outline)];
498
509
  case 1:
499
- _a.pageNumber = _b.sent();
510
+ _g.pageNumber = _h.sent();
500
511
  outline.items.forEach(function (outlineItem) { return __awaiter(_this, void 0, void 0, function () {
501
- var _a;
502
- return __generator(this, function (_b) {
503
- switch (_b.label) {
512
+ var _g;
513
+ return __generator(this, function (_h) {
514
+ switch (_h.label) {
504
515
  case 0:
505
- _a = outlineItem;
516
+ _g = outlineItem;
506
517
  return [4 /*yield*/, this.getOutlinePageNumber(pdfDocument, outlineItem)];
507
518
  case 1:
508
- _a.pageNumber = _b.sent();
519
+ _g.pageNumber = _h.sent();
509
520
  this.setNestedOutlinePageNumbers(pdfDocument, outlineItem);
510
521
  return [2 /*return*/];
511
522
  }
@@ -519,13 +530,13 @@
519
530
  PdfJsWrapper.prototype.getOutlinePageNumber = function (pdfDocument, outline) {
520
531
  return __awaiter(this, void 0, void 0, function () {
521
532
  var dest, pageIndex;
522
- return __generator(this, function (_a) {
523
- switch (_a.label) {
533
+ return __generator(this, function (_g) {
534
+ switch (_g.label) {
524
535
  case 0:
525
536
  dest = outline.dest;
526
537
  return [4 /*yield*/, pdfDocument.getPageIndex(dest[0])];
527
538
  case 1:
528
- pageIndex = _a.sent();
539
+ pageIndex = _g.sent();
529
540
  return [2 /*return*/, Number(pageIndex) + 1];
530
541
  }
531
542
  });
@@ -681,7 +692,11 @@
681
692
  this.applyRedactToDocument = new rxjs.Subject();
682
693
  this.clearAllRedactMarkers = new rxjs.Subject();
683
694
  this.redactWholePage = new rxjs.Subject();
695
+ this.redactionSerachSubject = new rxjs.Subject();
696
+ this.redactAllInProgressSubject = new rxjs.BehaviorSubject(false);
697
+ this.openRedactionSearch = new rxjs.Subject();
684
698
  this.sidebarOpen = new rxjs.BehaviorSubject(false);
699
+ this.sidebarOutlineView = new rxjs.BehaviorSubject(true);
685
700
  this.searchBarHidden = new rxjs.BehaviorSubject(true);
686
701
  this.commentsPanelVisible = new rxjs.BehaviorSubject(false);
687
702
  this.icp = icpEvents;
@@ -771,6 +786,9 @@
771
786
  ToolbarEventService.prototype.toggleSideBar = function (toggle) {
772
787
  this.sidebarOpen.next(toggle);
773
788
  };
789
+ ToolbarEventService.prototype.toggleSideBarView = function (toggle) {
790
+ this.sidebarOutlineView.next(toggle);
791
+ };
774
792
  ToolbarEventService.prototype.toggleRedactionMode = function () {
775
793
  if (this.redactionMode.getValue() === false) {
776
794
  this.drawModeSubject.next(false);
@@ -780,6 +798,7 @@
780
798
  else {
781
799
  this.redactionMode.next(false);
782
800
  }
801
+ this.openRedactionSearch.next(false);
783
802
  };
784
803
  ToolbarEventService.prototype.toggleRedactionPreview = function (viewMode) {
785
804
  this.redactionPreview.next(viewMode);
@@ -858,7 +877,9 @@
858
877
  };
859
878
  PrintService.prototype.printElementNatively = function (element, width, height) {
860
879
  var printWindow = window.open('', '', "left=0,top=0,width=" + width + ",height=" + height + ",toolbar=0,scrollbars=0,status=0");
861
- printWindow.document.write(element.innerHTML);
880
+ var documentHead = document.head;
881
+ printWindow.document.body.appendChild(documentHead.cloneNode(true));
882
+ printWindow.document.body.appendChild(element.cloneNode(true));
862
883
  printWindow.document.close();
863
884
  printWindow.focus();
864
885
  printWindow.print();
@@ -1910,7 +1931,8 @@
1910
1931
  });
1911
1932
  Object.entries(removeBookmarksByPage_1).forEach(function (_a) {
1912
1933
  var _b = __read(_a, 2), pageNumber = _b[0], bmrkIds = _b[1];
1913
- bookmarkPageEntities_1[pageNumber] = bookmarkPageEntities_1[pageNumber].filter(function (bookmarkId) { return bmrkIds.includes(bookmarkId); });
1934
+ bookmarkPageEntities_1[pageNumber]
1935
+ = bookmarkPageEntities_1[pageNumber].filter(function (bookmark) { return !bmrkIds.includes(bookmark.id); });
1914
1936
  });
1915
1937
  return Object.assign(Object.assign({}, state), { bookmarkEntities: bookmarkEntities_2,
1916
1938
  bookmarkPageEntities: bookmarkPageEntities_1, loading: false, loaded: true });
@@ -1939,6 +1961,9 @@
1939
1961
  var SAVE_REDACTION = '[Redaction] Save Redaction';
1940
1962
  var SAVE_REDACTION_SUCCESS = '[Redaction] Save Redaction Success';
1941
1963
  var SAVE_REDACTION_FAIL = '[Redaction] Save Redaction Fail';
1964
+ var SAVE_BULK_REDACTION = '[Redaction] Save bulk Redaction';
1965
+ var SAVE_BULK_REDACTION_SUCCESS = '[Redaction] Save bulk Redaction Success';
1966
+ var SAVE_BULK_REDACTION_FAIL = '[Redaction] Save bulk Redaction Fail';
1942
1967
  var DELETE_REDACTION = '[Redaction] Delete Redaction';
1943
1968
  var DELETE_REDACTION_SUCCESS = '[Redaction] Delete Redaction Success';
1944
1969
  var DELETE_REDACTION_FAIL = '[Redaction] Delete Redaction Fail';
@@ -1991,6 +2016,27 @@
1991
2016
  }
1992
2017
  return SaveRedactionFailure;
1993
2018
  }());
2019
+ var SaveBulkRedactionFailure = /** @class */ (function () {
2020
+ function SaveBulkRedactionFailure(payload) {
2021
+ this.payload = payload;
2022
+ this.type = SAVE_BULK_REDACTION_FAIL;
2023
+ }
2024
+ return SaveBulkRedactionFailure;
2025
+ }());
2026
+ var SaveBulkRedaction = /** @class */ (function () {
2027
+ function SaveBulkRedaction(payload) {
2028
+ this.payload = payload;
2029
+ this.type = SAVE_BULK_REDACTION;
2030
+ }
2031
+ return SaveBulkRedaction;
2032
+ }());
2033
+ var SaveBulkRedactionSuccess = /** @class */ (function () {
2034
+ function SaveBulkRedactionSuccess(payload) {
2035
+ this.payload = payload;
2036
+ this.type = SAVE_BULK_REDACTION_SUCCESS;
2037
+ }
2038
+ return SaveBulkRedactionSuccess;
2039
+ }());
1994
2040
  var DeleteRedaction = /** @class */ (function () {
1995
2041
  function DeleteRedaction(payload) {
1996
2042
  this.payload = payload;
@@ -2092,6 +2138,17 @@
2092
2138
  return Object.assign(Object.assign({}, state), { redactionEntities: redactionEntities_1,
2093
2139
  redactionPageEntities: redactionPageEntities });
2094
2140
  }
2141
+ case SAVE_BULK_REDACTION_SUCCESS: {
2142
+ var payloadResult = Object.assign.apply(Object, __spread([{}], action.payload.searchRedactions.map(function (x) {
2143
+ var _a;
2144
+ return (_a = {}, _a[x.redactionId] = x, _a);
2145
+ })));
2146
+ var redactionEntities_2 = Object.assign(Object.assign({}, state.redactionEntities), payloadResult);
2147
+ var redactionArray = Object.keys(redactionEntities_2).map(function (key) { return redactionEntities_2[key]; });
2148
+ var redactionPageEntities = StoreUtils.groupByKeyEntities(redactionArray, 'page');
2149
+ return Object.assign(Object.assign({}, state), { redactionEntities: redactionEntities_2,
2150
+ redactionPageEntities: redactionPageEntities });
2151
+ }
2095
2152
  case SELECT_REDACTION:
2096
2153
  case SELECT_ANNOTATION: {
2097
2154
  return Object.assign(Object.assign({}, state), { selectedRedaction: action.payload });
@@ -2818,7 +2875,7 @@
2818
2875
  PdfViewerComponent.decorators = [
2819
2876
  { type: i0.Component, args: [{
2820
2877
  selector: 'mv-pdf-viewer',
2821
- template: "<mv-side-bar *ngIf=\"toolbarEvents.sidebarOpen\"\n id=\"sidebarContainer\"\n [url]=\"url\"\n [zoom]=\"zoom\"\n [rotate]=\"rotation\"\n [outline]=\"documentOutline\"\n [annotationsEnabled]=\"enableAnnotations\"\n [currentPageNumber]=\"getCurrentPageNumber()\">\n</mv-side-bar>\n<mv-comment-set-header\n *ngIf=\"enableAnnotations\"\n [ngClass]=\"{'show-comments-panel': showCommentsPanel}\"\n [showCommentSummary]=\"toolbarButtons.showCommentSummary\"\n (showCommentSummaryDialog)=\"toggleCommentsSummary()\">\n</mv-comment-set-header>\n<mv-participants-list></mv-participants-list>\n<div\n class=\"pdfContainer\"\n [ngStyle]=\"{ height: height }\"\n [ngClass]=\"{ 'pdfContainer': true, hidden: errorMessage }\">\n <div\n #viewerContainer\n mvGrabNDrag\n [dragX]=\"viewerContainer\"\n [dragEnabled]=\"enableGrabNDrag\"\n id=\"viewerContainer\"\n class=\"viewer-container\"\n [class.annotations]=\"enableAnnotations\"\n [class.show-comments-panel]=\"(showCommentsPanel || showIcpParticipantsList) && !(toolbarEvents.redactionMode | async)\"\n [class.grabNDrag]=\"enableGrabNDrag\">\n <div #pdfViewer\n class=\"pdfViewer\"\n mvCreateTextHighlight\n [ngClass]=\"{ hidden: loadingDocument, highlightMode: highlightMode | async, drawMode: drawMode | async }\">\n </div>\n <mv-redactions *ngIf=\"(toolbarEvents.redactionMode | async); else annotationTemplate\"\n [zoom]=\"zoom\"\n [rotate]=\"rotation\"\n ></mv-redactions>\n <ng-template #annotationTemplate>\n <mv-metadata-layer\n *ngIf=\"enableAnnotations && annotationSet\"\n [zoom]=\"zoom\"\n [rotate]=\"rotation\">\n </mv-metadata-layer>\n <mv-bookmark-icons [zoom]=\"zoom\"\n [rotate]=\"rotation\">\n </mv-bookmark-icons>\n </ng-template>\n </div>\n <mv-comment-set [contentScrollTop]=\"viewerContainer.scrollTop\"\n *ngIf=\"enableAnnotations && annotationSet && !(toolbarEvents.redactionMode | async)\"\n [annotationSet]=\"annotationSet\"\n [zoom]=\"zoom\"\n [rotate]=\"rotation\"\n [height]=\"pdfViewer.offsetHeight\"\n [pageHeights]=\"pageHeights\">\n </mv-comment-set>\n <div class=\"loadingMessage\" *ngIf=\"loadingDocument\">\n <h3 class=\"govuk-heading-m\">Loading...{{ loadingDocumentProgress ? loadingDocumentProgress + '%' : '' }}</h3>\n </div>\n</div>\n",
2878
+ template: "<mv-side-bar\n *ngIf=\"toolbarEvents.sidebarOpen\"\n id=\"sidebarContainer\"\n [url]=\"url\"\n [zoom]=\"zoom\"\n [rotate]=\"rotation\"\n [outline]=\"documentOutline\"\n [annotationsEnabled]=\"enableAnnotations\"\n [currentPageNumber]=\"getCurrentPageNumber()\"\n>\n</mv-side-bar>\n<mv-comment-set-header\n *ngIf=\"enableAnnotations\"\n [ngClass]=\"{ 'show-comments-panel': showCommentsPanel }\"\n [showCommentSummary]=\"toolbarButtons.showCommentSummary\"\n (showCommentSummaryDialog)=\"toggleCommentsSummary()\"\n>\n</mv-comment-set-header>\n<mv-participants-list></mv-participants-list>\n<div\n class=\"pdfContainer\"\n [ngStyle]=\"{ height: height }\"\n [ngClass]=\"{ pdfContainer: true, hidden: errorMessage }\"\n>\n <mv-redaction-search-bar></mv-redaction-search-bar>\n <div\n #viewerContainer\n mvGrabNDrag\n [dragX]=\"viewerContainer\"\n [dragEnabled]=\"enableGrabNDrag\"\n id=\"viewerContainer\"\n class=\"viewer-container\"\n [class.annotations]=\"enableAnnotations\"\n [class.show-comments-panel]=\"\n (showCommentsPanel || showIcpParticipantsList) &&\n !(toolbarEvents.redactionMode | async)\n \"\n [class.grabNDrag]=\"enableGrabNDrag\"\n >\n <div\n #pdfViewer\n class=\"pdfViewer\"\n mvCreateTextHighlight\n [ngClass]=\"{\n hidden: loadingDocument,\n highlightMode: highlightMode | async,\n drawMode: drawMode | async\n }\"\n ></div>\n <mv-redactions\n *ngIf=\"toolbarEvents.redactionMode | async; else annotationTemplate\"\n [zoom]=\"zoom\"\n [rotate]=\"rotation\"\n ></mv-redactions>\n <ng-template #annotationTemplate>\n <mv-metadata-layer\n *ngIf=\"enableAnnotations && annotationSet\"\n [zoom]=\"zoom\"\n [rotate]=\"rotation\"\n >\n </mv-metadata-layer>\n <mv-bookmark-icons [zoom]=\"zoom\" [rotate]=\"rotation\"> </mv-bookmark-icons>\n </ng-template>\n </div>\n <mv-comment-set\n [contentScrollTop]=\"viewerContainer.scrollTop\"\n *ngIf=\"\n enableAnnotations &&\n annotationSet &&\n !(toolbarEvents.redactionMode | async)\n \"\n [annotationSet]=\"annotationSet\"\n [zoom]=\"zoom\"\n [rotate]=\"rotation\"\n [height]=\"pdfViewer.offsetHeight\"\n [pageHeights]=\"pageHeights\"\n >\n </mv-comment-set>\n <div class=\"loadingMessage\" *ngIf=\"loadingDocument\">\n <h3 class=\"govuk-heading-m\">\n Loading...{{\n loadingDocumentProgress ? loadingDocumentProgress + \"%\" : \"\"\n }}\n </h3>\n </div>\n</div>\n",
2822
2879
  encapsulation: i0.ViewEncapsulation.None
2823
2880
  },] }
2824
2881
  ];
@@ -2844,6 +2901,7 @@
2844
2901
  enableRedactions: [{ type: i0.Input }],
2845
2902
  enableICP: [{ type: i0.Input }],
2846
2903
  annotationSet: [{ type: i0.Input }],
2904
+ enableRedactSearch: [{ type: i0.Input }],
2847
2905
  height: [{ type: i0.Input }],
2848
2906
  caseId: [{ type: i0.Input }],
2849
2907
  viewerContainer: [{ type: i0.ViewChild, args: ['viewerContainer', { static: true },] }],
@@ -3021,7 +3079,7 @@
3021
3079
  ImageViewerComponent.decorators = [
3022
3080
  { type: i0.Component, args: [{
3023
3081
  selector: 'mv-image-viewer',
3024
- template: "<mv-comment-set-header [ngClass]=\"{'show-comments-panel': showCommentsPanel}\"\n [showCommentSummary]=\"toolbarButtons.showCommentSummary\"\n (showCommentSummaryDialog)=\"toggleCommentsSummary()\">\n</mv-comment-set-header>\n<div mvGrabNDrag [dragX]=\"imageContainer\" [dragEnabled]=\"enableGrabNDrag\"\n id=\"viewer-wrapper\"\n [ngStyle]=\"{ height: height }\"\n [ngClass]=\"{ 'grabNDrag': enableGrabNDrag }\"\n *ngIf=\"url && !errorMessage\">\n <div #imageContainer id=\"image-container\"\n [ngClass]=\"{ 'image-container': true, 'annotations': enableAnnotations, 'show-comments-panel': showCommentsPanel }\"\n [style.height.px]=\"imageHeight\">\n <img #img\n [src]=\"url\"\n [ngClass]=\"'rot' + rotation\"\n (error)=\"onLoadError(url)\"\n (load)=\"onLoad(img)\"/>\n <mv-redactions *ngIf=\"(toolbarEvents.redactionMode | async);else annotationTemplate\"\n [zoom]=\"zoom\"\n [rotate]=\"rotation\"\n ></mv-redactions>\n <ng-template #annotationTemplate>\n <mv-metadata-layer *ngIf=\"enableAnnotations && annotationSet\"\n [zoom]=\"zoom\"\n [rotate]=\"rotation\">\n </mv-metadata-layer>\n </ng-template>\n </div>\n\n <div class=\"comments\" [style.height.px]=\"imageHeight\">\n <mv-comment-set *ngIf=\"enableAnnotations && annotationSet && !(toolbarEvents.redactionMode | async)\"\n [annotationSet]=\"annotationSet\"\n [zoom]=\"zoom\"\n [rotate]=\"rotation\"\n [height]=\"imageHeight\">\n </mv-comment-set>\n </div>\n</div>\n"
3082
+ template: "<mv-comment-set-header [ngClass]=\"{'show-comments-panel': showCommentsPanel}\"\n [showCommentSummary]=\"toolbarButtons.showCommentSummary\"\n (showCommentSummaryDialog)=\"toggleCommentsSummary()\">\n</mv-comment-set-header>\n<div id=\"viewer-wrapper\"\n [ngStyle]=\"{ height: height }\"\n [ngClass]=\"{ 'grabNDrag': enableGrabNDrag }\"\n *ngIf=\"url && !errorMessage\">\n <div #imageContainer id=\"image-container\"\n mvGrabNDrag [dragX]=\"imageContainer\" [dragEnabled]=\"enableGrabNDrag\"\n (scroll)=\"$event\"\n [ngClass]=\"{ 'image-container': true, 'annotations': enableAnnotations, 'show-comments-panel': showCommentsPanel }\">\n <img #img\n [src]=\"url\"\n [ngClass]=\"'rot' + rotation\"\n (error)=\"onLoadError(url)\"\n (load)=\"onLoad(img)\"/>\n <mv-redactions *ngIf=\"(toolbarEvents.redactionMode | async);else annotationTemplate\"\n [zoom]=\"zoom\"\n [rotate]=\"rotation\"\n ></mv-redactions>\n <ng-template #annotationTemplate>\n <mv-metadata-layer *ngIf=\"enableAnnotations && annotationSet\"\n [zoom]=\"zoom\"\n [rotate]=\"rotation\">\n </mv-metadata-layer>\n </ng-template>\n </div>\n\n <mv-comment-set [contentScrollTop]=\"imageContainer.scrollTop\"\n *ngIf=\"enableAnnotations && annotationSet && !(toolbarEvents.redactionMode | async)\"\n [annotationSet]=\"annotationSet\"\n [zoom]=\"zoom\"\n [rotate]=\"rotation\"\n [height]=\"imageHeight\">\n </mv-comment-set>\n</div>\n"
3025
3083
  },] }
3026
3084
  ];
3027
3085
  /** @nocollapse */
@@ -3170,6 +3228,7 @@
3170
3228
  var CommentService = /** @class */ (function () {
3171
3229
  function CommentService() {
3172
3230
  this.unsavedChanges = new rxjs.Subject();
3231
+ this.marginToCommentEmitter = new rxjs.BehaviorSubject(false);
3173
3232
  }
3174
3233
  CommentService.prototype.setCommentSet = function (commentSetComponent) {
3175
3234
  this.commentSetComponent = commentSetComponent;
@@ -3202,6 +3261,9 @@
3202
3261
  CommentService.prototype.allCommentsSaved = function () {
3203
3262
  this.onCommentChange(this.commentSetComponent.commentComponents.some(function (comment) { return comment.hasUnsavedChanges === true; }));
3204
3263
  };
3264
+ CommentService.prototype.createMarginToCommentEvent = function (margin) {
3265
+ this.marginToCommentEmitter.next(margin);
3266
+ };
3205
3267
  return CommentService;
3206
3268
  }());
3207
3269
  CommentService.decorators = [
@@ -3337,6 +3399,7 @@
3337
3399
  this.enableRedactions = false;
3338
3400
  this.enableICP = false;
3339
3401
  this.multimediaPlayerEnabled = false;
3402
+ this.enableRedactSearch = false;
3340
3403
  this.multimediaContent = false;
3341
3404
  this.convertibleContent = false;
3342
3405
  this.unsupportedContent = false;
@@ -3462,7 +3525,7 @@
3462
3525
  MediaViewerComponent.decorators = [
3463
3526
  { type: i0.Component, args: [{
3464
3527
  selector: 'mv-media-viewer',
3465
- template: "<div id=\"outerContainer\"\n [ngClass]=\"{\n 'has-redact-bar': toolbarEvents.redactionMode | async,\n 'icp-mode': toolbarEvents.icp.enabled | async,\n 'is-redaction-preview': toolbarEvents.redactionPreview | async,\n sidebarOpen: toolbarEvents.sidebarOpen | async,\n 'has-scroll-bar': hasScrollBar,\n 'has-different-page-size': hasDifferentPageSize$ | async\n }\"\n [ngStyle]=\"{ width: width }\">\n\n <mv-comments-summary *ngIf=\"showCommentSummary\"\n [title]=\"documentTitle || 'Comment Summary'\"\n [contentType]=\"contentType\">\n </mv-comments-summary>\n\n <mv-confirm-action *ngIf=\"toolbarEvents.icp.leavingSession | async\"></mv-confirm-action>\n\n <div id=\"mainContainer\">\n <mv-main-toolbar *ngIf=\"showToolbar\"\n [enableAnnotations]=\"enableAnnotations\"\n [enableICP]=\"enableICP\"\n [enableRedactions]=\"enableRedactions\"\n [contentType]=\"contentType\"\n >\n </mv-main-toolbar>\n <mv-redaction-toolbar *ngIf=\"toolbarEvents.redactionMode | async\"></mv-redaction-toolbar>\n <mv-icp-toolbar *ngIf=\"toolbarEvents.icp.enabled | async\"></mv-icp-toolbar>\n\n <div #viewerRef>\n <mv-conversion-viewer *ngIf=\"convertibleContent\"\n (documentTitle)=\"onDocumentTitleChange($event)\"\n (mediaLoadStatus)=\"onMediaLoad($event)\"\n (viewerException)=\"onLoadException($event)\"\n [enableAnnotations]=\"enableAnnotations\"\n [enableRedactions]=\"enableRedactions\"\n [annotationSet]=\"enableAnnotations ? (annotationSet$ | async) : null\"\n [originalUrl]=\"url\"\n [downloadFileName]=\"downloadFileName\"\n [height]=\"viewerHeight\"\n mvRotationPersist>\n </mv-conversion-viewer>\n <mv-pdf-viewer *ngIf=\"contentType === 'pdf'\"\n #pdfViewer\n (mediaLoadStatus)=\"onMediaLoad($event)\"\n (pdfViewerException)=\"onLoadException($event)\"\n (documentTitle)=\"onDocumentTitleChange($event)\"\n [url]=\"url\"\n [enableAnnotations]=\"enableAnnotations\"\n [enableRedactions]=\"enableRedactions\"\n [enableICP]=\"enableICP\"\n [annotationSet]=\"enableAnnotations ? (annotationSet$ | async) : null\"\n [downloadFileName]=\"downloadFileName\"\n [height]=\"viewerHeight\"\n [caseId]=\"caseId\"\n mvRotationPersist>\n </mv-pdf-viewer>\n <mv-image-viewer *ngIf=\"contentType === 'image'\"\n (mediaLoadStatus)=\"onMediaLoad($event)\"\n (imageViewerException)=\"onLoadException($event)\"\n [url]=\"url\"\n [enableAnnotations]=\"enableAnnotations\"\n [annotationSet]=\"enableAnnotations ? (annotationSet$ | async) : null\"\n [downloadFileName]=\"downloadFileName\"\n [height]=\"viewerHeight\"\n mvRotationPersist>\n </mv-image-viewer>\n <mv-multimedia-player *ngIf=\"multimediaContent\"\n [multimediaOn]=\"multimediaPlayerEnabled\"\n [url]=\"url\"\n [downloadFileName]=\"downloadFileName\"\n (loadStatus)=\"onMediaLoad($event)\">\n </mv-multimedia-player>\n <mv-unsupported-viewer *ngIf=\"unsupportedContent\"\n [url]=\"url\"\n [typeException]=\"typeException\"\n [downloadFileName]=\"downloadFileName\"\n (loadStatus)=\"onMediaLoad($event)\"\n (unsupportedViewerException)=\"onLoadException($event)\">\n </mv-unsupported-viewer>\n </div>\n </div>\n</div>\n",
3528
+ template: "<div\n id=\"outerContainer\"\n [ngClass]=\"{\n 'has-redact-bar': toolbarEvents.redactionMode | async,\n 'icp-mode': toolbarEvents.icp.enabled | async,\n 'is-redaction-preview': toolbarEvents.redactionPreview | async,\n sidebarOpen: toolbarEvents.sidebarOpen | async,\n 'has-scroll-bar': hasScrollBar,\n 'has-different-page-size': hasDifferentPageSize$ | async\n }\"\n [ngStyle]=\"{ width: width }\"\n>\n <mv-comments-summary\n *ngIf=\"showCommentSummary\"\n [title]=\"documentTitle || 'Comment Summary'\"\n [contentType]=\"contentType\"\n >\n </mv-comments-summary>\n\n <mv-confirm-action\n *ngIf=\"toolbarEvents.icp.leavingSession | async\"\n ></mv-confirm-action>\n\n <div id=\"mainContainer\">\n <mv-main-toolbar\n *ngIf=\"showToolbar\"\n [enableAnnotations]=\"enableAnnotations\"\n [enableICP]=\"enableICP\"\n [enableRedactions]=\"enableRedactions\"\n [contentType]=\"contentType\"\n >\n </mv-main-toolbar>\n <mv-redaction-toolbar\n [showRedactSearch]=\"enableRedactSearch\"\n *ngIf=\"toolbarEvents.redactionMode | async\"\n ></mv-redaction-toolbar>\n <mv-icp-toolbar *ngIf=\"toolbarEvents.icp.enabled | async\"></mv-icp-toolbar>\n\n <div #viewerRef>\n <mv-conversion-viewer\n *ngIf=\"convertibleContent\"\n (documentTitle)=\"onDocumentTitleChange($event)\"\n (mediaLoadStatus)=\"onMediaLoad($event)\"\n (viewerException)=\"onLoadException($event)\"\n [enableAnnotations]=\"enableAnnotations\"\n [enableRedactions]=\"enableRedactions\"\n [annotationSet]=\"enableAnnotations ? (annotationSet$ | async) : null\"\n [originalUrl]=\"url\"\n [downloadFileName]=\"downloadFileName\"\n [height]=\"viewerHeight\"\n mvRotationPersist\n >\n </mv-conversion-viewer>\n <mv-pdf-viewer\n *ngIf=\"contentType === 'pdf'\"\n #pdfViewer\n (mediaLoadStatus)=\"onMediaLoad($event)\"\n (pdfViewerException)=\"onLoadException($event)\"\n (documentTitle)=\"onDocumentTitleChange($event)\"\n [url]=\"url\"\n [enableAnnotations]=\"enableAnnotations\"\n [enableRedactions]=\"enableRedactions\"\n [enableICP]=\"enableICP\"\n [annotationSet]=\"enableAnnotations ? (annotationSet$ | async) : null\"\n [downloadFileName]=\"downloadFileName\"\n [height]=\"viewerHeight\"\n [caseId]=\"caseId\"\n mvRotationPersist\n >\n </mv-pdf-viewer>\n <mv-image-viewer\n *ngIf=\"contentType === 'image'\"\n (mediaLoadStatus)=\"onMediaLoad($event)\"\n (imageViewerException)=\"onLoadException($event)\"\n [url]=\"url\"\n [enableAnnotations]=\"enableAnnotations\"\n [annotationSet]=\"enableAnnotations ? (annotationSet$ | async) : null\"\n [downloadFileName]=\"downloadFileName\"\n [height]=\"viewerHeight\"\n mvRotationPersist\n >\n </mv-image-viewer>\n <mv-multimedia-player\n *ngIf=\"multimediaContent\"\n [multimediaOn]=\"multimediaPlayerEnabled\"\n [url]=\"url\"\n [downloadFileName]=\"downloadFileName\"\n (loadStatus)=\"onMediaLoad($event)\"\n >\n </mv-multimedia-player>\n <mv-unsupported-viewer\n *ngIf=\"unsupportedContent\"\n [url]=\"url\"\n [typeException]=\"typeException\"\n [downloadFileName]=\"downloadFileName\"\n (loadStatus)=\"onMediaLoad($event)\"\n (unsupportedViewerException)=\"onLoadException($event)\"\n >\n </mv-unsupported-viewer>\n </div>\n </div>\n</div>\n",
3466
3529
  encapsulation: i0.ViewEncapsulation.None
3467
3530
  },] }
3468
3531
  ];
@@ -3494,9 +3557,270 @@
3494
3557
  enableRedactions: [{ type: i0.Input }],
3495
3558
  enableICP: [{ type: i0.Input }],
3496
3559
  multimediaPlayerEnabled: [{ type: i0.Input }],
3560
+ enableRedactSearch: [{ type: i0.Input }],
3497
3561
  caseId: [{ type: i0.Input }]
3498
3562
  };
3499
3563
 
3564
+ var HighlightCreateService = /** @class */ (function () {
3565
+ function HighlightCreateService(toolBarEvents, store) {
3566
+ this.toolBarEvents = toolBarEvents;
3567
+ this.store = store;
3568
+ }
3569
+ HighlightCreateService.prototype.saveAnnotation = function (rectangles, page) {
3570
+ var _this = this;
3571
+ this.store.pipe(store.select(getDocumentIdSetId), operators.take(1)).subscribe(function (anoSetDocId) {
3572
+ var anno = Object.assign(Object.assign({ id: uuid$1.v4(), color: 'FFFF00', comments: [], page: page, rectangles: rectangles, type: 'highlight' }, anoSetDocId), { createdBy: '', createdByDetails: undefined, createdDate: moment__default["default"].utc().tz('Europe/London').toISOString(), lastModifiedBy: '', lastModifiedByDetails: undefined, lastModifiedDate: '', tags: [] });
3573
+ _this.store.dispatch(new SaveAnnotation(anno));
3574
+ });
3575
+ };
3576
+ HighlightCreateService.prototype.applyRotation = function (pageHeight, pageWidth, offsetHeight, offsetWidth, offsetTop, offsetLeft, rotate, zoom) {
3577
+ var _a = {
3578
+ x: +(offsetLeft / zoom).toFixed(2),
3579
+ y: +(offsetTop / zoom).toFixed(2),
3580
+ width: +(offsetWidth / zoom).toFixed(2),
3581
+ height: +(offsetHeight / zoom).toFixed(2)
3582
+ }, x = _a.x, y = _a.y, width = _a.width, height = _a.height;
3583
+ var rectangle = { x: x, y: y, width: width, height: height };
3584
+ switch (rotate) {
3585
+ case 90:
3586
+ rectangle.width = height;
3587
+ rectangle.height = width;
3588
+ rectangle.x = y;
3589
+ rectangle.y = +(pageWidth / zoom - x - width).toFixed(2);
3590
+ break;
3591
+ case 180:
3592
+ rectangle.x = +(pageWidth / zoom - x - width).toFixed(2);
3593
+ rectangle.y = +(pageHeight / zoom - y - height).toFixed(2);
3594
+ break;
3595
+ case 270:
3596
+ rectangle.width = height;
3597
+ rectangle.height = width;
3598
+ rectangle.x = +(pageHeight / zoom - y - height).toFixed(2);
3599
+ rectangle.y = x;
3600
+ break;
3601
+ }
3602
+ return rectangle;
3603
+ };
3604
+ HighlightCreateService.prototype.resetHighlight = function () {
3605
+ window.getSelection().removeAllRanges();
3606
+ this.toolBarEvents.highlightModeSubject.next(false);
3607
+ };
3608
+ return HighlightCreateService;
3609
+ }());
3610
+ HighlightCreateService.decorators = [
3611
+ { type: i0.Injectable }
3612
+ ];
3613
+ /** @nocollapse */
3614
+ HighlightCreateService.ctorParameters = function () { return [
3615
+ { type: ToolbarEventService },
3616
+ { type: store.Store }
3617
+ ]; };
3618
+
3619
+ var RedactionSearchBarComponent = /** @class */ (function () {
3620
+ function RedactionSearchBarComponent(store, toolbarButtons, toolbarEvents, highlightService) {
3621
+ this.store = store;
3622
+ this.toolbarButtons = toolbarButtons;
3623
+ this.toolbarEvents = toolbarEvents;
3624
+ this.highlightService = highlightService;
3625
+ this.highlightAll = true;
3626
+ this.matchCase = false;
3627
+ this.wholeWord = false;
3628
+ this.resultsText = '';
3629
+ this.searchText = '';
3630
+ this.resultCount = 0;
3631
+ this.redactElements = [];
3632
+ this.advancedSearchVisible = false;
3633
+ }
3634
+ RedactionSearchBarComponent.prototype.ngOnInit = function () {
3635
+ var _this = this;
3636
+ this.subscription = this.toolbarEvents.redactionSerachSubject.subscribe(function (results) { return _this.redactAllSearched(results); });
3637
+ this.subscription.add(this.store.pipe(store.select(getDocumentId)).subscribe(function (docId) { return _this.documentId = docId; }));
3638
+ this.subscription.add(this.store.pipe(store.select(getPages)).subscribe(function (pages) {
3639
+ if (pages[1]) {
3640
+ _this.allPages = pages;
3641
+ }
3642
+ }));
3643
+ this.subscription.add(this.toolbarEvents.searchResultsCountSubject.subscribe(function (results) { return _this.setSearchResultsCount(results); }));
3644
+ this.subscription.add(this.toolbarEvents.openRedactionSearch.subscribe(function (isOpen) { return _this.openSearchModal = isOpen; }));
3645
+ this.subscription.add(this.toolbarEvents.redactAllInProgressSubject
3646
+ .subscribe(function (inProgress) { return _this.redactAllInProgress = inProgress; }));
3647
+ };
3648
+ RedactionSearchBarComponent.prototype.ngOnDestroy = function () {
3649
+ this.subscription.unsubscribe();
3650
+ };
3651
+ RedactionSearchBarComponent.prototype.onWindowKeyDown = function (e) {
3652
+ var _this = this;
3653
+ if (e.code === 'F3' || (e.ctrlKey && e.code === 'KeyF')) {
3654
+ e.preventDefault();
3655
+ this.toolbarEvents.searchBarHidden.next(false);
3656
+ setTimeout(function () { return _this.findInput.nativeElement.focus(); }, 200);
3657
+ }
3658
+ };
3659
+ RedactionSearchBarComponent.prototype.search = function (reset) {
3660
+ if (reset === void 0) { reset = true; }
3661
+ this.redactAll = !reset;
3662
+ if (this.redactAll) {
3663
+ this.toolbarEvents.redactAllInProgressSubject.next(true);
3664
+ }
3665
+ if (reset) {
3666
+ this.redactElements = [];
3667
+ }
3668
+ this.toolbarEvents.search({
3669
+ searchTerm: this.searchText,
3670
+ highlightAll: this.highlightAll,
3671
+ matchCase: this.matchCase,
3672
+ wholeWord: this.wholeWord,
3673
+ previous: false,
3674
+ reset: reset
3675
+ });
3676
+ };
3677
+ RedactionSearchBarComponent.prototype.saveRedaction = function (redactRectangle) {
3678
+ var _this = this;
3679
+ var redaction = redactRectangle.map(function (ele) {
3680
+ return { page: ele.page, rectangles: ele.rectangles, redactionId: uuid__default$1["default"](), documentId: _this.documentId };
3681
+ });
3682
+ this.store.dispatch(new SaveBulkRedaction({ searchRedactions: redaction }));
3683
+ };
3684
+ RedactionSearchBarComponent.prototype.existInRedactElements = function (pageNumber, matechedIndex, rectangles) {
3685
+ if (this.redactElements && this.redactElements.length > 0) {
3686
+ var pagesFound = this.redactElements.find(function (re) { return re.page === pageNumber && re.matchedIndex === matechedIndex; });
3687
+ var pageRectangles = pagesFound === null || pagesFound === void 0 ? void 0 : pagesFound.rectangles;
3688
+ if (!pageRectangles || pageRectangles.length <= 0) {
3689
+ return false;
3690
+ }
3691
+ var matchesRectangles = 0;
3692
+ var _loop_1 = function (rectIndx) {
3693
+ var rectangle = pageRectangles[rectIndx];
3694
+ var foundRectangle = rectangles.find(function (re) { return re.width === rectangle.width &&
3695
+ re.height === rectangle.height && re.x === rectangle.x && re.y === rectangle.y; });
3696
+ if (foundRectangle) {
3697
+ matchesRectangles++;
3698
+ }
3699
+ };
3700
+ for (var rectIndx = 0; rectIndx < pageRectangles.length; rectIndx++) {
3701
+ _loop_1(rectIndx);
3702
+ }
3703
+ return pageRectangles.length === matchesRectangles;
3704
+ }
3705
+ return false;
3706
+ };
3707
+ RedactionSearchBarComponent.prototype.onCloseSearchModal = function () {
3708
+ this.toolbarEvents.openRedactionSearch.next(false);
3709
+ };
3710
+ RedactionSearchBarComponent.prototype.setSearchResultsCount = function (results) {
3711
+ this.resultCount = results.total;
3712
+ this.resultsText = this.resultCount > 0
3713
+ ? results.total + " results founds"
3714
+ : 'No results found';
3715
+ };
3716
+ RedactionSearchBarComponent.prototype.redactAllSearched = function (results) {
3717
+ var $this = this;
3718
+ var intervalId = setInterval(function () {
3719
+ var highlightElement = document.getElementsByClassName('highlight selected');
3720
+ if (highlightElement && highlightElement.length > 0) {
3721
+ clearInterval(intervalId);
3722
+ $this.redactAllSearchedTick(results);
3723
+ }
3724
+ }, 100);
3725
+ };
3726
+ RedactionSearchBarComponent.prototype.redactAllSearchedTick = function (results) {
3727
+ var highlightElement = document.getElementsByClassName('highlight selected');
3728
+ if (highlightElement && highlightElement.length > 0) {
3729
+ this.resultCount = results.matchesCount;
3730
+ var pageNumber = results.page + 1;
3731
+ var rectangles = this.getRectangles(pageNumber);
3732
+ if (rectangles && this.redactElements.length <= this.resultCount
3733
+ && !this.existInRedactElements(pageNumber, results.matchedIndex, rectangles)) {
3734
+ this.redactElements.push({ page: pageNumber, matchedIndex: results === null || results === void 0 ? void 0 : results.matchedIndex, rectangles: rectangles });
3735
+ this.CreateRedactAllText();
3736
+ }
3737
+ if (this.redactAll && this.resultCount && this.resultCount > 0
3738
+ && rectangles && this.redactElements.length < this.resultCount) {
3739
+ this.search(false);
3740
+ }
3741
+ if (this.redactAll && this.resultCount && this.redactElements.length === this.resultCount) {
3742
+ this.redactAll = false;
3743
+ this.redactAllText = null;
3744
+ this.saveRedaction(this.redactElements);
3745
+ }
3746
+ }
3747
+ };
3748
+ RedactionSearchBarComponent.prototype.CreateRedactAllText = function () {
3749
+ this.redactAllText = this.redactElements.length + " of " + this.resultCount;
3750
+ };
3751
+ RedactionSearchBarComponent.prototype.onEscapeKeyPress = function (e) {
3752
+ this.toolbarEvents.searchBarHidden.next(true);
3753
+ };
3754
+ RedactionSearchBarComponent.prototype.onEnterKeyPress = function (e) {
3755
+ this.search();
3756
+ };
3757
+ RedactionSearchBarComponent.prototype.toggleSearchBar = function () {
3758
+ this.toolbarEvents.searchBarHidden.next(!this.toolbarEvents.searchBarHidden.getValue());
3759
+ };
3760
+ RedactionSearchBarComponent.prototype.getRectangles = function (page) {
3761
+ this.pageHeight = this.allPages[page].styles.height;
3762
+ this.pageWidth = this.allPages[page].styles.width;
3763
+ this.zoom = parseFloat(this.allPages[page].scaleRotation.scale);
3764
+ this.rotate = parseInt(this.allPages[page].scaleRotation.rotation, 10);
3765
+ var selectedHighLightedElements = document.getElementsByClassName('highlight selected');
3766
+ if (selectedHighLightedElements && selectedHighLightedElements.length > 0) {
3767
+ var docRange = document.createRange();
3768
+ docRange.selectNodeContents(selectedHighLightedElements[0]);
3769
+ var selection = window.getSelection();
3770
+ selection === null || selection === void 0 ? void 0 : selection.removeAllRanges();
3771
+ selection === null || selection === void 0 ? void 0 : selection.addRange(docRange);
3772
+ if (selection.rangeCount && !selection.isCollapsed) {
3773
+ var range = selection.getRangeAt(0).cloneRange();
3774
+ var clientRects = range.getClientRects();
3775
+ if (clientRects) {
3776
+ var parentRect = selectedHighLightedElements[0].parentElement.parentElement.getBoundingClientRect();
3777
+ var selectionRectangles = [];
3778
+ var _loop_2 = function (i) {
3779
+ var selectionRectangle = this_1.createTextRectangle(clientRects[i], parentRect);
3780
+ var findSelecttionRectangle = selectionRectangles.find(function (rect) { return rect.width === selectionRectangle.width && rect.x === selectionRectangle.x; });
3781
+ if (!findSelecttionRectangle) {
3782
+ selectionRectangles.push(selectionRectangle);
3783
+ }
3784
+ };
3785
+ var this_1 = this;
3786
+ for (var i = 0; i < clientRects.length; i++) {
3787
+ _loop_2(i);
3788
+ }
3789
+ return selectionRectangles;
3790
+ }
3791
+ }
3792
+ }
3793
+ };
3794
+ RedactionSearchBarComponent.prototype.createTextRectangle = function (rect, parentRect) {
3795
+ var height = rect.bottom - rect.top;
3796
+ var width = rect.right - rect.left;
3797
+ var top = rect.top - parentRect.top;
3798
+ var left = rect.left - parentRect.left;
3799
+ var rectangle = this.highlightService.applyRotation(this.pageHeight, this.pageWidth, height, width, top, left, this.rotate, this.zoom);
3800
+ rectangle = Object.assign({ id: uuid__default$1["default"]() }, rectangle);
3801
+ return rectangle;
3802
+ };
3803
+ return RedactionSearchBarComponent;
3804
+ }());
3805
+ RedactionSearchBarComponent.decorators = [
3806
+ { type: i0.Component, args: [{
3807
+ selector: 'mv-redaction-search-bar',
3808
+ template: "<div\n *ngIf=\"openSearchModal\"\n class=\"searchbar redaction-search-bar govuk-!-padding-3\"\n>\n <div class=\"govuk-grid-row\">\n <div class=\"govuk-grid-column-full govuk-!-padding-right-0\">\n <div class=\"redaction-search-buttons-area\">\n <button\n id=\"mvCloseBtn\"\n #mvCloseBtn\n class=\"mv-button searchbar-button--close\"\n title=\"Close Search\"\n data-l10n-id=\"mvRedactBtn\"\n (click)=\"onCloseSearchModal()\"\n ></button>\n </div>\n <input\n id=\"search_input\"\n class=\"govuk-input govuk-!-width-three-quarters govuk-!-display-inline-block govuk-!-margin-top-5\"\n type=\"text\"\n aria-label=\"Find in document\"\n #findInput\n title=\"Find in document\"\n placeholder=\"Redact from search...\"\n tabindex=\"0\"\n data-l10n-id=\"search_input\"\n [(ngModel)]=\"searchText\"\n (keydown.escape)=\"onEscapeKeyPress($event)\"\n (keydown.enter)=\"onEnterKeyPress($event)\"\n />\n <div class=\"redaction-search-buttons-area\">\n <button\n id=\"mvSearchAllBtn\"\n class=\"govuk-button govuk-!-margin-bottom-0\"\n data-module=\"govuk-button\"\n (click)=\"search()\"\n [disabled]=\"redactAllInProgress\"\n >\n Search\n </button>\n <button\n id=\"mvRedactAllBtn\"\n class=\"govuk-button govuk-!-margin-left-2 govuk-!-margin-bottom-0\"\n data-module=\"govuk-button\"\n (click)=\"search(false)\"\n [disabled]=\"redactAllInProgress\"\n >\n Redact all\n </button>\n </div>\n <div\n class=\"govuk-grid-column-three-quarters govuk-!-padding-left-0 govuk-!-padding-top-2 redaction-status-text\"\n >\n <span\n id=\"findRedactResultsCount\"\n class=\"govuk-grid-column-full govuk-!-margin-right-4 govuk-!-margin-left-0 govuk-!-padding-left-0\"\n ><h4\n class=\"govuk-!-display-inline-block govuk-!-margin-top-0 govuk-!-margin-bottom-1\"\n *ngIf=\"redactAllInProgress\"\n >\n Redacting in progress\n </h4>\n {{ redactAllInProgress ? \"\" : resultsText }}</span\n >\n <span>\n <h5\n id=\"redactAllInProgressCount\"\n class=\"govuk-!-display-inline-block govuk-!-margin-top-0 govuk-!-margin-bottom-1\"\n >\n {{ redactAllInProgress ? redactAllText : \"\" }}\n </h5>\n </span>\n </div>\n </div>\n </div>\n</div>\n",
3809
+ styles: [".redaction-search-buttons-area{display:flex;flex-direction:row;padding-top:.5rem}.redaction-search-bar{width:20rem;left:73%;top:2%}.redaction-status-text{height:2.6rem}"]
3810
+ },] }
3811
+ ];
3812
+ /** @nocollapse */
3813
+ RedactionSearchBarComponent.ctorParameters = function () { return [
3814
+ { type: store.Store },
3815
+ { type: ToolbarButtonVisibilityService },
3816
+ { type: ToolbarEventService },
3817
+ { type: HighlightCreateService }
3818
+ ]; };
3819
+ RedactionSearchBarComponent.propDecorators = {
3820
+ findInput: [{ type: i0.ViewChild, args: ['findInput', { static: true },] }],
3821
+ onWindowKeyDown: [{ type: i0.HostListener, args: ['window:keydown', ['$event'],] }]
3822
+ };
3823
+
3500
3824
  /**
3501
3825
  * Number Helper Service
3502
3826
  * */
@@ -3559,6 +3883,8 @@
3559
3883
  }
3560
3884
  }), this.toolbarEvents.redactionMode.subscribe(function (enabled) {
3561
3885
  _this.redactionEnabled = enabled;
3886
+ }), this.toolbarEvents.redactAllInProgressSubject.subscribe(function (disable) {
3887
+ _this.redactAllInProgress = disable;
3562
3888
  }));
3563
3889
  };
3564
3890
  MainToolbarComponent.prototype.ngOnDestroy = function () {
@@ -3594,8 +3920,21 @@
3594
3920
  MainToolbarComponent.prototype.onClickDrawToggle = function () {
3595
3921
  this.toolbarEvents.toggleDrawMode();
3596
3922
  };
3597
- MainToolbarComponent.prototype.toggleSideBar = function () {
3598
- this.toolbarEvents.sidebarOpen.next(!this.toolbarEvents.sidebarOpen.getValue());
3923
+ MainToolbarComponent.prototype.toggleIndexSideBar = function () {
3924
+ var sidebarOpen = this.toolbarEvents.sidebarOpen.getValue();
3925
+ var sidebarView = this.toolbarEvents.sidebarOutlineView.getValue();
3926
+ if (!(sidebarOpen && !sidebarView)) {
3927
+ this.toolbarEvents.toggleSideBar(!sidebarOpen);
3928
+ }
3929
+ this.toolbarEvents.toggleSideBarView(true);
3930
+ };
3931
+ MainToolbarComponent.prototype.toggleBookmarksSideBar = function () {
3932
+ var sidebarOpen = this.toolbarEvents.sidebarOpen.getValue();
3933
+ var sidebarView = this.toolbarEvents.sidebarOutlineView.getValue();
3934
+ if (!(sidebarOpen && sidebarView)) {
3935
+ this.toolbarEvents.toggleSideBar(!sidebarOpen);
3936
+ }
3937
+ this.toolbarEvents.toggleSideBarView(false);
3599
3938
  };
3600
3939
  MainToolbarComponent.prototype.togglePresentBar = function () {
3601
3940
  this.toolbarEvents.searchBarHidden.next(true);
@@ -3664,7 +4003,7 @@
3664
4003
  MainToolbarComponent.decorators = [
3665
4004
  { type: i0.Component, args: [{
3666
4005
  selector: 'mv-main-toolbar',
3667
- template: "<div class=\"toolbar\">\n <div id=\"toolbarContainer\">\n <div class=\"mv-toolbar__container\">\n <div #mvToolbar class=\"mv-toolbar\" [class.notSupported]=\"!contentType\">\n <!-- The mvToolbarMain div contains all toolbar buttons except the \"More options\" button. This allows for calculation of the available space to display buttons -->\n <div id=\"mvToolbarMain\" class=\"mv-toolbar-main\" #mvToolbarMain>\n <ng-container *ngTemplateOutlet=\"menuItems\"></ng-container>\n </div>\n <!-- The mvToolbarMoreOptions div contains the \"More options\" toolbar button (and the overlay template for the dropdown menu).\n The space occupied by the button (if visible) is excluded from the toolbar space available calculation -->\n <div id=\"mvToolbarMoreOptions\" class=\"mv-toolbar-more-options\">\n <button id=\"mvMoreOptionsBtn\" class=\"mv-button mv-toolbar__menu-button--more-options\"\n [class.mv-toolbar__menu-button--more-options__hidden]=\"mvToolbar.offsetWidth >= allButtonsWidth\" aria-pressed=\"false\"\n (click)=\"toggleMoreOptions()\" cdkOverlayOrigin #trigger=\"cdkOverlayOrigin\">\n <span>More options</span>\n </button>\n <!-- This template displays the overlay content for the dropdown menu and is connected to the \"More options\" button -->\n <ng-template cdkConnectedOverlay [cdkConnectedOverlayOrigin]=\"trigger\"\n [cdkConnectedOverlayOpen]=\"isDropdownMenuOpen\" [cdkConnectedOverlayPositions]=\"dropdownMenuPositions\">\n <div class=\"dropdown-menu\" #dropdownMenu tabindex=\"0\">\n <ng-container *ngTemplateOutlet=\"menuItems\"></ng-container>\n </div>\n </ng-template>\n </div>\n </div>\n\n <div id=\"mvMenuItems\" #mvMenuItems>\n <ng-template #menuItems>\n\n <button *ngIf=\"toolbarButtons.showSidebar\" id=\"mvIndexBtn\" title=\"Index\" data-l10n-id=\"index\" #mvIndexBtn\n class=\"mv-button mv-toolbar__menu-button--index\"\n [class.button-hidden-on-toolbar]=\"mvToolbarMain.offsetWidth < widthRequiredForBtn['mvIndexBtn']\"\n [class.button-hidden-on-dropdown]=\"mvToolbarMain.offsetWidth >= widthRequiredForBtn['mvIndexBtn']\" aria-pressed=\"false\"\n (click)=\"toggleSideBar(); isDropdownMenuOpen = false\">\n <span>Index</span>\n </button>\n\n <button *ngIf=\"toolbarButtons.showDrawButton\" [disabled]=\"icpEnabled || redactionEnabled\" id=\"mvDrawBtn\"\n #mvDrawBtn class=\"mv-button mv-toolbar__menu-button--draw\" title=\"Draw a box\" tabindex=\"-1\"\n [class.button-hidden-on-toolbar]=\"mvToolbarMain.offsetWidth < widthRequiredForBtn['mvDrawBtn']\"\n [class.button-hidden-on-dropdown]=\"mvToolbarMain.offsetWidth >= widthRequiredForBtn['mvDrawBtn']\"\n [class.toggled]=\"toolbarEvents.drawModeSubject | async\" aria-hidden=\"true\" aria-pressed=\"false\"\n data-l10n-id=\"toggleDrawButton\" (click)=\"onClickDrawToggle(); isDropdownMenuOpen = false\">\n <span data-l10n-id=\"draw_label\">Draw a box</span>\n </button>\n\n <button *ngIf=\"toolbarButtons.showHighlightButton\" [disabled]=\"icpEnabled || redactionEnabled\"\n id=\"mvHighlightBtn\" #mvHighlightBtn class=\"mv-button mv-toolbar__menu-button--highlight\" title=\"Highlight\"\n tabindex=\"-1\" [class.button-hidden-on-toolbar]=\"mvToolbarMain.offsetWidth < widthRequiredForBtn['mvHighlightBtn']\"\n [class.button-hidden-on-dropdown]=\"mvToolbarMain.offsetWidth >= widthRequiredForBtn['mvHighlightBtn']\"\n [class.toggled]=\"toolbarEvents.highlightModeSubject | async\" aria-hidden=\"true\" aria-pressed=\"false\"\n (click)=\"onClickHighlightToggle(); isDropdownMenuOpen = false\" data-l10n-id=\"toggleHighlightButton\">\n <span data-l10n-id=\"highlight_label\">Highlight</span>\n </button>\n\n <ng-container *ngIf=\"toolbarButtons.showNavigation\">\n <div id=\"mvPageBtn\" #mvPageBtn class=\"mv-toolbar__menu-button--page\" aria-pressed=\"false\"\n [class.button-hidden-on-toolbar]=\"mvToolbarMain.offsetWidth < widthRequiredForBtn['mvPageBtn']\"\n [class.button-hidden-on-dropdown]=\"mvToolbarMain.offsetWidth >= widthRequiredForBtn['mvPageBtn']\">\n <span>Page</span>\n\n <button id=\"mvUpBtn\" [disabled]=\"pageNumber === 1\" title=\"Previous Page\"\n class=\"mv-toolbar__menu-button--up button-image\" data-l10n-id=\"previous\"\n (click)=\"decreasePageNumber()\"><span></span></button>\n <button id=\"mvDownBtn\" [disabled]=\"pageNumber === pageCount\" title=\"Next Page\"\n class=\"mv-toolbar__menu-button--down button-image\" data-l10n-id=\"next\"\n (click)=\"increasePageNumber()\"><span></span></button>\n\n <input type=\"number\" id=\"pageNumber\" class=\"hmcts-toolbar-input govuk-input--width-2\" title=\"Page Number\"\n value=\"1\" size=\"4\" min=\"1\" [value]=\"pageNumber\" aria-label=\"page number\" tabindex=\"0\"\n data-l10n-id=\"page\" (change)=\"onPageNumberInputChange(pageNumberInput.value)\" #pageNumberInput>\n <span id=\"numPages\" class=\"toolbarLabel\">/ {{ pageCount }}</span>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"toolbarButtons.showZoom\">\n <div id=\"mvZoomBtn\" #mvZoomBtn class=\"mv-toolbar__menu-button--zoom\" aria-pressed=\"false\"\n [class.button-hidden-on-toolbar]=\"mvToolbarMain.offsetWidth < widthRequiredForBtn['mvZoomBtn']\"\n [class.button-hidden-on-dropdown]=\"mvToolbarMain.offsetWidth >= widthRequiredForBtn['mvZoomBtn']\">\n <button [disabled]=\"toolbarEvents.zoomValueSubject.value == 0.1\" id=\"mvMinusBtn\"\n class=\"mv-toolbar__menu-button--zoom-out button-image\" title=\"Zoom Out\" data-l10n-id=\"zoom_out\"\n (click)=\"stepZoom(-0.1)\"><span></span></button>\n <select id=\"scaleSelect\" class=\"hmcts-toolbar-select\" title=\"Zoom\" tabindex=\"0\" data-l10n-id=\"zoom\"\n (change)=\"zoom($event.target.value)\" aria-label=\"zoom\">\n <option #zoomSelect id=\"customScaleOption\" title=\"\" [value]=\"toolbarEvents.zoomValueSubject.value\">\n {{(toolbarEvents.zoomValueSubject.value) * 100 | number: '1.0-0'}}%</option>\n <option *ngFor=\"let zoomScale of zoomScales\" title=\"\" [value]=\"zoomScale\"\n [attr.data-l10n-id]=\"'page_scale_percent_' + zoomScale*100\">{{ zoomScale *100 }}%\n </option>\n </select>\n\n <button [disabled]=\"toolbarEvents.zoomValueSubject.value == 5\" id=\"mvPlusBtn\"\n class=\"mv-toolbar__menu-button--zoom-in button-image\" (click)=\"stepZoom(0.1)\" title=\"Zoom In\"\n data-l10n-id=\"zoom_in\"><span></span></button>\n </div>\n </ng-container>\n\n <div *ngIf=\"toolbarButtons.showRotate\" id=\"mvRotateBtn\" #mvRotateBtn class=\"mv-toolbar__menu-button--rotate\"\n aria-pressed=\"false\" [class.button-hidden-on-toolbar]=\"mvToolbarMain.offsetWidth < widthRequiredForBtn['mvRotateBtn']\"\n [class.button-hidden-on-dropdown]=\"mvToolbarMain.offsetWidth >= widthRequiredForBtn['mvRotateBtn']\">\n <button id=\"mvRotateLeftBtn\" class=\"mv-toolbar__menu-button--rotate_left button-image\"\n title=\"Rotate Counterclockwise\" data-l10n-id=\"page_rotate_ccw\" (click)=\"rotate(270)\"><span></span>\n </button>\n <button id=\"mvRotateRightBtn\" class=\"mv-toolbar__menu-button--rotate_right button-image\"\n title=\"Rotate Clockwise\" data-l10n-id=\"page_rotate_cw\" (click)=\"rotate(90)\"><span></span>\n </button>\n <span>Rotate</span>\n </div>\n\n <button *ngIf=\"toolbarButtons.showSearchBar\" [disabled]=\"icpEnabled\" id=\"mvSearchBtn\" #mvSearchBtn\n title=\"Search\" data-l10n-id=\"searchbar\" class=\"mv-button mv-toolbar__menu-button--search\"\n [class.button-hidden-on-toolbar]=\"mvToolbarMain.offsetWidth < widthRequiredForBtn['mvSearchBtn']\"\n [class.button-hidden-on-dropdown]=\"mvToolbarMain.offsetWidth >= widthRequiredForBtn['mvSearchBtn']\" aria-pressed=\"false\"\n (click)=\"toggleSearchBar(); isDropdownMenuOpen = false\">\n </button>\n\n <button *ngIf=\"enableICP && toolbarButtons.showPresentationMode && isPdf()\"\n [disabled]=\"icpEnabled || !contentType || redactionEnabled\" id=\"mvPresentBtn\" #mvPresentBtn\n class=\"mv-button mv-toolbar__menu-button--present\" title=\"In-Court Presentation Mode\"\n data-l10n-id=\"icpMode_label\" [class.button-hidden-on-toolbar]=\"mvToolbarMain.offsetWidth < widthRequiredForBtn['mvPresentBtn']\"\n [class.button-hidden-on-dropdown]=\"mvToolbarMain.offsetWidth >= widthRequiredForBtn['mvPresentBtn']\" aria-pressed=\"false\"\n (click)=\"togglePresentBar(); isDropdownMenuOpen = false\"><span data-l10n-id=\"icpMode_label\">Present</span>\n </button>\n\n <button *ngIf=\"enableRedactions && toolbarButtons.showRedact\" [disabled]=\"icpEnabled\" id=\"mvRedactBtn\"\n #mvRedactBtn title=\"Redact\" data-l10n-id=\"redact\" class=\"mv-button mv-toolbar__menu-button--redact\"\n [class.button-hidden-on-toolbar]=\"mvToolbarMain.offsetWidth < widthRequiredForBtn['mvRedactBtn']\"\n [class.button-hidden-on-dropdown]=\"mvToolbarMain.offsetWidth >= widthRequiredForBtn['mvRedactBtn']\" aria-pressed=\"false\"\n (click)=\"toggleRedactBar(); isDropdownMenuOpen = false\">\n <span>Redact</span>\n </button>\n\n <button *ngIf=\"toolbarButtons.showGrabNDragButton\" [disabled]=\"icpEnabled\" id=\"mvGrabBtn\" #mvGrabBtn\n class=\"mv-button mv-toolbar__menu-button--grab\" title=\"Grab and drag\"\n [class.button-hidden-on-toolbar]=\"mvToolbarMain.offsetWidth < widthRequiredForBtn['mvGrabBtn']\"\n [class.button-hidden-on-dropdown]=\"mvToolbarMain.offsetWidth >= widthRequiredForBtn['mvGrabBtn']\" aria-pressed=\"false\"\n (click)=\"toggleGrabNDrag(); isDropdownMenuOpen = false\">\n <span>Grab and drag</span>\n </button>\n\n <button *ngIf=\"toolbarButtons.showDownload\" [disabled]=\"icpEnabled || redactionEnabled\" id=\"mvDownloadBtn\"\n #mvDownloadBtn class=\"mv-button mv-toolbar__menu-button--download\" title=\"Download\" data-l10n-id=\"download\"\n [class.button-hidden-on-toolbar]=\"mvToolbarMain.offsetWidth < widthRequiredForBtn['mvDownloadBtn']\"\n [class.button-hidden-on-dropdown]=\"mvToolbarMain.offsetWidth >= widthRequiredForBtn['mvDownloadBtn']\" aria-pressed=\"false\"\n (click)=\"downloadFile(); isDropdownMenuOpen = false\">\n </button>\n\n <button *ngIf=\"toolbarButtons.showPrint\" [disabled]=\"icpEnabled || redactionEnabled\" id=\"mvPrintBtn\"\n #mvPrintBtn title=\"Print\" data-l10n-id=\"print\" class=\"mv-button mv-toolbar__menu-button--print\"\n [class.button-hidden-on-toolbar]=\"mvToolbarMain.offsetWidth < widthRequiredForBtn['mvPrintBtn']\"\n [class.button-hidden-on-dropdown]=\"mvToolbarMain.offsetWidth >= widthRequiredForBtn['mvPrintBtn']\" aria-pressed=\"false\"\n (click)=\"printFile(); isDropdownMenuOpen = false\">\n </button>\n\n <button *ngIf=\"enableAnnotations && toolbarButtons.showCommentSummary\" [disabled]=\"redactionEnabled\"\n id=\"mvCommentsBtn\" #mvCommentsBtn class=\"mv-button mv-toolbar__menu-button--comments\" title=\"Comments\"\n data-l10n-id=\"comments\" [class.button-hidden-on-toolbar]=\"mvToolbarMain.offsetWidth < widthRequiredForBtn['mvCommentsBtn']\"\n [class.button-hidden-on-dropdown]=\"mvToolbarMain.offsetWidth >= widthRequiredForBtn['mvCommentsBtn']\" aria-pressed=\"false\"\n (click)=\"toggleCommentsPanel(); isDropdownMenuOpen = false\">\n <span>Comments</span>\n </button>\n\n </ng-template>\n </div>\n <mv-search-bar></mv-search-bar>\n </div>\n\n <div id=\"loadingBar\">\n <div class=\"progress\">\n <div class=\"glimmer\">\n </div>\n </div>\n </div>\n </div>\n</div>\n"
4006
+ template: "<div class=\"toolbar\">\n <div id=\"toolbarContainer\">\n <div class=\"mv-toolbar__container\">\n <div #mvToolbar class=\"mv-toolbar\" [class.notSupported]=\"!contentType\">\n <!-- The mvToolbarMain div contains all toolbar buttons except the \"More options\" button. This allows for calculation of the available space to display buttons -->\n <div id=\"mvToolbarMain\" class=\"mv-toolbar-main\" #mvToolbarMain>\n <ng-container *ngTemplateOutlet=\"menuItems\"></ng-container>\n </div>\n <!-- The mvToolbarMoreOptions div contains the \"More options\" toolbar button (and the overlay template for the dropdown menu).\n The space occupied by the button (if visible) is excluded from the toolbar space available calculation -->\n <div id=\"mvToolbarMoreOptions\" class=\"mv-toolbar-more-options\">\n <button\n id=\"mvMoreOptionsBtn\"\n class=\"mv-button mv-toolbar__menu-button--more-options\"\n [class.mv-toolbar__menu-button--more-options__hidden]=\"\n mvToolbar.offsetWidth >= allButtonsWidth\n \"\n aria-pressed=\"false\"\n (click)=\"toggleMoreOptions()\"\n cdkOverlayOrigin\n #trigger=\"cdkOverlayOrigin\"\n [disabled]=\"redactAllInProgress\"\n >\n <span>More options</span>\n </button>\n <!-- This template displays the overlay content for the dropdown menu and is connected to the \"More options\" button -->\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"trigger\"\n [cdkConnectedOverlayOpen]=\"isDropdownMenuOpen\"\n [cdkConnectedOverlayPositions]=\"dropdownMenuPositions\"\n >\n <div class=\"dropdown-menu\" #dropdownMenu tabindex=\"0\">\n <ng-container *ngTemplateOutlet=\"menuItems\"></ng-container>\n </div>\n </ng-template>\n </div>\n </div>\n\n <div id=\"mvMenuItems\" #mvMenuItems>\n <ng-template #menuItems>\n <button\n *ngIf=\"toolbarButtons.showSidebar\"\n id=\"mvIndexBtn\"\n title=\"Index\"\n data-l10n-id=\"index\"\n #mvIndexBtn\n class=\"mv-button mv-toolbar__menu-button--index\"\n [class.button-hidden-on-toolbar]=\"\n mvToolbarMain.offsetWidth < widthRequiredForBtn['mvIndexBtn']\n \"\n [class.button-hidden-on-dropdown]=\"\n mvToolbarMain.offsetWidth >= widthRequiredForBtn['mvIndexBtn']\n \"\n aria-pressed=\"false\"\n [disabled]=\"redactAllInProgress\"\n (click)=\"toggleIndexSideBar(); isDropdownMenuOpen = false\"\n >\n <span>Index</span>\n </button>\n \n <button \n *ngIf=\"toolbarButtons.showSidebar\" \n id=\"mvBookmarksBtn\" \n title=\"Bookmarks\" \n data-l10n-id=\"bookmarks\"\n #mvBookmarksBtn \n [ngClass]=\"{ \n 'mv-button mv-toolbar__menu-button--bookmarks' : true,\n 'button-hidden-on-toolbar': mvToolbarMain.offsetWidth < widthRequiredForBtn['mvBookmarksBtn'],\n 'button-hidden-on-dropdown': mvToolbarMain.offsetWidth >= widthRequiredForBtn['mvBookmarksBtn']\n }\"\n aria-pressed=\"false\"\n [disabled]=\"redactAllInProgress\"\n (click)=\"toggleBookmarksSideBar(); isDropdownMenuOpen = false\"\n >\n <span>Bookmarks</span>\n </button>\n\n <button\n *ngIf=\"toolbarButtons.showDrawButton\"\n [disabled]=\"icpEnabled || redactionEnabled\"\n id=\"mvDrawBtn\"\n #mvDrawBtn\n class=\"mv-button mv-toolbar__menu-button--draw\"\n title=\"Draw a box\"\n tabindex=\"-1\"\n [class.button-hidden-on-toolbar]=\"\n mvToolbarMain.offsetWidth < widthRequiredForBtn['mvDrawBtn']\n \"\n [class.button-hidden-on-dropdown]=\"\n mvToolbarMain.offsetWidth >= widthRequiredForBtn['mvDrawBtn']\n \"\n [class.toggled]=\"toolbarEvents.drawModeSubject | async\"\n aria-hidden=\"true\"\n aria-pressed=\"false\"\n data-l10n-id=\"toggleDrawButton\"\n (click)=\"onClickDrawToggle(); isDropdownMenuOpen = false\"\n >\n <span data-l10n-id=\"draw_label\">Draw a box</span>\n </button>\n\n <button\n *ngIf=\"toolbarButtons.showHighlightButton\"\n [disabled]=\"icpEnabled || redactionEnabled\"\n id=\"mvHighlightBtn\"\n #mvHighlightBtn\n class=\"mv-button mv-toolbar__menu-button--highlight\"\n title=\"Highlight\"\n tabindex=\"-1\"\n [class.button-hidden-on-toolbar]=\"\n mvToolbarMain.offsetWidth < widthRequiredForBtn['mvHighlightBtn']\n \"\n [class.button-hidden-on-dropdown]=\"\n mvToolbarMain.offsetWidth >= widthRequiredForBtn['mvHighlightBtn']\n \"\n [class.toggled]=\"toolbarEvents.highlightModeSubject | async\"\n aria-hidden=\"true\"\n aria-pressed=\"false\"\n (click)=\"onClickHighlightToggle(); isDropdownMenuOpen = false\"\n data-l10n-id=\"toggleHighlightButton\"\n >\n <span data-l10n-id=\"highlight_label\">Highlight</span>\n </button>\n\n <ng-container *ngIf=\"toolbarButtons.showNavigation\">\n <div\n id=\"mvPageBtn\"\n #mvPageBtn\n class=\"mv-toolbar__menu-button--page\"\n aria-pressed=\"false\"\n [class.button-hidden-on-toolbar]=\"\n mvToolbarMain.offsetWidth < widthRequiredForBtn['mvPageBtn']\n \"\n [class.button-hidden-on-dropdown]=\"\n mvToolbarMain.offsetWidth >= widthRequiredForBtn['mvPageBtn']\n \"\n >\n <span>Page</span>\n\n <button\n id=\"mvUpBtn\"\n [disabled]=\"pageNumber === 1 || redactAllInProgress\"\n title=\"Previous Page\"\n class=\"mv-toolbar__menu-button--up button-image\"\n data-l10n-id=\"previous\"\n (click)=\"decreasePageNumber()\"\n [disabled]=\"redactAllInProgress\"\n >\n <span></span>\n </button>\n <button\n id=\"mvDownBtn\"\n [disabled]=\"pageNumber === pageCount || redactAllInProgress\"\n title=\"Next Page\"\n class=\"mv-toolbar__menu-button--down button-image\"\n data-l10n-id=\"next\"\n (click)=\"increasePageNumber()\"\n >\n <span></span>\n </button>\n\n <input\n type=\"number\"\n id=\"pageNumber\"\n class=\"hmcts-toolbar-input govuk-input--width-2\"\n title=\"Page Number\"\n value=\"1\"\n size=\"4\"\n min=\"1\"\n [value]=\"pageNumber\"\n aria-label=\"page number\"\n tabindex=\"0\"\n data-l10n-id=\"page\"\n (change)=\"onPageNumberInputChange(pageNumberInput.value)\"\n [disabled]=\"redactAllInProgress\"\n #pageNumberInput\n />\n <span id=\"numPages\" class=\"toolbarLabel\">/ {{ pageCount }}</span>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"toolbarButtons.showZoom\">\n <div\n id=\"mvZoomBtn\"\n #mvZoomBtn\n class=\"mv-toolbar__menu-button--zoom\"\n aria-pressed=\"false\"\n [class.button-hidden-on-toolbar]=\"\n mvToolbarMain.offsetWidth < widthRequiredForBtn['mvZoomBtn']\n \"\n [class.button-hidden-on-dropdown]=\"\n mvToolbarMain.offsetWidth >= widthRequiredForBtn['mvZoomBtn']\n \"\n >\n <button\n [disabled]=\"\n toolbarEvents.zoomValueSubject.value == 0.1 ||\n redactAllInProgress\n \"\n id=\"mvMinusBtn\"\n class=\"mv-toolbar__menu-button--zoom-out button-image\"\n title=\"Zoom Out\"\n data-l10n-id=\"zoom_out\"\n (click)=\"stepZoom(-0.1)\"\n >\n <span></span>\n </button>\n <select\n id=\"scaleSelect\"\n class=\"hmcts-toolbar-select\"\n title=\"Zoom\"\n tabindex=\"0\"\n data-l10n-id=\"zoom\"\n (change)=\"zoom($event.target.value)\"\n aria-label=\"zoom\"\n [disabled]=\"redactAllInProgress\"\n >\n <option\n #zoomSelect\n id=\"customScaleOption\"\n title=\"\"\n [value]=\"toolbarEvents.zoomValueSubject.value\"\n >\n {{\n toolbarEvents.zoomValueSubject.value * 100\n | number : \"1.0-0\"\n }}%\n </option>\n <option\n *ngFor=\"let zoomScale of zoomScales\"\n title=\"\"\n [value]=\"zoomScale\"\n [attr.data-l10n-id]=\"'page_scale_percent_' + zoomScale * 100\"\n >\n {{ zoomScale * 100 }}%\n </option>\n </select>\n\n <button\n [disabled]=\"\n toolbarEvents.zoomValueSubject.value == 5 ||\n redactAllInProgress\n \"\n id=\"mvPlusBtn\"\n class=\"mv-toolbar__menu-button--zoom-in button-image\"\n (click)=\"stepZoom(0.1)\"\n title=\"Zoom In\"\n data-l10n-id=\"zoom_in\"\n >\n <span></span>\n </button>\n </div>\n </ng-container>\n\n <div\n *ngIf=\"toolbarButtons.showRotate\"\n id=\"mvRotateBtn\"\n #mvRotateBtn\n class=\"mv-toolbar__menu-button--rotate\"\n aria-pressed=\"false\"\n [class.button-hidden-on-toolbar]=\"\n mvToolbarMain.offsetWidth < widthRequiredForBtn['mvRotateBtn']\n \"\n [class.button-hidden-on-dropdown]=\"\n mvToolbarMain.offsetWidth >= widthRequiredForBtn['mvRotateBtn']\n \"\n >\n <button\n id=\"mvRotateLeftBtn\"\n class=\"mv-toolbar__menu-button--rotate_left button-image\"\n title=\"Rotate Counterclockwise\"\n data-l10n-id=\"page_rotate_ccw\"\n (click)=\"rotate(270)\"\n [disabled]=\"redactAllInProgress\"\n >\n <span></span>\n </button>\n <button\n id=\"mvRotateRightBtn\"\n class=\"mv-toolbar__menu-button--rotate_right button-image\"\n title=\"Rotate Clockwise\"\n data-l10n-id=\"page_rotate_cw\"\n (click)=\"rotate(90)\"\n [disabled]=\"redactAllInProgress\"\n >\n <span></span>\n </button>\n <span>Rotate</span>\n </div>\n\n <button\n *ngIf=\"toolbarButtons.showSearchBar\"\n [disabled]=\"icpEnabled || redactAllInProgress\"\n id=\"mvSearchBtn\"\n #mvSearchBtn\n title=\"Search\"\n data-l10n-id=\"searchbar\"\n class=\"mv-button mv-toolbar__menu-button--search\"\n [class.button-hidden-on-toolbar]=\"\n mvToolbarMain.offsetWidth < widthRequiredForBtn['mvSearchBtn']\n \"\n [class.button-hidden-on-dropdown]=\"\n mvToolbarMain.offsetWidth >= widthRequiredForBtn['mvSearchBtn']\n \"\n aria-pressed=\"false\"\n (click)=\"toggleSearchBar(); isDropdownMenuOpen = false\"\n ></button>\n\n <button\n *ngIf=\"enableICP && toolbarButtons.showPresentationMode && isPdf()\"\n [disabled]=\"icpEnabled || !contentType || redactionEnabled\"\n id=\"mvPresentBtn\"\n #mvPresentBtn\n class=\"mv-button mv-toolbar__menu-button--present\"\n title=\"In-Court Presentation Mode\"\n data-l10n-id=\"icpMode_label\"\n [class.button-hidden-on-toolbar]=\"\n mvToolbarMain.offsetWidth < widthRequiredForBtn['mvPresentBtn']\n \"\n [class.button-hidden-on-dropdown]=\"\n mvToolbarMain.offsetWidth >= widthRequiredForBtn['mvPresentBtn']\n \"\n aria-pressed=\"false\"\n (click)=\"togglePresentBar(); isDropdownMenuOpen = false\"\n >\n <span data-l10n-id=\"icpMode_label\">Present</span>\n </button>\n\n <button\n *ngIf=\"enableRedactions && toolbarButtons.showRedact\"\n [disabled]=\"icpEnabled || redactAllInProgress\"\n id=\"mvRedactBtn\"\n #mvRedactBtn\n title=\"Redact\"\n data-l10n-id=\"redact\"\n class=\"mv-button mv-toolbar__menu-button--redact\"\n [class.button-hidden-on-toolbar]=\"\n mvToolbarMain.offsetWidth < widthRequiredForBtn['mvRedactBtn']\n \"\n [class.button-hidden-on-dropdown]=\"\n mvToolbarMain.offsetWidth >= widthRequiredForBtn['mvRedactBtn']\n \"\n aria-pressed=\"false\"\n (click)=\"toggleRedactBar(); isDropdownMenuOpen = false\"\n >\n <span>Redact</span>\n </button>\n\n <button\n *ngIf=\"toolbarButtons.showGrabNDragButton\"\n [disabled]=\"icpEnabled || redactAllInProgress\"\n id=\"mvGrabBtn\"\n #mvGrabBtn\n class=\"mv-button mv-toolbar__menu-button--grab\"\n title=\"Grab and drag\"\n [class.button-hidden-on-toolbar]=\"\n mvToolbarMain.offsetWidth < widthRequiredForBtn['mvGrabBtn']\n \"\n [class.button-hidden-on-dropdown]=\"\n mvToolbarMain.offsetWidth >= widthRequiredForBtn['mvGrabBtn']\n \"\n aria-pressed=\"false\"\n (click)=\"toggleGrabNDrag(); isDropdownMenuOpen = false\"\n >\n <span>Grab and drag</span>\n </button>\n\n <button\n *ngIf=\"toolbarButtons.showDownload\"\n [disabled]=\"icpEnabled || redactionEnabled\"\n id=\"mvDownloadBtn\"\n #mvDownloadBtn\n class=\"mv-button mv-toolbar__menu-button--download\"\n title=\"Download\"\n data-l10n-id=\"download\"\n [class.button-hidden-on-toolbar]=\"\n mvToolbarMain.offsetWidth < widthRequiredForBtn['mvDownloadBtn']\n \"\n [class.button-hidden-on-dropdown]=\"\n mvToolbarMain.offsetWidth >= widthRequiredForBtn['mvDownloadBtn']\n \"\n aria-pressed=\"false\"\n (click)=\"downloadFile(); isDropdownMenuOpen = false\"\n ></button>\n\n <button\n *ngIf=\"toolbarButtons.showPrint\"\n [disabled]=\"icpEnabled || redactionEnabled\"\n id=\"mvPrintBtn\"\n #mvPrintBtn\n title=\"Print\"\n data-l10n-id=\"print\"\n class=\"mv-button mv-toolbar__menu-button--print\"\n [class.button-hidden-on-toolbar]=\"\n mvToolbarMain.offsetWidth < widthRequiredForBtn['mvPrintBtn']\n \"\n [class.button-hidden-on-dropdown]=\"\n mvToolbarMain.offsetWidth >= widthRequiredForBtn['mvPrintBtn']\n \"\n aria-pressed=\"false\"\n (click)=\"printFile(); isDropdownMenuOpen = false\"\n ></button>\n\n <button\n *ngIf=\"enableAnnotations && toolbarButtons.showCommentSummary\"\n [disabled]=\"redactionEnabled\"\n id=\"mvCommentsBtn\"\n #mvCommentsBtn\n class=\"mv-button mv-toolbar__menu-button--comments\"\n title=\"Comments\"\n data-l10n-id=\"comments\"\n [class.button-hidden-on-toolbar]=\"\n mvToolbarMain.offsetWidth < widthRequiredForBtn['mvCommentsBtn']\n \"\n [class.button-hidden-on-dropdown]=\"\n mvToolbarMain.offsetWidth >= widthRequiredForBtn['mvCommentsBtn']\n \"\n aria-pressed=\"false\"\n (click)=\"toggleCommentsPanel(); isDropdownMenuOpen = false\"\n >\n <span>Comments</span>\n </button>\n </ng-template>\n </div>\n <mv-search-bar></mv-search-bar>\n </div>\n\n <div id=\"loadingBar\">\n <div class=\"progress\">\n <div class=\"glimmer\"></div>\n </div>\n </div>\n </div>\n</div>\n"
3668
4007
  },] }
3669
4008
  ];
3670
4009
  /** @nocollapse */
@@ -3831,12 +4170,19 @@
3831
4170
  this.store = store;
3832
4171
  this.preview = false;
3833
4172
  this.hasRedactions = false;
4173
+ this.subscriptions = [];
3834
4174
  }
3835
4175
  RedactionToolbarComponent.prototype.ngOnInit = function () {
3836
4176
  var _this = this;
3837
- this.$subscription = this.store.pipe(store.select(getRedactionArray)).subscribe(function (redactions) {
4177
+ this.subscriptions.push(this.store.pipe(store.select(getRedactionArray)).subscribe(function (redactions) {
3838
4178
  _this.hasRedactions = !!redactions.redactions.length;
3839
- });
4179
+ }));
4180
+ this.subscriptions.push(this.toolbarEventService.redactAllInProgressSubject.subscribe(function (inprogress) {
4181
+ _this.redactionAllInProgress = inprogress;
4182
+ }));
4183
+ };
4184
+ RedactionToolbarComponent.prototype.onRedactAllSearch = function () {
4185
+ this.toolbarEventService.openRedactionSearch.next(true);
3840
4186
  };
3841
4187
  RedactionToolbarComponent.prototype.toggleTextRedactionMode = function () {
3842
4188
  this.toolbarEventService.highlightModeSubject.next(true);
@@ -3862,14 +4208,27 @@
3862
4208
  this.toolbarEventService.redactPage();
3863
4209
  };
3864
4210
  RedactionToolbarComponent.prototype.ngOnDestroy = function () {
3865
- this.$subscription.unsubscribe();
4211
+ var e_1, _a;
4212
+ try {
4213
+ for (var _b = __values(this.subscriptions), _c = _b.next(); !_c.done; _c = _b.next()) {
4214
+ var subscription = _c.value;
4215
+ subscription.unsubscribe();
4216
+ }
4217
+ }
4218
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
4219
+ finally {
4220
+ try {
4221
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
4222
+ }
4223
+ finally { if (e_1) throw e_1.error; }
4224
+ }
3866
4225
  };
3867
4226
  return RedactionToolbarComponent;
3868
4227
  }());
3869
4228
  RedactionToolbarComponent.decorators = [
3870
4229
  { type: i0.Component, args: [{
3871
4230
  selector: 'mv-redaction-toolbar',
3872
- template: "<div class=\"redaction\">\n <label class=\"govuk-label redaction-title\" data-l10n-id=\"redaction_options\">Redaction options</label>\n <button id=\"toggleDrawButton\" class=\"mv-button redaction-button--draw\" title=\"Draw a box\"\n data-l10n-id=\"toggleDrawButton\" (click)=\"toggleDrawMode()\">\n <span data-l10n-id=\"toggleDrawButton_label\">Draw a box</span>\n </button>\n\n <button id=\"redactPageButton\" class=\"mv-button redaction-button--redact-page\" title=\"Redact Page\"\n data-l10n-id=\"redactPageButton\" (click)=\"redactPage()\">\n <span data-l10n-id=\"redactPageButton_label\">Redact page</span>\n </button>\n\n <button *ngIf=\"toolbarButtons.showHighlightButton\" id=\"toggleHighlightButton\"\n class=\"mv-button redaction-button--redact\" aria-pressed=\"false\" title=\"Redact text\"\n data-l10n-id=\"toggleTextRedactionButton\" (click)=\"toggleTextRedactionMode()\">\n <span data-l10n-id=\"toggleTextRedactionButton_label\">Redact text</span>\n </button>\n\n <button [disabled]=\"!hasRedactions\" id=\"mvClearBtn\" #mvClearBtn class=\"mv-button redaction-button--clear\" aria-pressed=\"false\" title=\"Clear all\"\n data-l10n-id=\"toggleClearAllButton\" (click)=\"unmarkAll()\">\n <span data-l10n-id=\"Clear all\">Clear all</span>\n </button>\n\n <button [disabled]=\"!hasRedactions\" id=\"mvPreviewBtn\" class=\"mv-button\" [class.redaction-button--preview]=\"!preview\"\n [class.redaction-button--hide-preview]=\"preview\" redaction-button--preview aria-pressed=\"false\" title=\"Preview\"\n data-l10n-id=\"togglePreviewButton\" (click)=\"togglePreview()\">\n <span *ngIf=\"!preview\" data-l10n-id=\"redaction-preview_label\">Preview</span>\n <span *ngIf=\"preview\" data-l10n-id=\"redaction-hide-preview_label\">Hide preview</span>\n </button>\n\n <button [disabled]=\"!hasRedactions\" id=\"mvRedactBtn\" class=\"mv-button redaction-button--download\" aria-pressed=\"false\" title=\"Redact\"\n data-l10n-id=\"mvRedactBtn\" (click)=\"redact()\">\n <span data-l10n-id=\"Save Document\">Save document</span>\n </button>\n\n <button id=\"mvCloseBtn\" #mvCloseBtn class=\"mv-button redaction-button--close\" title=\"Close Redaction\" data-l10n-id=\"mvRedactBtn\"\n (click)=\"toggleRedactBar()\">\n <span data-l10n-id=\"Close Redaction\">Close Redaction</span>\n </button>\n\n</div>\n"
4231
+ template: "<div class=\"redaction\">\n <label class=\"govuk-label redaction-title\" data-l10n-id=\"redaction_options\"\n >Redaction options</label\n >\n <button\n id=\"toggleDrawButton\"\n class=\"mv-button redaction-button--draw\"\n title=\"Draw a box\"\n data-l10n-id=\"toggleDrawButton\"\n (click)=\"toggleDrawMode()\"\n [disabled]=\"redactionAllInProgress\"\n >\n <span data-l10n-id=\"toggleDrawButton_label\">Draw a box</span>\n </button>\n\n <button\n id=\"redactPageButton\"\n class=\"mv-button redaction-button--redact-page\"\n title=\"Redact Page\"\n data-l10n-id=\"redactPageButton\"\n (click)=\"redactPage()\"\n [disabled]=\"redactionAllInProgress\"\n >\n <span data-l10n-id=\"redactPageButton_label\">Redact page</span>\n </button>\n <button\n *ngIf=\"showRedactSearch\"\n id=\"mvRedactFromSearchBtn\"\n title=\"From search\"\n data-l10n-id=\"fromSearchButton\"\n class=\"mv-button redaction-button--search\"\n (click)=\"onRedactAllSearch()\"\n [disabled]=\"redactionAllInProgress\"\n >\n <span style=\"width: 5rem\" data-l10n-id=\"fromSearchButton_label\"\n >From search</span\n >\n </button>\n\n <button\n *ngIf=\"toolbarButtons.showHighlightButton\"\n id=\"toggleHighlightButton\"\n class=\"mv-button redaction-button--redact\"\n aria-pressed=\"false\"\n title=\"Redact text\"\n data-l10n-id=\"toggleTextRedactionButton\"\n (click)=\"toggleTextRedactionMode()\"\n [disabled]=\"redactionAllInProgress\"\n >\n <span data-l10n-id=\"toggleTextRedactionButton_label\">Redact text</span>\n </button>\n\n <button\n [disabled]=\"!hasRedactions || redactionAllInProgress\"\n id=\"mvClearBtn\"\n #mvClearBtn\n class=\"mv-button redaction-button--clear\"\n aria-pressed=\"false\"\n title=\"Clear all\"\n data-l10n-id=\"toggleClearAllButton\"\n (click)=\"unmarkAll()\"\n >\n <span data-l10n-id=\"Clear all\">Clear all</span>\n </button>\n\n <button\n [disabled]=\"!hasRedactions || redactionAllInProgress\"\n id=\"mvPreviewBtn\"\n class=\"mv-button\"\n [class.redaction-button--preview]=\"!preview\"\n [class.redaction-button--hide-preview]=\"preview\"\n redaction-button--preview\n aria-pressed=\"false\"\n title=\"Preview\"\n data-l10n-id=\"togglePreviewButton\"\n (click)=\"togglePreview()\"\n >\n <span *ngIf=\"!preview\" data-l10n-id=\"redaction-preview_label\">Preview</span>\n <span *ngIf=\"preview\" data-l10n-id=\"redaction-hide-preview_label\"\n >Hide preview</span\n >\n </button>\n\n <button\n [disabled]=\"!hasRedactions || redactionAllInProgress\"\n id=\"mvRedactBtn\"\n class=\"mv-button redaction-button--download\"\n aria-pressed=\"false\"\n title=\"Redact\"\n data-l10n-id=\"mvRedactBtn\"\n (click)=\"redact()\"\n >\n <span data-l10n-id=\"Save Document\">Save document</span>\n </button>\n\n <button\n id=\"mvCloseBtn\"\n #mvCloseBtn\n class=\"mv-button redaction-button--close\"\n title=\"Close Redaction\"\n data-l10n-id=\"mvRedactBtn\"\n (click)=\"toggleRedactBar()\"\n [disabled]=\"redactionAllInProgress\"\n >\n <span data-l10n-id=\"Close Redaction\">Close Redaction</span>\n </button>\n</div>\n"
3873
4232
  },] }
3874
4233
  ];
3875
4234
  /** @nocollapse */
@@ -3878,6 +4237,9 @@
3878
4237
  { type: ToolbarButtonVisibilityService },
3879
4238
  { type: store.Store }
3880
4239
  ]; };
4240
+ RedactionToolbarComponent.propDecorators = {
4241
+ showRedactSearch: [{ type: i0.Input }]
4242
+ };
3881
4243
 
3882
4244
  var IcpToolbarComponent = /** @class */ (function () {
3883
4245
  function IcpToolbarComponent(toolbarEventService, store) {
@@ -3931,7 +4293,8 @@
3931
4293
  SearchBarComponent,
3932
4294
  MainToolbarComponent,
3933
4295
  RedactionToolbarComponent,
3934
- IcpToolbarComponent
4296
+ IcpToolbarComponent,
4297
+ RedactionSearchBarComponent
3935
4298
  ],
3936
4299
  providers: [
3937
4300
  ToolbarButtonVisibilityService,
@@ -3941,7 +4304,8 @@
3941
4304
  MainToolbarComponent,
3942
4305
  SearchBarComponent,
3943
4306
  RedactionToolbarComponent,
3944
- IcpToolbarComponent
4307
+ IcpToolbarComponent,
4308
+ RedactionSearchBarComponent
3945
4309
  ],
3946
4310
  imports: [
3947
4311
  common.CommonModule,
@@ -4084,92 +4448,37 @@
4084
4448
  pageWidth: [{ type: i0.Input }]
4085
4449
  };
4086
4450
 
4087
- var HighlightCreateService = /** @class */ (function () {
4088
- function HighlightCreateService(toolBarEvents, store) {
4089
- this.toolBarEvents = toolBarEvents;
4090
- this.store = store;
4451
+ var RectangleComponent = /** @class */ (function () {
4452
+ function RectangleComponent(toolbarEvents, highlightService) {
4453
+ this.toolbarEvents = toolbarEvents;
4454
+ this.highlightService = highlightService;
4455
+ this.select = new i0.EventEmitter();
4456
+ this.update = new i0.EventEmitter();
4457
+ this.subscriptions = [];
4458
+ this.enableGrabNDrag = false;
4091
4459
  }
4092
- HighlightCreateService.prototype.saveAnnotation = function (rectangles, page) {
4460
+ Object.defineProperty(RectangleComponent.prototype, "annoRect", {
4461
+ get: function () {
4462
+ return this._annoRect;
4463
+ },
4464
+ set: function (annoRect) {
4465
+ this._annoRect = Object.assign({}, annoRect);
4466
+ this.height = +(annoRect.height * this.zoom).toFixed(2);
4467
+ this.width = +(annoRect.width * this.zoom).toFixed(2);
4468
+ this.left = +(annoRect.x * this.zoom).toFixed(2);
4469
+ this.top = +(annoRect.y * this.zoom).toFixed(2);
4470
+ },
4471
+ enumerable: false,
4472
+ configurable: true
4473
+ });
4474
+ RectangleComponent.prototype.ngOnChanges = function (changes) {
4475
+ if (changes.rotate) {
4476
+ this.adjustForRotation(this.rotate);
4477
+ }
4478
+ };
4479
+ RectangleComponent.prototype.ngAfterViewInit = function () {
4093
4480
  var _this = this;
4094
- this.store.pipe(store.select(getDocumentIdSetId), operators.take(1)).subscribe(function (anoSetDocId) {
4095
- var anno = Object.assign(Object.assign({ id: uuid__default$1["default"](), color: 'FFFF00', comments: [], page: page, rectangles: rectangles, type: 'highlight' }, anoSetDocId), { createdBy: '', createdByDetails: undefined, createdDate: moment__default["default"].utc().tz('Europe/London').toISOString(), lastModifiedBy: '', lastModifiedByDetails: undefined, lastModifiedDate: '', tags: [] });
4096
- _this.store.dispatch(new SaveAnnotation(anno));
4097
- });
4098
- };
4099
- HighlightCreateService.prototype.applyRotation = function (pageHeight, pageWidth, offsetHeight, offsetWidth, offsetTop, offsetLeft, rotate, zoom) {
4100
- var _a = {
4101
- x: +(offsetLeft / zoom).toFixed(2),
4102
- y: +(offsetTop / zoom).toFixed(2),
4103
- width: +(offsetWidth / zoom).toFixed(2),
4104
- height: +(offsetHeight / zoom).toFixed(2)
4105
- }, x = _a.x, y = _a.y, width = _a.width, height = _a.height;
4106
- var rectangle = { x: x, y: y, width: width, height: height };
4107
- switch (rotate) {
4108
- case 90:
4109
- rectangle.width = height;
4110
- rectangle.height = width;
4111
- rectangle.x = y;
4112
- rectangle.y = +(pageWidth / zoom - x - width).toFixed(2);
4113
- break;
4114
- case 180:
4115
- rectangle.x = +(pageWidth / zoom - x - width).toFixed(2);
4116
- rectangle.y = +(pageHeight / zoom - y - height).toFixed(2);
4117
- break;
4118
- case 270:
4119
- rectangle.width = height;
4120
- rectangle.height = width;
4121
- rectangle.x = +(pageHeight / zoom - y - height).toFixed(2);
4122
- rectangle.y = x;
4123
- break;
4124
- }
4125
- return rectangle;
4126
- };
4127
- HighlightCreateService.prototype.resetHighlight = function () {
4128
- window.getSelection().removeAllRanges();
4129
- this.toolBarEvents.highlightModeSubject.next(false);
4130
- };
4131
- return HighlightCreateService;
4132
- }());
4133
- HighlightCreateService.decorators = [
4134
- { type: i0.Injectable }
4135
- ];
4136
- /** @nocollapse */
4137
- HighlightCreateService.ctorParameters = function () { return [
4138
- { type: ToolbarEventService },
4139
- { type: store.Store }
4140
- ]; };
4141
-
4142
- var RectangleComponent = /** @class */ (function () {
4143
- function RectangleComponent(toolbarEvents, highlightService) {
4144
- this.toolbarEvents = toolbarEvents;
4145
- this.highlightService = highlightService;
4146
- this.select = new i0.EventEmitter();
4147
- this.update = new i0.EventEmitter();
4148
- this.subscriptions = [];
4149
- this.enableGrabNDrag = false;
4150
- }
4151
- Object.defineProperty(RectangleComponent.prototype, "annoRect", {
4152
- get: function () {
4153
- return this._annoRect;
4154
- },
4155
- set: function (annoRect) {
4156
- this._annoRect = Object.assign({}, annoRect);
4157
- this.height = +(annoRect.height * this.zoom).toFixed(2);
4158
- this.width = +(annoRect.width * this.zoom).toFixed(2);
4159
- this.left = +(annoRect.x * this.zoom).toFixed(2);
4160
- this.top = +(annoRect.y * this.zoom).toFixed(2);
4161
- },
4162
- enumerable: false,
4163
- configurable: true
4164
- });
4165
- RectangleComponent.prototype.ngOnChanges = function (changes) {
4166
- if (changes.rotate) {
4167
- this.adjustForRotation(this.rotate);
4168
- }
4169
- };
4170
- RectangleComponent.prototype.ngAfterViewInit = function () {
4171
- var _this = this;
4172
- this.subscriptions.push(this.toolbarEvents.grabNDrag.subscribe(function (grabNDrag) { return _this.enableGrabNDrag = grabNDrag; }));
4481
+ this.subscriptions.push(this.toolbarEvents.grabNDrag.subscribe(function (grabNDrag) { return _this.enableGrabNDrag = grabNDrag; }));
4173
4482
  };
4174
4483
  RectangleComponent.prototype.ngOnDestroy = function () {
4175
4484
  this.subscriptions.filter(function (subscription) { return !subscription.closed; })
@@ -4312,6 +4621,7 @@
4312
4621
  this.subscriptions = this.store.select(getComponentSearchText)
4313
4622
  .pipe(operators.distinctUntilChanged()).subscribe(function (searchString) { return _this.searchString = searchString; });
4314
4623
  this.reRenderComments();
4624
+ this.marginToComment$ = this.commentService.marginToCommentEmitter.asObservable();
4315
4625
  };
4316
4626
  CommentComponent.prototype.ngAfterContentInit = function () {
4317
4627
  if (this.tagItems && this.tagItems.length) {
@@ -4443,7 +4753,7 @@
4443
4753
  CommentComponent.decorators = [
4444
4754
  { type: i0.Component, args: [{
4445
4755
  selector: 'mv-anno-comment',
4446
- template: "<div #form (click)=\"onCommentClick()\" class=\"aui-comment\"\n [style.top.px]=\"commentTop\"\n [style.zIndex]=\"selected ? 100 : 0\">\n <div id=\"detailsWrapper {{index}}\" class=\"aui-comment__header\">\n <span *ngIf=\"author && !editor\" class=\"aui-comment__author\">\n {{ author.forename }} {{ author.surname }}\n </span>\n <span *ngIf=\"editor\" class=\"aui-comment__author\">\n {{ editor.forename }} {{ editor.surname }}\n </span>\n <time [hidden]=\"!selected && !this.editable\" class=\"aui-comment__meta\">\n {{ lastUpdate | momentDate: 'd MMMM y h:mm a' }}\n </time>\n </div>\n <mv-tags\n [tagItems]=\"tagItems\"\n [userId]=\"createdBy\"\n [editable]=\"editable\"\n [annoId]=\"_comment.annotationId\">\n </mv-tags>\n <textarea *ngIf=\"selected && editable\"\n #editableComment\n mvTextAreaAutoExpand\n type=\"text\"\n required\n name=\"content\"\n [maxlength]=\"CHAR_LIMIT\"\n class=\"aui-comment__content form-control mimic-focus edit-mode expanded\"\n [(ngModel)]=\"fullComment\"\n (ngModelChange)=\"reRenderComments(); onCommentChange($event);\"\n aria-label=\"comment\">\n </textarea>\n <p *ngIf=\"!editable\"\n mvTextHighlight class=\"commentText\" [textToHighlight]=\"searchString\">\n {{ fullComment }}\n </p>\n <div *ngIf=\"selected || this.editable || (!fullComment.length && (tagItems && !tagItems.length))\"\n class=\"aui-comment__footer commentBtns\">\n <button class=\"govuk-button\"\n type=\"button\" role=\"button\"\n (click)=\"editOrSave()\">\n {{ !editable ? 'Edit' : 'Save' }}\n </button>\n <button type=\"button\" role=\"button\"\n class=\"govuk-button govuk-button--secondary\"\n (click)=\"deleteOrCancel()\">\n {{ !editable ? 'Delete' : 'Cancel' }}\n </button>\n </div>\n <span class=\"aui-comment__private\">private</span>\n</div>\n"
4756
+ template: "<div #form (click)=\"onCommentClick()\" class=\"aui-comment\"\n [ngClass]=\"{'stylestoggle' : (marginToComment$ | async ) }\"\n [style.top.px]=\"commentTop\"\n [style.zIndex]=\"selected ? 100 : 0\">\n <div id=\"detailsWrapper {{index}}\" class=\"aui-comment__header\">\n <span *ngIf=\"author && !editor\" class=\"aui-comment__author\">\n {{ author.forename }} {{ author.surname }}\n </span>\n <span *ngIf=\"editor\" class=\"aui-comment__author\">\n {{ editor.forename }} {{ editor.surname }}\n </span>\n <time [hidden]=\"!selected && !this.editable\" class=\"aui-comment__meta\">\n {{ lastUpdate | momentDate: 'd MMMM y h:mm a' }}\n </time>\n </div>\n <mv-tags\n [tagItems]=\"tagItems\"\n [userId]=\"createdBy\"\n [editable]=\"editable\"\n [annoId]=\"_comment.annotationId\">\n </mv-tags>\n <textarea *ngIf=\"selected && editable\"\n #editableComment\n mvTextAreaAutoExpand\n type=\"text\"\n required\n name=\"content\"\n [maxlength]=\"CHAR_LIMIT\"\n class=\"aui-comment__content form-control mimic-focus edit-mode expanded\"\n [(ngModel)]=\"fullComment\"\n (ngModelChange)=\"reRenderComments(); onCommentChange($event);\"\n aria-label=\"comment\">\n </textarea>\n <p *ngIf=\"!editable\"\n mvTextHighlight class=\"commentText\" [textToHighlight]=\"searchString\">\n {{ fullComment }}\n </p>\n <div *ngIf=\"selected || this.editable || (!fullComment.length && (tagItems && !tagItems.length))\"\n class=\"aui-comment__footer commentBtns\">\n <button class=\"govuk-button\"\n type=\"button\" role=\"button\"\n (click)=\"editOrSave()\">\n {{ !editable ? 'Edit' : 'Save' }}\n </button>\n <button type=\"button\" role=\"button\"\n class=\"govuk-button govuk-button--secondary\"\n (click)=\"deleteOrCancel()\">\n {{ !editable ? 'Delete' : 'Cancel' }}\n </button>\n </div>\n <span class=\"aui-comment__private\">private</span>\n</div>\n"
4447
4757
  },] }
4448
4758
  ];
4449
4759
  /** @nocollapse */
@@ -4940,7 +5250,7 @@
4940
5250
  if (this.height / this.zoom > 5 || this.width / this.zoom > 5) {
4941
5251
  var rectangle = this.highlightService
4942
5252
  .applyRotation(this.pageHeight, this.pageWidth, this.height, this.width, this.top, this.left, this.rotate, this.zoom);
4943
- rectangle = Object.assign({ id: uuid__default$1["default"]() }, rectangle);
5253
+ rectangle = Object.assign({ id: uuid$1.v4() }, rectangle);
4944
5254
  this.saveSelection.emit({ rectangles: [rectangle], page: this.page });
4945
5255
  this.resetHighlight();
4946
5256
  }
@@ -4985,8 +5295,9 @@
4985
5295
  };
4986
5296
 
4987
5297
  var CommentSetHeaderComponent = /** @class */ (function () {
4988
- function CommentSetHeaderComponent(store, toolbarEvents) {
5298
+ function CommentSetHeaderComponent(store, commentService, toolbarEvents) {
4989
5299
  this.store = store;
5300
+ this.commentService = commentService;
4990
5301
  this.toolbarEvents = toolbarEvents;
4991
5302
  this.showCommentSummaryDialog = new i0.EventEmitter();
4992
5303
  this.tabs = [];
@@ -5012,6 +5323,14 @@
5012
5323
  };
5013
5324
  CommentSetHeaderComponent.prototype.selectTab = function (tab) {
5014
5325
  this.tabSelected = tab !== this.tabSelected ? tab : undefined;
5326
+ if (this.tabSelected) {
5327
+ this.marginToComment = true;
5328
+ this.commentService.createMarginToCommentEvent(this.marginToComment);
5329
+ }
5330
+ else {
5331
+ this.marginToComment = false;
5332
+ this.commentService.createMarginToCommentEvent(this.marginToComment);
5333
+ }
5015
5334
  };
5016
5335
  CommentSetHeaderComponent.prototype.toggleCommentsPanel = function () {
5017
5336
  this.toolbarEvents.toggleCommentsPanel(!this.toolbarEvents.commentsPanelVisible.getValue());
@@ -5031,6 +5350,7 @@
5031
5350
  /** @nocollapse */
5032
5351
  CommentSetHeaderComponent.ctorParameters = function () { return [
5033
5352
  { type: store.Store },
5353
+ { type: CommentService },
5034
5354
  { type: ToolbarEventService }
5035
5355
  ]; };
5036
5356
  CommentSetHeaderComponent.propDecorators = {
@@ -5614,7 +5934,7 @@
5614
5934
  pageNumber: pdfPosition.pageNumber - 1,
5615
5935
  xCoordinate: pdfPosition.left,
5616
5936
  yCoordinate: pages[pdfPosition.pageNumber].styles.height - (pdfPosition.top * pages[pdfPosition.pageNumber].viewportScale),
5617
- previous: bookmarkNodes.length > 0 ? bookmarkNodes[bookmarkNodes.length - 1].id : undefined,
5937
+ previous: bookmarkNodes.length > 0 ? bookmarkNodes.sort(function (a, b) { return a.index - b.index; })[bookmarkNodes.length - 1].id : undefined,
5618
5938
  documentId: docId
5619
5939
  };
5620
5940
  };
@@ -5677,8 +5997,9 @@
5677
5997
  this.store.pipe(store.select(getBookmarkInfo), operators.take(1))
5678
5998
  .subscribe(function (bookmarkInfo) {
5679
5999
  var selection = window.getSelection().toString();
5680
- _this.store.dispatch(new CreateBookmark(Object.assign(Object.assign({}, bookmarkInfo), { name: selection.length > 0 ? selection.substr(0, 30) : 'new bookmark', id: uuid__default$1["default"](), pageNumber: _this.highlightPage - 1, xCoordinate: rectangle.x, yCoordinate: rectangle.y })));
6000
+ _this.store.dispatch(new CreateBookmark(Object.assign(Object.assign({}, bookmarkInfo), { name: selection.length > 0 ? selection.substr(0, 30) : 'new bookmark', id: uuid$1.v4(), pageNumber: _this.highlightPage - 1, xCoordinate: rectangle.x, yCoordinate: rectangle.y })));
5681
6001
  _this.toolbarEvents.toggleSideBar(true);
6002
+ _this.toolbarEvents.toggleSideBarView(false);
5682
6003
  _this.highlightService.resetHighlight();
5683
6004
  _this.rectangles = undefined;
5684
6005
  });
@@ -5758,6 +6079,7 @@
5758
6079
  BookmarksApiService,
5759
6080
  CommentSetRenderService,
5760
6081
  HighlightCreateService,
6082
+ CommentService,
5761
6083
  TagsServices
5762
6084
  ],
5763
6085
  exports: [
@@ -5829,17 +6151,205 @@
5829
6151
  onWindowPointerUp: [{ type: i0.HostListener, args: ['window:pointerup',] }]
5830
6152
  };
5831
6153
 
6154
+ var BookmarksComponent = /** @class */ (function () {
6155
+ function BookmarksComponent(store) {
6156
+ this.store = store;
6157
+ this.goToDestination = new i0.EventEmitter();
6158
+ this.pageLookup = {};
6159
+ this.BOOKMARK_CHAR_LIMIT = 30;
6160
+ this.options = {
6161
+ allowDrag: true,
6162
+ allowDrop: true
6163
+ };
6164
+ this._customSort = 'CUSTOM';
6165
+ this._positionSort = 'POSITION';
6166
+ }
6167
+ BookmarksComponent.prototype.ngOnInit = function () {
6168
+ var _this = this;
6169
+ this.sortMode = this.customSort;
6170
+ this.$subscription = this.store.pipe(store.select(getEditableBookmark))
6171
+ .subscribe(function (editableId) { return _this.editableBookmark = editableId; });
6172
+ this.$subscription.add(this.store.select(getPages)
6173
+ .subscribe(function (pages) {
6174
+ Object.keys(pages).map(function (key) {
6175
+ _this.pageLookup[key] = pages[key];
6176
+ });
6177
+ }));
6178
+ };
6179
+ BookmarksComponent.prototype.ngOnChanges = function (changes) {
6180
+ if (changes.bookmarkNodes && this.sortMode !== this.customSort) {
6181
+ this.sortBookmarks();
6182
+ }
6183
+ };
6184
+ BookmarksComponent.prototype.ngOnDestroy = function () {
6185
+ this.$subscription.unsubscribe();
6186
+ };
6187
+ BookmarksComponent.prototype.editBookmark = function (id) {
6188
+ this.editableBookmark = id;
6189
+ };
6190
+ BookmarksComponent.prototype.onAddBookmarkClick = function () {
6191
+ var _this = this;
6192
+ this.store.pipe(store.select(getBookmarkInfo), operators.take(1))
6193
+ .subscribe(function (bookmarkInfo) {
6194
+ _this.store.dispatch(new CreateBookmark(Object.assign(Object.assign({}, bookmarkInfo), { name: '', id: uuid__default$1["default"]() })));
6195
+ });
6196
+ };
6197
+ BookmarksComponent.prototype.onBookmarkMove = function (_a) {
6198
+ var node = _a.node, from = _a.from, to = _a.to;
6199
+ var movedBookmarks = [Object.assign(Object.assign({}, node), { previous: to.index > 0 ? to.parent.children[to.index - 1].id : undefined, parent: to.parent.documentId ? to.parent.id : undefined })];
6200
+ var fromNext = this.getSibling(from, from.index);
6201
+ fromNext = fromNext && fromNext.id === node.previous ? this.getSibling(from, from.index + 1) : fromNext;
6202
+ if (fromNext) {
6203
+ movedBookmarks = __spread(movedBookmarks, [Object.assign(Object.assign({}, fromNext), { previous: node.previous })]);
6204
+ }
6205
+ var toNext = this.getSibling(to, to.index + 1);
6206
+ if (toNext) {
6207
+ movedBookmarks = __spread(movedBookmarks, [Object.assign(Object.assign({}, toNext), { previous: node.id })]);
6208
+ }
6209
+ this.store.dispatch(new MoveBookmark(movedBookmarks));
6210
+ };
6211
+ BookmarksComponent.prototype.deleteBookmark = function (node) {
6212
+ this.customSortBookmarks();
6213
+ var next;
6214
+ node = this.tree.treeModel.getNodeById(node.id);
6215
+ if (!node.parent) {
6216
+ node.parent = this.tree.treeModel.virtualRoot;
6217
+ }
6218
+ var siblings = node.parent.children;
6219
+ if (siblings.length > node.index + 1) {
6220
+ next = siblings[node.index + 1].data;
6221
+ next.previous = node.data.previous;
6222
+ }
6223
+ this.store.dispatch(new DeleteBookmark({
6224
+ deleted: __spread([node.data.id], getBookmarkChildren(node.data.children)),
6225
+ updated: next
6226
+ }));
6227
+ };
6228
+ BookmarksComponent.prototype.updateBookmark = function (bookmark, name) {
6229
+ var editedBookmark = Object.assign(Object.assign({}, bookmark), { name: name });
6230
+ if (name) {
6231
+ this.store.dispatch(new UpdateBookmark(editedBookmark));
6232
+ this.editableBookmark = undefined;
6233
+ }
6234
+ };
6235
+ BookmarksComponent.prototype.goToBookmark = function (bookmark) {
6236
+ var thisPage = this.pageLookup[bookmark.pageNumber + 1];
6237
+ var defaultHeight = thisPage.styles.height;
6238
+ var defaultScaleY = this.scaledY(bookmark.yCoordinate, defaultHeight, thisPage);
6239
+ var top = 0, left = 0;
6240
+ switch (this.rotate) {
6241
+ case 90:
6242
+ left = -defaultScaleY;
6243
+ break;
6244
+ case 180:
6245
+ top = this.scaledY(bookmark.yCoordinate, (defaultHeight - (24 * this.zoom)), thisPage);
6246
+ break;
6247
+ case 270:
6248
+ left = defaultScaleY;
6249
+ break;
6250
+ default:
6251
+ top = defaultScaleY;
6252
+ }
6253
+ this.goToDestination.emit([
6254
+ bookmark.pageNumber,
6255
+ { 'name': 'XYZ' },
6256
+ left,
6257
+ top
6258
+ ]);
6259
+ };
6260
+ Object.defineProperty(BookmarksComponent.prototype, "customSort", {
6261
+ get: function () {
6262
+ return this._customSort;
6263
+ },
6264
+ enumerable: false,
6265
+ configurable: true
6266
+ });
6267
+ Object.defineProperty(BookmarksComponent.prototype, "positionSort", {
6268
+ get: function () {
6269
+ return this._positionSort;
6270
+ },
6271
+ enumerable: false,
6272
+ configurable: true
6273
+ });
6274
+ BookmarksComponent.prototype.sort = function (mode) {
6275
+ this.sortMode = mode;
6276
+ this.sortBookmarks();
6277
+ };
6278
+ BookmarksComponent.prototype.sortBookmarks = function () {
6279
+ switch (this.sortMode) {
6280
+ case this.customSort: {
6281
+ this.customSortBookmarks();
6282
+ break;
6283
+ }
6284
+ case this.positionSort: {
6285
+ this.positionSortBookmarks();
6286
+ break;
6287
+ }
6288
+ default: {
6289
+ this.customSortBookmarks();
6290
+ break;
6291
+ }
6292
+ }
6293
+ };
6294
+ BookmarksComponent.prototype.positionSortBookmarks = function () {
6295
+ this.bookmarkNodes.sort(function (a, b) { return a.pageNumber === b.pageNumber ? a.yCoordinate - b.yCoordinate : a.pageNumber - b.pageNumber; });
6296
+ this.tree.treeModel.update();
6297
+ this.setDragNDrop(false);
6298
+ };
6299
+ BookmarksComponent.prototype.customSortBookmarks = function () {
6300
+ this.bookmarkNodes.sort(function (a, b) { return a.index - b.index; });
6301
+ this.tree.treeModel.update();
6302
+ this.setDragNDrop(true);
6303
+ };
6304
+ BookmarksComponent.prototype.setDragNDrop = function (enabled) {
6305
+ this.options = {
6306
+ allowDrag: enabled,
6307
+ allowDrop: enabled
6308
+ };
6309
+ };
6310
+ BookmarksComponent.prototype.getSibling = function (node, index) {
6311
+ return node.parent.children.length > index ? node.parent.children[index] : undefined;
6312
+ };
6313
+ BookmarksComponent.prototype.scaledY = function (yCoordinate, height, page) {
6314
+ var viewportScale = page.viewportScale / this.zoom;
6315
+ return ((height / this.zoom) - yCoordinate) / viewportScale;
6316
+ };
6317
+ return BookmarksComponent;
6318
+ }());
6319
+ BookmarksComponent.decorators = [
6320
+ { type: i0.Component, args: [{
6321
+ selector: 'mv-bookmarks',
6322
+ template: "<a *ngIf=\"bookmarkNodes?.length === 0\" class=\"highlightedOutlineItem\">No bookmarks created yet</a>\n<tree-root [nodes]=\"bookmarkNodes\" class=\"bookmarks-tree\" [options]=\"options\" (moveNode)=\"onBookmarkMove($event)\">\n <ng-template #treeNodeTemplate let-node let-index=\"index\">\n <div class=\"outlineItem\" *ngIf=\"node.data.id !== editableBookmark; else inputBookmark\">\n <a (click)=\"goToBookmark(node.data)\">\n {{ node.data.name }}\n </a>\n <button class=\"bookmark__rename\" (click)=\"editBookmark(node.data.id)\"></button>\n <button class=\"bookmark__delete\" (click)=\"deleteBookmark(node)\"></button>\n </div>\n <ng-template #inputBookmark>\n <input #bookmarkName class=\"bookmark__input\" [value]=\"node.data.name\" [maxLength]=\"BOOKMARK_CHAR_LIMIT\">\n <button class=\"bookmark__save\" (click)=\"updateBookmark(node.data, bookmarkName.value)\"></button>\n </ng-template>\n </ng-template>\n</tree-root>\n"
6323
+ },] }
6324
+ ];
6325
+ /** @nocollapse */
6326
+ BookmarksComponent.ctorParameters = function () { return [
6327
+ { type: store.Store }
6328
+ ]; };
6329
+ BookmarksComponent.propDecorators = {
6330
+ bookmarkNodes: [{ type: i0.Input }],
6331
+ zoom: [{ type: i0.Input }],
6332
+ rotate: [{ type: i0.Input }],
6333
+ goToDestination: [{ type: i0.Output }],
6334
+ tree: [{ type: i0.ViewChild, args: [angularTreeComponent.TreeComponent,] }]
6335
+ };
6336
+
5832
6337
  var SideBarComponent = /** @class */ (function () {
5833
- function SideBarComponent(viewerEvents, store) {
6338
+ function SideBarComponent(viewerEvents, store, toolbarEvents) {
5834
6339
  this.viewerEvents = viewerEvents;
5835
6340
  this.store = store;
6341
+ this.toolbarEvents = toolbarEvents;
5836
6342
  this.selectedView = 'outline';
6343
+ this.subscriptions = [];
5837
6344
  }
5838
6345
  SideBarComponent.prototype.ngOnInit = function () {
5839
6346
  var _this = this;
5840
6347
  this.bookmarkNodes$ = this.store.pipe(store.select(getBookmarkNodes));
5841
- this.$subscription = this.store.pipe(store.select(getEditableBookmark))
5842
- .subscribe(function (editable) { return _this.selectedView = editable ? 'bookmarks' : _this.selectedView; });
6348
+ this.subscriptions.push(this.store.pipe(store.select(getEditableBookmark))
6349
+ .subscribe(function (editable) { return _this.selectedView = editable ? 'bookmarks' : _this.selectedView; }));
6350
+ this.subscriptions.push(this.toolbarEvents.sidebarOutlineView.subscribe(function (toggle) {
6351
+ _this.selectedView = toggle ? 'outline' : 'bookmarks';
6352
+ }));
5843
6353
  };
5844
6354
  SideBarComponent.prototype.ngOnChanges = function (changes) {
5845
6355
  if (changes.url && this.url) {
@@ -5847,7 +6357,9 @@
5847
6357
  }
5848
6358
  };
5849
6359
  SideBarComponent.prototype.ngOnDestroy = function () {
5850
- this.$subscription.unsubscribe();
6360
+ if (this.subscriptions.length > 0) {
6361
+ this.subscriptions.forEach(function (subscription) { return subscription.unsubscribe(); });
6362
+ }
5851
6363
  };
5852
6364
  SideBarComponent.prototype.goToDestination = function (destination) {
5853
6365
  this.viewerEvents.goToDestination(destination);
@@ -5855,15 +6367,10 @@
5855
6367
  SideBarComponent.prototype.toggleSidebarView = function (sidebarView) {
5856
6368
  this.selectedView = sidebarView;
5857
6369
  };
5858
- SideBarComponent.prototype.onAddBookmarkClick = function () {
5859
- var _this = this;
5860
- this.toggleSidebarView('bookmarks');
5861
- this.store.pipe(store.select(getBookmarkInfo), operators.take(1))
5862
- .subscribe(function (bookmarkInfo) {
5863
- _this.store.dispatch(new CreateBookmark(Object.assign(Object.assign({}, bookmarkInfo), { name: '', id: uuid__default$1["default"]() })));
5864
- });
5865
- };
5866
6370
  SideBarComponent.prototype.isViewedItem = function (current, next) {
6371
+ if (current.pageNumber === this.currentPageNumber) {
6372
+ return true;
6373
+ }
5867
6374
  return next === undefined ? current.pageNumber <= this.currentPageNumber :
5868
6375
  current.pageNumber <= this.currentPageNumber && (next.pageNumber > this.currentPageNumber);
5869
6376
  };
@@ -5875,13 +6382,14 @@
5875
6382
  SideBarComponent.decorators = [
5876
6383
  { type: i0.Component, args: [{
5877
6384
  selector: 'mv-side-bar',
5878
- template: "<div id=\"toolbarSidebar\">\n <div class=\"splitToolbarButton toggled\">\n <button id=\"viewOutline\"\n [ngClass]=\"{ 'toolbarButton': true, 'toggled': selectedView === 'outline' }\"\n (click)=\"toggleSidebarView('outline')\"\n title=\"Show Document Outline\" tabindex=\"1\" data-l10n-id=\"document_outline\">\n <span data-l10n-id=\"document_outline_label\">Document Outline</span>\n </button>\n <button *ngIf=\"annotationsEnabled\"\n id=\"viewBookmark\" class=\"toolbarButton bookmark\"\n [ngClass]=\"{ toggled: selectedView === 'bookmarks' }\"\n (click)=\"toggleSidebarView('bookmarks')\"\n title=\"Show Bookmarks\" tabindex=\"2\" data-l10n-id=\"bookmarks\">\n <span data-l10n-id=\"bookmarks_label\">Bookmarks</span>\n </button>\n </div>\n <div class=\"splitToolbarButtonSeparator\"></div>\n <div *ngIf=\"annotationsEnabled\"\n class=\"splitToolbarButton right\">\n <button id=\"addBookmark\"\n class=\"toolbarButton addBookmark\"\n (click)=\"onAddBookmarkClick()\"\n title=\"Add bookmark\" tabindex=\"3\" data-l10n-id=\"addBookmark\">\n <span data-l10n-id=\"addBookmark_label\">Add bookmark</span>\n </button>\n </div>\n</div>\n<div id=\"sidebarContent\">\n <div id=\"outlineView\" class=\"outlineWithDeepNesting\">\n <div class=\"outlineItem\" *ngIf=\"selectedView === 'outline'\">\n <mv-outline-item *ngFor=\"let outlineItem of outline; index as i\"\n [outline]=\"outlineItem\"\n [currentPageNumber]=\"currentPageNumber\"\n [isCurrentSection]= \"isViewedItem(outlineItem, outline[i+1])\"\n [endPage]=\"findEndPage(outline[i+1])\"\n (navigationEvent)=\"goToDestination($event)\"></mv-outline-item>\n </div>\n <div *ngIf=\"annotationsEnabled && selectedView === 'bookmarks'\"\n id=\"bookmarkContainer\">\n <mv-bookmarks [bookmarkNodes]=\"bookmarkNodes$ | async\"\n [zoom]=\"zoom\" [rotate]=\"rotate\"\n (goToDestination)=\"goToDestination($event)\"></mv-bookmarks>\n </div>\n </div>\n</div>\n"
6385
+ template: "<div id=\"toolbarSidebar\">\n <div *ngIf=\"annotationsEnabled && selectedView == 'bookmarks'\"\n class=\"splitToolbarButton toggled\">\n <button id=\"sortBookmarkPosition\" class=\"splitToolbarButton left bookmark__sort__position\"\n (click)=\"bookmarks.sort(bookmarks.positionSort)\" title=\"Order by place in document\"></button>\n <button id=\"sortBookmarkCustom\" class=\"splitToolbarButton left bookmark__sort__custom\"\n (click)=\"bookmarks.sort(bookmarks.customSort)\" title=\"Order manually\"></button></div>\n <div class=\"splitToolbarButtonSeparator\"></div>\n <div *ngIf=\"annotationsEnabled && selectedView == 'bookmarks'\"\n class=\"splitToolbarButton right\">\n <button id=\"addBookmark\"\n class=\"toolbarButton addBookmark\"\n (click)=\"bookmarks.onAddBookmarkClick()\"\n title=\"Add bookmark\" tabindex=\"3\" data-l10n-id=\"addBookmark\">\n <span data-l10n-id=\"addBookmark_label\">Add bookmark</span>\n </button>\n </div>\n</div>\n<div id=\"sidebarContent\">\n <div id=\"outlineView\" class=\"outlineWithDeepNesting\">\n <div class=\"outlineItem\" *ngIf=\"selectedView === 'outline'\">\n <mv-outline-item *ngFor=\"let outlineItem of outline; index as i\"\n [outline]=\"outlineItem\"\n [currentPageNumber]=\"currentPageNumber\"\n [isCurrentSection]= \"isViewedItem(outlineItem, outline[i+1])\"\n [endPage]=\"findEndPage(outline[i+1])\"\n (navigationEvent)=\"goToDestination($event)\"></mv-outline-item>\n </div>\n <div *ngIf=\"annotationsEnabled && selectedView === 'bookmarks'\"\n id=\"bookmarkContainer\">\n <mv-bookmarks [bookmarkNodes]=\"bookmarkNodes$ | async\"\n [zoom]=\"zoom\" [rotate]=\"rotate\"\n (goToDestination)=\"goToDestination($event)\"></mv-bookmarks>\n </div>\n </div>\n</div>\n"
5879
6386
  },] }
5880
6387
  ];
5881
6388
  /** @nocollapse */
5882
6389
  SideBarComponent.ctorParameters = function () { return [
5883
6390
  { type: ViewerEventService },
5884
- { type: store.Store }
6391
+ { type: store.Store },
6392
+ { type: ToolbarEventService }
5885
6393
  ]; };
5886
6394
  SideBarComponent.propDecorators = {
5887
6395
  annotationsEnabled: [{ type: i0.Input }],
@@ -5889,7 +6397,8 @@
5889
6397
  url: [{ type: i0.Input }],
5890
6398
  zoom: [{ type: i0.Input }],
5891
6399
  rotate: [{ type: i0.Input }],
5892
- currentPageNumber: [{ type: i0.Input }]
6400
+ currentPageNumber: [{ type: i0.Input }],
6401
+ bookmarks: [{ type: i0.ViewChild, args: [BookmarksComponent,] }]
5893
6402
  };
5894
6403
 
5895
6404
  var OutlineItemComponent = /** @class */ (function () {
@@ -5908,6 +6417,9 @@
5908
6417
  this.showOutlineItems = !this.showOutlineItems;
5909
6418
  };
5910
6419
  OutlineItemComponent.prototype.isViewedItem = function (current, next) {
6420
+ if (current.pageNumber === this.currentPageNumber) {
6421
+ return true;
6422
+ }
5911
6423
  return next === undefined ? current.pageNumber <= this.currentPageNumber && this.endPage > this.currentPageNumber :
5912
6424
  current.pageNumber <= this.currentPageNumber && (next.pageNumber > this.currentPageNumber);
5913
6425
  };
@@ -5973,7 +6485,7 @@
5973
6485
  this.toolbarEvents.drawModeSubject.next(false);
5974
6486
  };
5975
6487
  RedactionComponent.prototype.saveRedaction = function (page, rectangles) {
5976
- var redaction = { page: page, rectangles: rectangles, redactionId: uuid__default$1["default"](), documentId: this.documentId };
6488
+ var redaction = { page: page, rectangles: rectangles, redactionId: uuid$1.v4(), documentId: this.documentId };
5977
6489
  this.store.dispatch(new SaveRedaction(redaction));
5978
6490
  };
5979
6491
  RedactionComponent.prototype.onMarkerDelete = function (event) {
@@ -6162,6 +6674,7 @@
6162
6674
  this.httpClient = httpClient;
6163
6675
  this.markupsApiUrl = '/api/markups';
6164
6676
  this.redactApiUrl = '/api/redaction';
6677
+ this.markupsSearchApiUrl = '/api/markups/search';
6165
6678
  }
6166
6679
  RedactionApiService.prototype.getRedactions = function (documentId) {
6167
6680
  var fixedUrl = this.markupsApiUrl + "/" + documentId;
@@ -6173,6 +6686,11 @@
6173
6686
  .post(this.markupsApiUrl, body, { observe: 'response', withCredentials: true })
6174
6687
  .pipe(operators.map(function (response) { return response.body; }), operators.catchError(function () { return []; }));
6175
6688
  };
6689
+ RedactionApiService.prototype.saveBulkRedaction = function (body) {
6690
+ return this.httpClient
6691
+ .post(this.markupsSearchApiUrl, body, { observe: 'response', withCredentials: true })
6692
+ .pipe(operators.map(function (response) { return response.body; }), operators.catchError(function () { return []; }));
6693
+ };
6176
6694
  RedactionApiService.prototype.deleteRedaction = function (payload) {
6177
6695
  var url = this.markupsApiUrl + "/" + payload.documentId + "/" + payload.redactionId;
6178
6696
  return this.httpClient
@@ -6201,10 +6719,11 @@
6201
6719
  ]; };
6202
6720
 
6203
6721
  var RedactionEffects = /** @class */ (function () {
6204
- function RedactionEffects(actions$, redactionApiService) {
6722
+ function RedactionEffects(actions$, redactionApiService, toolbarEvents) {
6205
6723
  var _this = this;
6206
6724
  this.actions$ = actions$;
6207
6725
  this.redactionApiService = redactionApiService;
6726
+ this.toolbarEvents = toolbarEvents;
6208
6727
  this.loadRedactions$ = this.actions$.pipe(effects$1.ofType(LOAD_REDACTIONS), operators.map(function (action) { return action.payload; }), operators.switchMap(function (documentId) {
6209
6728
  return _this.redactionApiService.getRedactions(documentId).pipe(operators.map(function (resp) {
6210
6729
  return new LoadRedactionSuccess(resp.body);
@@ -6219,6 +6738,13 @@
6219
6738
  return rxjs.of(new SaveRedactionFailure(error));
6220
6739
  }));
6221
6740
  }));
6741
+ this.saveBulkRedaction$ = this.actions$.pipe(effects$1.ofType(SAVE_BULK_REDACTION), operators.map(function (action) { return action.payload; }), operators.exhaustMap(function (redaction) {
6742
+ return _this.redactionApiService.saveBulkRedaction(redaction).pipe(operators.tap(function () { return _this.toolbarEvents.redactAllInProgressSubject.next(false); })).pipe(operators.map(function (resp) {
6743
+ return new SaveBulkRedactionSuccess(resp);
6744
+ }), operators.catchError(function (error) {
6745
+ return rxjs.of(new SaveBulkRedactionFailure(error));
6746
+ }));
6747
+ }));
6222
6748
  this.deleteRedaction$ = this.actions$.pipe(effects$1.ofType(DELETE_REDACTION), operators.map(function (action) { return action.payload; }), operators.exhaustMap(function (redactionPayload) {
6223
6749
  return _this.redactionApiService.deleteRedaction(redactionPayload).pipe(operators.map(function () {
6224
6750
  return new DeleteRedactionSuccess(redactionPayload);
@@ -6252,7 +6778,8 @@
6252
6778
  /** @nocollapse */
6253
6779
  RedactionEffects.ctorParameters = function () { return [
6254
6780
  { type: effects$1.Actions },
6255
- { type: RedactionApiService }
6781
+ { type: RedactionApiService },
6782
+ { type: ToolbarEventService }
6256
6783
  ]; };
6257
6784
  __decorate([
6258
6785
  effects$1.Effect(),
@@ -6262,6 +6789,10 @@
6262
6789
  effects$1.Effect(),
6263
6790
  __metadata("design:type", Object)
6264
6791
  ], RedactionEffects.prototype, "saveRedaction$", void 0);
6792
+ __decorate([
6793
+ effects$1.Effect(),
6794
+ __metadata("design:type", Object)
6795
+ ], RedactionEffects.prototype, "saveBulkRedaction$", void 0);
6265
6796
  __decorate([
6266
6797
  effects$1.Effect(),
6267
6798
  __metadata("design:type", Object)
@@ -6407,118 +6938,6 @@
6407
6938
 
6408
6939
  var effects = [AnnotationEffects, BookmarksEffects, RedactionEffects, DocumentEffects, IcpEffects];
6409
6940
 
6410
- var BookmarksComponent = /** @class */ (function () {
6411
- function BookmarksComponent(store) {
6412
- this.store = store;
6413
- this.goToDestination = new i0.EventEmitter();
6414
- this.pageLookup = {};
6415
- this.BOOKMARK_CHAR_LIMIT = 30;
6416
- this.options = {
6417
- allowDrag: true,
6418
- allowDrop: true
6419
- };
6420
- }
6421
- BookmarksComponent.prototype.ngOnInit = function () {
6422
- var _this = this;
6423
- this.$subscription = this.store.pipe(store.select(getEditableBookmark))
6424
- .subscribe(function (editableId) { return _this.editableBookmark = editableId; });
6425
- this.$subscription.add(this.store.select(getPages)
6426
- .subscribe(function (pages) {
6427
- Object.keys(pages).map(function (key) {
6428
- _this.pageLookup[key] = pages[key];
6429
- });
6430
- }));
6431
- };
6432
- BookmarksComponent.prototype.ngOnDestroy = function () {
6433
- this.$subscription.unsubscribe();
6434
- };
6435
- BookmarksComponent.prototype.editBookmark = function (id) {
6436
- this.editableBookmark = id;
6437
- };
6438
- BookmarksComponent.prototype.onBookmarkMove = function (_a) {
6439
- var node = _a.node, from = _a.from, to = _a.to;
6440
- var movedBookmarks = [Object.assign(Object.assign({}, node), { previous: to.index > 0 ? to.parent.children[to.index - 1].id : undefined, parent: to.parent.documentId ? to.parent.id : undefined })];
6441
- var fromNext = this.getSibling(from, from.index);
6442
- fromNext = fromNext && fromNext.id === node.previous ? this.getSibling(from, from.index + 1) : fromNext;
6443
- if (fromNext) {
6444
- movedBookmarks = __spread(movedBookmarks, [Object.assign(Object.assign({}, fromNext), { previous: node.previous })]);
6445
- }
6446
- var toNext = this.getSibling(to, to.index + 1);
6447
- if (toNext) {
6448
- movedBookmarks = __spread(movedBookmarks, [Object.assign(Object.assign({}, toNext), { previous: node.id })]);
6449
- }
6450
- this.store.dispatch(new MoveBookmark(movedBookmarks));
6451
- };
6452
- BookmarksComponent.prototype.deleteBookmark = function (node) {
6453
- var next;
6454
- var siblings = node.parent.children;
6455
- if (siblings.length > node.index + 1) {
6456
- next = siblings[node.index + 1].data;
6457
- next.previous = node.data.previous;
6458
- }
6459
- this.store.dispatch(new DeleteBookmark({
6460
- deleted: __spread([node.data.id], getBookmarkChildren(node.data.children)),
6461
- updated: next
6462
- }));
6463
- };
6464
- BookmarksComponent.prototype.updateBookmark = function (bookmark, name) {
6465
- var editedBookmark = Object.assign(Object.assign({}, bookmark), { name: name });
6466
- if (name) {
6467
- this.store.dispatch(new UpdateBookmark(editedBookmark));
6468
- this.editableBookmark = undefined;
6469
- }
6470
- };
6471
- BookmarksComponent.prototype.goToBookmark = function (bookmark) {
6472
- var thisPage = this.pageLookup[bookmark.pageNumber + 1];
6473
- var defaultHeight = thisPage.styles.height;
6474
- var defaultScaleY = this.scaledY(bookmark.yCoordinate, defaultHeight, thisPage);
6475
- var top = 0, left = 0;
6476
- switch (this.rotate) {
6477
- case 90:
6478
- left = -defaultScaleY;
6479
- break;
6480
- case 180:
6481
- top = this.scaledY(bookmark.yCoordinate, (defaultHeight - (24 * this.zoom)), thisPage);
6482
- break;
6483
- case 270:
6484
- left = defaultScaleY;
6485
- break;
6486
- default:
6487
- top = defaultScaleY;
6488
- }
6489
- this.goToDestination.emit([
6490
- bookmark.pageNumber,
6491
- { 'name': 'XYZ' },
6492
- left,
6493
- top
6494
- ]);
6495
- };
6496
- BookmarksComponent.prototype.getSibling = function (node, index) {
6497
- return node.parent.children.length > index ? node.parent.children[index] : undefined;
6498
- };
6499
- BookmarksComponent.prototype.scaledY = function (yCoordinate, height, page) {
6500
- var viewportScale = page.viewportScale / this.zoom;
6501
- return ((height / this.zoom) - yCoordinate) / viewportScale;
6502
- };
6503
- return BookmarksComponent;
6504
- }());
6505
- BookmarksComponent.decorators = [
6506
- { type: i0.Component, args: [{
6507
- selector: 'mv-bookmarks',
6508
- template: "<tree-root [nodes]=\"bookmarkNodes\"\n class=\"bookmarks-tree\"\n [options]=\"options\"\n (moveNode)=\"onBookmarkMove($event)\">\n <ng-template #treeNodeTemplate let-node let-index=\"index\">\n <div class=\"outlineItem\" *ngIf=\"node.data.id !== editableBookmark; else inputBookmark\">\n <a (click)=\"goToBookmark(node.data)\">\n {{ node.data.name }}\n </a>\n <button class=\"bookmark__rename\" (click)=\"editBookmark(node.data.id)\" ></button>\n <button class=\"bookmark__delete\" (click)=\"deleteBookmark(node)\"></button>\n </div>\n <ng-template #inputBookmark>\n <input #bookmarkName class=\"bookmark__input\" [value]=\"node.data.name\" [maxLength]=\"BOOKMARK_CHAR_LIMIT\">\n <button class=\"bookmark__save\" (click)=\"updateBookmark(node.data, bookmarkName.value)\"></button>\n </ng-template>\n <a *ngIf=\"bookmarkNodes?.length === 0\" class=\"outlineItem\">No bookmarks created yet</a>\n </ng-template>\n</tree-root>\n"
6509
- },] }
6510
- ];
6511
- /** @nocollapse */
6512
- BookmarksComponent.ctorParameters = function () { return [
6513
- { type: store.Store }
6514
- ]; };
6515
- BookmarksComponent.propDecorators = {
6516
- bookmarkNodes: [{ type: i0.Input }],
6517
- zoom: [{ type: i0.Input }],
6518
- rotate: [{ type: i0.Input }],
6519
- goToDestination: [{ type: i0.Output }]
6520
- };
6521
-
6522
6941
  var ConvertibleContentViewerComponent = /** @class */ (function () {
6523
6942
  function ConvertibleContentViewerComponent(store) {
6524
6943
  this.store = store;
@@ -6801,7 +7220,7 @@
6801
7220
  var top = rect.top - parentRect.top;
6802
7221
  var left = rect.left - parentRect.left;
6803
7222
  var rectangle = this.highlightService.applyRotation(this.pageHeight, this.pageWidth, height, width, top, left, this.rotate, this.zoom);
6804
- rectangle = Object.assign({ id: uuid__default$1["default"]() }, rectangle);
7223
+ rectangle = Object.assign({ id: uuid$1.v4() }, rectangle);
6805
7224
  return rectangle;
6806
7225
  };
6807
7226
  HighlightCreateDirective.prototype.removeEnhancedTextModeStyling = function (element) {
@@ -7048,50 +7467,51 @@
7048
7467
  exports["ɵ6"] = ɵ6;
7049
7468
  exports["ɵ7"] = ɵ7;
7050
7469
  exports["ɵa"] = NumberHelperService;
7051
- exports["ɵba"] = TextHighlightDirective;
7052
- exports["ɵbb"] = CtxToolbarComponent;
7053
- exports["ɵbc"] = CommentSetRenderService;
7054
- exports["ɵbd"] = CommentsNavigateComponent;
7055
- exports["ɵbe"] = TextareaAutoExpandDirective;
7056
- exports["ɵbf"] = PrintService;
7057
- exports["ɵbg"] = BookmarksApiService;
7058
- exports["ɵbh"] = effects;
7059
- exports["ɵbi"] = BookmarksEffects;
7060
- exports["ɵbj"] = RedactionEffects;
7061
- exports["ɵbk"] = RedactionApiService;
7062
- exports["ɵbl"] = DocumentEffects;
7063
- exports["ɵbm"] = DocumentConversionApiService;
7064
- exports["ɵbn"] = RotationApiService;
7065
- exports["ɵbo"] = IcpEffects;
7066
- exports["ɵbp"] = IcpSessionApiService;
7067
- exports["ɵbq"] = IcpUpdateService;
7068
- exports["ɵbr"] = SocketService;
7069
- exports["ɵbs"] = PdfViewerComponent;
7070
- exports["ɵbt"] = PdfJsWrapperFactory;
7071
- exports["ɵbu"] = IcpService;
7072
- exports["ɵbv"] = IcpPresenterService;
7073
- exports["ɵbw"] = IcpFollowerService;
7074
- exports["ɵbx"] = SideBarComponent;
7075
- exports["ɵby"] = BookmarksComponent;
7076
- exports["ɵbz"] = OutlineItemComponent;
7470
+ exports["ɵba"] = TagsServices;
7471
+ exports["ɵbb"] = TextHighlightDirective;
7472
+ exports["ɵbc"] = CtxToolbarComponent;
7473
+ exports["ɵbd"] = CommentSetRenderService;
7474
+ exports["ɵbe"] = CommentsNavigateComponent;
7475
+ exports["ɵbf"] = TextareaAutoExpandDirective;
7476
+ exports["ɵbg"] = PrintService;
7477
+ exports["ɵbh"] = BookmarksApiService;
7478
+ exports["ɵbi"] = effects;
7479
+ exports["ɵbj"] = BookmarksEffects;
7480
+ exports["ɵbk"] = RedactionEffects;
7481
+ exports["ɵbl"] = RedactionApiService;
7482
+ exports["ɵbm"] = DocumentEffects;
7483
+ exports["ɵbn"] = DocumentConversionApiService;
7484
+ exports["ɵbo"] = RotationApiService;
7485
+ exports["ɵbp"] = IcpEffects;
7486
+ exports["ɵbq"] = IcpSessionApiService;
7487
+ exports["ɵbr"] = IcpUpdateService;
7488
+ exports["ɵbs"] = SocketService;
7489
+ exports["ɵbt"] = PdfViewerComponent;
7490
+ exports["ɵbu"] = PdfJsWrapperFactory;
7491
+ exports["ɵbv"] = IcpService;
7492
+ exports["ɵbw"] = IcpPresenterService;
7493
+ exports["ɵbx"] = IcpFollowerService;
7494
+ exports["ɵby"] = SideBarComponent;
7495
+ exports["ɵbz"] = BookmarksComponent;
7077
7496
  exports["ɵc"] = reducers;
7078
- exports["ɵca"] = ImageViewerComponent;
7079
- exports["ɵcb"] = ViewerUtilService;
7080
- exports["ɵcc"] = UnsupportedViewerComponent;
7081
- exports["ɵcd"] = MultimediaPlayerComponent;
7082
- exports["ɵce"] = ConvertibleContentViewerComponent;
7083
- exports["ɵcf"] = GrabNDragDirective;
7084
- exports["ɵcg"] = RotationPersistDirective;
7085
- exports["ɵch"] = HighlightCreateDirective;
7086
- exports["ɵci"] = ConfirmActionDialogComponent;
7087
- exports["ɵcj"] = RedactionComponent;
7088
- exports["ɵck"] = BookmarkIconsComponent;
7089
- exports["ɵcl"] = ParticipantsListComponent;
7090
- exports["ɵcm"] = getDocumentState;
7091
- exports["ɵcn"] = getPages;
7092
- exports["ɵco"] = getTagsRootState;
7093
- exports["ɵcp"] = getTagFiltered;
7094
- exports["ɵcq"] = getFilteredPageEntities;
7497
+ exports["ɵca"] = OutlineItemComponent;
7498
+ exports["ɵcb"] = ImageViewerComponent;
7499
+ exports["ɵcc"] = ViewerUtilService;
7500
+ exports["ɵcd"] = UnsupportedViewerComponent;
7501
+ exports["ɵce"] = MultimediaPlayerComponent;
7502
+ exports["ɵcf"] = ConvertibleContentViewerComponent;
7503
+ exports["ɵcg"] = GrabNDragDirective;
7504
+ exports["ɵch"] = RotationPersistDirective;
7505
+ exports["ɵci"] = HighlightCreateDirective;
7506
+ exports["ɵcj"] = ConfirmActionDialogComponent;
7507
+ exports["ɵck"] = RedactionComponent;
7508
+ exports["ɵcl"] = BookmarkIconsComponent;
7509
+ exports["ɵcm"] = ParticipantsListComponent;
7510
+ exports["ɵcn"] = getDocumentState;
7511
+ exports["ɵco"] = getPages;
7512
+ exports["ɵcp"] = getTagsRootState;
7513
+ exports["ɵcq"] = getTagFiltered;
7514
+ exports["ɵcr"] = getFilteredPageEntities;
7095
7515
  exports["ɵd"] = getMVState;
7096
7516
  exports["ɵf"] = docReducer;
7097
7517
  exports["ɵg"] = getDocPages;
@@ -7101,17 +7521,17 @@
7101
7521
  exports["ɵl"] = bookmarksReducer;
7102
7522
  exports["ɵm"] = redactionReducer;
7103
7523
  exports["ɵn"] = icpReducer;
7104
- exports["ɵp"] = SharedModule;
7105
- exports["ɵq"] = GovUkDateComponent;
7106
- exports["ɵr"] = GovUkErrorMessageComponent;
7107
- exports["ɵs"] = GovUkFieldsetComponent;
7108
- exports["ɵt"] = GovUkLabelComponent;
7109
- exports["ɵu"] = HighlightCreateService;
7110
- exports["ɵv"] = ViewerEventService;
7111
- exports["ɵw"] = CommentService;
7112
- exports["ɵx"] = RectangleComponent;
7113
- exports["ɵy"] = CommentComponent;
7114
- exports["ɵz"] = TagsServices;
7524
+ exports["ɵp"] = RedactionSearchBarComponent;
7525
+ exports["ɵq"] = HighlightCreateService;
7526
+ exports["ɵr"] = SharedModule;
7527
+ exports["ɵs"] = GovUkDateComponent;
7528
+ exports["ɵt"] = GovUkErrorMessageComponent;
7529
+ exports["ɵu"] = GovUkFieldsetComponent;
7530
+ exports["ɵv"] = GovUkLabelComponent;
7531
+ exports["ɵw"] = ViewerEventService;
7532
+ exports["ɵx"] = CommentService;
7533
+ exports["ɵy"] = RectangleComponent;
7534
+ exports["ɵz"] = CommentComponent;
7115
7535
 
7116
7536
  Object.defineProperty(exports, '__esModule', { value: true });
7117
7537