@d-i-t-a/reader 2.1.8 → 2.1.11-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -39506,17 +39506,7 @@ var TextHighlighter = class {
39506
39506
  toolbox.style.top = ev.clientY + (self2.delegate.attributes?.navHeight ?? 0) + "px";
39507
39507
  toolbox.style.left = ev.clientX + "px";
39508
39508
  if (getComputedStyle(toolbox).display === "none") {
39509
- let noteH = function() {
39510
- self2.delegate.annotationModule?.api?.addCommentToAnnotation(anno).then((result) => {
39511
- self2.delegate.annotationModule?.updateAnnotation(result).then(async () => {
39512
- import_loglevel5.default.log("update highlight " + result.id);
39513
- toolbox.style.display = "none";
39514
- self2.selectionMenuClosed();
39515
- });
39516
- toolbox.style.display = "none";
39517
- self2.selectionMenuClosed();
39518
- });
39519
- }, deleteH = function() {
39509
+ let deleteH = function() {
39520
39510
  if (self2.delegate.rights.enableAnnotations) {
39521
39511
  self2.delegate.annotationModule?.deleteSelectedHighlight(anno).then(async () => {
39522
39512
  import_loglevel5.default.log("delete highlight " + anno.id);
@@ -39551,14 +39541,6 @@ var TextHighlighter = class {
39551
39541
  }
39552
39542
  if (commentIcon) {
39553
39543
  commentIcon.style.display = "none";
39554
- let clone = commentIcon.cloneNode(true);
39555
- let parent = commentIcon.parentElement;
39556
- clone.style.display = "unset";
39557
- clone.id = "cloneCommentIcon";
39558
- clone.addEventListener("click", noteH, false);
39559
- if (parent) {
39560
- parent.append(clone);
39561
- }
39562
39544
  }
39563
39545
  let deleteIcon = document.getElementById("deleteIcon");
39564
39546
  let cloneDeleteIcon = document.getElementById("cloneDeleteIcon");
@@ -39658,7 +39640,55 @@ var _getCssSelectorOptions = {
39658
39640
 
39659
39641
  // src/modules/AnnotationModule.ts
39660
39642
  var lodash2 = __toModule(require_lodash());
39643
+ var import_loglevel8 = __toModule(require_loglevel());
39644
+
39645
+ // src/modules/consumption/ConsumptionModule.ts
39646
+ init_polyfills();
39661
39647
  var import_loglevel7 = __toModule(require_loglevel());
39648
+ var Action;
39649
+ (function(Action2) {
39650
+ Action2["BookmarkCreated"] = "BookmarkCreated";
39651
+ Action2["HighlightCreated"] = "HighlightCreated";
39652
+ })(Action || (Action = {}));
39653
+ var ConsumptionModule = class {
39654
+ constructor(delegate, publication, properties, api) {
39655
+ this.delegate = delegate;
39656
+ this.publication = publication;
39657
+ this.properties = properties;
39658
+ this.api = api;
39659
+ }
39660
+ static async create(config2) {
39661
+ const consumption = new this(config2.delegate, config2.publication, config2, config2.api);
39662
+ await consumption.start();
39663
+ return consumption;
39664
+ }
39665
+ async start() {
39666
+ this.delegate.consumptionModule = this;
39667
+ }
39668
+ async stop() {
39669
+ import_loglevel7.default.log("Consumption module stop");
39670
+ }
39671
+ async trackAction(locator, action) {
39672
+ this.api?.actionTracked(locator, action);
39673
+ }
39674
+ async startProgress(locator) {
39675
+ this.startLocator = locator;
39676
+ }
39677
+ async continueProgress(locator) {
39678
+ this.lastLocator = locator;
39679
+ if (this.startLocator === void 0) {
39680
+ this.startLocator = locator;
39681
+ }
39682
+ }
39683
+ async endProgress() {
39684
+ if (this.startLocator && this.lastLocator) {
39685
+ let progress = this.lastLocator.locations.totalProgression - this.startLocator.locations.totalProgression;
39686
+ this.api?.progressTracked(this.startLocator, this.lastLocator, Math.round(progress * 100));
39687
+ }
39688
+ }
39689
+ };
39690
+
39691
+ // src/modules/AnnotationModule.ts
39662
39692
  var AnnotationModule = class {
39663
39693
  constructor(annotator, rights, publication, delegate, initialAnnotations, properties, highlighter, api, headerMenu) {
39664
39694
  this.hide = findElement(document, "#menu-button-hide");
@@ -39679,7 +39709,7 @@ var AnnotationModule = class {
39679
39709
  return annotations;
39680
39710
  }
39681
39711
  async stop() {
39682
- import_loglevel7.default.log("Annotation module stop");
39712
+ import_loglevel8.default.log("Annotation module stop");
39683
39713
  }
39684
39714
  async start() {
39685
39715
  this.delegate.annotationModule = this;
@@ -39762,8 +39792,8 @@ var AnnotationModule = class {
39762
39792
  return "";
39763
39793
  }
39764
39794
  } catch (err) {
39765
- import_loglevel7.default.log("uniqueCssSelector:");
39766
- import_loglevel7.default.error(err);
39795
+ import_loglevel8.default.log("uniqueCssSelector:");
39796
+ import_loglevel8.default.error(err);
39767
39797
  return "";
39768
39798
  }
39769
39799
  };
@@ -39784,7 +39814,7 @@ var AnnotationModule = class {
39784
39814
  let book = this.delegate.highlighter?.createHighlight(this.delegate.highlighter?.dom(doc.body).getWindow(), selectionInfo, menuItem.highlight.color, true, AnnotationMarker.Bookmark, menuItem.icon, menuItem.popup, menuItem.highlight.style);
39785
39815
  if (book) {
39786
39816
  this.saveAnnotation(book[0]).then((anno) => {
39787
- import_loglevel7.default.log("saved bookmark " + anno.id);
39817
+ import_loglevel8.default.log("saved bookmark " + anno.id);
39788
39818
  });
39789
39819
  }
39790
39820
  }
@@ -39794,7 +39824,7 @@ var AnnotationModule = class {
39794
39824
  }
39795
39825
  }
39796
39826
  async scrollToHighlight(id2) {
39797
- import_loglevel7.default.log("still need to scroll to " + id2);
39827
+ import_loglevel8.default.log("still need to scroll to " + id2);
39798
39828
  var element = await this.annotator?.getAnnotationElement(id2, this.delegate.iframes[0].contentWindow);
39799
39829
  element.scrollIntoView({
39800
39830
  block: "center",
@@ -39805,8 +39835,8 @@ var AnnotationModule = class {
39805
39835
  if (this.annotator) {
39806
39836
  let deleted = await this.annotator.deleteAnnotation(annotation.id);
39807
39837
  let added = await this.addAnnotation(annotation);
39808
- import_loglevel7.default.log("Highlight deleted " + JSON.stringify(deleted));
39809
- import_loglevel7.default.log("Highlight added " + JSON.stringify(added));
39838
+ import_loglevel8.default.log("Highlight deleted " + JSON.stringify(deleted));
39839
+ import_loglevel8.default.log("Highlight added " + JSON.stringify(added));
39810
39840
  await this.showHighlights();
39811
39841
  await this.drawHighlights();
39812
39842
  return added;
@@ -39817,7 +39847,7 @@ var AnnotationModule = class {
39817
39847
  async deleteLocalHighlight(id2) {
39818
39848
  if (this.annotator) {
39819
39849
  var deleted = await this.annotator.deleteAnnotation(id2);
39820
- import_loglevel7.default.log("Highlight deleted " + JSON.stringify(deleted));
39850
+ import_loglevel8.default.log("Highlight deleted " + JSON.stringify(deleted));
39821
39851
  await this.showHighlights();
39822
39852
  await this.drawHighlights();
39823
39853
  return deleted;
@@ -39913,6 +39943,7 @@ var AnnotationModule = class {
39913
39943
  }
39914
39944
  }
39915
39945
  if (annotation) {
39946
+ this.delegate.consumptionModule?.trackAction(annotation, Action.HighlightCreated);
39916
39947
  if (this.api?.addAnnotation) {
39917
39948
  try {
39918
39949
  let result = await this.api.addAnnotation(annotation);
@@ -40244,17 +40275,17 @@ var AnnotationModule = class {
40244
40275
  this.delegate.stopReadAloud();
40245
40276
  this.delegate.navigate(locator);
40246
40277
  } else {
40247
- import_loglevel7.default.log("annotation data missing: ", event);
40278
+ import_loglevel8.default.log("annotation data missing: ", event);
40248
40279
  }
40249
40280
  }
40250
40281
  handleAnnotationLinkDeleteClick(type, event, locator) {
40251
- import_loglevel7.default.log("annotation data locator: ", locator);
40282
+ import_loglevel8.default.log("annotation data locator: ", locator);
40252
40283
  if (locator) {
40253
40284
  if (type === AnnotationType.Annotation) {
40254
40285
  this.deleteHighlight(locator);
40255
40286
  }
40256
40287
  } else {
40257
- import_loglevel7.default.log("annotation data missing: ", event);
40288
+ import_loglevel8.default.log("annotation data missing: ", event);
40258
40289
  }
40259
40290
  }
40260
40291
  static readableTimestamp(timestamp) {
@@ -40322,7 +40353,7 @@ var AnnotationModule = class {
40322
40353
  // src/modules/BookmarkModule.ts
40323
40354
  init_polyfills();
40324
40355
  var import_uuid2 = __toModule(require_uuid());
40325
- var import_loglevel8 = __toModule(require_loglevel());
40356
+ var import_loglevel9 = __toModule(require_loglevel());
40326
40357
  var BookmarkModule = class {
40327
40358
  static async create(config2) {
40328
40359
  const module = new this(config2.annotator, config2.rights || { enableBookmarks: false }, config2.publication, config2.delegate, config2, config2.initialAnnotations, config2.api, config2.headerMenu);
@@ -40340,7 +40371,7 @@ var BookmarkModule = class {
40340
40371
  this.api = api;
40341
40372
  }
40342
40373
  stop() {
40343
- import_loglevel8.default.log("Bookmark module stop");
40374
+ import_loglevel9.default.log("Bookmark module stop");
40344
40375
  }
40345
40376
  async start() {
40346
40377
  this.delegate.bookmarkModule = this;
@@ -40390,13 +40421,13 @@ var BookmarkModule = class {
40390
40421
  if (this.api?.deleteBookmark) {
40391
40422
  await this.api?.deleteBookmark(bookmark);
40392
40423
  let deleted = await this.annotator.deleteBookmark(bookmark);
40393
- import_loglevel8.default.log("Bookmark deleted " + JSON.stringify(deleted));
40424
+ import_loglevel9.default.log("Bookmark deleted " + JSON.stringify(deleted));
40394
40425
  await this.showBookmarks();
40395
40426
  await this.drawBookmarks();
40396
40427
  return deleted;
40397
40428
  } else {
40398
40429
  let deleted = await this.annotator.deleteBookmark(bookmark);
40399
- import_loglevel8.default.log("Bookmark deleted " + JSON.stringify(deleted));
40430
+ import_loglevel9.default.log("Bookmark deleted " + JSON.stringify(deleted));
40400
40431
  await this.showBookmarks();
40401
40432
  await this.drawBookmarks();
40402
40433
  return deleted;
@@ -40448,20 +40479,21 @@ var BookmarkModule = class {
40448
40479
  };
40449
40480
  }
40450
40481
  if (!this.annotator.locatorExists(bookmark, AnnotationType.Bookmark)) {
40482
+ this.delegate.consumptionModule?.trackAction(bookmark, Action.BookmarkCreated);
40451
40483
  if (this.api?.addBookmark) {
40452
40484
  const result = await this.api.addBookmark(bookmark);
40453
40485
  if (result) {
40454
40486
  bookmark = result;
40455
40487
  }
40456
- import_loglevel8.default.log(bookmark);
40488
+ import_loglevel9.default.log(bookmark);
40457
40489
  let saved = this.annotator.saveBookmark(bookmark);
40458
- import_loglevel8.default.log("Bookmark added " + JSON.stringify(saved));
40490
+ import_loglevel9.default.log("Bookmark added " + JSON.stringify(saved));
40459
40491
  this.showBookmarks();
40460
40492
  await this.drawBookmarks();
40461
40493
  return saved;
40462
40494
  } else {
40463
40495
  let saved = this.annotator.saveBookmark(bookmark);
40464
- import_loglevel8.default.log("Bookmark added " + JSON.stringify(saved));
40496
+ import_loglevel9.default.log("Bookmark added " + JSON.stringify(saved));
40465
40497
  this.showBookmarks();
40466
40498
  await this.drawBookmarks();
40467
40499
  return saved;
@@ -40561,7 +40593,7 @@ var BookmarkModule = class {
40561
40593
  this.delegate.iframes[0].contentDocument?.getSelection()?.removeAllRanges();
40562
40594
  if (book) {
40563
40595
  return this.saveAnnotation(book[0]).then((anno) => {
40564
- import_loglevel8.default.log("saved bookmark " + anno?.id);
40596
+ import_loglevel9.default.log("saved bookmark " + anno?.id);
40565
40597
  });
40566
40598
  }
40567
40599
  }
@@ -40620,6 +40652,7 @@ var BookmarkModule = class {
40620
40652
  }
40621
40653
  }
40622
40654
  if (annotation) {
40655
+ this.delegate.consumptionModule?.trackAction(annotation, Action.BookmarkCreated);
40623
40656
  if (this.api?.addBookmark) {
40624
40657
  let result = await this.api.addBookmark(annotation);
40625
40658
  const saved = await this.annotator.saveAnnotation(result);
@@ -40739,7 +40772,7 @@ var BookmarkModule = class {
40739
40772
  async deleteLocalHighlight(id2) {
40740
40773
  if (this.annotator) {
40741
40774
  var deleted = await this.annotator.deleteAnnotation(id2);
40742
- import_loglevel8.default.log("Highlight deleted " + JSON.stringify(deleted));
40775
+ import_loglevel9.default.log("Highlight deleted " + JSON.stringify(deleted));
40743
40776
  await this.showBookmarks();
40744
40777
  await this.drawBookmarks();
40745
40778
  return deleted;
@@ -40849,17 +40882,17 @@ var BookmarkModule = class {
40849
40882
  this.delegate.stopReadAloud();
40850
40883
  this.delegate.navigate(locator);
40851
40884
  } else {
40852
- import_loglevel8.default.log("bookmark data missing: ", event);
40885
+ import_loglevel9.default.log("bookmark data missing: ", event);
40853
40886
  }
40854
40887
  }
40855
40888
  handleAnnotationLinkDeleteClick(type, event, locator) {
40856
- import_loglevel8.default.log("bookmark data locator: ", locator);
40889
+ import_loglevel9.default.log("bookmark data locator: ", locator);
40857
40890
  if (locator) {
40858
40891
  if (type === AnnotationType.Bookmark) {
40859
40892
  this.deleteBookmark(locator);
40860
40893
  }
40861
40894
  } else {
40862
- import_loglevel8.default.log("bookmark data missing: ", event);
40895
+ import_loglevel9.default.log("bookmark data missing: ", event);
40863
40896
  }
40864
40897
  }
40865
40898
  static readableTimestamp(timestamp) {
@@ -40880,7 +40913,7 @@ var import_media_overlay = __toModule(require_media_overlay());
40880
40913
 
40881
40914
  // src/modules/mediaoverlays/MediaOverlaySettings.ts
40882
40915
  init_polyfills();
40883
- var import_loglevel9 = __toModule(require_loglevel());
40916
+ var import_loglevel10 = __toModule(require_loglevel());
40884
40917
  var R2_MO_CLASS_ACTIVE = "r2-mo-active";
40885
40918
  var _MEDIAOVERLAYREFS = class {
40886
40919
  };
@@ -40912,7 +40945,7 @@ var MediaOverlaySettings = class {
40912
40945
  this.api = api;
40913
40946
  this.headerMenu = headerMenu;
40914
40947
  this.initialise();
40915
- import_loglevel9.default.log(this.api);
40948
+ import_loglevel10.default.log(this.api);
40916
40949
  }
40917
40950
  static create(config2) {
40918
40951
  const settings = new this(config2.store, config2.api, config2.headerMenu);
@@ -40920,34 +40953,34 @@ var MediaOverlaySettings = class {
40920
40953
  let initialSettings = config2.initialMediaOverlaySettings;
40921
40954
  if (initialSettings?.color) {
40922
40955
  settings.color = initialSettings.color;
40923
- import_loglevel9.default.log(settings.color);
40956
+ import_loglevel10.default.log(settings.color);
40924
40957
  }
40925
40958
  if (initialSettings?.autoScroll) {
40926
40959
  settings.autoScroll = initialSettings.autoScroll;
40927
- import_loglevel9.default.log(settings.autoScroll);
40960
+ import_loglevel10.default.log(settings.autoScroll);
40928
40961
  }
40929
40962
  if (initialSettings?.autoTurn) {
40930
40963
  settings.autoTurn = initialSettings.autoTurn;
40931
- import_loglevel9.default.log(settings.autoScroll);
40964
+ import_loglevel10.default.log(settings.autoScroll);
40932
40965
  }
40933
40966
  if (initialSettings?.volume) {
40934
40967
  settings.volume = initialSettings.volume;
40935
- import_loglevel9.default.log(settings.volume);
40968
+ import_loglevel10.default.log(settings.volume);
40936
40969
  }
40937
40970
  if (initialSettings?.rate) {
40938
40971
  settings.rate = initialSettings.rate;
40939
- import_loglevel9.default.log(settings.rate);
40972
+ import_loglevel10.default.log(settings.rate);
40940
40973
  }
40941
40974
  if (initialSettings?.wait) {
40942
40975
  settings.wait = initialSettings.wait;
40943
- import_loglevel9.default.log(settings.wait);
40976
+ import_loglevel10.default.log(settings.wait);
40944
40977
  }
40945
40978
  }
40946
40979
  settings.initializeSelections();
40947
40980
  return settings;
40948
40981
  }
40949
40982
  stop() {
40950
- import_loglevel9.default.log("MediaOverlay settings stop");
40983
+ import_loglevel10.default.log("MediaOverlay settings stop");
40951
40984
  }
40952
40985
  initialise() {
40953
40986
  this.autoScroll = this.getProperty(MEDIAOVERLAYREFS.AUTO_SCROLL_KEY) != null ? this.getProperty(MEDIAOVERLAYREFS.AUTO_SCROLL_KEY).value : this.autoScroll;
@@ -41013,7 +41046,7 @@ var MediaOverlaySettings = class {
41013
41046
  this.applyMediaOverlaySettings(syncSettings);
41014
41047
  if (this.api?.updateSettings) {
41015
41048
  this.api?.updateSettings(syncSettings).then(async (settings) => {
41016
- import_loglevel9.default.log("api updated sync settings", settings);
41049
+ import_loglevel10.default.log("api updated sync settings", settings);
41017
41050
  });
41018
41051
  }
41019
41052
  }
@@ -41068,7 +41101,7 @@ var MediaOverlaySettings = class {
41068
41101
  this.settingsChangeCallback();
41069
41102
  }
41070
41103
  if (mediaOverlaySettings.autoScroll !== void 0) {
41071
- import_loglevel9.default.log("autoScroll " + this.autoScroll);
41104
+ import_loglevel10.default.log("autoScroll " + this.autoScroll);
41072
41105
  this.autoScroll = mediaOverlaySettings.autoScroll;
41073
41106
  let prop = this.userProperties.getByRef(MEDIAOVERLAYREFS.AUTO_SCROLL_REF);
41074
41107
  if (prop) {
@@ -41078,7 +41111,7 @@ var MediaOverlaySettings = class {
41078
41111
  this.settingsChangeCallback();
41079
41112
  }
41080
41113
  if (mediaOverlaySettings.autoTurn !== void 0) {
41081
- import_loglevel9.default.log("autoTurn " + this.autoTurn);
41114
+ import_loglevel10.default.log("autoTurn " + this.autoTurn);
41082
41115
  this.autoTurn = mediaOverlaySettings.autoTurn;
41083
41116
  let prop = this.userProperties.getByRef(MEDIAOVERLAYREFS.AUTO_TURN_REF);
41084
41117
  if (prop) {
@@ -41088,7 +41121,7 @@ var MediaOverlaySettings = class {
41088
41121
  this.settingsChangeCallback();
41089
41122
  }
41090
41123
  if (mediaOverlaySettings.volume) {
41091
- import_loglevel9.default.log("volume " + this.volume);
41124
+ import_loglevel10.default.log("volume " + this.volume);
41092
41125
  this.volume = mediaOverlaySettings.volume;
41093
41126
  let prop = this.userProperties.getByRef(MEDIAOVERLAYREFS.VOLUME_REF);
41094
41127
  if (prop) {
@@ -41098,7 +41131,7 @@ var MediaOverlaySettings = class {
41098
41131
  this.settingsChangeCallback();
41099
41132
  }
41100
41133
  if (mediaOverlaySettings.rate) {
41101
- import_loglevel9.default.log("rate " + this.rate);
41134
+ import_loglevel10.default.log("rate " + this.rate);
41102
41135
  this.rate = mediaOverlaySettings.rate;
41103
41136
  let prop = this.userProperties.getByRef(MEDIAOVERLAYREFS.RATE_REF);
41104
41137
  if (prop) {
@@ -41176,7 +41209,7 @@ var MediaOverlaySettings = class {
41176
41209
  };
41177
41210
 
41178
41211
  // src/modules/mediaoverlays/MediaOverlayModule.ts
41179
- var import_loglevel10 = __toModule(require_loglevel());
41212
+ var import_loglevel11 = __toModule(require_loglevel());
41180
41213
  var MediaOverlayModule = class {
41181
41214
  constructor(delegate, publication, settings, properties) {
41182
41215
  this.play = findElement(document, "#menu-button-play");
@@ -41185,7 +41218,7 @@ var MediaOverlayModule = class {
41185
41218
  this.pid = void 0;
41186
41219
  this.__ontimeupdate = false;
41187
41220
  this.ontimeupdate = async (_v) => {
41188
- import_loglevel10.default.log("ontimeupdate");
41221
+ import_loglevel11.default.log("ontimeupdate");
41189
41222
  this.trackCurrentTime();
41190
41223
  };
41191
41224
  this.ensureOnTimeUpdate = (remove, replace) => {
@@ -41220,11 +41253,11 @@ var MediaOverlayModule = class {
41220
41253
  return mediaOverlay;
41221
41254
  }
41222
41255
  stop() {
41223
- import_loglevel10.default.log("MediaOverlay module stop");
41256
+ import_loglevel11.default.log("MediaOverlay module stop");
41224
41257
  }
41225
41258
  start() {
41226
41259
  this.delegate.mediaOverlayModule = this;
41227
- import_loglevel10.default.log("MediaOverlay module start");
41260
+ import_loglevel11.default.log("MediaOverlay module start");
41228
41261
  }
41229
41262
  async initialize() {
41230
41263
  return new Promise(async (resolve) => {
@@ -41257,7 +41290,7 @@ var MediaOverlayModule = class {
41257
41290
  return;
41258
41291
  }
41259
41292
  if (!response.ok) {
41260
- import_loglevel10.default.log("BAD RESPONSE?!");
41293
+ import_loglevel11.default.log("BAD RESPONSE?!");
41261
41294
  }
41262
41295
  let moJson;
41263
41296
  try {
@@ -41266,7 +41299,7 @@ var MediaOverlayModule = class {
41266
41299
  console.error(e);
41267
41300
  }
41268
41301
  if (!moJson) {
41269
- import_loglevel10.default.log("## moJson" + moJson);
41302
+ import_loglevel11.default.log("## moJson" + moJson);
41270
41303
  return;
41271
41304
  }
41272
41305
  link.MediaOverlays = TaJsonDeserialize(moJson, import_media_overlay.MediaOverlayNode);
@@ -41352,7 +41385,7 @@ var MediaOverlayModule = class {
41352
41385
  }
41353
41386
  }
41354
41387
  findDepthFirstTextAudioPair(textHref, mo, textFragmentIDChain) {
41355
- import_loglevel10.default.log("findDepthFirstTextAudioPair()");
41388
+ import_loglevel11.default.log("findDepthFirstTextAudioPair()");
41356
41389
  let isTextUrlMatch;
41357
41390
  let isFragmentIDMatch;
41358
41391
  if (mo.Text) {
@@ -41373,16 +41406,16 @@ var MediaOverlayModule = class {
41373
41406
  isTextUrlMatch = false;
41374
41407
  }
41375
41408
  }
41376
- import_loglevel10.default.log("isFragmentIDMatch: " + isFragmentIDMatch);
41377
- import_loglevel10.default.log("isTextUrlMatch: " + isTextUrlMatch);
41409
+ import_loglevel11.default.log("isFragmentIDMatch: " + isFragmentIDMatch);
41410
+ import_loglevel11.default.log("isTextUrlMatch: " + isTextUrlMatch);
41378
41411
  if (!mo.Children || !mo.Children.length) {
41379
- import_loglevel10.default.log("findDepthFirstTextAudioPair() - leaf text/audio pair");
41412
+ import_loglevel11.default.log("findDepthFirstTextAudioPair() - leaf text/audio pair");
41380
41413
  if (!isTextUrlMatch) {
41381
- import_loglevel10.default.log("findDepthFirstTextAudioPair() - leaf - !isTextUrlMatch");
41414
+ import_loglevel11.default.log("findDepthFirstTextAudioPair() - leaf - !isTextUrlMatch");
41382
41415
  return void 0;
41383
41416
  }
41384
41417
  if (isFragmentIDMatch || isTextUrlMatch && !textFragmentIDChain) {
41385
- import_loglevel10.default.log("findDepthFirstTextAudioPair() - leaf - isFragmentIDMatch || (isTextUrlMatch && !textFragmentIDChain");
41418
+ import_loglevel11.default.log("findDepthFirstTextAudioPair() - leaf - isFragmentIDMatch || (isTextUrlMatch && !textFragmentIDChain");
41386
41419
  return mo;
41387
41420
  }
41388
41421
  return void 0;
@@ -41390,25 +41423,25 @@ var MediaOverlayModule = class {
41390
41423
  const textFragmentIDChainOriginal = textFragmentIDChain;
41391
41424
  let frags = textFragmentIDChain;
41392
41425
  for (const child of mo.Children) {
41393
- import_loglevel10.default.log("findDepthFirstTextAudioPair() - child");
41394
- import_loglevel10.default.log(JSON.stringify(child));
41426
+ import_loglevel11.default.log("findDepthFirstTextAudioPair() - child");
41427
+ import_loglevel11.default.log(JSON.stringify(child));
41395
41428
  const match = this.findDepthFirstTextAudioPair(textHref, child, frags);
41396
41429
  if (match === null) {
41397
- import_loglevel10.default.log("findDepthFirstTextAudioPair() - child - match null (skip)");
41430
+ import_loglevel11.default.log("findDepthFirstTextAudioPair() - child - match null (skip)");
41398
41431
  frags = void 0;
41399
41432
  }
41400
41433
  if (match) {
41401
- import_loglevel10.default.log("findDepthFirstTextAudioPair() - child - match");
41402
- import_loglevel10.default.log(JSON.stringify(match));
41434
+ import_loglevel11.default.log("findDepthFirstTextAudioPair() - child - match");
41435
+ import_loglevel11.default.log(JSON.stringify(match));
41403
41436
  return match;
41404
41437
  }
41405
41438
  }
41406
41439
  if (isFragmentIDMatch) {
41407
- import_loglevel10.default.log("findDepthFirstTextAudioPair() - post isFragmentIDMatch");
41440
+ import_loglevel11.default.log("findDepthFirstTextAudioPair() - post isFragmentIDMatch");
41408
41441
  const match = this.findDepthFirstTextAudioPair(textHref, mo, void 0);
41409
41442
  if (match) {
41410
- import_loglevel10.default.log("findDepthFirstTextAudioPair() - post isFragmentIDMatch - match");
41411
- import_loglevel10.default.log(JSON.stringify(match));
41443
+ import_loglevel11.default.log("findDepthFirstTextAudioPair() - post isFragmentIDMatch - match");
41444
+ import_loglevel11.default.log(JSON.stringify(match));
41412
41445
  return match;
41413
41446
  } else {
41414
41447
  return match;
@@ -41424,7 +41457,7 @@ var MediaOverlayModule = class {
41424
41457
  if (this.mediaOverlayTextAudioPair) {
41425
41458
  try {
41426
41459
  if (this.currentAudioEnd && this.audioElement.currentTime >= this.currentAudioEnd - 0.05) {
41427
- import_loglevel10.default.log("ontimeupdate - mediaOverlaysNext()");
41460
+ import_loglevel11.default.log("ontimeupdate - mediaOverlaysNext()");
41428
41461
  this.mediaOverlaysNext();
41429
41462
  }
41430
41463
  const match_i = this.mediaOverlayTextAudioPair.Text.lastIndexOf("#");
@@ -41436,11 +41469,11 @@ var MediaOverlayModule = class {
41436
41469
  }
41437
41470
  }
41438
41471
  mediaOverlaysNext(escape2) {
41439
- import_loglevel10.default.log("mediaOverlaysNext()");
41472
+ import_loglevel11.default.log("mediaOverlaysNext()");
41440
41473
  if (this.mediaOverlayRoot && this.mediaOverlayTextAudioPair) {
41441
41474
  const nextTextAudioPair = this.findNextTextAudioPair(this.mediaOverlayRoot, this.mediaOverlayTextAudioPair, { prev: void 0 }, escape2 ? true : false);
41442
41475
  if (!nextTextAudioPair) {
41443
- import_loglevel10.default.log("mediaOverlaysNext() - navLeftOrRight()");
41476
+ import_loglevel11.default.log("mediaOverlaysNext() - navLeftOrRight()");
41444
41477
  this.mediaOverlaysStop();
41445
41478
  if (this.currentLinks.length > 1 && this.currentLinkIndex === 0) {
41446
41479
  this.currentLinkIndex++;
@@ -41460,21 +41493,21 @@ var MediaOverlayModule = class {
41460
41493
  const hrefUrlObj1 = new URL("https://dita.digital/" + this.mediaOverlayTextAudioPair.Text);
41461
41494
  const hrefUrlObj2 = new URL("https://dita.digital/" + nextTextAudioPair.Text);
41462
41495
  if (hrefUrlObj1.pathname !== hrefUrlObj2.pathname) {
41463
- import_loglevel10.default.log("mediaOverlaysNext() SWITCH! " + hrefUrlObj1.pathname + " != " + hrefUrlObj2.pathname);
41496
+ import_loglevel11.default.log("mediaOverlaysNext() SWITCH! " + hrefUrlObj1.pathname + " != " + hrefUrlObj2.pathname);
41464
41497
  switchDoc = true;
41465
41498
  }
41466
41499
  }
41467
41500
  if (switchDoc) {
41468
41501
  this.mediaOverlaysStop();
41469
41502
  } else {
41470
- import_loglevel10.default.log("mediaOverlaysNext() - playMediaOverlaysAudio()");
41503
+ import_loglevel11.default.log("mediaOverlaysNext() - playMediaOverlaysAudio()");
41471
41504
  setTimeout(async () => {
41472
41505
  await this.playMediaOverlaysAudio(nextTextAudioPair, void 0, void 0);
41473
41506
  }, 0);
41474
41507
  }
41475
41508
  }
41476
41509
  } else {
41477
- import_loglevel10.default.log("mediaOverlaysNext() - navLeftOrRight() 2");
41510
+ import_loglevel11.default.log("mediaOverlaysNext() - navLeftOrRight() 2");
41478
41511
  this.mediaOverlaysStop();
41479
41512
  if (this.currentLinks.length > 1 && this.currentLinkIndex === 0) {
41480
41513
  this.currentLinkIndex++;
@@ -41491,13 +41524,13 @@ var MediaOverlayModule = class {
41491
41524
  }
41492
41525
  }
41493
41526
  mediaOverlaysStop() {
41494
- import_loglevel10.default.log("mediaOverlaysStop()");
41527
+ import_loglevel11.default.log("mediaOverlaysStop()");
41495
41528
  this.mediaOverlaysPause();
41496
41529
  this.mediaOverlayRoot = void 0;
41497
41530
  this.mediaOverlayTextAudioPair = void 0;
41498
41531
  }
41499
41532
  mediaOverlaysPause() {
41500
- import_loglevel10.default.log("mediaOverlaysPause()");
41533
+ import_loglevel11.default.log("mediaOverlaysPause()");
41501
41534
  this.mediaOverlayHighlight(void 0);
41502
41535
  if (this.audioElement) {
41503
41536
  this.audioElement.pause();
@@ -41506,28 +41539,28 @@ var MediaOverlayModule = class {
41506
41539
  findNextTextAudioPair(mo, moToMatch, previousMo, escape2) {
41507
41540
  if (!mo.Children || !mo.Children.length) {
41508
41541
  if (previousMo?.prev === moToMatch) {
41509
- import_loglevel10.default.log("findNextTextAudioPair() - prevMo === moToMatch");
41542
+ import_loglevel11.default.log("findNextTextAudioPair() - prevMo === moToMatch");
41510
41543
  return mo;
41511
41544
  }
41512
- import_loglevel10.default.log("findNextTextAudioPair() - set previous");
41513
- import_loglevel10.default.log(JSON.stringify(mo));
41545
+ import_loglevel11.default.log("findNextTextAudioPair() - set previous");
41546
+ import_loglevel11.default.log(JSON.stringify(mo));
41514
41547
  previousMo.prev = mo;
41515
41548
  return void 0;
41516
41549
  }
41517
41550
  for (const child of mo.Children) {
41518
- import_loglevel10.default.log("findNextTextAudioPair() - child");
41519
- import_loglevel10.default.log(JSON.stringify(child));
41551
+ import_loglevel11.default.log("findNextTextAudioPair() - child");
41552
+ import_loglevel11.default.log(JSON.stringify(child));
41520
41553
  const match = this.findNextTextAudioPair(child, moToMatch, previousMo, escape2);
41521
41554
  if (match) {
41522
- import_loglevel10.default.log("findNextTextAudioPair() - match");
41523
- import_loglevel10.default.log(JSON.stringify(match));
41555
+ import_loglevel11.default.log("findNextTextAudioPair() - match");
41556
+ import_loglevel11.default.log(JSON.stringify(match));
41524
41557
  return match;
41525
41558
  }
41526
41559
  }
41527
41560
  return void 0;
41528
41561
  }
41529
41562
  async playMediaOverlaysAudio(moTextAudioPair, begin, end) {
41530
- import_loglevel10.default.log("playMediaOverlaysAudio()");
41563
+ import_loglevel11.default.log("playMediaOverlaysAudio()");
41531
41564
  this.mediaOverlayTextAudioPair = moTextAudioPair;
41532
41565
  if (!moTextAudioPair.Audio) {
41533
41566
  return;
@@ -41551,14 +41584,14 @@ var MediaOverlayModule = class {
41551
41584
  try {
41552
41585
  this.currentAudioBegin = parseFloat(b);
41553
41586
  } catch (err) {
41554
- import_loglevel10.default.error(err);
41587
+ import_loglevel11.default.error(err);
41555
41588
  }
41556
41589
  if (matches.length >= 3) {
41557
41590
  const e = matches[3];
41558
41591
  try {
41559
41592
  this.currentAudioEnd = parseFloat(e);
41560
41593
  } catch (err) {
41561
- import_loglevel10.default.error(err);
41594
+ import_loglevel11.default.error(err);
41562
41595
  }
41563
41596
  }
41564
41597
  }
@@ -41567,7 +41600,7 @@ var MediaOverlayModule = class {
41567
41600
  this.currentAudioBegin = begin;
41568
41601
  this.currentAudioEnd = end;
41569
41602
  }
41570
- import_loglevel10.default.log(`${urlFull} => [${this.currentAudioBegin}-${this.currentAudioEnd}]`);
41603
+ import_loglevel11.default.log(`${urlFull} => [${this.currentAudioBegin}-${this.currentAudioEnd}]`);
41571
41604
  const playClip = async (initial) => {
41572
41605
  if (!this.audioElement) {
41573
41606
  return;
@@ -41575,7 +41608,7 @@ var MediaOverlayModule = class {
41575
41608
  const timeToSeekTo = this.currentAudioBegin ? this.currentAudioBegin : 0;
41576
41609
  if (initial || this.audioElement.paused) {
41577
41610
  if (initial && !timeToSeekTo || this.audioElement.currentTime === timeToSeekTo) {
41578
- import_loglevel10.default.log("playMediaOverlaysAudio() - playClip() - _currentAudioElement.play()");
41611
+ import_loglevel11.default.log("playMediaOverlaysAudio() - playClip() - _currentAudioElement.play()");
41579
41612
  this.ensureOnTimeUpdate(false, false);
41580
41613
  this.audioElement.playbackRate = this.settings.rate;
41581
41614
  this.audioElement.volume = this.settings.volume;
@@ -41594,10 +41627,10 @@ var MediaOverlayModule = class {
41594
41627
  checkReady();
41595
41628
  }
41596
41629
  } else {
41597
- import_loglevel10.default.log("playMediaOverlaysAudio() - playClip() - ontimeupdateSeeked");
41630
+ import_loglevel11.default.log("playMediaOverlaysAudio() - playClip() - ontimeupdateSeeked");
41598
41631
  const ontimeupdateSeeked = async (_ev) => {
41599
41632
  this.audioElement.removeEventListener("timeupdate", ontimeupdateSeeked);
41600
- import_loglevel10.default.log("playMediaOverlaysAudio() - playClip() - ontimeupdateSeeked - .play()");
41633
+ import_loglevel11.default.log("playMediaOverlaysAudio() - playClip() - ontimeupdateSeeked - .play()");
41601
41634
  this.ensureOnTimeUpdate(false, false);
41602
41635
  if (this.audioElement) {
41603
41636
  this.audioElement.playbackRate = this.settings.rate;
@@ -41625,9 +41658,9 @@ var MediaOverlayModule = class {
41625
41658
  const contiguous = this.previousAudioUrl === this.currentAudioUrl && typeof this.previousAudioEnd !== "undefined" && this.previousAudioEnd > timeToSeekTo - 0.02 && this.previousAudioEnd <= timeToSeekTo && this.audioElement.currentTime >= timeToSeekTo - 0.1;
41626
41659
  this.ensureOnTimeUpdate(false, false);
41627
41660
  if (contiguous) {
41628
- import_loglevel10.default.log("playMediaOverlaysAudio() - playClip() - ensureOnTimeUpdate");
41661
+ import_loglevel11.default.log("playMediaOverlaysAudio() - playClip() - ensureOnTimeUpdate");
41629
41662
  } else {
41630
- import_loglevel10.default.log("playMediaOverlaysAudio() - playClip() - currentTime = timeToSeekTo");
41663
+ import_loglevel11.default.log("playMediaOverlaysAudio() - playClip() - currentTime = timeToSeekTo");
41631
41664
  this.audioElement.currentTime = timeToSeekTo;
41632
41665
  }
41633
41666
  }
@@ -41635,7 +41668,7 @@ var MediaOverlayModule = class {
41635
41668
  this.previousAudioUrl = this.currentAudioUrl;
41636
41669
  if (!this.currentAudioUrl || urlNoQuery !== this.currentAudioUrl) {
41637
41670
  this.currentAudioUrl = urlNoQuery;
41638
- import_loglevel10.default.log("playMediaOverlaysAudio() - RESET: " + this.previousAudioUrl + " => " + this.currentAudioUrl);
41671
+ import_loglevel11.default.log("playMediaOverlaysAudio() - RESET: " + this.previousAudioUrl + " => " + this.currentAudioUrl);
41639
41672
  this.audioElement = document.getElementById("AUDIO_MO_ID");
41640
41673
  if (this.audioElement) {
41641
41674
  this.audioElement.pause();
@@ -41652,21 +41685,21 @@ var MediaOverlayModule = class {
41652
41685
  this.audioElement.playbackRate = this.settings.rate;
41653
41686
  document.body.appendChild(this.audioElement);
41654
41687
  this.audioElement.addEventListener("error", (ev) => {
41655
- import_loglevel10.default.log("-1) error: " + (this.currentAudioUrl !== ev.currentTarget.src ? this.currentAudioUrl + " -- " : "") + ev.currentTarget.src.substr(ev.currentTarget.src.lastIndexOf("/")));
41688
+ import_loglevel11.default.log("-1) error: " + (this.currentAudioUrl !== ev.currentTarget.src ? this.currentAudioUrl + " -- " : "") + ev.currentTarget.src.substr(ev.currentTarget.src.lastIndexOf("/")));
41656
41689
  if (this.audioElement && this.audioElement.error) {
41657
- import_loglevel10.default.log(this.audioElement.error.code);
41658
- import_loglevel10.default.log(this.audioElement.error.message);
41690
+ import_loglevel11.default.log(this.audioElement.error.code);
41691
+ import_loglevel11.default.log(this.audioElement.error.message);
41659
41692
  }
41660
41693
  });
41661
41694
  const oncanplaythrough = async (ev) => {
41662
41695
  const currentAudioElement = ev.currentTarget;
41663
41696
  currentAudioElement.removeEventListener("canplaythrough", oncanplaythrough);
41664
- import_loglevel10.default.log("oncanplaythrough");
41697
+ import_loglevel11.default.log("oncanplaythrough");
41665
41698
  await playClip(true);
41666
41699
  };
41667
41700
  this.audioElement.addEventListener("canplaythrough", oncanplaythrough);
41668
41701
  const onended = async (_ev) => {
41669
- import_loglevel10.default.log("onended");
41702
+ import_loglevel11.default.log("onended");
41670
41703
  if (this.currentLinks.length > 1 && this.currentLinkIndex === 0) {
41671
41704
  this.currentLinkIndex++;
41672
41705
  await this.playLink();
@@ -41683,35 +41716,35 @@ var MediaOverlayModule = class {
41683
41716
  this.audioElement.playbackRate = this.settings.rate;
41684
41717
  this.audioElement.setAttribute("src", this.currentAudioUrl);
41685
41718
  } else {
41686
- import_loglevel10.default.log("playMediaOverlaysAudio() - playClip()");
41719
+ import_loglevel11.default.log("playMediaOverlaysAudio() - playClip()");
41687
41720
  await playClip(false);
41688
41721
  }
41689
41722
  }
41690
41723
  async playMediaOverlays(textHref, rootMo, textFragmentIDChain) {
41691
- import_loglevel10.default.log("playMediaOverlays()");
41724
+ import_loglevel11.default.log("playMediaOverlays()");
41692
41725
  let textFragmentIDChain_ = textFragmentIDChain ? textFragmentIDChain.filter((id2) => id2) : void 0;
41693
41726
  if (textFragmentIDChain_ && textFragmentIDChain_.length === 0) {
41694
41727
  textFragmentIDChain_ = void 0;
41695
41728
  }
41696
41729
  let moTextAudioPair = this.findDepthFirstTextAudioPair(textHref, rootMo, textFragmentIDChain_);
41697
41730
  if (!moTextAudioPair && textFragmentIDChain_) {
41698
- import_loglevel10.default.log("playMediaOverlays() - findDepthFirstTextAudioPair() SECOND CHANCE ");
41699
- import_loglevel10.default.log(JSON.stringify(textFragmentIDChain_, null, 4));
41700
- import_loglevel10.default.log(JSON.stringify(rootMo, null, 4));
41731
+ import_loglevel11.default.log("playMediaOverlays() - findDepthFirstTextAudioPair() SECOND CHANCE ");
41732
+ import_loglevel11.default.log(JSON.stringify(textFragmentIDChain_, null, 4));
41733
+ import_loglevel11.default.log(JSON.stringify(rootMo, null, 4));
41701
41734
  moTextAudioPair = this.findDepthFirstTextAudioPair(textHref, rootMo, void 0);
41702
41735
  }
41703
41736
  if (moTextAudioPair) {
41704
41737
  if (moTextAudioPair.Audio) {
41705
- import_loglevel10.default.log("playMediaOverlays() - playMediaOverlaysAudio()");
41738
+ import_loglevel11.default.log("playMediaOverlays() - playMediaOverlaysAudio()");
41706
41739
  this.mediaOverlayRoot = rootMo;
41707
41740
  await this.playMediaOverlaysAudio(moTextAudioPair, void 0, void 0);
41708
41741
  }
41709
41742
  } else {
41710
- import_loglevel10.default.log("playMediaOverlays() - !moTextAudioPair " + textHref);
41743
+ import_loglevel11.default.log("playMediaOverlays() - !moTextAudioPair " + textHref);
41711
41744
  }
41712
41745
  }
41713
41746
  mediaOverlayHighlight(id2) {
41714
- import_loglevel10.default.log("moHighlight: ## " + id2);
41747
+ import_loglevel11.default.log("moHighlight: ## " + id2);
41715
41748
  let classActive = this.publication.Metadata?.MediaOverlay?.ActiveClass;
41716
41749
  if (!classActive) {
41717
41750
  classActive = this.settings.color;
@@ -41756,7 +41789,7 @@ var MediaOverlayModule = class {
41756
41789
 
41757
41790
  // src/modules/positions/TimelineModule.ts
41758
41791
  init_polyfills();
41759
- var import_loglevel11 = __toModule(require_loglevel());
41792
+ var import_loglevel12 = __toModule(require_loglevel());
41760
41793
  var TimelineModule = class {
41761
41794
  static async create(config2) {
41762
41795
  const timeline = new this(config2.delegate, config2.publication);
@@ -41768,7 +41801,7 @@ var TimelineModule = class {
41768
41801
  this.publication = publication;
41769
41802
  }
41770
41803
  async stop() {
41771
- import_loglevel11.default.log("Timeline module stop");
41804
+ import_loglevel12.default.log("Timeline module stop");
41772
41805
  }
41773
41806
  async start() {
41774
41807
  this.delegate.timelineModule = this;
@@ -41837,7 +41870,7 @@ var TimelineModule = class {
41837
41870
  title: link.Title
41838
41871
  };
41839
41872
  }
41840
- import_loglevel11.default.log(position);
41873
+ import_loglevel12.default.log(position);
41841
41874
  this.delegate.navigate(position);
41842
41875
  });
41843
41876
  if (tocHrefAbs === this.delegate.currentChapterLink.href) {
@@ -41860,19 +41893,19 @@ var import_debounce3 = __toModule(require_debounce());
41860
41893
 
41861
41894
  // src/utils/index.ts
41862
41895
  init_polyfills();
41863
- var import_loglevel12 = __toModule(require_loglevel());
41896
+ var import_loglevel13 = __toModule(require_loglevel());
41864
41897
  function delay(t, v) {
41865
41898
  return new Promise(function(resolve) {
41866
41899
  setTimeout(resolve.bind(null, v), t);
41867
41900
  });
41868
41901
  }
41869
41902
  var IS_DEV = false;
41870
- import_loglevel12.default.setLevel(IS_DEV ? "trace" : "warn", true);
41903
+ import_loglevel13.default.setLevel(IS_DEV ? "trace" : "warn", true);
41871
41904
 
41872
41905
  // src/modules/protection/ContentProtectionModule.ts
41873
41906
  var import_browserslist_useragent_regexp = __toModule(require_lib7());
41874
41907
  var import_devtools_detector = __toModule(require_devtools_detector());
41875
- var import_loglevel13 = __toModule(require_loglevel());
41908
+ var import_loglevel14 = __toModule(require_loglevel());
41876
41909
  var ContentProtectionModule = class {
41877
41910
  constructor(delegate, properties) {
41878
41911
  this.hasEventListener = false;
@@ -41934,14 +41967,14 @@ var ContentProtectionModule = class {
41934
41967
  var self2 = this;
41935
41968
  this.mutationObserver = new MutationObserver(function(mutations) {
41936
41969
  mutations.forEach(function(mutation) {
41937
- import_loglevel13.default.log(mutation.type);
41970
+ import_loglevel14.default.log(mutation.type);
41938
41971
  self2.isHacked = true;
41939
41972
  });
41940
41973
  });
41941
41974
  }
41942
41975
  }
41943
41976
  async stop() {
41944
- import_loglevel13.default.log("Protection module stop");
41977
+ import_loglevel14.default.log("Protection module stop");
41945
41978
  this.mutationObserver.disconnect();
41946
41979
  if (this.properties?.disableKeys) {
41947
41980
  removeEventListenerOptional(this.delegate.mainElement, "keydown", this.disableSave);
@@ -42251,7 +42284,7 @@ var ContentProtectionModule = class {
42251
42284
  return true;
42252
42285
  }
42253
42286
  preventCopy(event) {
42254
- import_loglevel13.default.log("copy action initiated");
42287
+ import_loglevel14.default.log("copy action initiated");
42255
42288
  event.clipboardData.setData("text/plain", "copy not allowed");
42256
42289
  event.stopPropagation();
42257
42290
  event.preventDefault();
@@ -42269,7 +42302,7 @@ var ContentProtectionModule = class {
42269
42302
  if (this.citation) {
42270
42303
  return;
42271
42304
  }
42272
- import_loglevel13.default.log("copy action initiated");
42305
+ import_loglevel14.default.log("copy action initiated");
42273
42306
  let win = this.delegate.iframes[0].contentWindow;
42274
42307
  if (win) {
42275
42308
  let getCssSelector = function(element) {
@@ -42373,7 +42406,7 @@ var ContentProtectionModule = class {
42373
42406
  selection?.addRange(rangeToSelect);
42374
42407
  }
42375
42408
  beforePrint(event) {
42376
- import_loglevel13.default.log("before print");
42409
+ import_loglevel14.default.log("before print");
42377
42410
  if (this.delegate && this.delegate.headerMenu) {
42378
42411
  this.delegate.headerMenu.style.display = "none";
42379
42412
  this.delegate.mainElement.style.display = "none";
@@ -42383,7 +42416,7 @@ var ContentProtectionModule = class {
42383
42416
  return false;
42384
42417
  }
42385
42418
  afterPrint(event) {
42386
- import_loglevel13.default.log("after print");
42419
+ import_loglevel14.default.log("after print");
42387
42420
  if (this.delegate && this.delegate.headerMenu) {
42388
42421
  this.delegate.headerMenu.style.removeProperty("display");
42389
42422
  this.delegate.mainElement.style.removeProperty("display");
@@ -42473,12 +42506,12 @@ var ContentProtectionModule = class {
42473
42506
  rect.width = width;
42474
42507
  rect.left = left;
42475
42508
  } catch (error) {
42476
- import_loglevel13.default.log("error " + error);
42477
- import_loglevel13.default.log(rect);
42478
- import_loglevel13.default.log(rect.node);
42479
- import_loglevel13.default.log("scrambledTextContent " + rect.scrambledTextContent);
42480
- import_loglevel13.default.log("textContent " + rect.textContent);
42481
- import_loglevel13.default.log("isObfuscated " + rect.isObfuscated);
42509
+ import_loglevel14.default.log("error " + error);
42510
+ import_loglevel14.default.log(rect);
42511
+ import_loglevel14.default.log(rect.node);
42512
+ import_loglevel14.default.log("scrambledTextContent " + rect.scrambledTextContent);
42513
+ import_loglevel14.default.log("textContent " + rect.textContent);
42514
+ import_loglevel14.default.log("isObfuscated " + rect.isObfuscated);
42482
42515
  }
42483
42516
  });
42484
42517
  }
@@ -42534,14 +42567,14 @@ var ContentProtectionModule = class {
42534
42567
  range.detach();
42535
42568
  return rect;
42536
42569
  } catch (error) {
42537
- import_loglevel13.default.log("measureTextNode " + error);
42538
- import_loglevel13.default.log("measureTextNode " + node);
42539
- import_loglevel13.default.log(node.textContent);
42570
+ import_loglevel14.default.log("measureTextNode " + error);
42571
+ import_loglevel14.default.log("measureTextNode " + node);
42572
+ import_loglevel14.default.log(node.textContent);
42540
42573
  }
42541
42574
  }
42542
42575
  isBeingHacked(element) {
42543
42576
  if (element.style.animation || element.style.transition || element.style.position || element.hasAttribute("style")) {
42544
- import_loglevel13.default.log("content being hacked");
42577
+ import_loglevel14.default.log("content being hacked");
42545
42578
  return true;
42546
42579
  }
42547
42580
  return false;
@@ -42705,7 +42738,7 @@ async function searchDocDomSeek(searchInput, doc, href, title, fullWordSearch =
42705
42738
  }
42706
42739
 
42707
42740
  // src/modules/search/SearchModule.ts
42708
- var import_loglevel14 = __toModule(require_loglevel());
42741
+ var import_loglevel15 = __toModule(require_loglevel());
42709
42742
  var SearchModule = class {
42710
42743
  constructor(delegate, publication, properties, highlighter, api, headerMenu) {
42711
42744
  this.currentChapterSearchResult = [];
@@ -42724,7 +42757,7 @@ var SearchModule = class {
42724
42757
  return search;
42725
42758
  }
42726
42759
  async stop() {
42727
- import_loglevel14.default.log("Search module stop");
42760
+ import_loglevel15.default.log("Search module stop");
42728
42761
  removeEventListenerOptional(this.searchInput, "keypress", this.handleSearch.bind(this));
42729
42762
  removeEventListenerOptional(this.searchGo, "click", this.handleSearch.bind(this));
42730
42763
  }
@@ -43280,7 +43313,7 @@ var SearchModule = class {
43280
43313
 
43281
43314
  // src/modules/TTS/TTSSettings.ts
43282
43315
  init_polyfills();
43283
- var import_loglevel15 = __toModule(require_loglevel());
43316
+ var import_loglevel16 = __toModule(require_loglevel());
43284
43317
  var _TTSREFS = class {
43285
43318
  };
43286
43319
  var TTSREFS = _TTSREFS;
@@ -43322,34 +43355,34 @@ var TTSSettings = class {
43322
43355
  let initialTTSSettings = config2.initialTTSSettings;
43323
43356
  if (initialTTSSettings?.rate) {
43324
43357
  settings.rate = initialTTSSettings.rate;
43325
- import_loglevel15.default.log(settings.rate);
43358
+ import_loglevel16.default.log(settings.rate);
43326
43359
  }
43327
43360
  if (initialTTSSettings?.pitch) {
43328
43361
  settings.pitch = initialTTSSettings.pitch;
43329
- import_loglevel15.default.log(settings.pitch);
43362
+ import_loglevel16.default.log(settings.pitch);
43330
43363
  }
43331
43364
  if (initialTTSSettings?.volume) {
43332
43365
  settings.volume = initialTTSSettings.volume;
43333
- import_loglevel15.default.log(settings.volume);
43366
+ import_loglevel16.default.log(settings.volume);
43334
43367
  }
43335
43368
  if (initialTTSSettings?.color) {
43336
43369
  settings.color = initialTTSSettings.color;
43337
- import_loglevel15.default.log(settings.color);
43370
+ import_loglevel16.default.log(settings.color);
43338
43371
  }
43339
43372
  if (initialTTSSettings?.autoScroll) {
43340
43373
  settings.autoScroll = initialTTSSettings.autoScroll;
43341
- import_loglevel15.default.log(settings.autoScroll);
43374
+ import_loglevel16.default.log(settings.autoScroll);
43342
43375
  }
43343
43376
  if (initialTTSSettings?.voice) {
43344
43377
  settings.voice = initialTTSSettings.voice;
43345
- import_loglevel15.default.log(settings.voice);
43378
+ import_loglevel16.default.log(settings.voice);
43346
43379
  }
43347
43380
  }
43348
43381
  settings.initializeSelections();
43349
43382
  return settings;
43350
43383
  }
43351
43384
  stop() {
43352
- import_loglevel15.default.log("tts settings stop");
43385
+ import_loglevel16.default.log("tts settings stop");
43353
43386
  }
43354
43387
  initialise() {
43355
43388
  this.autoScroll = this.getProperty(TTSREFS.AUTO_SCROLL_KEY) != null ? this.getProperty(TTSREFS.AUTO_SCROLL_KEY).value : this.autoScroll;
@@ -43422,7 +43455,7 @@ var TTSSettings = class {
43422
43455
  this.applyTTSSettings(ttsSettings);
43423
43456
  if (this.api?.updateSettings) {
43424
43457
  this.api?.updateSettings(ttsSettings).then(async (settings) => {
43425
- import_loglevel15.default.log("api updated tts settings", settings);
43458
+ import_loglevel16.default.log("api updated tts settings", settings);
43426
43459
  });
43427
43460
  }
43428
43461
  }
@@ -43470,7 +43503,7 @@ var TTSSettings = class {
43470
43503
  }
43471
43504
  applyTTSSettings(ttsSettings) {
43472
43505
  if (ttsSettings.rate) {
43473
- import_loglevel15.default.log("rate " + this.rate);
43506
+ import_loglevel16.default.log("rate " + this.rate);
43474
43507
  this.rate = ttsSettings.rate;
43475
43508
  let prop = this.userProperties.getByRef(TTSREFS.RATE_REF);
43476
43509
  if (prop) {
@@ -43481,7 +43514,7 @@ var TTSSettings = class {
43481
43514
  this.restartCallback();
43482
43515
  }
43483
43516
  if (ttsSettings.pitch) {
43484
- import_loglevel15.default.log("pitch " + this.pitch);
43517
+ import_loglevel16.default.log("pitch " + this.pitch);
43485
43518
  this.pitch = ttsSettings.pitch;
43486
43519
  let prop = this.userProperties.getByRef(TTSREFS.PITCH_REF);
43487
43520
  if (prop) {
@@ -43492,7 +43525,7 @@ var TTSSettings = class {
43492
43525
  this.restartCallback();
43493
43526
  }
43494
43527
  if (ttsSettings.volume) {
43495
- import_loglevel15.default.log("volume " + this.volume);
43528
+ import_loglevel16.default.log("volume " + this.volume);
43496
43529
  this.volume = ttsSettings.volume;
43497
43530
  let prop = this.userProperties.getByRef(TTSREFS.VOLUME_REF);
43498
43531
  if (prop) {
@@ -43512,7 +43545,7 @@ var TTSSettings = class {
43512
43545
  this.settingsChangeCallback();
43513
43546
  }
43514
43547
  if (ttsSettings.autoScroll !== void 0) {
43515
- import_loglevel15.default.log("autoScroll " + this.autoScroll);
43548
+ import_loglevel16.default.log("autoScroll " + this.autoScroll);
43516
43549
  this.autoScroll = ttsSettings.autoScroll;
43517
43550
  let prop = this.userProperties.getByRef(TTSREFS.AUTO_SCROLL_REF);
43518
43551
  if (prop) {
@@ -43522,7 +43555,7 @@ var TTSSettings = class {
43522
43555
  this.settingsChangeCallback();
43523
43556
  }
43524
43557
  if (ttsSettings.voice) {
43525
- import_loglevel15.default.log("voice " + this.voice);
43558
+ import_loglevel16.default.log("voice " + this.voice);
43526
43559
  this.voice = ttsSettings.voice;
43527
43560
  let prop = this.userProperties.getByRef(TTSREFS.VOICE_REF);
43528
43561
  if (prop) {
@@ -43858,7 +43891,7 @@ var SampleReadEventHandler = class {
43858
43891
 
43859
43892
  // src/navigator/IFrameNavigator.ts
43860
43893
  var import_eventemitter3 = __toModule(require_eventemitter3());
43861
- var import_loglevel16 = __toModule(require_loglevel());
43894
+ var import_loglevel17 = __toModule(require_loglevel());
43862
43895
  var IFrameNavigator = class extends import_eventemitter3.default {
43863
43896
  constructor(settings, annotator = void 0, initialLastReadingPosition = void 0, publication, api, rights, tts, injectables, attributes, services, sample, requestConfig) {
43864
43897
  super();
@@ -43894,8 +43927,8 @@ var IFrameNavigator = class extends import_eventemitter3.default {
43894
43927
  }
43895
43928
  if (lastReadingPosition) {
43896
43929
  const linkHref = this.publication.getAbsoluteHref(lastReadingPosition.href);
43897
- import_loglevel16.default.log(lastReadingPosition.href);
43898
- import_loglevel16.default.log(linkHref);
43930
+ import_loglevel17.default.log(lastReadingPosition.href);
43931
+ import_loglevel17.default.log(linkHref);
43899
43932
  lastReadingPosition.href = linkHref;
43900
43933
  await this.navigate(lastReadingPosition);
43901
43934
  }
@@ -43961,7 +43994,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
43961
43994
  return new Promise((resolve) => resolve(navigator2));
43962
43995
  }
43963
43996
  stop() {
43964
- import_loglevel16.default.log("Iframe navigator stop");
43997
+ import_loglevel17.default.log("Iframe navigator stop");
43965
43998
  removeEventListenerOptional(this.previousChapterAnchorElement, "click", this.handlePreviousChapterClick.bind(this));
43966
43999
  removeEventListenerOptional(this.nextChapterAnchorElement, "click", this.handleNextChapterClick.bind(this));
43967
44000
  removeEventListenerOptional(this.previousChapterTopAnchorElement, "click", this.handlePreviousPageClick.bind(this));
@@ -44169,7 +44202,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
44169
44202
  this.setupEvents();
44170
44203
  return await this.loadManifest();
44171
44204
  } catch (err) {
44172
- import_loglevel16.default.error(err);
44205
+ import_loglevel17.default.error(err);
44173
44206
  this.abortOnError(err);
44174
44207
  return Promise.reject(err);
44175
44208
  }
@@ -44463,8 +44496,8 @@ var IFrameNavigator = class extends import_eventemitter3.default {
44463
44496
  }
44464
44497
  if (lastReadingPosition) {
44465
44498
  const linkHref = this.publication.getAbsoluteHref(lastReadingPosition.href);
44466
- import_loglevel16.default.log(lastReadingPosition.href);
44467
- import_loglevel16.default.log(linkHref);
44499
+ import_loglevel17.default.log(lastReadingPosition.href);
44500
+ import_loglevel17.default.log(linkHref);
44468
44501
  lastReadingPosition.href = linkHref;
44469
44502
  await this.navigate(lastReadingPosition);
44470
44503
  } else if (startUrl) {
@@ -44480,7 +44513,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
44480
44513
  }
44481
44514
  return new Promise((resolve) => resolve());
44482
44515
  } catch (err) {
44483
- import_loglevel16.default.error(err);
44516
+ import_loglevel17.default.error(err);
44484
44517
  this.abortOnError(err);
44485
44518
  return new Promise((_, reject) => reject(err)).catch(() => {
44486
44519
  });
@@ -44662,7 +44695,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
44662
44695
  }, 200);
44663
44696
  return new Promise((resolve) => resolve());
44664
44697
  } catch (err) {
44665
- import_loglevel16.default.error(err);
44698
+ import_loglevel17.default.error(err);
44666
44699
  this.abortOnError(err);
44667
44700
  return Promise.reject(err);
44668
44701
  }
@@ -45206,8 +45239,8 @@ var IFrameNavigator = class extends import_eventemitter3.default {
45206
45239
  const position = __spreadValues({}, locator);
45207
45240
  position.locations = locations;
45208
45241
  const linkHref = this.publication.getAbsoluteHref(locator.href);
45209
- import_loglevel16.default.log(locator.href);
45210
- import_loglevel16.default.log(linkHref);
45242
+ import_loglevel17.default.log(locator.href);
45243
+ import_loglevel17.default.log(linkHref);
45211
45244
  position.href = linkHref;
45212
45245
  this.stopReadAloud();
45213
45246
  this.navigate(position);
@@ -45263,7 +45296,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
45263
45296
  snapToSelector(selector2) {
45264
45297
  const doc = this.iframes[0].contentDocument;
45265
45298
  if (doc) {
45266
- import_loglevel16.default.log(selector2);
45299
+ import_loglevel17.default.log(selector2);
45267
45300
  let result = doc.querySelectorAll(selector2);
45268
45301
  if (result.length > 0)
45269
45302
  this.view?.snap(result[0]);
@@ -45541,7 +45574,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
45541
45574
  title: previous.Title
45542
45575
  };
45543
45576
  this.stopReadAloud();
45544
- this.navigate(position);
45577
+ this.navigate(position, false);
45545
45578
  } else {
45546
45579
  if (this.previousChapterLink) {
45547
45580
  const position = {
@@ -45553,7 +45586,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
45553
45586
  title: this.previousChapterLink.title
45554
45587
  };
45555
45588
  this.stopReadAloud();
45556
- this.navigate(position);
45589
+ this.navigate(position, false);
45557
45590
  }
45558
45591
  }
45559
45592
  if (event) {
@@ -45577,7 +45610,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
45577
45610
  title: next.Title
45578
45611
  };
45579
45612
  this.stopReadAloud();
45580
- this.navigate(position);
45613
+ this.navigate(position, false);
45581
45614
  } else {
45582
45615
  if (this.nextChapterLink) {
45583
45616
  const position = {
@@ -45589,7 +45622,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
45589
45622
  title: this.nextChapterLink.title
45590
45623
  };
45591
45624
  this.stopReadAloud();
45592
- this.navigate(position);
45625
+ this.navigate(position, false);
45593
45626
  }
45594
45627
  }
45595
45628
  if (event) {
@@ -45617,6 +45650,12 @@ var IFrameNavigator = class extends import_eventemitter3.default {
45617
45650
  }
45618
45651
  }
45619
45652
  async navigate(locator, history = true) {
45653
+ if (this.consumptionModule) {
45654
+ if (history) {
45655
+ await this.consumptionModule.endProgress();
45656
+ await this.consumptionModule.startProgress(locator);
45657
+ }
45658
+ }
45620
45659
  if (this.historyModule) {
45621
45660
  this.historyModule.push(locator, history);
45622
45661
  }
@@ -45959,13 +45998,16 @@ var IFrameNavigator = class extends import_eventemitter3.default {
45959
45998
  }
45960
45999
  if (this.api?.updateCurrentLocation) {
45961
46000
  this.api?.updateCurrentLocation(position).then(async (_) => {
45962
- import_loglevel16.default.log("api updated current location", position);
46001
+ import_loglevel17.default.log("api updated current location", position);
45963
46002
  return this.annotator?.saveLastReadingPosition(position);
45964
46003
  });
45965
46004
  } else {
45966
- import_loglevel16.default.log("save last reading position", position);
46005
+ import_loglevel17.default.log("save last reading position", position);
45967
46006
  this.annotator.saveLastReadingPosition(position);
45968
46007
  }
46008
+ if (this.consumptionModule) {
46009
+ this.consumptionModule.continueProgress(position);
46010
+ }
45969
46011
  }
45970
46012
  }
45971
46013
  }
@@ -46481,7 +46523,7 @@ function convertAndCamel(o) {
46481
46523
 
46482
46524
  // src/modules/highlight/LayerSettings.ts
46483
46525
  init_polyfills();
46484
- var import_loglevel17 = __toModule(require_loglevel());
46526
+ var import_loglevel18 = __toModule(require_loglevel());
46485
46527
  var LayerSettings = class {
46486
46528
  constructor(store) {
46487
46529
  this.LAYERSETTINGS = "layerSetting";
@@ -46493,7 +46535,7 @@ var LayerSettings = class {
46493
46535
  return new Promise((resolve) => resolve(settings));
46494
46536
  }
46495
46537
  async stop() {
46496
- import_loglevel17.default.log("MediaOverlay settings stop");
46538
+ import_loglevel18.default.log("MediaOverlay settings stop");
46497
46539
  }
46498
46540
  async initialize() {
46499
46541
  this.userProperties = await this.getLayerSettings();
@@ -46537,7 +46579,7 @@ var LayerSettings = class {
46537
46579
 
46538
46580
  // src/modules/pagebreak/PageBreakModule.ts
46539
46581
  init_polyfills();
46540
- var import_loglevel18 = __toModule(require_loglevel());
46582
+ var import_loglevel19 = __toModule(require_loglevel());
46541
46583
  var PageBreakModule = class {
46542
46584
  static async create(config2) {
46543
46585
  const pageBreak = new this(config2.delegate, config2.publication, config2, config2.headerMenu);
@@ -46551,7 +46593,7 @@ var PageBreakModule = class {
46551
46593
  this.properties = properties;
46552
46594
  }
46553
46595
  async stop() {
46554
- import_loglevel18.default.log("Page Break module stop");
46596
+ import_loglevel19.default.log("Page Break module stop");
46555
46597
  }
46556
46598
  async start() {
46557
46599
  this.delegate.pageBreakModule = this;
@@ -46620,15 +46662,15 @@ var PageBreakModule = class {
46620
46662
  return "";
46621
46663
  }
46622
46664
  } catch (err) {
46623
- import_loglevel18.default.log("uniqueCssSelector:");
46624
- import_loglevel18.default.error(err);
46665
+ import_loglevel19.default.log("uniqueCssSelector:");
46666
+ import_loglevel19.default.error(err);
46625
46667
  return "";
46626
46668
  }
46627
46669
  }
46628
46670
  if (pageBreaks) {
46629
46671
  for (let i = 0; i < pageBreaks.length; i++) {
46630
46672
  let img = pageBreaks[i];
46631
- import_loglevel18.default.log(img);
46673
+ import_loglevel19.default.log(img);
46632
46674
  let title = img.innerHTML;
46633
46675
  let hide = false;
46634
46676
  if (img.innerHTML.length === 0) {
@@ -46701,7 +46743,7 @@ var PageBreakModule = class {
46701
46743
  init_polyfills();
46702
46744
  var import_sanitize_html2 = __toModule(require_sanitize_html());
46703
46745
  var import_debounce6 = __toModule(require_debounce());
46704
- var import_loglevel19 = __toModule(require_loglevel());
46746
+ var import_loglevel20 = __toModule(require_loglevel());
46705
46747
  var TTSModule2 = class {
46706
46748
  constructor(delegate, tts, rights, highlighter, properties, api, headerMenu) {
46707
46749
  this.voices = [];
@@ -46824,14 +46866,14 @@ var TTSModule2 = class {
46824
46866
  }
46825
46867
  let s = setSpeech();
46826
46868
  s.then(async (voices) => {
46827
- import_loglevel19.default.log(voices);
46869
+ import_loglevel20.default.log(voices);
46828
46870
  this.voices = [];
46829
46871
  voices.forEach((voice) => {
46830
46872
  if (voice.localService === true) {
46831
46873
  this.voices.push(voice);
46832
46874
  }
46833
46875
  });
46834
- import_loglevel19.default.log(this.voices);
46876
+ import_loglevel20.default.log(this.voices);
46835
46877
  if (first) {
46836
46878
  if (this.headerMenu) {
46837
46879
  var preferredLanguageSelector = findElement(this.headerMenu, "#preferred-languages");
@@ -46920,16 +46962,16 @@ var TTSModule2 = class {
46920
46962
  restOfTheText = restOfTheText.replace(textToBeSpoken, "").trim();
46921
46963
  }
46922
46964
  utterance = new SpeechSynthesisUtterance(textToBeSpoken);
46923
- import_loglevel19.default.log(selectionInfo);
46924
- import_loglevel19.default.log(textToBeSpoken, selectionInfo.range?.commonAncestorContainer.textContent);
46925
- import_loglevel19.default.log(ttsQueueItem);
46926
- import_loglevel19.default.log(ttsQueueItem.item.textNodes);
46927
- import_loglevel19.default.log(startIndex);
46928
- import_loglevel19.default.log(ttsQueueItem.item.combinedText);
46965
+ import_loglevel20.default.log(selectionInfo);
46966
+ import_loglevel20.default.log(textToBeSpoken, selectionInfo.range?.commonAncestorContainer.textContent);
46967
+ import_loglevel20.default.log(ttsQueueItem);
46968
+ import_loglevel20.default.log(ttsQueueItem.item.textNodes);
46969
+ import_loglevel20.default.log(startIndex);
46970
+ import_loglevel20.default.log(ttsQueueItem.item.combinedText);
46929
46971
  let node = ttsQueueItem.item.textNodes.filter((node2) => {
46930
46972
  return node2 === selectionInfo.range?.commonAncestorContainer;
46931
46973
  })[0];
46932
- import_loglevel19.default.log(node);
46974
+ import_loglevel20.default.log(node);
46933
46975
  utterance.onboundary = (ev) => {
46934
46976
  this.updateTTSInfo(ttsQueueItem, ev.charIndex, ev.charLength, startIndex, utterance.text);
46935
46977
  };
@@ -46942,7 +46984,7 @@ var TTSModule2 = class {
46942
46984
  utterance.rate = this.tts.rate;
46943
46985
  utterance.pitch = this.tts.pitch;
46944
46986
  utterance.volume = this.tts.volume;
46945
- import_loglevel19.default.log("this.tts.voice.lang", this.tts.voice.lang);
46987
+ import_loglevel20.default.log("this.tts.voice.lang", this.tts.voice.lang);
46946
46988
  var initialVoiceHasHyphen = true;
46947
46989
  if (this.tts.voice && this.tts.voice.lang) {
46948
46990
  initialVoiceHasHyphen = this.tts.voice.lang.indexOf("-") !== -1;
@@ -46951,8 +46993,8 @@ var TTSModule2 = class {
46951
46993
  initialVoiceHasHyphen = true;
46952
46994
  }
46953
46995
  }
46954
- import_loglevel19.default.log("initialVoiceHasHyphen", initialVoiceHasHyphen);
46955
- import_loglevel19.default.log("voices", this.voices);
46996
+ import_loglevel20.default.log("initialVoiceHasHyphen", initialVoiceHasHyphen);
46997
+ import_loglevel20.default.log("voices", this.voices);
46956
46998
  var initialVoice;
46957
46999
  if (initialVoiceHasHyphen === true) {
46958
47000
  initialVoice = this.tts.voice && this.tts.voice.lang && this.tts.voice.name ? this.voices.filter((v) => {
@@ -46970,9 +47012,9 @@ var TTSModule2 = class {
46970
47012
  initialVoice = this.tts.voice && this.tts.voice.lang ? this.voices.filter((v) => v.lang === this.tts.voice.lang)[0] : void 0;
46971
47013
  }
46972
47014
  }
46973
- import_loglevel19.default.log("initialVoice", initialVoice);
47015
+ import_loglevel20.default.log("initialVoice", initialVoice);
46974
47016
  var publicationVoiceHasHyphen = self2.delegate.publication.Metadata.Language[0].indexOf("-") !== -1;
46975
- import_loglevel19.default.log("publicationVoiceHasHyphen", publicationVoiceHasHyphen);
47017
+ import_loglevel20.default.log("publicationVoiceHasHyphen", publicationVoiceHasHyphen);
46976
47018
  var publicationVoice;
46977
47019
  if (publicationVoiceHasHyphen === true) {
46978
47020
  publicationVoice = this.tts.voice && this.tts.voice.usePublication ? this.voices.filter((v) => {
@@ -46984,9 +47026,9 @@ var TTSModule2 = class {
46984
47026
  return v.lang.startsWith(self2.delegate.publication.Metadata.Language[0]) || v.lang.endsWith(self2.delegate.publication.Metadata.Language[0].toUpperCase());
46985
47027
  })[0] : void 0;
46986
47028
  }
46987
- import_loglevel19.default.log("publicationVoice", publicationVoice);
47029
+ import_loglevel20.default.log("publicationVoice", publicationVoice);
46988
47030
  var defaultVoiceHasHyphen = navigator.language.indexOf("-") !== -1;
46989
- import_loglevel19.default.log("defaultVoiceHasHyphen", defaultVoiceHasHyphen);
47031
+ import_loglevel20.default.log("defaultVoiceHasHyphen", defaultVoiceHasHyphen);
46990
47032
  var defaultVoice;
46991
47033
  if (defaultVoiceHasHyphen === true) {
46992
47034
  defaultVoice = this.voices.filter((voice) => {
@@ -47005,23 +47047,23 @@ var TTSModule2 = class {
47005
47047
  return lang.includes(navigator.language) && voice.localService === true;
47006
47048
  })[0];
47007
47049
  }
47008
- import_loglevel19.default.log("defaultVoice", defaultVoice);
47050
+ import_loglevel20.default.log("defaultVoice", defaultVoice);
47009
47051
  if (initialVoice) {
47010
- import_loglevel19.default.log("initialVoice");
47052
+ import_loglevel20.default.log("initialVoice");
47011
47053
  utterance.voice = initialVoice;
47012
47054
  } else if (publicationVoice) {
47013
- import_loglevel19.default.log("publicationVoice");
47055
+ import_loglevel20.default.log("publicationVoice");
47014
47056
  utterance.voice = publicationVoice;
47015
47057
  } else if (defaultVoice) {
47016
- import_loglevel19.default.log("defaultVoice");
47058
+ import_loglevel20.default.log("defaultVoice");
47017
47059
  utterance.voice = defaultVoice;
47018
47060
  }
47019
47061
  if (utterance.voice !== void 0 && utterance.voice !== null) {
47020
47062
  utterance.lang = utterance.voice.lang;
47021
- import_loglevel19.default.log("utterance.voice.lang", utterance.voice.lang);
47022
- import_loglevel19.default.log("utterance.lang", utterance.lang);
47063
+ import_loglevel20.default.log("utterance.voice.lang", utterance.voice.lang);
47064
+ import_loglevel20.default.log("utterance.lang", utterance.lang);
47023
47065
  }
47024
- import_loglevel19.default.log("navigator.language", navigator.language);
47066
+ import_loglevel20.default.log("navigator.language", navigator.language);
47025
47067
  setTimeout(() => {
47026
47068
  window.speechSynthesis.speak(utterance);
47027
47069
  }, 0);
@@ -47056,14 +47098,14 @@ var TTSModule2 = class {
47056
47098
  onend();
47057
47099
  }
47058
47100
  if (idx > idxEnd) {
47059
- import_loglevel19.default.log("utterance ended");
47101
+ import_loglevel20.default.log("utterance ended");
47060
47102
  self2.highlighter.doneSpeaking();
47061
47103
  self2.api?.finished();
47062
47104
  self2.delegate.emit("readaloud.finished", "finished");
47063
47105
  }
47064
47106
  }
47065
47107
  } else {
47066
- import_loglevel19.default.log("utterance ended");
47108
+ import_loglevel20.default.log("utterance ended");
47067
47109
  self2.highlighter.doneSpeaking();
47068
47110
  self2.api?.finished();
47069
47111
  self2.delegate.emit("readaloud.finished", "finished");
@@ -47180,7 +47222,7 @@ var TTSModule2 = class {
47180
47222
  }
47181
47223
  }
47182
47224
  stop() {
47183
- import_loglevel19.default.log("TTS module stop");
47225
+ import_loglevel20.default.log("TTS module stop");
47184
47226
  removeEventListenerOptional(document, "wheel", this.wheel.bind(this));
47185
47227
  removeEventListenerOptional(this.body, "wheel", this.wheel.bind(this));
47186
47228
  removeEventListenerOptional(document, "keydown", this.wheel.bind(this));
@@ -47338,7 +47380,7 @@ var TTSModule2 = class {
47338
47380
  utterance.rate = this.tts.rate;
47339
47381
  utterance.pitch = this.tts.pitch;
47340
47382
  utterance.volume = this.tts.volume;
47341
- import_loglevel19.default.log("this.tts.voice.lang", this.tts.voice.lang);
47383
+ import_loglevel20.default.log("this.tts.voice.lang", this.tts.voice.lang);
47342
47384
  var initialVoiceHasHyphen = true;
47343
47385
  if (this.tts.voice && this.tts.voice.lang) {
47344
47386
  initialVoiceHasHyphen = this.tts.voice.lang.indexOf("-") !== -1;
@@ -47347,8 +47389,8 @@ var TTSModule2 = class {
47347
47389
  initialVoiceHasHyphen = true;
47348
47390
  }
47349
47391
  }
47350
- import_loglevel19.default.log("initialVoiceHasHyphen", initialVoiceHasHyphen);
47351
- import_loglevel19.default.log("voices", this.voices);
47392
+ import_loglevel20.default.log("initialVoiceHasHyphen", initialVoiceHasHyphen);
47393
+ import_loglevel20.default.log("voices", this.voices);
47352
47394
  var initialVoice;
47353
47395
  if (initialVoiceHasHyphen === true) {
47354
47396
  initialVoice = this.tts.voice && this.tts.voice.lang && this.tts.voice.name ? this.voices.filter((v) => {
@@ -47366,10 +47408,10 @@ var TTSModule2 = class {
47366
47408
  initialVoice = this.tts.voice && this.tts.voice.lang ? this.voices.filter((v) => v.lang === this.tts.voice.lang)[0] : void 0;
47367
47409
  }
47368
47410
  }
47369
- import_loglevel19.default.log("initialVoice", initialVoice);
47411
+ import_loglevel20.default.log("initialVoice", initialVoice);
47370
47412
  var self2 = this;
47371
47413
  var publicationVoiceHasHyphen = self2.delegate.publication.Metadata.Language[0].indexOf("-") !== -1;
47372
- import_loglevel19.default.log("publicationVoiceHasHyphen", publicationVoiceHasHyphen);
47414
+ import_loglevel20.default.log("publicationVoiceHasHyphen", publicationVoiceHasHyphen);
47373
47415
  var publicationVoice;
47374
47416
  if (publicationVoiceHasHyphen === true) {
47375
47417
  publicationVoice = this.tts.voice && this.tts.voice.usePublication ? this.voices.filter((v) => {
@@ -47381,9 +47423,9 @@ var TTSModule2 = class {
47381
47423
  return v.lang.startsWith(self2.delegate.publication.Metadata.Language[0]) || v.lang.endsWith(self2.delegate.publication.Metadata.Language[0].toUpperCase());
47382
47424
  })[0] : void 0;
47383
47425
  }
47384
- import_loglevel19.default.log("publicationVoice", publicationVoice);
47426
+ import_loglevel20.default.log("publicationVoice", publicationVoice);
47385
47427
  var defaultVoiceHasHyphen = navigator.language.indexOf("-") !== -1;
47386
- import_loglevel19.default.log("defaultVoiceHasHyphen", defaultVoiceHasHyphen);
47428
+ import_loglevel20.default.log("defaultVoiceHasHyphen", defaultVoiceHasHyphen);
47387
47429
  var defaultVoice;
47388
47430
  if (defaultVoiceHasHyphen === true) {
47389
47431
  defaultVoice = this.voices.filter((voice) => {
@@ -47402,25 +47444,25 @@ var TTSModule2 = class {
47402
47444
  return lang.includes(navigator.language) && voice.localService === true;
47403
47445
  })[0];
47404
47446
  }
47405
- import_loglevel19.default.log("defaultVoice", defaultVoice);
47447
+ import_loglevel20.default.log("defaultVoice", defaultVoice);
47406
47448
  if (initialVoice) {
47407
- import_loglevel19.default.log("initialVoice");
47449
+ import_loglevel20.default.log("initialVoice");
47408
47450
  utterance.voice = initialVoice;
47409
47451
  } else if (publicationVoice) {
47410
- import_loglevel19.default.log("publicationVoice");
47452
+ import_loglevel20.default.log("publicationVoice");
47411
47453
  utterance.voice = publicationVoice;
47412
47454
  } else if (defaultVoice) {
47413
- import_loglevel19.default.log("defaultVoice");
47455
+ import_loglevel20.default.log("defaultVoice");
47414
47456
  utterance.voice = defaultVoice;
47415
47457
  }
47416
47458
  if (utterance.voice !== void 0 && utterance.voice !== null) {
47417
47459
  utterance.lang = utterance.voice.lang;
47418
- import_loglevel19.default.log("utterance.voice.lang", utterance.voice.lang);
47419
- import_loglevel19.default.log("utterance.lang", utterance.lang);
47460
+ import_loglevel20.default.log("utterance.voice.lang", utterance.voice.lang);
47461
+ import_loglevel20.default.log("utterance.lang", utterance.lang);
47420
47462
  }
47421
- import_loglevel19.default.log("navigator.language", navigator.language);
47463
+ import_loglevel20.default.log("navigator.language", navigator.language);
47422
47464
  utterance.onboundary = (ev) => {
47423
- import_loglevel19.default.log(ev.name);
47465
+ import_loglevel20.default.log(ev.name);
47424
47466
  this.updateTTSInfo(ttsQueueItem, ev.charIndex, ev.charLength, 0, utterance.text);
47425
47467
  };
47426
47468
  setTimeout(() => {
@@ -47439,7 +47481,7 @@ var TTSModule2 = class {
47439
47481
  if (!ttsQueueItem) {
47440
47482
  return void 0;
47441
47483
  }
47442
- import_loglevel19.default.log(ttsQueueItem, charIndex, charLength, utteranceText);
47484
+ import_loglevel20.default.log(ttsQueueItem, charIndex, charLength, utteranceText);
47443
47485
  const ttsQueueItemText = utteranceText ? utteranceText : getTtsQueueItemRefText(ttsQueueItem);
47444
47486
  if (charIndex >= 0 && utteranceText) {
47445
47487
  const start = utteranceText.slice(0, charIndex + 1).search(/\S+$/);
@@ -47460,9 +47502,9 @@ var TTSModule2 = class {
47460
47502
  return ttsQueueItemText;
47461
47503
  }
47462
47504
  wrapHighlightWord(ttsQueueItemRef, utteranceText, charIndex, charLength, word, start, end) {
47463
- import_loglevel19.default.log(ttsQueueItemRef);
47464
- import_loglevel19.default.log(utteranceText);
47465
- import_loglevel19.default.log(charIndex, charLength, word, start, end);
47505
+ import_loglevel20.default.log(ttsQueueItemRef);
47506
+ import_loglevel20.default.log(utteranceText);
47507
+ import_loglevel20.default.log(charIndex, charLength, word, start, end);
47466
47508
  if (this._ttsQueueItemHighlightsWord) {
47467
47509
  this.delegate.highlighter?.destroyHighlights(HighlightType.ReadAloud);
47468
47510
  this._ttsQueueItemHighlightsWord = void 0;
@@ -47505,8 +47547,8 @@ var TTSModule2 = class {
47505
47547
  return "";
47506
47548
  }
47507
47549
  } catch (err) {
47508
- import_loglevel19.default.log("uniqueCssSelector:");
47509
- import_loglevel19.default.error(err);
47550
+ import_loglevel20.default.log("uniqueCssSelector:");
47551
+ import_loglevel20.default.error(err);
47510
47552
  return "";
47511
47553
  }
47512
47554
  };
@@ -47613,7 +47655,7 @@ function getTtsQueueItemRefText(obj) {
47613
47655
  init_polyfills();
47614
47656
  var lodash3 = __toModule(require_lodash());
47615
47657
  var import_debounce7 = __toModule(require_debounce());
47616
- var import_loglevel20 = __toModule(require_loglevel());
47658
+ var import_loglevel21 = __toModule(require_loglevel());
47617
47659
  var DefinitionsModule = class {
47618
47660
  constructor(delegate, publication, properties, highlighter, api) {
47619
47661
  this.currentChapterPopupResult = [];
@@ -47638,7 +47680,7 @@ var DefinitionsModule = class {
47638
47680
  return search;
47639
47681
  }
47640
47682
  async stop() {
47641
- import_loglevel20.default.log("Definitions module stop");
47683
+ import_loglevel21.default.log("Definitions module stop");
47642
47684
  }
47643
47685
  async start() {
47644
47686
  this.delegate.definitionsModule = this;
@@ -47760,7 +47802,7 @@ var DefinitionsModule = class {
47760
47802
 
47761
47803
  // src/modules/linefocus/LineFocusModule.ts
47762
47804
  init_polyfills();
47763
- var import_loglevel21 = __toModule(require_loglevel());
47805
+ var import_loglevel22 = __toModule(require_loglevel());
47764
47806
  var DEFAULT_BACKGROUND_COLOR_OPACITY2 = 0.5;
47765
47807
  var LineFocusModule = class {
47766
47808
  constructor(delegate, properties, highlighter, api) {
@@ -47785,7 +47827,7 @@ var LineFocusModule = class {
47785
47827
  return search;
47786
47828
  }
47787
47829
  async stop() {
47788
- import_loglevel21.default.log("Definitions module stop");
47830
+ import_loglevel22.default.log("Definitions module stop");
47789
47831
  this.hasEventListener = false;
47790
47832
  removeEventListenerOptional(document, "keydown", this.keydown.bind(this));
47791
47833
  removeEventListenerOptional(document, "keyup", this.keyup.bind(this));
@@ -48180,9 +48222,9 @@ var LineFocusModule = class {
48180
48222
  range.detach();
48181
48223
  return rect;
48182
48224
  } catch (error) {
48183
- import_loglevel21.default.log("measureTextNode " + error);
48184
- import_loglevel21.default.log("measureTextNode " + node);
48185
- import_loglevel21.default.log(`${node.textContent}`);
48225
+ import_loglevel22.default.log("measureTextNode " + error);
48226
+ import_loglevel22.default.log("measureTextNode " + node);
48227
+ import_loglevel22.default.log(`${node.textContent}`);
48186
48228
  }
48187
48229
  }
48188
48230
  measureImageNodes(node) {
@@ -48193,16 +48235,16 @@ var LineFocusModule = class {
48193
48235
  range.detach();
48194
48236
  return rect;
48195
48237
  } catch (error) {
48196
- import_loglevel21.default.log("measureTextNode " + error);
48197
- import_loglevel21.default.log("measureTextNode " + node);
48198
- import_loglevel21.default.log(`${node.textContent}`);
48238
+ import_loglevel22.default.log("measureTextNode " + error);
48239
+ import_loglevel22.default.log("measureTextNode " + node);
48240
+ import_loglevel22.default.log(`${node.textContent}`);
48199
48241
  }
48200
48242
  }
48201
48243
  };
48202
48244
 
48203
48245
  // src/modules/history/HistoryModule.ts
48204
48246
  init_polyfills();
48205
- var import_loglevel22 = __toModule(require_loglevel());
48247
+ var import_loglevel23 = __toModule(require_loglevel());
48206
48248
  var HistoryModule = class {
48207
48249
  constructor(annotator, delegate, publication, properties, headerMenu) {
48208
48250
  this.history = [];
@@ -48218,7 +48260,7 @@ var HistoryModule = class {
48218
48260
  return pageBreak;
48219
48261
  }
48220
48262
  async stop() {
48221
- import_loglevel22.default.log("Page Break module stop");
48263
+ import_loglevel23.default.log("Page Break module stop");
48222
48264
  removeEventListenerOptional(this.historyForwardAnchorElement, "click", this.handleHistoryForwardClick.bind(this));
48223
48265
  removeEventListenerOptional(this.historyBackAnchorElement, "click", this.handleHistoryBackClick.bind(this));
48224
48266
  }
@@ -48256,8 +48298,8 @@ var HistoryModule = class {
48256
48298
  lastInHistory = this.history[this.history.length - 1];
48257
48299
  if (lastInHistory && lastInHistory.href !== lastReadingPosition.href || lastInHistory === void 0) {
48258
48300
  const linkHref = this.publication.getAbsoluteHref(lastReadingPosition.href);
48259
- import_loglevel22.default.log(lastReadingPosition.href);
48260
- import_loglevel22.default.log(linkHref);
48301
+ import_loglevel23.default.log(lastReadingPosition.href);
48302
+ import_loglevel23.default.log(linkHref);
48261
48303
  lastReadingPosition.href = linkHref;
48262
48304
  this.history.push(lastReadingPosition);
48263
48305
  this.historyCurrentIndex = this.history.length - 1;
@@ -48284,30 +48326,36 @@ var HistoryModule = class {
48284
48326
  addEventListenerOptional(this.historyBackAnchorElement, "click", this.handleHistoryBackClick.bind(this));
48285
48327
  }
48286
48328
  async handleHistoryForwardClick(event) {
48329
+ await this.historyForward();
48330
+ event.preventDefault();
48331
+ event.stopPropagation();
48332
+ }
48333
+ async historyForward() {
48287
48334
  if (this.history.length > 0) {
48288
48335
  if (this.historyCurrentIndex + 1 < this.history.length) {
48289
48336
  this.historyCurrentIndex = this.historyCurrentIndex + 1;
48290
48337
  await this.delegate.navigate(this.history[this.historyCurrentIndex], false);
48291
48338
  }
48292
48339
  }
48340
+ }
48341
+ async handleHistoryBackClick(event) {
48342
+ await this.historyBack();
48293
48343
  event.preventDefault();
48294
48344
  event.stopPropagation();
48295
48345
  }
48296
- async handleHistoryBackClick(event) {
48346
+ async historyBack() {
48297
48347
  if (this.history.length > 0) {
48298
48348
  if (this.historyCurrentIndex > 0) {
48299
48349
  this.historyCurrentIndex = this.historyCurrentIndex - 1;
48300
48350
  await this.delegate.navigate(this.history[this.historyCurrentIndex], false);
48301
48351
  }
48302
48352
  }
48303
- event.preventDefault();
48304
- event.stopPropagation();
48305
48353
  }
48306
48354
  };
48307
48355
 
48308
48356
  // src/modules/citation/CitationModule.ts
48309
48357
  init_polyfills();
48310
- var import_loglevel23 = __toModule(require_loglevel());
48358
+ var import_loglevel24 = __toModule(require_loglevel());
48311
48359
  var CitationStyle;
48312
48360
  (function(CitationStyle2) {
48313
48361
  CitationStyle2[CitationStyle2["Chicago"] = 0] = "Chicago";
@@ -48335,7 +48383,7 @@ var CitationModule = class {
48335
48383
  return module;
48336
48384
  }
48337
48385
  async stop() {
48338
- import_loglevel23.default.log("Citation module stop");
48386
+ import_loglevel24.default.log("Citation module stop");
48339
48387
  }
48340
48388
  copyToClipboard(textToClipboard) {
48341
48389
  if (this.delegate?.contentProtectionModule) {
@@ -48546,7 +48594,7 @@ var CitationModule = class {
48546
48594
 
48547
48595
  // src/reader.ts
48548
48596
  var D2Reader = class {
48549
- constructor(settings, navigator2, highlighter, bookmarkModule, annotationModule, ttsSettings, ttsModule, searchModule, definitionsModule, contentProtectionModule, timelineModule, mediaOverlaySettings, mediaOverlayModule, pageBreakModule, lineFocusModule, historyModule, citationModule) {
48597
+ constructor(settings, navigator2, highlighter, bookmarkModule, annotationModule, ttsSettings, ttsModule, searchModule, definitionsModule, contentProtectionModule, timelineModule, mediaOverlaySettings, mediaOverlayModule, pageBreakModule, lineFocusModule, historyModule, citationModule, consumptionModule) {
48550
48598
  this.settings = settings;
48551
48599
  this.navigator = navigator2;
48552
48600
  this.highlighter = highlighter;
@@ -48564,6 +48612,7 @@ var D2Reader = class {
48564
48612
  this.lineFocusModule = lineFocusModule;
48565
48613
  this.historyModule = historyModule;
48566
48614
  this.citationModule = citationModule;
48615
+ this.consumptionModule = consumptionModule;
48567
48616
  this.startReadAloud = () => {
48568
48617
  this.navigator.startReadAloud();
48569
48618
  };
@@ -48627,6 +48676,12 @@ var D2Reader = class {
48627
48676
  this.addDefinition = async (definition) => {
48628
48677
  await this.definitionsModule?.addDefinition(definition);
48629
48678
  };
48679
+ this.historyBack = async () => {
48680
+ return this.historyModule?.historyBack();
48681
+ };
48682
+ this.historyForward = async () => {
48683
+ return this.historyModule?.historyForward();
48684
+ };
48630
48685
  this.search = async (term, current) => {
48631
48686
  return await this.searchModule?.search(term, current) ?? [];
48632
48687
  };
@@ -48927,7 +48982,11 @@ var D2Reader = class {
48927
48982
  delegate: navigator2,
48928
48983
  headerMenu
48929
48984
  }) : void 0;
48930
- return new D2Reader(settings, navigator2, highlighter, bookmarkModule, annotationModule, ttsSettings, ttsModule, searchModule, definitionsModule, contentProtectionModule, timelineModule, mediaOverlaySettings, mediaOverlayModule, pageBreakModule, lineFocusModule, historyModule, citationModule);
48985
+ const consumptionModule = rights.enableConsumption ? await ConsumptionModule.create(__spreadValues({
48986
+ publication,
48987
+ delegate: navigator2
48988
+ }, initialConfig.consumption)) : void 0;
48989
+ return new D2Reader(settings, navigator2, highlighter, bookmarkModule, annotationModule, ttsSettings, ttsModule, searchModule, definitionsModule, contentProtectionModule, timelineModule, mediaOverlaySettings, mediaOverlayModule, pageBreakModule, lineFocusModule, historyModule, citationModule, consumptionModule);
48931
48990
  }
48932
48991
  get hasMediaOverlays() {
48933
48992
  return this.navigator.hasMediaOverlays;
@@ -48944,6 +49003,12 @@ var D2Reader = class {
48944
49003
  get annotations() {
48945
49004
  return this.annotationModule?.getAnnotations();
48946
49005
  }
49006
+ get history() {
49007
+ return this.historyModule?.history;
49008
+ }
49009
+ get historyCurrentIndex() {
49010
+ return this.historyModule?.historyCurrentIndex;
49011
+ }
48947
49012
  get currentResource() {
48948
49013
  return this.navigator.currentResource();
48949
49014
  }