@netless/app-slide 0.2.106-beta.1 → 0.2.106-beta.2

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/main.es.js CHANGED
@@ -32263,7 +32263,12 @@ void main(void){
32263
32263
  }, this.showController = (t3) => {
32264
32264
  t3.stopPropagation(), this.show();
32265
32265
  }, this.getMediaDuration = () => {
32266
- this.duration && !Number.isNaN(this.duration) || (this.duration = this.media.duration, this.start && (this.duration -= this.start, this.jumpToTime()), this.end && (this.duration -= this.end)), this.totalTime.innerText = Dy.formatTime(this.duration);
32266
+ if (this.duration <= 0 || !Number.isFinite(this.duration)) {
32267
+ if (!Number.isFinite(this.media.duration) || this.media.duration <= 0)
32268
+ return;
32269
+ this.duration = this.media.duration, this.start && (this.duration -= this.start, 0 === this.seekGeneration && this.jumpToTime()), this.end && (this.duration -= this.end), this.duration = Math.max(0, this.duration);
32270
+ }
32271
+ this.totalTime.innerText = Dy.formatTime(this.duration);
32267
32272
  }, this.playMedia = () => Oy(this, void 0, void 0, function* () {
32268
32273
  this.playButton.style.display = "none", this.pauseButton.style.display = "block", yield this.media.play(), this.medianIsEnd && (this.medianIsEnd = false, this.jumpToTime()), this.playCallBackList.forEach((t3) => {
32269
32274
  t3();
@@ -32284,7 +32289,7 @@ void main(void){
32284
32289
  }, this.onPlayMedia = () => {
32285
32290
  this.fadeState = { in: false, out: false }, this.fadeHit(0), this.playButton.style.display = "none", this.pauseButton.style.display = "block", this.playCallBackList.forEach((t3) => {
32286
32291
  t3();
32287
- }), this.media.currentTime < this.start && this.jumpToTime();
32292
+ }), this.duration > 0 && this.media.currentTime < this.start && this.jumpToTime();
32288
32293
  }, this._playMediaFromCtrl = () => {
32289
32294
  this.playMediaFromCtrl(false);
32290
32295
  }, this._pauseMediaFromCtrl = () => {
@@ -32707,7 +32712,7 @@ void main(void){
32707
32712
  class Uy extends Ka.a {
32708
32713
  constructor(t2) {
32709
32714
  var e2, i2, n2, r2, o2, s2, a2, l2;
32710
- super(), this.type = "video", this.sprite = new np(), this.rtcAudio = null, this.isPlaying = false, this.audioNeedsUserGesture = false, this.videoNeedsUserGesture = false, this.isGlobalPause = false, this.fullscreen = false, this.url = "", this.isLoaded = false, this.destroyed = false, this.videoEventListeners = /* @__PURE__ */ new Map(), this.operationGeneration = 0, this.spriteVisibilityTimeout = "", this.onVideoResourceLoaded = () => {
32715
+ super(), this.type = "video", this.sprite = new np(), this.rtcAudio = null, this.isPlaying = false, this.audioNeedsUserGesture = false, this.videoNeedsUserGesture = false, this.isGlobalPause = false, this.fullscreen = false, this.url = "", this.isLoaded = false, this.destroyed = false, this.videoEventListeners = /* @__PURE__ */ new Map(), this.operationGeneration = 0, this.spriteVisibilityTimeout = "", this.audioRecoveryInProgress = false, this.onVideoResourceLoaded = () => {
32711
32716
  this.destroyed || (this.isLoaded = true, this.notifyUserGestureRequirement());
32712
32717
  }, this.onRtcAudioLoad = () => {
32713
32718
  this.notifyUserGestureRequirement();
@@ -32845,10 +32850,17 @@ void main(void){
32845
32850
  recoverAudioAfterVideoStart() {
32846
32851
  var t2;
32847
32852
  const { operationGeneration: e2 } = this;
32848
- if (this.destroyed || !this.isPlaying || this.audioPlayGeneration !== e2 || this.audioRecoveryGeneration === e2)
32853
+ if (this.destroyed || !this.isPlaying || this.audioPlayGeneration !== e2 || this.audioRecoveryGeneration === e2 || this.audioRecoveryInProgress)
32849
32854
  return;
32850
32855
  const i2 = this.videoElement;
32851
- !i2 || i2.paused || !Number.isFinite(i2.currentTime) || i2.currentTime <= 0 || (this.audioRecoveryGeneration = e2, null === (t2 = this.rtcAudio) || void 0 === t2 || t2.recoverFromNativePause(i2.currentTime));
32856
+ if (i2 && !i2.paused && Number.isFinite(i2.currentTime) && !(i2.currentTime <= 0)) {
32857
+ this.audioRecoveryInProgress = true;
32858
+ try {
32859
+ (null === (t2 = this.rtcAudio) || void 0 === t2 ? void 0 : t2.recoverFromNativePause(i2.currentTime)) && (this.audioRecoveryGeneration = e2);
32860
+ } finally {
32861
+ this.audioRecoveryInProgress = false;
32862
+ }
32863
+ }
32852
32864
  }
32853
32865
  showController() {
32854
32866
  this.controller.show();
@@ -33345,6 +33357,8 @@ void main(void){
33345
33357
  this.triggerParams = t2;
33346
33358
  }
33347
33359
  addCond(t2) {
33360
+ if (t2.event && void 0 !== this.cond[t2.event])
33361
+ return;
33348
33362
  const e2 = (...e3) => {
33349
33363
  this.condHandle(t2, e3);
33350
33364
  }, i2 = (t3, i3) => {
@@ -33397,7 +33411,10 @@ void main(void){
33397
33411
  }
33398
33412
  };
33399
33413
  const { json: e2, iterateType: i2, isIterate: n2, isSub: r2, parent: o2, ctx: s2, eventHub: a2, iterateIndex: l2, iterateId: h2, isInInteractiveSeq: u2 } = t2;
33400
- this.isMainSeq = "mainSeq" === e2.ctn.nodeType, this.isInteractiveSeq = "interactiveSeq" === e2.ctn.nodeType, this.id = e2.ctn.id, this.isIterate = n2, this.json = e2, this.ctx = s2, this.timingClock = s2.timingClock, this.globalEventHub = a2, this.commonTimeNode = new Z_({ json: e2.ctn, isSub: r2, eventHubs: { global: a2, runtime: this.runtimeNodeEventHub }, ctx: s2, parent: o2, isIterate: false, iterateType: i2, iterateIndex: l2, iterateId: h2, isInInteractiveSeq: u2 || this.isInteractiveSeq, fromSeqId: this.isInteractiveSeq ? this.json.ctn.id : "" }), this.bindShapeEvent(), this.nextConds = new Xy("mainSeq", e2.nextCondLst, { global: a2, runtime: this.runtimeNodeEventHub }, this.ctx), this.prevConds = new Xy("mainSeq", e2.preCondLst, { global: a2, runtime: this.runtimeNodeEventHub }, this.ctx), this.commonTimeNode.on("timeNodeRestart", () => {
33414
+ this.isMainSeq = "mainSeq" === e2.ctn.nodeType, this.isInteractiveSeq = "interactiveSeq" === e2.ctn.nodeType, this.id = e2.ctn.id, this.isIterate = n2, this.json = e2, this.ctx = s2, this.timingClock = s2.timingClock, this.globalEventHub = a2, this.commonTimeNode = new Z_({ json: e2.ctn, isSub: r2, eventHubs: { global: a2, runtime: this.runtimeNodeEventHub }, ctx: s2, parent: o2, isIterate: false, iterateType: i2, iterateIndex: l2, iterateId: h2, isInInteractiveSeq: u2 || this.isInteractiveSeq, fromSeqId: this.isInteractiveSeq ? this.json.ctn.id : "" }), this.bindShapeEvent(), this.nextConds = new Xy("mainSeq", e2.nextCondLst, { global: a2, runtime: this.runtimeNodeEventHub }, this.ctx), this.prevConds = new Xy("mainSeq", e2.preCondLst, { global: a2, runtime: this.runtimeNodeEventHub }, this.ctx), this.isInteractiveSeq && 0 === e2.nextCondLst.length && this.commonTimeNode.on("timeNodeStart", () => {
33415
+ var t3;
33416
+ null === (t3 = this.commonTimeNode.children[0]) || void 0 === t3 || t3.commonTimeNode.startTimeNodeForce();
33417
+ }), this.commonTimeNode.on("timeNodeRestart", () => {
33401
33418
  this.currentSeqIndex = 0, this.currentSeqState = "idle";
33402
33419
  }), this.commonTimeNode.on("childTimeNodeStart", (t3) => {
33403
33420
  const e3 = this.commonTimeNode.children.findIndex((e4) => e4.commonTimeNode.uuid === t3.id);
@@ -33459,23 +33476,26 @@ void main(void){
33459
33476
  t2.isInfiniteRepeat() ? e2.result = t2 : t2.children.map((t3) => t3.commonTimeNode).forEach((t3) => this.findChildInfiniteRepeat(t3, e2));
33460
33477
  }
33461
33478
  bindShapeEvent() {
33462
- "interactiveSeq" === this.json.ctn.nodeType && this.json.nextCondLst.forEach((t2) => {
33463
- if (/^shape/.test(t2.event)) {
33464
- const e2 = t2.event.split(" ")[1];
33465
- if (e2) {
33466
- const t3 = this.ctx.timingTargets.getTargetById(e2);
33467
- if (t3) {
33468
- t3.interactiveContainer.interactive = true, t3.interactiveContainer.cursor = "pointer";
33469
- const i2 = () => {
33470
- this.ctx.eventHub.emit(tb.userInput);
33471
- const t4 = `shape ${e2} onClick`, { mode: i3 } = this.ctx;
33472
- "interactive" !== i3 && "sync" !== i3 || this.ctx.eventHub.emit(tb.interactiveSeqAction, { action: t4, seqId: this.json.ctn.id }), "sync" !== i3 && "local" !== i3 || this.globalEventHub.emit(t4);
33473
- };
33474
- t3.interactiveContainer.on("pointerdown", i2), this.interactiveListeners.push([t3, i2]);
33479
+ if ("interactiveSeq" === this.json.ctn.nodeType) {
33480
+ const t2 = (this.json.ctn.stCondLst || []).filter((t3) => /^shape \S+ onClick$/.test(t3.event)), e2 = /* @__PURE__ */ new Set();
33481
+ [...this.json.nextCondLst, ...t2].forEach((t3) => {
33482
+ if (/^shape/.test(t3.event)) {
33483
+ const i2 = t3.event.split(" ")[1];
33484
+ if (i2 && !e2.has(i2)) {
33485
+ const t4 = this.ctx.timingTargets.getTargetById(i2);
33486
+ if (t4) {
33487
+ e2.add(i2), t4.interactiveContainer.interactive = true, t4.interactiveContainer.cursor = "pointer";
33488
+ const n2 = () => {
33489
+ this.ctx.eventHub.emit(tb.userInput);
33490
+ const t5 = `shape ${i2} onClick`, { mode: e3 } = this.ctx;
33491
+ "interactive" !== e3 && "sync" !== e3 || this.ctx.eventHub.emit(tb.interactiveSeqAction, { action: t5, seqId: this.json.ctn.id }), "sync" !== e3 && "local" !== e3 || this.globalEventHub.emit(t5);
33492
+ };
33493
+ t4.interactiveContainer.on("pointerdown", n2), this.interactiveListeners.push([t4, n2]);
33494
+ }
33475
33495
  }
33476
33496
  }
33477
- }
33478
- });
33497
+ });
33498
+ }
33479
33499
  }
33480
33500
  setCurrentStep(t2, e2) {
33481
33501
  const { length: i2 } = this.commonTimeNode.children;
@@ -34639,19 +34659,28 @@ void main(void){
34639
34659
  }(t2, r2, n2);
34640
34660
  if (e2)
34641
34661
  if (void 0 !== i2) {
34642
- if (t2.clippedDuration <= 0 && t2.isReadyForUserGesture && (yield t2.play(), !o2()))
34662
+ const e3 = (t3) => {
34663
+ const e4 = () => !o2() || t3();
34664
+ return n2 ? n2.waitUntil(e4, 5e3, 16) : Lm(e4, 5e3);
34665
+ };
34666
+ if (yield e3(() => t2.clippedDuration > 0 || !!t2.isReadyForUserGesture), !o2())
34643
34667
  return;
34644
- if (n2 ? yield n2.waitUntil(() => t2.clippedDuration > 0, 5e3, 16) : yield Lm(() => t2.clippedDuration > 0, 5e3), !o2())
34668
+ if (t2.clippedDuration <= 0 && t2.isReadyForUserGesture) {
34669
+ if (yield t2.play(), !o2())
34670
+ return;
34671
+ yield e3(() => t2.clippedDuration > 0);
34672
+ }
34673
+ if (!o2())
34645
34674
  return;
34646
34675
  if (i2 < t2.clippedDuration)
34647
34676
  if (t2.isPlaying)
34648
34677
  yield t2.seek(i2);
34649
34678
  else {
34650
- const e3 = () => {
34679
+ const e4 = () => {
34651
34680
  tx.delete(t2), o2() && Promise.resolve(t2.seek(i2)).catch(() => {
34652
34681
  });
34653
34682
  };
34654
- tx.set(t2, e3), t2.once("play", e3), yield t2.play(), o2() || nx(t2);
34683
+ tx.set(t2, e4), t2.once("play", e4), yield t2.play(), o2() || nx(t2);
34655
34684
  }
34656
34685
  } else
34657
34686
  yield t2.play();
@@ -38731,19 +38760,12 @@ geometry=${JSON.stringify(o2)}`;
38731
38760
  }
38732
38761
  };
38733
38762
  }
38734
- return t2.prototype.getRunningTask = function() {
38735
- var t3;
38736
- return null !== (t3 = this.runningTask) && void 0 !== t3 ? t3 : null;
38737
- }, t2.prototype.addTask = function(t3, e2) {
38763
+ return t2.prototype.addTask = function(t3, e2) {
38764
+ var i2;
38738
38765
  if (this.isDestroy)
38739
38766
  return Promise.resolve();
38740
- var i2 = this.getRunningTask();
38741
- if (i2 && t3 === i2.type)
38742
- return i2.promise;
38743
- var n2, r2, o2 = this.tasks.find(function(e3) {
38744
- return e3.type === t3;
38745
- });
38746
- if (o2)
38767
+ var n2, r2, o2 = null !== (i2 = this.tasks[this.tasks.length - 1]) && void 0 !== i2 ? i2 : this.runningTask;
38768
+ if ((null == o2 ? void 0 : o2.type) === t3)
38747
38769
  return o2.promise;
38748
38770
  var s2 = new Promise(function(t4, e3) {
38749
38771
  n2 = t4, r2 = e3;
@@ -39439,7 +39461,7 @@ geometry=${JSON.stringify(o2)}`;
39439
39461
  }
39440
39462
  var Nw = { syncDispatch: "syncDispatch", syncReceive: "syncReceive", syncEventLag: "syncEventLag", renderStart: "renderStart", renderEnd: "renderEnd", renderError: "renderError", slideChange: "slideChange", mainSeqStepStart: "mainSeqStepStart", mainSeqStepEnd: "mainSeqStepEnd", animateStart: "animateStart", animateEnd: "animateEnd", stateChange: "stateChange", slideStepEnd: "slideEnd", slideStepStart: "slideStart", useraddLink: "useraddLink" }, Dw = { taskId: "", url: "", currentSlideIndex: -1, mainSeqStep: -1, mainSeqState: null, mediaState: /* @__PURE__ */ Object.create(null), interactiveSeqState: /* @__PURE__ */ Object.create(null) }, Fw = "";
39441
39463
  try {
39442
- Fw = "1.4.61-beta.0";
39464
+ Fw = "1.4.61";
39443
39465
  } catch (t2) {
39444
39466
  Fw = "-dev-";
39445
39467
  }
@@ -40220,25 +40242,25 @@ geometry=${JSON.stringify(o2)}`;
40220
40242
  }, e2.prototype._doRelease = function(t3) {
40221
40243
  var e3, i3;
40222
40244
  return Mw(this, void 0, void 0, function() {
40223
- var n2, r3, o2, s2;
40224
- return Cw(this, function(a2) {
40225
- switch (a2.label) {
40245
+ var n2, r3, o2, s2, a2;
40246
+ return Cw(this, function(l2) {
40247
+ switch (l2.label) {
40226
40248
  case 0:
40227
40249
  if (this.logger.info("do release slide", this.taskId), this.tracker({ name: "releaseSlide", reason: "", result: "", payload: { taskId: this.taskId } }), this.player)
40228
40250
  return [2];
40229
- this.isReleasing = true, a2.label = 1;
40251
+ this.isReleasing = true, l2.label = 1;
40230
40252
  case 1:
40231
- return a2.trys.push([1, , 5, 6]), [4, ww(eb.platform)];
40253
+ return l2.trys.push([1, , 5, 6]), [4, ww(eb.platform)];
40232
40254
  case 2:
40233
- if (a2.sent(), "alive" !== this.lifecycle || this.player)
40255
+ if (l2.sent(), "alive" !== this.lifecycle || this.player)
40234
40256
  return [2];
40235
- for (r3 in this.player = this.initPlayer(this.config), (null === (e3 = this.config) || void 0 === e3 ? void 0 : e3.controller) && this.createController(), this.player.view && (this.canvasContainer.appendChild(this.player.view), this.player.view.style.visibility = "hidden"), n2 = this.__slideState, this.__slideState = hb()(Dw), n2.mediaState)
40236
- "play" === (o2 = n2.mediaState[r3]).type && (s2 = Math.max(null !== (i3 = o2.frozenTime) && void 0 !== i3 ? i3 : 0, o2.time), o2.time = this.timestamp() - (s2 - o2.time), o2.frozenTime = void 0);
40237
- return [4, this.setSlideState(n2)];
40257
+ for (o2 in n2 = this.player = this.initPlayer(this.config), (null === (e3 = this.config) || void 0 === e3 ? void 0 : e3.controller) && this.createController(), this.player.view && (this.canvasContainer.appendChild(this.player.view), this.player.view.style.visibility = "hidden"), r3 = this.__slideState, this.__slideState = hb()(Dw), r3.mediaState)
40258
+ "play" === (s2 = r3.mediaState[o2]).type && (a2 = Math.max(null !== (i3 = s2.frozenTime) && void 0 !== i3 ? i3 : 0, s2.time), s2.time = this.timestamp() - (a2 - s2.time), s2.frozenTime = void 0);
40259
+ return [4, this.setSlideState(r3)];
40238
40260
  case 3:
40239
- return a2.sent(), [4, this.player.clock.delay(333)];
40261
+ return l2.sent(), "alive" !== this.lifecycle || this.player !== n2 ? [2] : [4, Ow(333)];
40240
40262
  case 4:
40241
- return a2.sent(), this.player.view && (this.player.view.style.visibility = "visible"), "hidden" === this.frame.style.visibility && (this.frame.style.visibility = "visible"), this.cacheImage.style.display = "none", t3 && t3(), [3, 6];
40263
+ return l2.sent(), "alive" !== this.lifecycle || this.player !== n2 ? [2] : (n2.view && (n2.view.style.visibility = "visible"), "hidden" === this.frame.style.visibility && (this.frame.style.visibility = "visible"), this.cacheImage.style.display = "none", t3 && t3(), [3, 6]);
40242
40264
  case 5:
40243
40265
  return this.isReleasing = false, this.notifyPptMediaPermissionRequest(), [7];
40244
40266
  case 6:
@@ -40301,7 +40323,7 @@ geometry=${JSON.stringify(o2)}`;
40301
40323
  return this.player ? this.player.preloadResource(t3) : Promise.resolve();
40302
40324
  }, e2.prototype.destroy = function() {
40303
40325
  var t3, e3 = this;
40304
- return "disposed" === this.lifecycle ? Promise.resolve() : (this.destroyPromise || (this.lifecycle = "disposing", this.lifecycleGeneration += 1, this.renderVisibilityTimers.forEach(function(t4) {
40326
+ return this.destroyPromise ? this.destroyPromise : "disposed" === this.lifecycle ? Promise.resolve() : (this.lifecycle = "disposing", this.lifecycleGeneration += 1, this.renderVisibilityTimers.forEach(function(t4) {
40305
40327
  return clearTimeout(t4);
40306
40328
  }), this.renderVisibilityTimers.clear(), this.renderingTaskManager.destroy(), null === (t3 = this.player) || void 0 === t3 || t3.destroy(), this.logger.info("pre destroy slide", ""), this.destroyPromise = Mw(e3, void 0, void 0, function() {
40307
40329
  var t4;
@@ -40321,7 +40343,7 @@ geometry=${JSON.stringify(o2)}`;
40321
40343
  return [2];
40322
40344
  }
40323
40345
  });
40324
- })), this.destroyPromise);
40346
+ }), this.destroyPromise);
40325
40347
  }, e2.prototype.clearSlideCache = function() {
40326
40348
  var t3;
40327
40349
  null === (t3 = this.player) || void 0 === t3 || t3.clearLocalCache();
@@ -42936,6 +42958,18 @@ class ResizableContainer {
42936
42958
  (_a = this.scrollBar) == null ? void 0 : _a.destroy();
42937
42959
  }
42938
42960
  }
42961
+ function resolveNavigationButtonMode(mode) {
42962
+ return mode != null ? mode : "page";
42963
+ }
42964
+ function navigateWithNavigationButton(mode, origin, currentPageIndex, targetPageIndex, controller, onNavigate) {
42965
+ if (mode === "step" && origin === "navigation") {
42966
+ const action = targetPageIndex < currentPageIndex ? "prevStep" : "nextStep";
42967
+ controller.slide[action]();
42968
+ onNavigate(controller.page, origin);
42969
+ return;
42970
+ }
42971
+ controller.jumpToPage(targetPageIndex + 1, origin);
42972
+ }
42939
42973
  var resizeObservers = [];
42940
42974
  var hasActiveObservations = function() {
42941
42975
  return resizeObservers.some(function(ro) {
@@ -43466,6 +43500,7 @@ class SlideDocsViewer {
43466
43500
  appId,
43467
43501
  urlInterrupter,
43468
43502
  enableScale,
43503
+ navigationButtonMode,
43469
43504
  onPagesReady,
43470
43505
  onNavigate
43471
43506
  }) {
@@ -43598,7 +43633,14 @@ class SlideDocsViewer {
43598
43633
  };
43599
43634
  this.onNewPageIndex = (index, origin) => {
43600
43635
  if (this.slideController) {
43601
- this.slideController.jumpToPage(index + 1, origin);
43636
+ navigateWithNavigationButton(
43637
+ this.navigationButtonMode,
43638
+ origin,
43639
+ this.viewer.pageIndex,
43640
+ index,
43641
+ this.slideController,
43642
+ this.onNavigate
43643
+ );
43602
43644
  }
43603
43645
  };
43604
43646
  this.sideEffect = new SideEffectManager();
@@ -43685,6 +43727,7 @@ class SlideDocsViewer {
43685
43727
  this.onNavigate = onNavigate || noop;
43686
43728
  this.baseScenePath = baseScenePath;
43687
43729
  this.enableScale = enableScale != null ? enableScale : false;
43730
+ this.navigationButtonMode = resolveNavigationButtonMode(navigationButtonMode);
43688
43731
  this.appId = appId;
43689
43732
  this.viewer = new DocsViewer({
43690
43733
  readonly: box.readonly,
@@ -43845,6 +43888,7 @@ class SlideDocsViewer {
43845
43888
  }
43846
43889
  mount() {
43847
43890
  var _a, _b, _c, _d;
43891
+ this.unmountPromise = void 0;
43848
43892
  this.box.mountContent(this.viewer.$content);
43849
43893
  this.box.mountFooter(this.viewer.$footer);
43850
43894
  this.slideController = this.mountSlideController({
@@ -43900,28 +43944,38 @@ class SlideDocsViewer {
43900
43944
  getPageIndex(page) {
43901
43945
  return (page > 0 ? page : 1) - 1;
43902
43946
  }
43903
- async unmount() {
43904
- var _a, _b;
43905
- (_a = this.offBoxSizeChange) == null ? void 0 : _a.call(this);
43906
- this.offBoxSizeChange = void 0;
43907
- (_b = this.contentResizeObserver) == null ? void 0 : _b.disconnect();
43908
- this.contentResizeObserver = void 0;
43909
- if (this.slideController) {
43910
- const controller = this.slideController;
43911
- this.slideController = null;
43912
- await controller.destroy();
43913
- }
43914
- this.viewer.unmount();
43915
- this.resizableContainer.destroy(this.box);
43916
- return this;
43947
+ unmount() {
43948
+ if (!this.unmountPromise) {
43949
+ this.unmountPromise = Promise.resolve().then(async () => {
43950
+ var _a, _b;
43951
+ (_a = this.offBoxSizeChange) == null ? void 0 : _a.call(this);
43952
+ this.offBoxSizeChange = void 0;
43953
+ (_b = this.contentResizeObserver) == null ? void 0 : _b.disconnect();
43954
+ this.contentResizeObserver = void 0;
43955
+ if (this.slideController) {
43956
+ const controller = this.slideController;
43957
+ this.slideController = null;
43958
+ await controller.destroy();
43959
+ }
43960
+ this.viewer.unmount();
43961
+ this.resizableContainer.destroy(this.box);
43962
+ return this;
43963
+ });
43964
+ }
43965
+ return this.unmountPromise;
43917
43966
  }
43918
43967
  setReadonly(readonly) {
43919
43968
  this.viewer.setReadonly(readonly);
43920
43969
  }
43921
- async destroy() {
43922
- this.sideEffect.flushAll();
43923
- await this.unmount();
43924
- this.viewer.destroy();
43970
+ destroy() {
43971
+ if (!this.destroyPromise) {
43972
+ this.destroyPromise = Promise.resolve().then(async () => {
43973
+ this.sideEffect.flushAll();
43974
+ await this.unmount();
43975
+ this.viewer.destroy();
43976
+ });
43977
+ }
43978
+ return this.destroyPromise;
43925
43979
  }
43926
43980
  toggleClickThrough(tool) {
43927
43981
  this.$whiteboardView.style.pointerEvents = !tool || ClickThroughAppliances.has(tool) ? "none" : "auto";
@@ -44211,12 +44265,12 @@ class SlidePreviewer {
44211
44265
  }
44212
44266
  }
44213
44267
  const usePlugin = /* @__PURE__ */ Slide.Slide.usePlugin.bind(Slide.Slide);
44214
- const version = "0.2.106-beta.1";
44268
+ const version = "0.2.106-beta.2";
44215
44269
  const DEFAULT_SLIDE_SETUP_READY_TIMEOUT = 5e3;
44216
44270
  const SlideApp = {
44217
44271
  kind: "Slide",
44218
44272
  setup(context) {
44219
- var _a, _b, _c, _d, _e, _f;
44273
+ var _a, _b, _c, _d, _e, _f, _g;
44220
44274
  console.log("[Slide] setup @ " + version);
44221
44275
  if (context.getIsWritable()) {
44222
44276
  context.storage.ensureState(EmptyAttributes);
@@ -44305,6 +44359,7 @@ const SlideApp = {
44305
44359
  appId: context.appId,
44306
44360
  urlInterrupter: (_a = context.getAppOptions()) == null ? void 0 : _a.urlInterrupter,
44307
44361
  enableScale: (_c = (_b = context.getAppOptions()) == null ? void 0 : _b.enableScale) != null ? _c : false,
44362
+ navigationButtonMode: (_d = context.getAppOptions()) == null ? void 0 : _d.navigationButtonMode,
44308
44363
  onPagesReady: ({ length }) => {
44309
44364
  const index = (docsViewer == null ? void 0 : docsViewer.viewer.pageIndex) || 0;
44310
44365
  context.dispatchAppEvent("pageStateChange", { index, length });
@@ -44314,8 +44369,8 @@ const SlideApp = {
44314
44369
  }
44315
44370
  });
44316
44371
  const appOptions = context.getAppOptions();
44317
- docsViewer.setSyncEventQueuePolicy((_d = appOptions == null ? void 0 : appOptions.syncEventQueuePolicy) != null ? _d : "fifo");
44318
- docsViewer.setJustSildeReadonly((_e = appOptions == null ? void 0 : appOptions.justSildeReadonly) != null ? _e : false);
44372
+ docsViewer.setSyncEventQueuePolicy((_e = appOptions == null ? void 0 : appOptions.syncEventQueuePolicy) != null ? _e : "fifo");
44373
+ docsViewer.setJustSildeReadonly((_f = appOptions == null ? void 0 : appOptions.justSildeReadonly) != null ? _f : false);
44319
44374
  const room = context.getRoom();
44320
44375
  const sideEffect = new SideEffectManager();
44321
44376
  sideEffect.add(() => {
@@ -44371,22 +44426,26 @@ const SlideApp = {
44371
44426
  );
44372
44427
  let disposed = false;
44373
44428
  let offDestroy;
44374
- const teardown = async () => {
44375
- if (disposed)
44376
- return;
44429
+ let teardownPromise;
44430
+ const teardown = () => {
44431
+ if (teardownPromise)
44432
+ return teardownPromise;
44377
44433
  disposed = true;
44378
- const removeDestroy = offDestroy;
44379
- offDestroy = void 0;
44380
- removeDestroy == null ? void 0 : removeDestroy();
44381
- log("[Slide] destroy", context.appId);
44382
- if (useFreezer)
44383
- apps.delete(context.appId);
44384
- sideEffect.flushAll();
44385
- if (docsViewer) {
44386
- const viewer = docsViewer;
44387
- docsViewer = null;
44388
- await viewer.destroy();
44389
- }
44434
+ teardownPromise = Promise.resolve().then(async () => {
44435
+ const removeDestroy = offDestroy;
44436
+ offDestroy = void 0;
44437
+ removeDestroy == null ? void 0 : removeDestroy();
44438
+ log("[Slide] destroy", context.appId);
44439
+ if (useFreezer)
44440
+ apps.delete(context.appId);
44441
+ sideEffect.flushAll();
44442
+ if (docsViewer) {
44443
+ const viewer = docsViewer;
44444
+ docsViewer = null;
44445
+ await viewer.destroy();
44446
+ }
44447
+ });
44448
+ return teardownPromise;
44390
44449
  };
44391
44450
  offDestroy = context.emitter.on("destroy", teardown);
44392
44451
  docsViewer.mount();
@@ -44544,7 +44603,7 @@ const SlideApp = {
44544
44603
  return false;
44545
44604
  }
44546
44605
  };
44547
- const setupReadyTimeout = (_f = appOptions == null ? void 0 : appOptions.setupReadyTimeout) != null ? _f : DEFAULT_SLIDE_SETUP_READY_TIMEOUT;
44606
+ const setupReadyTimeout = (_g = appOptions == null ? void 0 : appOptions.setupReadyTimeout) != null ? _g : DEFAULT_SLIDE_SETUP_READY_TIMEOUT;
44548
44607
  return waitForFirstRender(setupReadyTimeout).then(() => {
44549
44608
  if (firstRenderFailed) {
44550
44609
  throw new Error("[Slide] first render failed before ready");