@d-i-t-a/reader 2.1.10 → 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
@@ -39640,7 +39640,55 @@ var _getCssSelectorOptions = {
39640
39640
 
39641
39641
  // src/modules/AnnotationModule.ts
39642
39642
  var lodash2 = __toModule(require_lodash());
39643
+ var import_loglevel8 = __toModule(require_loglevel());
39644
+
39645
+ // src/modules/consumption/ConsumptionModule.ts
39646
+ init_polyfills();
39643
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
39644
39692
  var AnnotationModule = class {
39645
39693
  constructor(annotator, rights, publication, delegate, initialAnnotations, properties, highlighter, api, headerMenu) {
39646
39694
  this.hide = findElement(document, "#menu-button-hide");
@@ -39661,7 +39709,7 @@ var AnnotationModule = class {
39661
39709
  return annotations;
39662
39710
  }
39663
39711
  async stop() {
39664
- import_loglevel7.default.log("Annotation module stop");
39712
+ import_loglevel8.default.log("Annotation module stop");
39665
39713
  }
39666
39714
  async start() {
39667
39715
  this.delegate.annotationModule = this;
@@ -39744,8 +39792,8 @@ var AnnotationModule = class {
39744
39792
  return "";
39745
39793
  }
39746
39794
  } catch (err) {
39747
- import_loglevel7.default.log("uniqueCssSelector:");
39748
- import_loglevel7.default.error(err);
39795
+ import_loglevel8.default.log("uniqueCssSelector:");
39796
+ import_loglevel8.default.error(err);
39749
39797
  return "";
39750
39798
  }
39751
39799
  };
@@ -39766,7 +39814,7 @@ var AnnotationModule = class {
39766
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);
39767
39815
  if (book) {
39768
39816
  this.saveAnnotation(book[0]).then((anno) => {
39769
- import_loglevel7.default.log("saved bookmark " + anno.id);
39817
+ import_loglevel8.default.log("saved bookmark " + anno.id);
39770
39818
  });
39771
39819
  }
39772
39820
  }
@@ -39776,7 +39824,7 @@ var AnnotationModule = class {
39776
39824
  }
39777
39825
  }
39778
39826
  async scrollToHighlight(id2) {
39779
- import_loglevel7.default.log("still need to scroll to " + id2);
39827
+ import_loglevel8.default.log("still need to scroll to " + id2);
39780
39828
  var element = await this.annotator?.getAnnotationElement(id2, this.delegate.iframes[0].contentWindow);
39781
39829
  element.scrollIntoView({
39782
39830
  block: "center",
@@ -39787,8 +39835,8 @@ var AnnotationModule = class {
39787
39835
  if (this.annotator) {
39788
39836
  let deleted = await this.annotator.deleteAnnotation(annotation.id);
39789
39837
  let added = await this.addAnnotation(annotation);
39790
- import_loglevel7.default.log("Highlight deleted " + JSON.stringify(deleted));
39791
- 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));
39792
39840
  await this.showHighlights();
39793
39841
  await this.drawHighlights();
39794
39842
  return added;
@@ -39799,7 +39847,7 @@ var AnnotationModule = class {
39799
39847
  async deleteLocalHighlight(id2) {
39800
39848
  if (this.annotator) {
39801
39849
  var deleted = await this.annotator.deleteAnnotation(id2);
39802
- import_loglevel7.default.log("Highlight deleted " + JSON.stringify(deleted));
39850
+ import_loglevel8.default.log("Highlight deleted " + JSON.stringify(deleted));
39803
39851
  await this.showHighlights();
39804
39852
  await this.drawHighlights();
39805
39853
  return deleted;
@@ -39895,6 +39943,7 @@ var AnnotationModule = class {
39895
39943
  }
39896
39944
  }
39897
39945
  if (annotation) {
39946
+ this.delegate.consumptionModule?.trackAction(annotation, Action.HighlightCreated);
39898
39947
  if (this.api?.addAnnotation) {
39899
39948
  try {
39900
39949
  let result = await this.api.addAnnotation(annotation);
@@ -40226,17 +40275,17 @@ var AnnotationModule = class {
40226
40275
  this.delegate.stopReadAloud();
40227
40276
  this.delegate.navigate(locator);
40228
40277
  } else {
40229
- import_loglevel7.default.log("annotation data missing: ", event);
40278
+ import_loglevel8.default.log("annotation data missing: ", event);
40230
40279
  }
40231
40280
  }
40232
40281
  handleAnnotationLinkDeleteClick(type, event, locator) {
40233
- import_loglevel7.default.log("annotation data locator: ", locator);
40282
+ import_loglevel8.default.log("annotation data locator: ", locator);
40234
40283
  if (locator) {
40235
40284
  if (type === AnnotationType.Annotation) {
40236
40285
  this.deleteHighlight(locator);
40237
40286
  }
40238
40287
  } else {
40239
- import_loglevel7.default.log("annotation data missing: ", event);
40288
+ import_loglevel8.default.log("annotation data missing: ", event);
40240
40289
  }
40241
40290
  }
40242
40291
  static readableTimestamp(timestamp) {
@@ -40304,7 +40353,7 @@ var AnnotationModule = class {
40304
40353
  // src/modules/BookmarkModule.ts
40305
40354
  init_polyfills();
40306
40355
  var import_uuid2 = __toModule(require_uuid());
40307
- var import_loglevel8 = __toModule(require_loglevel());
40356
+ var import_loglevel9 = __toModule(require_loglevel());
40308
40357
  var BookmarkModule = class {
40309
40358
  static async create(config2) {
40310
40359
  const module = new this(config2.annotator, config2.rights || { enableBookmarks: false }, config2.publication, config2.delegate, config2, config2.initialAnnotations, config2.api, config2.headerMenu);
@@ -40322,7 +40371,7 @@ var BookmarkModule = class {
40322
40371
  this.api = api;
40323
40372
  }
40324
40373
  stop() {
40325
- import_loglevel8.default.log("Bookmark module stop");
40374
+ import_loglevel9.default.log("Bookmark module stop");
40326
40375
  }
40327
40376
  async start() {
40328
40377
  this.delegate.bookmarkModule = this;
@@ -40372,13 +40421,13 @@ var BookmarkModule = class {
40372
40421
  if (this.api?.deleteBookmark) {
40373
40422
  await this.api?.deleteBookmark(bookmark);
40374
40423
  let deleted = await this.annotator.deleteBookmark(bookmark);
40375
- import_loglevel8.default.log("Bookmark deleted " + JSON.stringify(deleted));
40424
+ import_loglevel9.default.log("Bookmark deleted " + JSON.stringify(deleted));
40376
40425
  await this.showBookmarks();
40377
40426
  await this.drawBookmarks();
40378
40427
  return deleted;
40379
40428
  } else {
40380
40429
  let deleted = await this.annotator.deleteBookmark(bookmark);
40381
- import_loglevel8.default.log("Bookmark deleted " + JSON.stringify(deleted));
40430
+ import_loglevel9.default.log("Bookmark deleted " + JSON.stringify(deleted));
40382
40431
  await this.showBookmarks();
40383
40432
  await this.drawBookmarks();
40384
40433
  return deleted;
@@ -40430,20 +40479,21 @@ var BookmarkModule = class {
40430
40479
  };
40431
40480
  }
40432
40481
  if (!this.annotator.locatorExists(bookmark, AnnotationType.Bookmark)) {
40482
+ this.delegate.consumptionModule?.trackAction(bookmark, Action.BookmarkCreated);
40433
40483
  if (this.api?.addBookmark) {
40434
40484
  const result = await this.api.addBookmark(bookmark);
40435
40485
  if (result) {
40436
40486
  bookmark = result;
40437
40487
  }
40438
- import_loglevel8.default.log(bookmark);
40488
+ import_loglevel9.default.log(bookmark);
40439
40489
  let saved = this.annotator.saveBookmark(bookmark);
40440
- import_loglevel8.default.log("Bookmark added " + JSON.stringify(saved));
40490
+ import_loglevel9.default.log("Bookmark added " + JSON.stringify(saved));
40441
40491
  this.showBookmarks();
40442
40492
  await this.drawBookmarks();
40443
40493
  return saved;
40444
40494
  } else {
40445
40495
  let saved = this.annotator.saveBookmark(bookmark);
40446
- import_loglevel8.default.log("Bookmark added " + JSON.stringify(saved));
40496
+ import_loglevel9.default.log("Bookmark added " + JSON.stringify(saved));
40447
40497
  this.showBookmarks();
40448
40498
  await this.drawBookmarks();
40449
40499
  return saved;
@@ -40543,7 +40593,7 @@ var BookmarkModule = class {
40543
40593
  this.delegate.iframes[0].contentDocument?.getSelection()?.removeAllRanges();
40544
40594
  if (book) {
40545
40595
  return this.saveAnnotation(book[0]).then((anno) => {
40546
- import_loglevel8.default.log("saved bookmark " + anno?.id);
40596
+ import_loglevel9.default.log("saved bookmark " + anno?.id);
40547
40597
  });
40548
40598
  }
40549
40599
  }
@@ -40602,6 +40652,7 @@ var BookmarkModule = class {
40602
40652
  }
40603
40653
  }
40604
40654
  if (annotation) {
40655
+ this.delegate.consumptionModule?.trackAction(annotation, Action.BookmarkCreated);
40605
40656
  if (this.api?.addBookmark) {
40606
40657
  let result = await this.api.addBookmark(annotation);
40607
40658
  const saved = await this.annotator.saveAnnotation(result);
@@ -40721,7 +40772,7 @@ var BookmarkModule = class {
40721
40772
  async deleteLocalHighlight(id2) {
40722
40773
  if (this.annotator) {
40723
40774
  var deleted = await this.annotator.deleteAnnotation(id2);
40724
- import_loglevel8.default.log("Highlight deleted " + JSON.stringify(deleted));
40775
+ import_loglevel9.default.log("Highlight deleted " + JSON.stringify(deleted));
40725
40776
  await this.showBookmarks();
40726
40777
  await this.drawBookmarks();
40727
40778
  return deleted;
@@ -40831,17 +40882,17 @@ var BookmarkModule = class {
40831
40882
  this.delegate.stopReadAloud();
40832
40883
  this.delegate.navigate(locator);
40833
40884
  } else {
40834
- import_loglevel8.default.log("bookmark data missing: ", event);
40885
+ import_loglevel9.default.log("bookmark data missing: ", event);
40835
40886
  }
40836
40887
  }
40837
40888
  handleAnnotationLinkDeleteClick(type, event, locator) {
40838
- import_loglevel8.default.log("bookmark data locator: ", locator);
40889
+ import_loglevel9.default.log("bookmark data locator: ", locator);
40839
40890
  if (locator) {
40840
40891
  if (type === AnnotationType.Bookmark) {
40841
40892
  this.deleteBookmark(locator);
40842
40893
  }
40843
40894
  } else {
40844
- import_loglevel8.default.log("bookmark data missing: ", event);
40895
+ import_loglevel9.default.log("bookmark data missing: ", event);
40845
40896
  }
40846
40897
  }
40847
40898
  static readableTimestamp(timestamp) {
@@ -40862,7 +40913,7 @@ var import_media_overlay = __toModule(require_media_overlay());
40862
40913
 
40863
40914
  // src/modules/mediaoverlays/MediaOverlaySettings.ts
40864
40915
  init_polyfills();
40865
- var import_loglevel9 = __toModule(require_loglevel());
40916
+ var import_loglevel10 = __toModule(require_loglevel());
40866
40917
  var R2_MO_CLASS_ACTIVE = "r2-mo-active";
40867
40918
  var _MEDIAOVERLAYREFS = class {
40868
40919
  };
@@ -40894,7 +40945,7 @@ var MediaOverlaySettings = class {
40894
40945
  this.api = api;
40895
40946
  this.headerMenu = headerMenu;
40896
40947
  this.initialise();
40897
- import_loglevel9.default.log(this.api);
40948
+ import_loglevel10.default.log(this.api);
40898
40949
  }
40899
40950
  static create(config2) {
40900
40951
  const settings = new this(config2.store, config2.api, config2.headerMenu);
@@ -40902,34 +40953,34 @@ var MediaOverlaySettings = class {
40902
40953
  let initialSettings = config2.initialMediaOverlaySettings;
40903
40954
  if (initialSettings?.color) {
40904
40955
  settings.color = initialSettings.color;
40905
- import_loglevel9.default.log(settings.color);
40956
+ import_loglevel10.default.log(settings.color);
40906
40957
  }
40907
40958
  if (initialSettings?.autoScroll) {
40908
40959
  settings.autoScroll = initialSettings.autoScroll;
40909
- import_loglevel9.default.log(settings.autoScroll);
40960
+ import_loglevel10.default.log(settings.autoScroll);
40910
40961
  }
40911
40962
  if (initialSettings?.autoTurn) {
40912
40963
  settings.autoTurn = initialSettings.autoTurn;
40913
- import_loglevel9.default.log(settings.autoScroll);
40964
+ import_loglevel10.default.log(settings.autoScroll);
40914
40965
  }
40915
40966
  if (initialSettings?.volume) {
40916
40967
  settings.volume = initialSettings.volume;
40917
- import_loglevel9.default.log(settings.volume);
40968
+ import_loglevel10.default.log(settings.volume);
40918
40969
  }
40919
40970
  if (initialSettings?.rate) {
40920
40971
  settings.rate = initialSettings.rate;
40921
- import_loglevel9.default.log(settings.rate);
40972
+ import_loglevel10.default.log(settings.rate);
40922
40973
  }
40923
40974
  if (initialSettings?.wait) {
40924
40975
  settings.wait = initialSettings.wait;
40925
- import_loglevel9.default.log(settings.wait);
40976
+ import_loglevel10.default.log(settings.wait);
40926
40977
  }
40927
40978
  }
40928
40979
  settings.initializeSelections();
40929
40980
  return settings;
40930
40981
  }
40931
40982
  stop() {
40932
- import_loglevel9.default.log("MediaOverlay settings stop");
40983
+ import_loglevel10.default.log("MediaOverlay settings stop");
40933
40984
  }
40934
40985
  initialise() {
40935
40986
  this.autoScroll = this.getProperty(MEDIAOVERLAYREFS.AUTO_SCROLL_KEY) != null ? this.getProperty(MEDIAOVERLAYREFS.AUTO_SCROLL_KEY).value : this.autoScroll;
@@ -40995,7 +41046,7 @@ var MediaOverlaySettings = class {
40995
41046
  this.applyMediaOverlaySettings(syncSettings);
40996
41047
  if (this.api?.updateSettings) {
40997
41048
  this.api?.updateSettings(syncSettings).then(async (settings) => {
40998
- import_loglevel9.default.log("api updated sync settings", settings);
41049
+ import_loglevel10.default.log("api updated sync settings", settings);
40999
41050
  });
41000
41051
  }
41001
41052
  }
@@ -41050,7 +41101,7 @@ var MediaOverlaySettings = class {
41050
41101
  this.settingsChangeCallback();
41051
41102
  }
41052
41103
  if (mediaOverlaySettings.autoScroll !== void 0) {
41053
- import_loglevel9.default.log("autoScroll " + this.autoScroll);
41104
+ import_loglevel10.default.log("autoScroll " + this.autoScroll);
41054
41105
  this.autoScroll = mediaOverlaySettings.autoScroll;
41055
41106
  let prop = this.userProperties.getByRef(MEDIAOVERLAYREFS.AUTO_SCROLL_REF);
41056
41107
  if (prop) {
@@ -41060,7 +41111,7 @@ var MediaOverlaySettings = class {
41060
41111
  this.settingsChangeCallback();
41061
41112
  }
41062
41113
  if (mediaOverlaySettings.autoTurn !== void 0) {
41063
- import_loglevel9.default.log("autoTurn " + this.autoTurn);
41114
+ import_loglevel10.default.log("autoTurn " + this.autoTurn);
41064
41115
  this.autoTurn = mediaOverlaySettings.autoTurn;
41065
41116
  let prop = this.userProperties.getByRef(MEDIAOVERLAYREFS.AUTO_TURN_REF);
41066
41117
  if (prop) {
@@ -41070,7 +41121,7 @@ var MediaOverlaySettings = class {
41070
41121
  this.settingsChangeCallback();
41071
41122
  }
41072
41123
  if (mediaOverlaySettings.volume) {
41073
- import_loglevel9.default.log("volume " + this.volume);
41124
+ import_loglevel10.default.log("volume " + this.volume);
41074
41125
  this.volume = mediaOverlaySettings.volume;
41075
41126
  let prop = this.userProperties.getByRef(MEDIAOVERLAYREFS.VOLUME_REF);
41076
41127
  if (prop) {
@@ -41080,7 +41131,7 @@ var MediaOverlaySettings = class {
41080
41131
  this.settingsChangeCallback();
41081
41132
  }
41082
41133
  if (mediaOverlaySettings.rate) {
41083
- import_loglevel9.default.log("rate " + this.rate);
41134
+ import_loglevel10.default.log("rate " + this.rate);
41084
41135
  this.rate = mediaOverlaySettings.rate;
41085
41136
  let prop = this.userProperties.getByRef(MEDIAOVERLAYREFS.RATE_REF);
41086
41137
  if (prop) {
@@ -41158,7 +41209,7 @@ var MediaOverlaySettings = class {
41158
41209
  };
41159
41210
 
41160
41211
  // src/modules/mediaoverlays/MediaOverlayModule.ts
41161
- var import_loglevel10 = __toModule(require_loglevel());
41212
+ var import_loglevel11 = __toModule(require_loglevel());
41162
41213
  var MediaOverlayModule = class {
41163
41214
  constructor(delegate, publication, settings, properties) {
41164
41215
  this.play = findElement(document, "#menu-button-play");
@@ -41167,7 +41218,7 @@ var MediaOverlayModule = class {
41167
41218
  this.pid = void 0;
41168
41219
  this.__ontimeupdate = false;
41169
41220
  this.ontimeupdate = async (_v) => {
41170
- import_loglevel10.default.log("ontimeupdate");
41221
+ import_loglevel11.default.log("ontimeupdate");
41171
41222
  this.trackCurrentTime();
41172
41223
  };
41173
41224
  this.ensureOnTimeUpdate = (remove, replace) => {
@@ -41202,11 +41253,11 @@ var MediaOverlayModule = class {
41202
41253
  return mediaOverlay;
41203
41254
  }
41204
41255
  stop() {
41205
- import_loglevel10.default.log("MediaOverlay module stop");
41256
+ import_loglevel11.default.log("MediaOverlay module stop");
41206
41257
  }
41207
41258
  start() {
41208
41259
  this.delegate.mediaOverlayModule = this;
41209
- import_loglevel10.default.log("MediaOverlay module start");
41260
+ import_loglevel11.default.log("MediaOverlay module start");
41210
41261
  }
41211
41262
  async initialize() {
41212
41263
  return new Promise(async (resolve) => {
@@ -41239,7 +41290,7 @@ var MediaOverlayModule = class {
41239
41290
  return;
41240
41291
  }
41241
41292
  if (!response.ok) {
41242
- import_loglevel10.default.log("BAD RESPONSE?!");
41293
+ import_loglevel11.default.log("BAD RESPONSE?!");
41243
41294
  }
41244
41295
  let moJson;
41245
41296
  try {
@@ -41248,7 +41299,7 @@ var MediaOverlayModule = class {
41248
41299
  console.error(e);
41249
41300
  }
41250
41301
  if (!moJson) {
41251
- import_loglevel10.default.log("## moJson" + moJson);
41302
+ import_loglevel11.default.log("## moJson" + moJson);
41252
41303
  return;
41253
41304
  }
41254
41305
  link.MediaOverlays = TaJsonDeserialize(moJson, import_media_overlay.MediaOverlayNode);
@@ -41334,7 +41385,7 @@ var MediaOverlayModule = class {
41334
41385
  }
41335
41386
  }
41336
41387
  findDepthFirstTextAudioPair(textHref, mo, textFragmentIDChain) {
41337
- import_loglevel10.default.log("findDepthFirstTextAudioPair()");
41388
+ import_loglevel11.default.log("findDepthFirstTextAudioPair()");
41338
41389
  let isTextUrlMatch;
41339
41390
  let isFragmentIDMatch;
41340
41391
  if (mo.Text) {
@@ -41355,16 +41406,16 @@ var MediaOverlayModule = class {
41355
41406
  isTextUrlMatch = false;
41356
41407
  }
41357
41408
  }
41358
- import_loglevel10.default.log("isFragmentIDMatch: " + isFragmentIDMatch);
41359
- import_loglevel10.default.log("isTextUrlMatch: " + isTextUrlMatch);
41409
+ import_loglevel11.default.log("isFragmentIDMatch: " + isFragmentIDMatch);
41410
+ import_loglevel11.default.log("isTextUrlMatch: " + isTextUrlMatch);
41360
41411
  if (!mo.Children || !mo.Children.length) {
41361
- import_loglevel10.default.log("findDepthFirstTextAudioPair() - leaf text/audio pair");
41412
+ import_loglevel11.default.log("findDepthFirstTextAudioPair() - leaf text/audio pair");
41362
41413
  if (!isTextUrlMatch) {
41363
- import_loglevel10.default.log("findDepthFirstTextAudioPair() - leaf - !isTextUrlMatch");
41414
+ import_loglevel11.default.log("findDepthFirstTextAudioPair() - leaf - !isTextUrlMatch");
41364
41415
  return void 0;
41365
41416
  }
41366
41417
  if (isFragmentIDMatch || isTextUrlMatch && !textFragmentIDChain) {
41367
- import_loglevel10.default.log("findDepthFirstTextAudioPair() - leaf - isFragmentIDMatch || (isTextUrlMatch && !textFragmentIDChain");
41418
+ import_loglevel11.default.log("findDepthFirstTextAudioPair() - leaf - isFragmentIDMatch || (isTextUrlMatch && !textFragmentIDChain");
41368
41419
  return mo;
41369
41420
  }
41370
41421
  return void 0;
@@ -41372,25 +41423,25 @@ var MediaOverlayModule = class {
41372
41423
  const textFragmentIDChainOriginal = textFragmentIDChain;
41373
41424
  let frags = textFragmentIDChain;
41374
41425
  for (const child of mo.Children) {
41375
- import_loglevel10.default.log("findDepthFirstTextAudioPair() - child");
41376
- import_loglevel10.default.log(JSON.stringify(child));
41426
+ import_loglevel11.default.log("findDepthFirstTextAudioPair() - child");
41427
+ import_loglevel11.default.log(JSON.stringify(child));
41377
41428
  const match = this.findDepthFirstTextAudioPair(textHref, child, frags);
41378
41429
  if (match === null) {
41379
- import_loglevel10.default.log("findDepthFirstTextAudioPair() - child - match null (skip)");
41430
+ import_loglevel11.default.log("findDepthFirstTextAudioPair() - child - match null (skip)");
41380
41431
  frags = void 0;
41381
41432
  }
41382
41433
  if (match) {
41383
- import_loglevel10.default.log("findDepthFirstTextAudioPair() - child - match");
41384
- import_loglevel10.default.log(JSON.stringify(match));
41434
+ import_loglevel11.default.log("findDepthFirstTextAudioPair() - child - match");
41435
+ import_loglevel11.default.log(JSON.stringify(match));
41385
41436
  return match;
41386
41437
  }
41387
41438
  }
41388
41439
  if (isFragmentIDMatch) {
41389
- import_loglevel10.default.log("findDepthFirstTextAudioPair() - post isFragmentIDMatch");
41440
+ import_loglevel11.default.log("findDepthFirstTextAudioPair() - post isFragmentIDMatch");
41390
41441
  const match = this.findDepthFirstTextAudioPair(textHref, mo, void 0);
41391
41442
  if (match) {
41392
- import_loglevel10.default.log("findDepthFirstTextAudioPair() - post isFragmentIDMatch - match");
41393
- import_loglevel10.default.log(JSON.stringify(match));
41443
+ import_loglevel11.default.log("findDepthFirstTextAudioPair() - post isFragmentIDMatch - match");
41444
+ import_loglevel11.default.log(JSON.stringify(match));
41394
41445
  return match;
41395
41446
  } else {
41396
41447
  return match;
@@ -41406,7 +41457,7 @@ var MediaOverlayModule = class {
41406
41457
  if (this.mediaOverlayTextAudioPair) {
41407
41458
  try {
41408
41459
  if (this.currentAudioEnd && this.audioElement.currentTime >= this.currentAudioEnd - 0.05) {
41409
- import_loglevel10.default.log("ontimeupdate - mediaOverlaysNext()");
41460
+ import_loglevel11.default.log("ontimeupdate - mediaOverlaysNext()");
41410
41461
  this.mediaOverlaysNext();
41411
41462
  }
41412
41463
  const match_i = this.mediaOverlayTextAudioPair.Text.lastIndexOf("#");
@@ -41418,11 +41469,11 @@ var MediaOverlayModule = class {
41418
41469
  }
41419
41470
  }
41420
41471
  mediaOverlaysNext(escape2) {
41421
- import_loglevel10.default.log("mediaOverlaysNext()");
41472
+ import_loglevel11.default.log("mediaOverlaysNext()");
41422
41473
  if (this.mediaOverlayRoot && this.mediaOverlayTextAudioPair) {
41423
41474
  const nextTextAudioPair = this.findNextTextAudioPair(this.mediaOverlayRoot, this.mediaOverlayTextAudioPair, { prev: void 0 }, escape2 ? true : false);
41424
41475
  if (!nextTextAudioPair) {
41425
- import_loglevel10.default.log("mediaOverlaysNext() - navLeftOrRight()");
41476
+ import_loglevel11.default.log("mediaOverlaysNext() - navLeftOrRight()");
41426
41477
  this.mediaOverlaysStop();
41427
41478
  if (this.currentLinks.length > 1 && this.currentLinkIndex === 0) {
41428
41479
  this.currentLinkIndex++;
@@ -41442,21 +41493,21 @@ var MediaOverlayModule = class {
41442
41493
  const hrefUrlObj1 = new URL("https://dita.digital/" + this.mediaOverlayTextAudioPair.Text);
41443
41494
  const hrefUrlObj2 = new URL("https://dita.digital/" + nextTextAudioPair.Text);
41444
41495
  if (hrefUrlObj1.pathname !== hrefUrlObj2.pathname) {
41445
- import_loglevel10.default.log("mediaOverlaysNext() SWITCH! " + hrefUrlObj1.pathname + " != " + hrefUrlObj2.pathname);
41496
+ import_loglevel11.default.log("mediaOverlaysNext() SWITCH! " + hrefUrlObj1.pathname + " != " + hrefUrlObj2.pathname);
41446
41497
  switchDoc = true;
41447
41498
  }
41448
41499
  }
41449
41500
  if (switchDoc) {
41450
41501
  this.mediaOverlaysStop();
41451
41502
  } else {
41452
- import_loglevel10.default.log("mediaOverlaysNext() - playMediaOverlaysAudio()");
41503
+ import_loglevel11.default.log("mediaOverlaysNext() - playMediaOverlaysAudio()");
41453
41504
  setTimeout(async () => {
41454
41505
  await this.playMediaOverlaysAudio(nextTextAudioPair, void 0, void 0);
41455
41506
  }, 0);
41456
41507
  }
41457
41508
  }
41458
41509
  } else {
41459
- import_loglevel10.default.log("mediaOverlaysNext() - navLeftOrRight() 2");
41510
+ import_loglevel11.default.log("mediaOverlaysNext() - navLeftOrRight() 2");
41460
41511
  this.mediaOverlaysStop();
41461
41512
  if (this.currentLinks.length > 1 && this.currentLinkIndex === 0) {
41462
41513
  this.currentLinkIndex++;
@@ -41473,13 +41524,13 @@ var MediaOverlayModule = class {
41473
41524
  }
41474
41525
  }
41475
41526
  mediaOverlaysStop() {
41476
- import_loglevel10.default.log("mediaOverlaysStop()");
41527
+ import_loglevel11.default.log("mediaOverlaysStop()");
41477
41528
  this.mediaOverlaysPause();
41478
41529
  this.mediaOverlayRoot = void 0;
41479
41530
  this.mediaOverlayTextAudioPair = void 0;
41480
41531
  }
41481
41532
  mediaOverlaysPause() {
41482
- import_loglevel10.default.log("mediaOverlaysPause()");
41533
+ import_loglevel11.default.log("mediaOverlaysPause()");
41483
41534
  this.mediaOverlayHighlight(void 0);
41484
41535
  if (this.audioElement) {
41485
41536
  this.audioElement.pause();
@@ -41488,28 +41539,28 @@ var MediaOverlayModule = class {
41488
41539
  findNextTextAudioPair(mo, moToMatch, previousMo, escape2) {
41489
41540
  if (!mo.Children || !mo.Children.length) {
41490
41541
  if (previousMo?.prev === moToMatch) {
41491
- import_loglevel10.default.log("findNextTextAudioPair() - prevMo === moToMatch");
41542
+ import_loglevel11.default.log("findNextTextAudioPair() - prevMo === moToMatch");
41492
41543
  return mo;
41493
41544
  }
41494
- import_loglevel10.default.log("findNextTextAudioPair() - set previous");
41495
- import_loglevel10.default.log(JSON.stringify(mo));
41545
+ import_loglevel11.default.log("findNextTextAudioPair() - set previous");
41546
+ import_loglevel11.default.log(JSON.stringify(mo));
41496
41547
  previousMo.prev = mo;
41497
41548
  return void 0;
41498
41549
  }
41499
41550
  for (const child of mo.Children) {
41500
- import_loglevel10.default.log("findNextTextAudioPair() - child");
41501
- import_loglevel10.default.log(JSON.stringify(child));
41551
+ import_loglevel11.default.log("findNextTextAudioPair() - child");
41552
+ import_loglevel11.default.log(JSON.stringify(child));
41502
41553
  const match = this.findNextTextAudioPair(child, moToMatch, previousMo, escape2);
41503
41554
  if (match) {
41504
- import_loglevel10.default.log("findNextTextAudioPair() - match");
41505
- import_loglevel10.default.log(JSON.stringify(match));
41555
+ import_loglevel11.default.log("findNextTextAudioPair() - match");
41556
+ import_loglevel11.default.log(JSON.stringify(match));
41506
41557
  return match;
41507
41558
  }
41508
41559
  }
41509
41560
  return void 0;
41510
41561
  }
41511
41562
  async playMediaOverlaysAudio(moTextAudioPair, begin, end) {
41512
- import_loglevel10.default.log("playMediaOverlaysAudio()");
41563
+ import_loglevel11.default.log("playMediaOverlaysAudio()");
41513
41564
  this.mediaOverlayTextAudioPair = moTextAudioPair;
41514
41565
  if (!moTextAudioPair.Audio) {
41515
41566
  return;
@@ -41533,14 +41584,14 @@ var MediaOverlayModule = class {
41533
41584
  try {
41534
41585
  this.currentAudioBegin = parseFloat(b);
41535
41586
  } catch (err) {
41536
- import_loglevel10.default.error(err);
41587
+ import_loglevel11.default.error(err);
41537
41588
  }
41538
41589
  if (matches.length >= 3) {
41539
41590
  const e = matches[3];
41540
41591
  try {
41541
41592
  this.currentAudioEnd = parseFloat(e);
41542
41593
  } catch (err) {
41543
- import_loglevel10.default.error(err);
41594
+ import_loglevel11.default.error(err);
41544
41595
  }
41545
41596
  }
41546
41597
  }
@@ -41549,7 +41600,7 @@ var MediaOverlayModule = class {
41549
41600
  this.currentAudioBegin = begin;
41550
41601
  this.currentAudioEnd = end;
41551
41602
  }
41552
- import_loglevel10.default.log(`${urlFull} => [${this.currentAudioBegin}-${this.currentAudioEnd}]`);
41603
+ import_loglevel11.default.log(`${urlFull} => [${this.currentAudioBegin}-${this.currentAudioEnd}]`);
41553
41604
  const playClip = async (initial) => {
41554
41605
  if (!this.audioElement) {
41555
41606
  return;
@@ -41557,7 +41608,7 @@ var MediaOverlayModule = class {
41557
41608
  const timeToSeekTo = this.currentAudioBegin ? this.currentAudioBegin : 0;
41558
41609
  if (initial || this.audioElement.paused) {
41559
41610
  if (initial && !timeToSeekTo || this.audioElement.currentTime === timeToSeekTo) {
41560
- import_loglevel10.default.log("playMediaOverlaysAudio() - playClip() - _currentAudioElement.play()");
41611
+ import_loglevel11.default.log("playMediaOverlaysAudio() - playClip() - _currentAudioElement.play()");
41561
41612
  this.ensureOnTimeUpdate(false, false);
41562
41613
  this.audioElement.playbackRate = this.settings.rate;
41563
41614
  this.audioElement.volume = this.settings.volume;
@@ -41576,10 +41627,10 @@ var MediaOverlayModule = class {
41576
41627
  checkReady();
41577
41628
  }
41578
41629
  } else {
41579
- import_loglevel10.default.log("playMediaOverlaysAudio() - playClip() - ontimeupdateSeeked");
41630
+ import_loglevel11.default.log("playMediaOverlaysAudio() - playClip() - ontimeupdateSeeked");
41580
41631
  const ontimeupdateSeeked = async (_ev) => {
41581
41632
  this.audioElement.removeEventListener("timeupdate", ontimeupdateSeeked);
41582
- import_loglevel10.default.log("playMediaOverlaysAudio() - playClip() - ontimeupdateSeeked - .play()");
41633
+ import_loglevel11.default.log("playMediaOverlaysAudio() - playClip() - ontimeupdateSeeked - .play()");
41583
41634
  this.ensureOnTimeUpdate(false, false);
41584
41635
  if (this.audioElement) {
41585
41636
  this.audioElement.playbackRate = this.settings.rate;
@@ -41607,9 +41658,9 @@ var MediaOverlayModule = class {
41607
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;
41608
41659
  this.ensureOnTimeUpdate(false, false);
41609
41660
  if (contiguous) {
41610
- import_loglevel10.default.log("playMediaOverlaysAudio() - playClip() - ensureOnTimeUpdate");
41661
+ import_loglevel11.default.log("playMediaOverlaysAudio() - playClip() - ensureOnTimeUpdate");
41611
41662
  } else {
41612
- import_loglevel10.default.log("playMediaOverlaysAudio() - playClip() - currentTime = timeToSeekTo");
41663
+ import_loglevel11.default.log("playMediaOverlaysAudio() - playClip() - currentTime = timeToSeekTo");
41613
41664
  this.audioElement.currentTime = timeToSeekTo;
41614
41665
  }
41615
41666
  }
@@ -41617,7 +41668,7 @@ var MediaOverlayModule = class {
41617
41668
  this.previousAudioUrl = this.currentAudioUrl;
41618
41669
  if (!this.currentAudioUrl || urlNoQuery !== this.currentAudioUrl) {
41619
41670
  this.currentAudioUrl = urlNoQuery;
41620
- import_loglevel10.default.log("playMediaOverlaysAudio() - RESET: " + this.previousAudioUrl + " => " + this.currentAudioUrl);
41671
+ import_loglevel11.default.log("playMediaOverlaysAudio() - RESET: " + this.previousAudioUrl + " => " + this.currentAudioUrl);
41621
41672
  this.audioElement = document.getElementById("AUDIO_MO_ID");
41622
41673
  if (this.audioElement) {
41623
41674
  this.audioElement.pause();
@@ -41634,21 +41685,21 @@ var MediaOverlayModule = class {
41634
41685
  this.audioElement.playbackRate = this.settings.rate;
41635
41686
  document.body.appendChild(this.audioElement);
41636
41687
  this.audioElement.addEventListener("error", (ev) => {
41637
- 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("/")));
41638
41689
  if (this.audioElement && this.audioElement.error) {
41639
- import_loglevel10.default.log(this.audioElement.error.code);
41640
- 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);
41641
41692
  }
41642
41693
  });
41643
41694
  const oncanplaythrough = async (ev) => {
41644
41695
  const currentAudioElement = ev.currentTarget;
41645
41696
  currentAudioElement.removeEventListener("canplaythrough", oncanplaythrough);
41646
- import_loglevel10.default.log("oncanplaythrough");
41697
+ import_loglevel11.default.log("oncanplaythrough");
41647
41698
  await playClip(true);
41648
41699
  };
41649
41700
  this.audioElement.addEventListener("canplaythrough", oncanplaythrough);
41650
41701
  const onended = async (_ev) => {
41651
- import_loglevel10.default.log("onended");
41702
+ import_loglevel11.default.log("onended");
41652
41703
  if (this.currentLinks.length > 1 && this.currentLinkIndex === 0) {
41653
41704
  this.currentLinkIndex++;
41654
41705
  await this.playLink();
@@ -41665,35 +41716,35 @@ var MediaOverlayModule = class {
41665
41716
  this.audioElement.playbackRate = this.settings.rate;
41666
41717
  this.audioElement.setAttribute("src", this.currentAudioUrl);
41667
41718
  } else {
41668
- import_loglevel10.default.log("playMediaOverlaysAudio() - playClip()");
41719
+ import_loglevel11.default.log("playMediaOverlaysAudio() - playClip()");
41669
41720
  await playClip(false);
41670
41721
  }
41671
41722
  }
41672
41723
  async playMediaOverlays(textHref, rootMo, textFragmentIDChain) {
41673
- import_loglevel10.default.log("playMediaOverlays()");
41724
+ import_loglevel11.default.log("playMediaOverlays()");
41674
41725
  let textFragmentIDChain_ = textFragmentIDChain ? textFragmentIDChain.filter((id2) => id2) : void 0;
41675
41726
  if (textFragmentIDChain_ && textFragmentIDChain_.length === 0) {
41676
41727
  textFragmentIDChain_ = void 0;
41677
41728
  }
41678
41729
  let moTextAudioPair = this.findDepthFirstTextAudioPair(textHref, rootMo, textFragmentIDChain_);
41679
41730
  if (!moTextAudioPair && textFragmentIDChain_) {
41680
- import_loglevel10.default.log("playMediaOverlays() - findDepthFirstTextAudioPair() SECOND CHANCE ");
41681
- import_loglevel10.default.log(JSON.stringify(textFragmentIDChain_, null, 4));
41682
- 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));
41683
41734
  moTextAudioPair = this.findDepthFirstTextAudioPair(textHref, rootMo, void 0);
41684
41735
  }
41685
41736
  if (moTextAudioPair) {
41686
41737
  if (moTextAudioPair.Audio) {
41687
- import_loglevel10.default.log("playMediaOverlays() - playMediaOverlaysAudio()");
41738
+ import_loglevel11.default.log("playMediaOverlays() - playMediaOverlaysAudio()");
41688
41739
  this.mediaOverlayRoot = rootMo;
41689
41740
  await this.playMediaOverlaysAudio(moTextAudioPair, void 0, void 0);
41690
41741
  }
41691
41742
  } else {
41692
- import_loglevel10.default.log("playMediaOverlays() - !moTextAudioPair " + textHref);
41743
+ import_loglevel11.default.log("playMediaOverlays() - !moTextAudioPair " + textHref);
41693
41744
  }
41694
41745
  }
41695
41746
  mediaOverlayHighlight(id2) {
41696
- import_loglevel10.default.log("moHighlight: ## " + id2);
41747
+ import_loglevel11.default.log("moHighlight: ## " + id2);
41697
41748
  let classActive = this.publication.Metadata?.MediaOverlay?.ActiveClass;
41698
41749
  if (!classActive) {
41699
41750
  classActive = this.settings.color;
@@ -41738,7 +41789,7 @@ var MediaOverlayModule = class {
41738
41789
 
41739
41790
  // src/modules/positions/TimelineModule.ts
41740
41791
  init_polyfills();
41741
- var import_loglevel11 = __toModule(require_loglevel());
41792
+ var import_loglevel12 = __toModule(require_loglevel());
41742
41793
  var TimelineModule = class {
41743
41794
  static async create(config2) {
41744
41795
  const timeline = new this(config2.delegate, config2.publication);
@@ -41750,7 +41801,7 @@ var TimelineModule = class {
41750
41801
  this.publication = publication;
41751
41802
  }
41752
41803
  async stop() {
41753
- import_loglevel11.default.log("Timeline module stop");
41804
+ import_loglevel12.default.log("Timeline module stop");
41754
41805
  }
41755
41806
  async start() {
41756
41807
  this.delegate.timelineModule = this;
@@ -41819,7 +41870,7 @@ var TimelineModule = class {
41819
41870
  title: link.Title
41820
41871
  };
41821
41872
  }
41822
- import_loglevel11.default.log(position);
41873
+ import_loglevel12.default.log(position);
41823
41874
  this.delegate.navigate(position);
41824
41875
  });
41825
41876
  if (tocHrefAbs === this.delegate.currentChapterLink.href) {
@@ -41842,19 +41893,19 @@ var import_debounce3 = __toModule(require_debounce());
41842
41893
 
41843
41894
  // src/utils/index.ts
41844
41895
  init_polyfills();
41845
- var import_loglevel12 = __toModule(require_loglevel());
41896
+ var import_loglevel13 = __toModule(require_loglevel());
41846
41897
  function delay(t, v) {
41847
41898
  return new Promise(function(resolve) {
41848
41899
  setTimeout(resolve.bind(null, v), t);
41849
41900
  });
41850
41901
  }
41851
41902
  var IS_DEV = false;
41852
- import_loglevel12.default.setLevel(IS_DEV ? "trace" : "warn", true);
41903
+ import_loglevel13.default.setLevel(IS_DEV ? "trace" : "warn", true);
41853
41904
 
41854
41905
  // src/modules/protection/ContentProtectionModule.ts
41855
41906
  var import_browserslist_useragent_regexp = __toModule(require_lib7());
41856
41907
  var import_devtools_detector = __toModule(require_devtools_detector());
41857
- var import_loglevel13 = __toModule(require_loglevel());
41908
+ var import_loglevel14 = __toModule(require_loglevel());
41858
41909
  var ContentProtectionModule = class {
41859
41910
  constructor(delegate, properties) {
41860
41911
  this.hasEventListener = false;
@@ -41916,14 +41967,14 @@ var ContentProtectionModule = class {
41916
41967
  var self2 = this;
41917
41968
  this.mutationObserver = new MutationObserver(function(mutations) {
41918
41969
  mutations.forEach(function(mutation) {
41919
- import_loglevel13.default.log(mutation.type);
41970
+ import_loglevel14.default.log(mutation.type);
41920
41971
  self2.isHacked = true;
41921
41972
  });
41922
41973
  });
41923
41974
  }
41924
41975
  }
41925
41976
  async stop() {
41926
- import_loglevel13.default.log("Protection module stop");
41977
+ import_loglevel14.default.log("Protection module stop");
41927
41978
  this.mutationObserver.disconnect();
41928
41979
  if (this.properties?.disableKeys) {
41929
41980
  removeEventListenerOptional(this.delegate.mainElement, "keydown", this.disableSave);
@@ -42233,7 +42284,7 @@ var ContentProtectionModule = class {
42233
42284
  return true;
42234
42285
  }
42235
42286
  preventCopy(event) {
42236
- import_loglevel13.default.log("copy action initiated");
42287
+ import_loglevel14.default.log("copy action initiated");
42237
42288
  event.clipboardData.setData("text/plain", "copy not allowed");
42238
42289
  event.stopPropagation();
42239
42290
  event.preventDefault();
@@ -42251,7 +42302,7 @@ var ContentProtectionModule = class {
42251
42302
  if (this.citation) {
42252
42303
  return;
42253
42304
  }
42254
- import_loglevel13.default.log("copy action initiated");
42305
+ import_loglevel14.default.log("copy action initiated");
42255
42306
  let win = this.delegate.iframes[0].contentWindow;
42256
42307
  if (win) {
42257
42308
  let getCssSelector = function(element) {
@@ -42355,7 +42406,7 @@ var ContentProtectionModule = class {
42355
42406
  selection?.addRange(rangeToSelect);
42356
42407
  }
42357
42408
  beforePrint(event) {
42358
- import_loglevel13.default.log("before print");
42409
+ import_loglevel14.default.log("before print");
42359
42410
  if (this.delegate && this.delegate.headerMenu) {
42360
42411
  this.delegate.headerMenu.style.display = "none";
42361
42412
  this.delegate.mainElement.style.display = "none";
@@ -42365,7 +42416,7 @@ var ContentProtectionModule = class {
42365
42416
  return false;
42366
42417
  }
42367
42418
  afterPrint(event) {
42368
- import_loglevel13.default.log("after print");
42419
+ import_loglevel14.default.log("after print");
42369
42420
  if (this.delegate && this.delegate.headerMenu) {
42370
42421
  this.delegate.headerMenu.style.removeProperty("display");
42371
42422
  this.delegate.mainElement.style.removeProperty("display");
@@ -42455,12 +42506,12 @@ var ContentProtectionModule = class {
42455
42506
  rect.width = width;
42456
42507
  rect.left = left;
42457
42508
  } catch (error) {
42458
- import_loglevel13.default.log("error " + error);
42459
- import_loglevel13.default.log(rect);
42460
- import_loglevel13.default.log(rect.node);
42461
- import_loglevel13.default.log("scrambledTextContent " + rect.scrambledTextContent);
42462
- import_loglevel13.default.log("textContent " + rect.textContent);
42463
- 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);
42464
42515
  }
42465
42516
  });
42466
42517
  }
@@ -42516,14 +42567,14 @@ var ContentProtectionModule = class {
42516
42567
  range.detach();
42517
42568
  return rect;
42518
42569
  } catch (error) {
42519
- import_loglevel13.default.log("measureTextNode " + error);
42520
- import_loglevel13.default.log("measureTextNode " + node);
42521
- 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);
42522
42573
  }
42523
42574
  }
42524
42575
  isBeingHacked(element) {
42525
42576
  if (element.style.animation || element.style.transition || element.style.position || element.hasAttribute("style")) {
42526
- import_loglevel13.default.log("content being hacked");
42577
+ import_loglevel14.default.log("content being hacked");
42527
42578
  return true;
42528
42579
  }
42529
42580
  return false;
@@ -42687,7 +42738,7 @@ async function searchDocDomSeek(searchInput, doc, href, title, fullWordSearch =
42687
42738
  }
42688
42739
 
42689
42740
  // src/modules/search/SearchModule.ts
42690
- var import_loglevel14 = __toModule(require_loglevel());
42741
+ var import_loglevel15 = __toModule(require_loglevel());
42691
42742
  var SearchModule = class {
42692
42743
  constructor(delegate, publication, properties, highlighter, api, headerMenu) {
42693
42744
  this.currentChapterSearchResult = [];
@@ -42706,7 +42757,7 @@ var SearchModule = class {
42706
42757
  return search;
42707
42758
  }
42708
42759
  async stop() {
42709
- import_loglevel14.default.log("Search module stop");
42760
+ import_loglevel15.default.log("Search module stop");
42710
42761
  removeEventListenerOptional(this.searchInput, "keypress", this.handleSearch.bind(this));
42711
42762
  removeEventListenerOptional(this.searchGo, "click", this.handleSearch.bind(this));
42712
42763
  }
@@ -43262,7 +43313,7 @@ var SearchModule = class {
43262
43313
 
43263
43314
  // src/modules/TTS/TTSSettings.ts
43264
43315
  init_polyfills();
43265
- var import_loglevel15 = __toModule(require_loglevel());
43316
+ var import_loglevel16 = __toModule(require_loglevel());
43266
43317
  var _TTSREFS = class {
43267
43318
  };
43268
43319
  var TTSREFS = _TTSREFS;
@@ -43304,34 +43355,34 @@ var TTSSettings = class {
43304
43355
  let initialTTSSettings = config2.initialTTSSettings;
43305
43356
  if (initialTTSSettings?.rate) {
43306
43357
  settings.rate = initialTTSSettings.rate;
43307
- import_loglevel15.default.log(settings.rate);
43358
+ import_loglevel16.default.log(settings.rate);
43308
43359
  }
43309
43360
  if (initialTTSSettings?.pitch) {
43310
43361
  settings.pitch = initialTTSSettings.pitch;
43311
- import_loglevel15.default.log(settings.pitch);
43362
+ import_loglevel16.default.log(settings.pitch);
43312
43363
  }
43313
43364
  if (initialTTSSettings?.volume) {
43314
43365
  settings.volume = initialTTSSettings.volume;
43315
- import_loglevel15.default.log(settings.volume);
43366
+ import_loglevel16.default.log(settings.volume);
43316
43367
  }
43317
43368
  if (initialTTSSettings?.color) {
43318
43369
  settings.color = initialTTSSettings.color;
43319
- import_loglevel15.default.log(settings.color);
43370
+ import_loglevel16.default.log(settings.color);
43320
43371
  }
43321
43372
  if (initialTTSSettings?.autoScroll) {
43322
43373
  settings.autoScroll = initialTTSSettings.autoScroll;
43323
- import_loglevel15.default.log(settings.autoScroll);
43374
+ import_loglevel16.default.log(settings.autoScroll);
43324
43375
  }
43325
43376
  if (initialTTSSettings?.voice) {
43326
43377
  settings.voice = initialTTSSettings.voice;
43327
- import_loglevel15.default.log(settings.voice);
43378
+ import_loglevel16.default.log(settings.voice);
43328
43379
  }
43329
43380
  }
43330
43381
  settings.initializeSelections();
43331
43382
  return settings;
43332
43383
  }
43333
43384
  stop() {
43334
- import_loglevel15.default.log("tts settings stop");
43385
+ import_loglevel16.default.log("tts settings stop");
43335
43386
  }
43336
43387
  initialise() {
43337
43388
  this.autoScroll = this.getProperty(TTSREFS.AUTO_SCROLL_KEY) != null ? this.getProperty(TTSREFS.AUTO_SCROLL_KEY).value : this.autoScroll;
@@ -43404,7 +43455,7 @@ var TTSSettings = class {
43404
43455
  this.applyTTSSettings(ttsSettings);
43405
43456
  if (this.api?.updateSettings) {
43406
43457
  this.api?.updateSettings(ttsSettings).then(async (settings) => {
43407
- import_loglevel15.default.log("api updated tts settings", settings);
43458
+ import_loglevel16.default.log("api updated tts settings", settings);
43408
43459
  });
43409
43460
  }
43410
43461
  }
@@ -43452,7 +43503,7 @@ var TTSSettings = class {
43452
43503
  }
43453
43504
  applyTTSSettings(ttsSettings) {
43454
43505
  if (ttsSettings.rate) {
43455
- import_loglevel15.default.log("rate " + this.rate);
43506
+ import_loglevel16.default.log("rate " + this.rate);
43456
43507
  this.rate = ttsSettings.rate;
43457
43508
  let prop = this.userProperties.getByRef(TTSREFS.RATE_REF);
43458
43509
  if (prop) {
@@ -43463,7 +43514,7 @@ var TTSSettings = class {
43463
43514
  this.restartCallback();
43464
43515
  }
43465
43516
  if (ttsSettings.pitch) {
43466
- import_loglevel15.default.log("pitch " + this.pitch);
43517
+ import_loglevel16.default.log("pitch " + this.pitch);
43467
43518
  this.pitch = ttsSettings.pitch;
43468
43519
  let prop = this.userProperties.getByRef(TTSREFS.PITCH_REF);
43469
43520
  if (prop) {
@@ -43474,7 +43525,7 @@ var TTSSettings = class {
43474
43525
  this.restartCallback();
43475
43526
  }
43476
43527
  if (ttsSettings.volume) {
43477
- import_loglevel15.default.log("volume " + this.volume);
43528
+ import_loglevel16.default.log("volume " + this.volume);
43478
43529
  this.volume = ttsSettings.volume;
43479
43530
  let prop = this.userProperties.getByRef(TTSREFS.VOLUME_REF);
43480
43531
  if (prop) {
@@ -43494,7 +43545,7 @@ var TTSSettings = class {
43494
43545
  this.settingsChangeCallback();
43495
43546
  }
43496
43547
  if (ttsSettings.autoScroll !== void 0) {
43497
- import_loglevel15.default.log("autoScroll " + this.autoScroll);
43548
+ import_loglevel16.default.log("autoScroll " + this.autoScroll);
43498
43549
  this.autoScroll = ttsSettings.autoScroll;
43499
43550
  let prop = this.userProperties.getByRef(TTSREFS.AUTO_SCROLL_REF);
43500
43551
  if (prop) {
@@ -43504,7 +43555,7 @@ var TTSSettings = class {
43504
43555
  this.settingsChangeCallback();
43505
43556
  }
43506
43557
  if (ttsSettings.voice) {
43507
- import_loglevel15.default.log("voice " + this.voice);
43558
+ import_loglevel16.default.log("voice " + this.voice);
43508
43559
  this.voice = ttsSettings.voice;
43509
43560
  let prop = this.userProperties.getByRef(TTSREFS.VOICE_REF);
43510
43561
  if (prop) {
@@ -43840,7 +43891,7 @@ var SampleReadEventHandler = class {
43840
43891
 
43841
43892
  // src/navigator/IFrameNavigator.ts
43842
43893
  var import_eventemitter3 = __toModule(require_eventemitter3());
43843
- var import_loglevel16 = __toModule(require_loglevel());
43894
+ var import_loglevel17 = __toModule(require_loglevel());
43844
43895
  var IFrameNavigator = class extends import_eventemitter3.default {
43845
43896
  constructor(settings, annotator = void 0, initialLastReadingPosition = void 0, publication, api, rights, tts, injectables, attributes, services, sample, requestConfig) {
43846
43897
  super();
@@ -43876,8 +43927,8 @@ var IFrameNavigator = class extends import_eventemitter3.default {
43876
43927
  }
43877
43928
  if (lastReadingPosition) {
43878
43929
  const linkHref = this.publication.getAbsoluteHref(lastReadingPosition.href);
43879
- import_loglevel16.default.log(lastReadingPosition.href);
43880
- import_loglevel16.default.log(linkHref);
43930
+ import_loglevel17.default.log(lastReadingPosition.href);
43931
+ import_loglevel17.default.log(linkHref);
43881
43932
  lastReadingPosition.href = linkHref;
43882
43933
  await this.navigate(lastReadingPosition);
43883
43934
  }
@@ -43943,7 +43994,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
43943
43994
  return new Promise((resolve) => resolve(navigator2));
43944
43995
  }
43945
43996
  stop() {
43946
- import_loglevel16.default.log("Iframe navigator stop");
43997
+ import_loglevel17.default.log("Iframe navigator stop");
43947
43998
  removeEventListenerOptional(this.previousChapterAnchorElement, "click", this.handlePreviousChapterClick.bind(this));
43948
43999
  removeEventListenerOptional(this.nextChapterAnchorElement, "click", this.handleNextChapterClick.bind(this));
43949
44000
  removeEventListenerOptional(this.previousChapterTopAnchorElement, "click", this.handlePreviousPageClick.bind(this));
@@ -44151,7 +44202,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
44151
44202
  this.setupEvents();
44152
44203
  return await this.loadManifest();
44153
44204
  } catch (err) {
44154
- import_loglevel16.default.error(err);
44205
+ import_loglevel17.default.error(err);
44155
44206
  this.abortOnError(err);
44156
44207
  return Promise.reject(err);
44157
44208
  }
@@ -44445,8 +44496,8 @@ var IFrameNavigator = class extends import_eventemitter3.default {
44445
44496
  }
44446
44497
  if (lastReadingPosition) {
44447
44498
  const linkHref = this.publication.getAbsoluteHref(lastReadingPosition.href);
44448
- import_loglevel16.default.log(lastReadingPosition.href);
44449
- import_loglevel16.default.log(linkHref);
44499
+ import_loglevel17.default.log(lastReadingPosition.href);
44500
+ import_loglevel17.default.log(linkHref);
44450
44501
  lastReadingPosition.href = linkHref;
44451
44502
  await this.navigate(lastReadingPosition);
44452
44503
  } else if (startUrl) {
@@ -44462,7 +44513,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
44462
44513
  }
44463
44514
  return new Promise((resolve) => resolve());
44464
44515
  } catch (err) {
44465
- import_loglevel16.default.error(err);
44516
+ import_loglevel17.default.error(err);
44466
44517
  this.abortOnError(err);
44467
44518
  return new Promise((_, reject) => reject(err)).catch(() => {
44468
44519
  });
@@ -44644,7 +44695,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
44644
44695
  }, 200);
44645
44696
  return new Promise((resolve) => resolve());
44646
44697
  } catch (err) {
44647
- import_loglevel16.default.error(err);
44698
+ import_loglevel17.default.error(err);
44648
44699
  this.abortOnError(err);
44649
44700
  return Promise.reject(err);
44650
44701
  }
@@ -45188,8 +45239,8 @@ var IFrameNavigator = class extends import_eventemitter3.default {
45188
45239
  const position = __spreadValues({}, locator);
45189
45240
  position.locations = locations;
45190
45241
  const linkHref = this.publication.getAbsoluteHref(locator.href);
45191
- import_loglevel16.default.log(locator.href);
45192
- import_loglevel16.default.log(linkHref);
45242
+ import_loglevel17.default.log(locator.href);
45243
+ import_loglevel17.default.log(linkHref);
45193
45244
  position.href = linkHref;
45194
45245
  this.stopReadAloud();
45195
45246
  this.navigate(position);
@@ -45245,7 +45296,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
45245
45296
  snapToSelector(selector2) {
45246
45297
  const doc = this.iframes[0].contentDocument;
45247
45298
  if (doc) {
45248
- import_loglevel16.default.log(selector2);
45299
+ import_loglevel17.default.log(selector2);
45249
45300
  let result = doc.querySelectorAll(selector2);
45250
45301
  if (result.length > 0)
45251
45302
  this.view?.snap(result[0]);
@@ -45523,7 +45574,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
45523
45574
  title: previous.Title
45524
45575
  };
45525
45576
  this.stopReadAloud();
45526
- this.navigate(position);
45577
+ this.navigate(position, false);
45527
45578
  } else {
45528
45579
  if (this.previousChapterLink) {
45529
45580
  const position = {
@@ -45535,7 +45586,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
45535
45586
  title: this.previousChapterLink.title
45536
45587
  };
45537
45588
  this.stopReadAloud();
45538
- this.navigate(position);
45589
+ this.navigate(position, false);
45539
45590
  }
45540
45591
  }
45541
45592
  if (event) {
@@ -45559,7 +45610,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
45559
45610
  title: next.Title
45560
45611
  };
45561
45612
  this.stopReadAloud();
45562
- this.navigate(position);
45613
+ this.navigate(position, false);
45563
45614
  } else {
45564
45615
  if (this.nextChapterLink) {
45565
45616
  const position = {
@@ -45571,7 +45622,7 @@ var IFrameNavigator = class extends import_eventemitter3.default {
45571
45622
  title: this.nextChapterLink.title
45572
45623
  };
45573
45624
  this.stopReadAloud();
45574
- this.navigate(position);
45625
+ this.navigate(position, false);
45575
45626
  }
45576
45627
  }
45577
45628
  if (event) {
@@ -45599,6 +45650,12 @@ var IFrameNavigator = class extends import_eventemitter3.default {
45599
45650
  }
45600
45651
  }
45601
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
+ }
45602
45659
  if (this.historyModule) {
45603
45660
  this.historyModule.push(locator, history);
45604
45661
  }
@@ -45941,13 +45998,16 @@ var IFrameNavigator = class extends import_eventemitter3.default {
45941
45998
  }
45942
45999
  if (this.api?.updateCurrentLocation) {
45943
46000
  this.api?.updateCurrentLocation(position).then(async (_) => {
45944
- import_loglevel16.default.log("api updated current location", position);
46001
+ import_loglevel17.default.log("api updated current location", position);
45945
46002
  return this.annotator?.saveLastReadingPosition(position);
45946
46003
  });
45947
46004
  } else {
45948
- import_loglevel16.default.log("save last reading position", position);
46005
+ import_loglevel17.default.log("save last reading position", position);
45949
46006
  this.annotator.saveLastReadingPosition(position);
45950
46007
  }
46008
+ if (this.consumptionModule) {
46009
+ this.consumptionModule.continueProgress(position);
46010
+ }
45951
46011
  }
45952
46012
  }
45953
46013
  }
@@ -46463,7 +46523,7 @@ function convertAndCamel(o) {
46463
46523
 
46464
46524
  // src/modules/highlight/LayerSettings.ts
46465
46525
  init_polyfills();
46466
- var import_loglevel17 = __toModule(require_loglevel());
46526
+ var import_loglevel18 = __toModule(require_loglevel());
46467
46527
  var LayerSettings = class {
46468
46528
  constructor(store) {
46469
46529
  this.LAYERSETTINGS = "layerSetting";
@@ -46475,7 +46535,7 @@ var LayerSettings = class {
46475
46535
  return new Promise((resolve) => resolve(settings));
46476
46536
  }
46477
46537
  async stop() {
46478
- import_loglevel17.default.log("MediaOverlay settings stop");
46538
+ import_loglevel18.default.log("MediaOverlay settings stop");
46479
46539
  }
46480
46540
  async initialize() {
46481
46541
  this.userProperties = await this.getLayerSettings();
@@ -46519,7 +46579,7 @@ var LayerSettings = class {
46519
46579
 
46520
46580
  // src/modules/pagebreak/PageBreakModule.ts
46521
46581
  init_polyfills();
46522
- var import_loglevel18 = __toModule(require_loglevel());
46582
+ var import_loglevel19 = __toModule(require_loglevel());
46523
46583
  var PageBreakModule = class {
46524
46584
  static async create(config2) {
46525
46585
  const pageBreak = new this(config2.delegate, config2.publication, config2, config2.headerMenu);
@@ -46533,7 +46593,7 @@ var PageBreakModule = class {
46533
46593
  this.properties = properties;
46534
46594
  }
46535
46595
  async stop() {
46536
- import_loglevel18.default.log("Page Break module stop");
46596
+ import_loglevel19.default.log("Page Break module stop");
46537
46597
  }
46538
46598
  async start() {
46539
46599
  this.delegate.pageBreakModule = this;
@@ -46602,15 +46662,15 @@ var PageBreakModule = class {
46602
46662
  return "";
46603
46663
  }
46604
46664
  } catch (err) {
46605
- import_loglevel18.default.log("uniqueCssSelector:");
46606
- import_loglevel18.default.error(err);
46665
+ import_loglevel19.default.log("uniqueCssSelector:");
46666
+ import_loglevel19.default.error(err);
46607
46667
  return "";
46608
46668
  }
46609
46669
  }
46610
46670
  if (pageBreaks) {
46611
46671
  for (let i = 0; i < pageBreaks.length; i++) {
46612
46672
  let img = pageBreaks[i];
46613
- import_loglevel18.default.log(img);
46673
+ import_loglevel19.default.log(img);
46614
46674
  let title = img.innerHTML;
46615
46675
  let hide = false;
46616
46676
  if (img.innerHTML.length === 0) {
@@ -46683,7 +46743,7 @@ var PageBreakModule = class {
46683
46743
  init_polyfills();
46684
46744
  var import_sanitize_html2 = __toModule(require_sanitize_html());
46685
46745
  var import_debounce6 = __toModule(require_debounce());
46686
- var import_loglevel19 = __toModule(require_loglevel());
46746
+ var import_loglevel20 = __toModule(require_loglevel());
46687
46747
  var TTSModule2 = class {
46688
46748
  constructor(delegate, tts, rights, highlighter, properties, api, headerMenu) {
46689
46749
  this.voices = [];
@@ -46806,14 +46866,14 @@ var TTSModule2 = class {
46806
46866
  }
46807
46867
  let s = setSpeech();
46808
46868
  s.then(async (voices) => {
46809
- import_loglevel19.default.log(voices);
46869
+ import_loglevel20.default.log(voices);
46810
46870
  this.voices = [];
46811
46871
  voices.forEach((voice) => {
46812
46872
  if (voice.localService === true) {
46813
46873
  this.voices.push(voice);
46814
46874
  }
46815
46875
  });
46816
- import_loglevel19.default.log(this.voices);
46876
+ import_loglevel20.default.log(this.voices);
46817
46877
  if (first) {
46818
46878
  if (this.headerMenu) {
46819
46879
  var preferredLanguageSelector = findElement(this.headerMenu, "#preferred-languages");
@@ -46902,16 +46962,16 @@ var TTSModule2 = class {
46902
46962
  restOfTheText = restOfTheText.replace(textToBeSpoken, "").trim();
46903
46963
  }
46904
46964
  utterance = new SpeechSynthesisUtterance(textToBeSpoken);
46905
- import_loglevel19.default.log(selectionInfo);
46906
- import_loglevel19.default.log(textToBeSpoken, selectionInfo.range?.commonAncestorContainer.textContent);
46907
- import_loglevel19.default.log(ttsQueueItem);
46908
- import_loglevel19.default.log(ttsQueueItem.item.textNodes);
46909
- import_loglevel19.default.log(startIndex);
46910
- 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);
46911
46971
  let node = ttsQueueItem.item.textNodes.filter((node2) => {
46912
46972
  return node2 === selectionInfo.range?.commonAncestorContainer;
46913
46973
  })[0];
46914
- import_loglevel19.default.log(node);
46974
+ import_loglevel20.default.log(node);
46915
46975
  utterance.onboundary = (ev) => {
46916
46976
  this.updateTTSInfo(ttsQueueItem, ev.charIndex, ev.charLength, startIndex, utterance.text);
46917
46977
  };
@@ -46924,7 +46984,7 @@ var TTSModule2 = class {
46924
46984
  utterance.rate = this.tts.rate;
46925
46985
  utterance.pitch = this.tts.pitch;
46926
46986
  utterance.volume = this.tts.volume;
46927
- 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);
46928
46988
  var initialVoiceHasHyphen = true;
46929
46989
  if (this.tts.voice && this.tts.voice.lang) {
46930
46990
  initialVoiceHasHyphen = this.tts.voice.lang.indexOf("-") !== -1;
@@ -46933,8 +46993,8 @@ var TTSModule2 = class {
46933
46993
  initialVoiceHasHyphen = true;
46934
46994
  }
46935
46995
  }
46936
- import_loglevel19.default.log("initialVoiceHasHyphen", initialVoiceHasHyphen);
46937
- import_loglevel19.default.log("voices", this.voices);
46996
+ import_loglevel20.default.log("initialVoiceHasHyphen", initialVoiceHasHyphen);
46997
+ import_loglevel20.default.log("voices", this.voices);
46938
46998
  var initialVoice;
46939
46999
  if (initialVoiceHasHyphen === true) {
46940
47000
  initialVoice = this.tts.voice && this.tts.voice.lang && this.tts.voice.name ? this.voices.filter((v) => {
@@ -46952,9 +47012,9 @@ var TTSModule2 = class {
46952
47012
  initialVoice = this.tts.voice && this.tts.voice.lang ? this.voices.filter((v) => v.lang === this.tts.voice.lang)[0] : void 0;
46953
47013
  }
46954
47014
  }
46955
- import_loglevel19.default.log("initialVoice", initialVoice);
47015
+ import_loglevel20.default.log("initialVoice", initialVoice);
46956
47016
  var publicationVoiceHasHyphen = self2.delegate.publication.Metadata.Language[0].indexOf("-") !== -1;
46957
- import_loglevel19.default.log("publicationVoiceHasHyphen", publicationVoiceHasHyphen);
47017
+ import_loglevel20.default.log("publicationVoiceHasHyphen", publicationVoiceHasHyphen);
46958
47018
  var publicationVoice;
46959
47019
  if (publicationVoiceHasHyphen === true) {
46960
47020
  publicationVoice = this.tts.voice && this.tts.voice.usePublication ? this.voices.filter((v) => {
@@ -46966,9 +47026,9 @@ var TTSModule2 = class {
46966
47026
  return v.lang.startsWith(self2.delegate.publication.Metadata.Language[0]) || v.lang.endsWith(self2.delegate.publication.Metadata.Language[0].toUpperCase());
46967
47027
  })[0] : void 0;
46968
47028
  }
46969
- import_loglevel19.default.log("publicationVoice", publicationVoice);
47029
+ import_loglevel20.default.log("publicationVoice", publicationVoice);
46970
47030
  var defaultVoiceHasHyphen = navigator.language.indexOf("-") !== -1;
46971
- import_loglevel19.default.log("defaultVoiceHasHyphen", defaultVoiceHasHyphen);
47031
+ import_loglevel20.default.log("defaultVoiceHasHyphen", defaultVoiceHasHyphen);
46972
47032
  var defaultVoice;
46973
47033
  if (defaultVoiceHasHyphen === true) {
46974
47034
  defaultVoice = this.voices.filter((voice) => {
@@ -46987,23 +47047,23 @@ var TTSModule2 = class {
46987
47047
  return lang.includes(navigator.language) && voice.localService === true;
46988
47048
  })[0];
46989
47049
  }
46990
- import_loglevel19.default.log("defaultVoice", defaultVoice);
47050
+ import_loglevel20.default.log("defaultVoice", defaultVoice);
46991
47051
  if (initialVoice) {
46992
- import_loglevel19.default.log("initialVoice");
47052
+ import_loglevel20.default.log("initialVoice");
46993
47053
  utterance.voice = initialVoice;
46994
47054
  } else if (publicationVoice) {
46995
- import_loglevel19.default.log("publicationVoice");
47055
+ import_loglevel20.default.log("publicationVoice");
46996
47056
  utterance.voice = publicationVoice;
46997
47057
  } else if (defaultVoice) {
46998
- import_loglevel19.default.log("defaultVoice");
47058
+ import_loglevel20.default.log("defaultVoice");
46999
47059
  utterance.voice = defaultVoice;
47000
47060
  }
47001
47061
  if (utterance.voice !== void 0 && utterance.voice !== null) {
47002
47062
  utterance.lang = utterance.voice.lang;
47003
- import_loglevel19.default.log("utterance.voice.lang", utterance.voice.lang);
47004
- 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);
47005
47065
  }
47006
- import_loglevel19.default.log("navigator.language", navigator.language);
47066
+ import_loglevel20.default.log("navigator.language", navigator.language);
47007
47067
  setTimeout(() => {
47008
47068
  window.speechSynthesis.speak(utterance);
47009
47069
  }, 0);
@@ -47038,14 +47098,14 @@ var TTSModule2 = class {
47038
47098
  onend();
47039
47099
  }
47040
47100
  if (idx > idxEnd) {
47041
- import_loglevel19.default.log("utterance ended");
47101
+ import_loglevel20.default.log("utterance ended");
47042
47102
  self2.highlighter.doneSpeaking();
47043
47103
  self2.api?.finished();
47044
47104
  self2.delegate.emit("readaloud.finished", "finished");
47045
47105
  }
47046
47106
  }
47047
47107
  } else {
47048
- import_loglevel19.default.log("utterance ended");
47108
+ import_loglevel20.default.log("utterance ended");
47049
47109
  self2.highlighter.doneSpeaking();
47050
47110
  self2.api?.finished();
47051
47111
  self2.delegate.emit("readaloud.finished", "finished");
@@ -47162,7 +47222,7 @@ var TTSModule2 = class {
47162
47222
  }
47163
47223
  }
47164
47224
  stop() {
47165
- import_loglevel19.default.log("TTS module stop");
47225
+ import_loglevel20.default.log("TTS module stop");
47166
47226
  removeEventListenerOptional(document, "wheel", this.wheel.bind(this));
47167
47227
  removeEventListenerOptional(this.body, "wheel", this.wheel.bind(this));
47168
47228
  removeEventListenerOptional(document, "keydown", this.wheel.bind(this));
@@ -47320,7 +47380,7 @@ var TTSModule2 = class {
47320
47380
  utterance.rate = this.tts.rate;
47321
47381
  utterance.pitch = this.tts.pitch;
47322
47382
  utterance.volume = this.tts.volume;
47323
- 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);
47324
47384
  var initialVoiceHasHyphen = true;
47325
47385
  if (this.tts.voice && this.tts.voice.lang) {
47326
47386
  initialVoiceHasHyphen = this.tts.voice.lang.indexOf("-") !== -1;
@@ -47329,8 +47389,8 @@ var TTSModule2 = class {
47329
47389
  initialVoiceHasHyphen = true;
47330
47390
  }
47331
47391
  }
47332
- import_loglevel19.default.log("initialVoiceHasHyphen", initialVoiceHasHyphen);
47333
- import_loglevel19.default.log("voices", this.voices);
47392
+ import_loglevel20.default.log("initialVoiceHasHyphen", initialVoiceHasHyphen);
47393
+ import_loglevel20.default.log("voices", this.voices);
47334
47394
  var initialVoice;
47335
47395
  if (initialVoiceHasHyphen === true) {
47336
47396
  initialVoice = this.tts.voice && this.tts.voice.lang && this.tts.voice.name ? this.voices.filter((v) => {
@@ -47348,10 +47408,10 @@ var TTSModule2 = class {
47348
47408
  initialVoice = this.tts.voice && this.tts.voice.lang ? this.voices.filter((v) => v.lang === this.tts.voice.lang)[0] : void 0;
47349
47409
  }
47350
47410
  }
47351
- import_loglevel19.default.log("initialVoice", initialVoice);
47411
+ import_loglevel20.default.log("initialVoice", initialVoice);
47352
47412
  var self2 = this;
47353
47413
  var publicationVoiceHasHyphen = self2.delegate.publication.Metadata.Language[0].indexOf("-") !== -1;
47354
- import_loglevel19.default.log("publicationVoiceHasHyphen", publicationVoiceHasHyphen);
47414
+ import_loglevel20.default.log("publicationVoiceHasHyphen", publicationVoiceHasHyphen);
47355
47415
  var publicationVoice;
47356
47416
  if (publicationVoiceHasHyphen === true) {
47357
47417
  publicationVoice = this.tts.voice && this.tts.voice.usePublication ? this.voices.filter((v) => {
@@ -47363,9 +47423,9 @@ var TTSModule2 = class {
47363
47423
  return v.lang.startsWith(self2.delegate.publication.Metadata.Language[0]) || v.lang.endsWith(self2.delegate.publication.Metadata.Language[0].toUpperCase());
47364
47424
  })[0] : void 0;
47365
47425
  }
47366
- import_loglevel19.default.log("publicationVoice", publicationVoice);
47426
+ import_loglevel20.default.log("publicationVoice", publicationVoice);
47367
47427
  var defaultVoiceHasHyphen = navigator.language.indexOf("-") !== -1;
47368
- import_loglevel19.default.log("defaultVoiceHasHyphen", defaultVoiceHasHyphen);
47428
+ import_loglevel20.default.log("defaultVoiceHasHyphen", defaultVoiceHasHyphen);
47369
47429
  var defaultVoice;
47370
47430
  if (defaultVoiceHasHyphen === true) {
47371
47431
  defaultVoice = this.voices.filter((voice) => {
@@ -47384,25 +47444,25 @@ var TTSModule2 = class {
47384
47444
  return lang.includes(navigator.language) && voice.localService === true;
47385
47445
  })[0];
47386
47446
  }
47387
- import_loglevel19.default.log("defaultVoice", defaultVoice);
47447
+ import_loglevel20.default.log("defaultVoice", defaultVoice);
47388
47448
  if (initialVoice) {
47389
- import_loglevel19.default.log("initialVoice");
47449
+ import_loglevel20.default.log("initialVoice");
47390
47450
  utterance.voice = initialVoice;
47391
47451
  } else if (publicationVoice) {
47392
- import_loglevel19.default.log("publicationVoice");
47452
+ import_loglevel20.default.log("publicationVoice");
47393
47453
  utterance.voice = publicationVoice;
47394
47454
  } else if (defaultVoice) {
47395
- import_loglevel19.default.log("defaultVoice");
47455
+ import_loglevel20.default.log("defaultVoice");
47396
47456
  utterance.voice = defaultVoice;
47397
47457
  }
47398
47458
  if (utterance.voice !== void 0 && utterance.voice !== null) {
47399
47459
  utterance.lang = utterance.voice.lang;
47400
- import_loglevel19.default.log("utterance.voice.lang", utterance.voice.lang);
47401
- 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);
47402
47462
  }
47403
- import_loglevel19.default.log("navigator.language", navigator.language);
47463
+ import_loglevel20.default.log("navigator.language", navigator.language);
47404
47464
  utterance.onboundary = (ev) => {
47405
- import_loglevel19.default.log(ev.name);
47465
+ import_loglevel20.default.log(ev.name);
47406
47466
  this.updateTTSInfo(ttsQueueItem, ev.charIndex, ev.charLength, 0, utterance.text);
47407
47467
  };
47408
47468
  setTimeout(() => {
@@ -47421,7 +47481,7 @@ var TTSModule2 = class {
47421
47481
  if (!ttsQueueItem) {
47422
47482
  return void 0;
47423
47483
  }
47424
- import_loglevel19.default.log(ttsQueueItem, charIndex, charLength, utteranceText);
47484
+ import_loglevel20.default.log(ttsQueueItem, charIndex, charLength, utteranceText);
47425
47485
  const ttsQueueItemText = utteranceText ? utteranceText : getTtsQueueItemRefText(ttsQueueItem);
47426
47486
  if (charIndex >= 0 && utteranceText) {
47427
47487
  const start = utteranceText.slice(0, charIndex + 1).search(/\S+$/);
@@ -47442,9 +47502,9 @@ var TTSModule2 = class {
47442
47502
  return ttsQueueItemText;
47443
47503
  }
47444
47504
  wrapHighlightWord(ttsQueueItemRef, utteranceText, charIndex, charLength, word, start, end) {
47445
- import_loglevel19.default.log(ttsQueueItemRef);
47446
- import_loglevel19.default.log(utteranceText);
47447
- 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);
47448
47508
  if (this._ttsQueueItemHighlightsWord) {
47449
47509
  this.delegate.highlighter?.destroyHighlights(HighlightType.ReadAloud);
47450
47510
  this._ttsQueueItemHighlightsWord = void 0;
@@ -47487,8 +47547,8 @@ var TTSModule2 = class {
47487
47547
  return "";
47488
47548
  }
47489
47549
  } catch (err) {
47490
- import_loglevel19.default.log("uniqueCssSelector:");
47491
- import_loglevel19.default.error(err);
47550
+ import_loglevel20.default.log("uniqueCssSelector:");
47551
+ import_loglevel20.default.error(err);
47492
47552
  return "";
47493
47553
  }
47494
47554
  };
@@ -47595,7 +47655,7 @@ function getTtsQueueItemRefText(obj) {
47595
47655
  init_polyfills();
47596
47656
  var lodash3 = __toModule(require_lodash());
47597
47657
  var import_debounce7 = __toModule(require_debounce());
47598
- var import_loglevel20 = __toModule(require_loglevel());
47658
+ var import_loglevel21 = __toModule(require_loglevel());
47599
47659
  var DefinitionsModule = class {
47600
47660
  constructor(delegate, publication, properties, highlighter, api) {
47601
47661
  this.currentChapterPopupResult = [];
@@ -47620,7 +47680,7 @@ var DefinitionsModule = class {
47620
47680
  return search;
47621
47681
  }
47622
47682
  async stop() {
47623
- import_loglevel20.default.log("Definitions module stop");
47683
+ import_loglevel21.default.log("Definitions module stop");
47624
47684
  }
47625
47685
  async start() {
47626
47686
  this.delegate.definitionsModule = this;
@@ -47742,7 +47802,7 @@ var DefinitionsModule = class {
47742
47802
 
47743
47803
  // src/modules/linefocus/LineFocusModule.ts
47744
47804
  init_polyfills();
47745
- var import_loglevel21 = __toModule(require_loglevel());
47805
+ var import_loglevel22 = __toModule(require_loglevel());
47746
47806
  var DEFAULT_BACKGROUND_COLOR_OPACITY2 = 0.5;
47747
47807
  var LineFocusModule = class {
47748
47808
  constructor(delegate, properties, highlighter, api) {
@@ -47767,7 +47827,7 @@ var LineFocusModule = class {
47767
47827
  return search;
47768
47828
  }
47769
47829
  async stop() {
47770
- import_loglevel21.default.log("Definitions module stop");
47830
+ import_loglevel22.default.log("Definitions module stop");
47771
47831
  this.hasEventListener = false;
47772
47832
  removeEventListenerOptional(document, "keydown", this.keydown.bind(this));
47773
47833
  removeEventListenerOptional(document, "keyup", this.keyup.bind(this));
@@ -48162,9 +48222,9 @@ var LineFocusModule = class {
48162
48222
  range.detach();
48163
48223
  return rect;
48164
48224
  } catch (error) {
48165
- import_loglevel21.default.log("measureTextNode " + error);
48166
- import_loglevel21.default.log("measureTextNode " + node);
48167
- 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}`);
48168
48228
  }
48169
48229
  }
48170
48230
  measureImageNodes(node) {
@@ -48175,16 +48235,16 @@ var LineFocusModule = class {
48175
48235
  range.detach();
48176
48236
  return rect;
48177
48237
  } catch (error) {
48178
- import_loglevel21.default.log("measureTextNode " + error);
48179
- import_loglevel21.default.log("measureTextNode " + node);
48180
- 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}`);
48181
48241
  }
48182
48242
  }
48183
48243
  };
48184
48244
 
48185
48245
  // src/modules/history/HistoryModule.ts
48186
48246
  init_polyfills();
48187
- var import_loglevel22 = __toModule(require_loglevel());
48247
+ var import_loglevel23 = __toModule(require_loglevel());
48188
48248
  var HistoryModule = class {
48189
48249
  constructor(annotator, delegate, publication, properties, headerMenu) {
48190
48250
  this.history = [];
@@ -48200,7 +48260,7 @@ var HistoryModule = class {
48200
48260
  return pageBreak;
48201
48261
  }
48202
48262
  async stop() {
48203
- import_loglevel22.default.log("Page Break module stop");
48263
+ import_loglevel23.default.log("Page Break module stop");
48204
48264
  removeEventListenerOptional(this.historyForwardAnchorElement, "click", this.handleHistoryForwardClick.bind(this));
48205
48265
  removeEventListenerOptional(this.historyBackAnchorElement, "click", this.handleHistoryBackClick.bind(this));
48206
48266
  }
@@ -48238,8 +48298,8 @@ var HistoryModule = class {
48238
48298
  lastInHistory = this.history[this.history.length - 1];
48239
48299
  if (lastInHistory && lastInHistory.href !== lastReadingPosition.href || lastInHistory === void 0) {
48240
48300
  const linkHref = this.publication.getAbsoluteHref(lastReadingPosition.href);
48241
- import_loglevel22.default.log(lastReadingPosition.href);
48242
- import_loglevel22.default.log(linkHref);
48301
+ import_loglevel23.default.log(lastReadingPosition.href);
48302
+ import_loglevel23.default.log(linkHref);
48243
48303
  lastReadingPosition.href = linkHref;
48244
48304
  this.history.push(lastReadingPosition);
48245
48305
  this.historyCurrentIndex = this.history.length - 1;
@@ -48295,7 +48355,7 @@ var HistoryModule = class {
48295
48355
 
48296
48356
  // src/modules/citation/CitationModule.ts
48297
48357
  init_polyfills();
48298
- var import_loglevel23 = __toModule(require_loglevel());
48358
+ var import_loglevel24 = __toModule(require_loglevel());
48299
48359
  var CitationStyle;
48300
48360
  (function(CitationStyle2) {
48301
48361
  CitationStyle2[CitationStyle2["Chicago"] = 0] = "Chicago";
@@ -48323,7 +48383,7 @@ var CitationModule = class {
48323
48383
  return module;
48324
48384
  }
48325
48385
  async stop() {
48326
- import_loglevel23.default.log("Citation module stop");
48386
+ import_loglevel24.default.log("Citation module stop");
48327
48387
  }
48328
48388
  copyToClipboard(textToClipboard) {
48329
48389
  if (this.delegate?.contentProtectionModule) {
@@ -48534,7 +48594,7 @@ var CitationModule = class {
48534
48594
 
48535
48595
  // src/reader.ts
48536
48596
  var D2Reader = class {
48537
- 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) {
48538
48598
  this.settings = settings;
48539
48599
  this.navigator = navigator2;
48540
48600
  this.highlighter = highlighter;
@@ -48552,6 +48612,7 @@ var D2Reader = class {
48552
48612
  this.lineFocusModule = lineFocusModule;
48553
48613
  this.historyModule = historyModule;
48554
48614
  this.citationModule = citationModule;
48615
+ this.consumptionModule = consumptionModule;
48555
48616
  this.startReadAloud = () => {
48556
48617
  this.navigator.startReadAloud();
48557
48618
  };
@@ -48921,7 +48982,11 @@ var D2Reader = class {
48921
48982
  delegate: navigator2,
48922
48983
  headerMenu
48923
48984
  }) : void 0;
48924
- 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);
48925
48990
  }
48926
48991
  get hasMediaOverlays() {
48927
48992
  return this.navigator.hasMediaOverlays;