@netless/app-slide 0.2.105 → 0.2.106-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/main.es.js CHANGED
@@ -38722,25 +38722,42 @@ geometry=${JSON.stringify(o2)}`;
38722
38722
  }(), mw = function() {
38723
38723
  function t2() {
38724
38724
  var t3 = this;
38725
- this.tasks = [], this.isDestroy = false, this.isScheduling = false, this.schedule = function() {
38726
- t3.isScheduling = true;
38727
- var e2 = t3.tasks.shift();
38728
- e2 && !t3.isDestroy && (e2.status = "running", e2.fn.apply(null).then(function() {
38729
- t3.tasks.length > 0 ? setTimeout(t3.schedule) : t3.isScheduling = false;
38730
- }).catch(function() {
38731
- t3.tasks.length > 0 ? setTimeout(t3.schedule) : t3.isScheduling = false;
38732
- }));
38725
+ this.tasks = [], this.isDestroy = false, this.schedule = function() {
38726
+ if (!t3.runningTask && !t3.isDestroy) {
38727
+ var e2 = t3.tasks.shift();
38728
+ e2 && (e2.status = "running", t3.runningTask = e2, e2.fn.apply(null).then(e2.resolve, e2.reject).finally(function() {
38729
+ t3.runningTask === e2 && (t3.runningTask = void 0), !t3.isDestroy && t3.tasks.length > 0 && setTimeout(t3.schedule);
38730
+ }));
38731
+ }
38733
38732
  };
38734
38733
  }
38735
38734
  return t2.prototype.getRunningTask = function() {
38736
- return this.tasks[0] && "running" === this.tasks[0].status ? this.tasks[0] : null;
38735
+ var t3;
38736
+ return null !== (t3 = this.runningTask) && void 0 !== t3 ? t3 : null;
38737
38737
  }, t2.prototype.addTask = function(t3, e2) {
38738
- var i2 = { type: t3, status: "wait", fn: e2 }, n2 = this.getRunningTask();
38739
- n2 && t3 === n2.type || (this.tasks = this.tasks.filter(function(e3) {
38740
- return e3.type !== t3;
38741
- }), this.tasks.push(i2), this.isScheduling || this.schedule());
38738
+ if (this.isDestroy)
38739
+ 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)
38747
+ return o2.promise;
38748
+ var s2 = new Promise(function(t4, e3) {
38749
+ n2 = t4, r2 = e3;
38750
+ });
38751
+ s2.catch(function() {
38752
+ });
38753
+ var a2 = { type: t3, status: "wait", fn: e2, promise: s2, resolve: n2, reject: r2 };
38754
+ return this.tasks.push(a2), this.schedule(), s2;
38742
38755
  }, t2.prototype.destroy = function() {
38743
- this.isDestroy = true;
38756
+ var t3, e2;
38757
+ return this.isDestroy = true, this.tasks.splice(0, this.tasks.length).forEach(function(t4) {
38758
+ return t4.resolve();
38759
+ }), null !== (e2 = null === (t3 = this.runningTask) || void 0 === t3 ? void 0 : t3.promise.catch(function() {
38760
+ })) && void 0 !== e2 ? e2 : Promise.resolve();
38744
38761
  }, t2;
38745
38762
  }(), gw = function() {
38746
38763
  return (gw = Object.assign || function(t2) {
@@ -39422,7 +39439,7 @@ geometry=${JSON.stringify(o2)}`;
39422
39439
  }
39423
39440
  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 = "";
39424
39441
  try {
39425
- Fw = "1.4.60";
39442
+ Fw = "1.4.61-beta.0";
39426
39443
  } catch (t2) {
39427
39444
  Fw = "-dev-";
39428
39445
  }
@@ -40181,21 +40198,23 @@ geometry=${JSON.stringify(o2)}`;
40181
40198
  case 0:
40182
40199
  return this.logger.info("do frozen with player[" + !!this.player + "]", this.taskId), this.tracker({ name: "frozenSlide", reason: "", result: "", payload: { taskId: this.taskId } }), this.view && this.player ? [4, (i3 = this.player).waitUntilActive(function() {
40183
40200
  return !s2.isLoading;
40184
- }, 6e4)] : [3, 2];
40201
+ }, 6e4)] : [3, 3];
40185
40202
  case 1:
40186
40203
  if (a2.sent(), "alive" !== this.lifecycle || this.player !== i3)
40187
40204
  return [2];
40188
40205
  for (r3 in n2 = i3.getSnapshot() || "", this.cacheImage.src = n2, this.cacheImage.style.display = "block", "hidden" === this.frame.style.visibility && (this.frame.style.visibility = "visible"), i3.destroy(), null === (e3 = this.playerController) || void 0 === e3 || e3.destroy(), this.player = void 0, this.pptMediaPermissionNotified = false, this.__slideState.mediaState)
40189
40206
  o2 = this.__slideState.mediaState[r3], this.__slideState.mediaState[r3] = Ew(Ew({}, o2), { frozenTime: this.timestamp() });
40190
- a2.label = 2;
40207
+ return [4, ww(eb.platform)];
40191
40208
  case 2:
40209
+ a2.sent(), a2.label = 3;
40210
+ case 3:
40192
40211
  return t3 && t3(), [2];
40193
40212
  }
40194
40213
  });
40195
40214
  });
40196
40215
  }, e2.prototype.frozen = function(t3) {
40197
40216
  var e3 = this;
40198
- this.frozenTaskManager.addTask("frozen", function() {
40217
+ return this.frozenTaskManager.addTask("frozen", function() {
40199
40218
  return e3._doFrozen(t3);
40200
40219
  });
40201
40220
  }, e2.prototype._doRelease = function(t3) {
@@ -40211,7 +40230,9 @@ geometry=${JSON.stringify(o2)}`;
40211
40230
  case 1:
40212
40231
  return a2.trys.push([1, , 5, 6]), [4, ww(eb.platform)];
40213
40232
  case 2:
40214
- for (r3 in a2.sent(), 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)
40233
+ if (a2.sent(), "alive" !== this.lifecycle || this.player)
40234
+ 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)
40215
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);
40216
40237
  return [4, this.setSlideState(n2)];
40217
40238
  case 3:
@@ -40227,7 +40248,7 @@ geometry=${JSON.stringify(o2)}`;
40227
40248
  });
40228
40249
  }, e2.prototype.release = function(t3) {
40229
40250
  var e3 = this;
40230
- this.frozenTaskManager.addTask("release", function() {
40251
+ return this.frozenTaskManager.addTask("release", function() {
40231
40252
  return e3._doRelease(t3);
40232
40253
  });
40233
40254
  }, e2.prototype._doDestroy = function() {
@@ -40280,11 +40301,27 @@ geometry=${JSON.stringify(o2)}`;
40280
40301
  return this.player ? this.player.preloadResource(t3) : Promise.resolve();
40281
40302
  }, e2.prototype.destroy = function() {
40282
40303
  var t3, e3 = this;
40283
- "alive" === this.lifecycle && (this.lifecycle = "disposing", this.lifecycleGeneration += 1, this.renderVisibilityTimers.forEach(function(t4) {
40304
+ return "disposed" === this.lifecycle ? Promise.resolve() : (this.destroyPromise || (this.lifecycle = "disposing", this.lifecycleGeneration += 1, this.renderVisibilityTimers.forEach(function(t4) {
40284
40305
  return clearTimeout(t4);
40285
- }), this.renderVisibilityTimers.clear(), this.renderingTaskManager.destroy(), null === (t3 = this.player) || void 0 === t3 || t3.destroy(), this.logger.info("pre destroy slide", ""), this.isLoading ? this.waitLoadEnd().then(function() {
40286
- e3._doDestroy();
40287
- }) : this._doDestroy());
40306
+ }), 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
+ var t4;
40308
+ return Cw(this, function(e4) {
40309
+ switch (e4.label) {
40310
+ case 0:
40311
+ return [4, this.frozenTaskManager.destroy()];
40312
+ case 1:
40313
+ return e4.sent(), this.isLoading ? [4, this.waitLoadEnd()] : [3, 3];
40314
+ case 2:
40315
+ e4.sent(), e4.label = 3;
40316
+ case 3:
40317
+ return t4 = Boolean(this.player || this.iosNewPlayer), this._doDestroy(), t4 ? [4, ww(eb.platform)] : [3, 5];
40318
+ case 4:
40319
+ e4.sent(), e4.label = 5;
40320
+ case 5:
40321
+ return [2];
40322
+ }
40323
+ });
40324
+ })), this.destroyPromise);
40288
40325
  }, e2.prototype.clearSlideCache = function() {
40289
40326
  var t3;
40290
40327
  null === (t3 = this.player) || void 0 === t3 || t3.clearLocalCache();
@@ -41179,23 +41216,26 @@ class SlideControllerBase {
41179
41216
  if (this.ready) {
41180
41217
  log("[Slide] freeze", this.context.appId);
41181
41218
  if (this.invisibleBehavior === "frozen") {
41182
- this.slide.frozen();
41219
+ return Promise.resolve(this.slide.frozen());
41183
41220
  } else {
41184
41221
  this.slide.pause();
41185
41222
  }
41186
41223
  } else {
41187
41224
  this._toFreeze = 1;
41188
41225
  }
41226
+ return Promise.resolve();
41189
41227
  };
41190
41228
  this.unfreeze = async () => {
41191
41229
  if (!this.visible)
41192
41230
  return;
41231
+ if (!this.isFrozen && this.ready)
41232
+ return;
41193
41233
  this.isFrozen = false;
41194
41234
  if (this.ready) {
41195
41235
  let isNeedSyncState = false;
41196
41236
  log("[Slide] unfreeze", this.context.appId);
41197
41237
  if (this.invisibleBehavior === "frozen") {
41198
- this.slide.release(() => {
41238
+ await this.slide.release(() => {
41199
41239
  this.slide.notifyFrameResize();
41200
41240
  });
41201
41241
  isNeedSyncState = true;
@@ -41442,12 +41482,14 @@ class SlideControllerBase {
41442
41482
  return slide;
41443
41483
  }
41444
41484
  destroy() {
41485
+ var _a;
41445
41486
  this.sideEffect.flushAll();
41446
41487
  if (!this.destroyed) {
41447
41488
  log("[Slide] destroy slide (once)");
41448
- this.slide.destroy();
41449
41489
  this.destroyed = true;
41490
+ this.destroyPromise = Promise.resolve(this.slide.destroy());
41450
41491
  }
41492
+ return (_a = this.destroyPromise) != null ? _a : Promise.resolve();
41451
41493
  }
41452
41494
  }
41453
41495
  class SlideController extends SlideControllerBase {
@@ -42810,8 +42852,6 @@ class ResizableContainer {
42810
42852
  this.whiteboardContainer.style.clipPath = `inset(${padding}px 0px ${padding}px 0px)`;
42811
42853
  }
42812
42854
  }
42813
- this.translateX = 0.5;
42814
- this.translateY = 0.5;
42815
42855
  this.renderScrollBar(
42816
42856
  parentBounds.width,
42817
42857
  parentBounds.width * this.scale,
@@ -42820,14 +42860,15 @@ class ResizableContainer {
42820
42860
  );
42821
42861
  this.handleNormalizeTranslate(this.translateX, this.translateY, {
42822
42862
  triggerScrollBar: true,
42823
- triggerSync: true
42863
+ triggerSync: false,
42864
+ force: true
42824
42865
  });
42825
42866
  (_a = this.slide) == null ? void 0 : _a.notifyFrameResize();
42826
42867
  (_b = this.onLayoutUpdated) == null ? void 0 : _b.call(this);
42827
42868
  }
42828
42869
  handleNormalizeTranslate(x, y, options) {
42829
42870
  var _a;
42830
- if (Math.abs(x - this.translateX) < 1e-3 && Math.abs(y - this.translateY) < 1e-3 && !options.triggerSync) {
42871
+ if (Math.abs(x - this.translateX) < 1e-3 && Math.abs(y - this.translateY) < 1e-3 && !options.triggerSync && !options.force) {
42831
42872
  return;
42832
42873
  }
42833
42874
  const parentBounds = this.scrollContainer.getBoundingClientRect();
@@ -43673,6 +43714,7 @@ class SlideDocsViewer {
43673
43714
  this.render();
43674
43715
  this._registerBoxSizeChange();
43675
43716
  this.sideEffect.add(() => {
43717
+ var _a, _b;
43676
43718
  const applyScale = (scale) => {
43677
43719
  if (this.resizableContainer) {
43678
43720
  this.resizableContainer.scaleContainer(scale);
@@ -43689,16 +43731,22 @@ class SlideDocsViewer {
43689
43731
  } else {
43690
43732
  console.log("[SlideDocsViewer] No initial slideScale found");
43691
43733
  }
43734
+ const initialTranslateX = (_a = this.context.storage.state.translateX) != null ? _a : 0.5;
43735
+ const initialTranslateY = (_b = this.context.storage.state.translateY) != null ? _b : 0.5;
43736
+ this.resizableContainer.handleNormalizeTranslate(initialTranslateX, initialTranslateY, {
43737
+ triggerScrollBar: true,
43738
+ triggerSync: false
43739
+ });
43692
43740
  const handler = (diff) => {
43693
- var _a, _b;
43741
+ var _a2, _b2;
43694
43742
  if (diff.slideScale !== void 0) {
43695
43743
  const newScale = diff.slideScale.newValue;
43696
43744
  applyScale(newScale != null ? newScale : 1);
43697
43745
  }
43698
43746
  if (diff.translateX !== void 0 || diff.translateY !== void 0) {
43699
43747
  const currentTranslate = this.resizableContainer.getTranslate();
43700
- const translateX = diff.translateX ? (_a = diff.translateX.newValue) != null ? _a : 0.5 : currentTranslate.x;
43701
- const translateY = diff.translateY ? (_b = diff.translateY.newValue) != null ? _b : 0.5 : currentTranslate.y;
43748
+ const translateX = diff.translateX ? (_a2 = diff.translateX.newValue) != null ? _a2 : 0.5 : currentTranslate.x;
43749
+ const translateY = diff.translateY ? (_b2 = diff.translateY.newValue) != null ? _b2 : 0.5 : currentTranslate.y;
43702
43750
  if (this.resizableContainer) {
43703
43751
  this.resizableContainer.handleNormalizeTranslate(translateX, translateY, {
43704
43752
  triggerScrollBar: true,
@@ -43852,15 +43900,16 @@ class SlideDocsViewer {
43852
43900
  getPageIndex(page) {
43853
43901
  return (page > 0 ? page : 1) - 1;
43854
43902
  }
43855
- unmount() {
43903
+ async unmount() {
43856
43904
  var _a, _b;
43857
43905
  (_a = this.offBoxSizeChange) == null ? void 0 : _a.call(this);
43858
43906
  this.offBoxSizeChange = void 0;
43859
43907
  (_b = this.contentResizeObserver) == null ? void 0 : _b.disconnect();
43860
43908
  this.contentResizeObserver = void 0;
43861
43909
  if (this.slideController) {
43862
- this.slideController.destroy();
43910
+ const controller = this.slideController;
43863
43911
  this.slideController = null;
43912
+ await controller.destroy();
43864
43913
  }
43865
43914
  this.viewer.unmount();
43866
43915
  this.resizableContainer.destroy(this.box);
@@ -43869,9 +43918,9 @@ class SlideDocsViewer {
43869
43918
  setReadonly(readonly) {
43870
43919
  this.viewer.setReadonly(readonly);
43871
43920
  }
43872
- destroy() {
43921
+ async destroy() {
43873
43922
  this.sideEffect.flushAll();
43874
- this.unmount();
43923
+ await this.unmount();
43875
43924
  this.viewer.destroy();
43876
43925
  }
43877
43926
  toggleClickThrough(tool) {
@@ -44136,12 +44185,13 @@ class SlidePreviewer {
44136
44185
  slide.on(Slide.SLIDE_EVENTS.renderEnd, this.resolveReady);
44137
44186
  this.readyPromise.then(this.refreshPages);
44138
44187
  }
44139
- destroy() {
44188
+ async destroy() {
44140
44189
  this.sideEffect.flushAll();
44141
44190
  if (this.slide && !this.destroyed) {
44142
- this.slide.destroy();
44143
44191
  this.destroyed = true;
44192
+ this.destroyPromise = Promise.resolve(this.slide.destroy());
44144
44193
  }
44194
+ await this.destroyPromise;
44145
44195
  this.viewer.destroy();
44146
44196
  }
44147
44197
  getPageIndex(page) {
@@ -44161,11 +44211,12 @@ class SlidePreviewer {
44161
44211
  }
44162
44212
  }
44163
44213
  const usePlugin = /* @__PURE__ */ Slide.Slide.usePlugin.bind(Slide.Slide);
44164
- const version = "0.2.105";
44214
+ const version = "0.2.106-beta.1";
44215
+ const DEFAULT_SLIDE_SETUP_READY_TIMEOUT = 5e3;
44165
44216
  const SlideApp = {
44166
44217
  kind: "Slide",
44167
44218
  setup(context) {
44168
- var _a, _b, _c, _d, _e;
44219
+ var _a, _b, _c, _d, _e, _f;
44169
44220
  console.log("[Slide] setup @ " + version);
44170
44221
  if (context.getIsWritable()) {
44171
44222
  context.storage.ensureState(EmptyAttributes);
@@ -44178,6 +44229,10 @@ const SlideApp = {
44178
44229
  throw new Error("[Slide] no view, please set scenePath on addApp()");
44179
44230
  }
44180
44231
  view.disableCameraTransform = true;
44232
+ const isLazySetupMode = () => {
44233
+ var _a2;
44234
+ return ((_a2 = context.getWindowManager()) == null ? void 0 : _a2.lazySetupInMaximizedMode) === true;
44235
+ };
44181
44236
  const box = context.getBox();
44182
44237
  box.mountStyles(styles);
44183
44238
  try {
@@ -44186,6 +44241,8 @@ const SlideApp = {
44186
44241
  }
44187
44242
  const baseScenePath = context.getInitScenePath();
44188
44243
  let docsViewer = null;
44244
+ let slideControllerRef;
44245
+ let firstRenderFailed = false;
44189
44246
  const onPageChanged = (page) => {
44190
44247
  const room2 = context.getRoom();
44191
44248
  if (docsViewer && docsViewer.slideController) {
@@ -44211,14 +44268,21 @@ const SlideApp = {
44211
44268
  ...options,
44212
44269
  onPageChanged,
44213
44270
  onNavigate: options.onNavigate,
44214
- onRenderError: appOptions2.onRenderError,
44271
+ onRenderError: (error, pageIndex) => {
44272
+ var _a2;
44273
+ firstRenderFailed = true;
44274
+ (_a2 = appOptions2.onRenderError) == null ? void 0 : _a2.call(appOptions2, error, pageIndex);
44275
+ },
44215
44276
  showRenderError: appOptions2.showRenderError,
44216
44277
  invisibleBehavior: appOptions2.invisibleBehavior
44217
44278
  });
44218
- if (useFreezer)
44279
+ slideControllerRef = slideController;
44280
+ if (useFreezer && !isLazySetupMode())
44219
44281
  apps.set(context.appId, slideController, box);
44220
44282
  logger.setAppController(context.appId, slideController);
44221
44283
  slideController.readyPromise.then(options.onReady).then(() => {
44284
+ if (disposed)
44285
+ return;
44222
44286
  const room2 = context.getRoom();
44223
44287
  let synced = false;
44224
44288
  if (room2 && context.getIsWritable()) {
@@ -44273,18 +44337,82 @@ const SlideApp = {
44273
44337
  return () => room.callbacks.off("onRoomStateChanged", onRoomStateChanged);
44274
44338
  });
44275
44339
  }
44276
- context.emitter.on("destroy", () => {
44340
+ const isBlurFreezeAllowed = () => {
44341
+ var _a2;
44342
+ const boxStatus = context.getBoxStatus();
44343
+ if (boxStatus)
44344
+ return boxStatus !== "normal";
44345
+ const boxState = (_a2 = context.getWindowManager()) == null ? void 0 : _a2.boxState;
44346
+ return boxState != null && boxState !== "normal";
44347
+ };
44348
+ sideEffect.add(
44349
+ () => context.emitter.on("focus", async (isFocused) => {
44350
+ if (disposed)
44351
+ return;
44352
+ if (!isLazySetupMode())
44353
+ return;
44354
+ const controller = docsViewer == null ? void 0 : docsViewer.slideController;
44355
+ if (!controller)
44356
+ return;
44357
+ if (!isFocused) {
44358
+ if (!isBlurFreezeAllowed())
44359
+ return;
44360
+ if (!controller.isFrozen) {
44361
+ log("[Slide] blur freeze", context.appId);
44362
+ await controller.freeze();
44363
+ }
44364
+ return;
44365
+ }
44366
+ if (controller.isFrozen) {
44367
+ log("[Slide] focus unfreeze", context.appId);
44368
+ await controller.unfreeze();
44369
+ }
44370
+ })
44371
+ );
44372
+ let disposed = false;
44373
+ let offDestroy;
44374
+ const teardown = async () => {
44375
+ if (disposed)
44376
+ return;
44377
+ disposed = true;
44378
+ const removeDestroy = offDestroy;
44379
+ offDestroy = void 0;
44380
+ removeDestroy == null ? void 0 : removeDestroy();
44277
44381
  log("[Slide] destroy", context.appId);
44278
44382
  if (useFreezer)
44279
44383
  apps.delete(context.appId);
44280
44384
  sideEffect.flushAll();
44281
44385
  if (docsViewer) {
44282
- docsViewer.destroy();
44386
+ const viewer = docsViewer;
44283
44387
  docsViewer = null;
44388
+ await viewer.destroy();
44284
44389
  }
44285
- });
44390
+ };
44391
+ offDestroy = context.emitter.on("destroy", teardown);
44286
44392
  docsViewer.mount();
44287
- return {
44393
+ SlideApp.__teardownByContext || (SlideApp.__teardownByContext = /* @__PURE__ */ new WeakMap());
44394
+ SlideApp.__teardownByContext.set(context, teardown);
44395
+ const waitForFirstRender = (timeoutMs) => new Promise((resolve) => {
44396
+ let settled = false;
44397
+ const settle = (loaded) => {
44398
+ if (settled)
44399
+ return;
44400
+ settled = true;
44401
+ window.clearTimeout(timeoutTimer);
44402
+ window.clearInterval(pollTimer);
44403
+ resolve(loaded);
44404
+ };
44405
+ const timeoutTimer = window.setTimeout(() => settle(false), timeoutMs);
44406
+ slideControllerRef == null ? void 0 : slideControllerRef.readyPromise.then(
44407
+ () => settle(!firstRenderFailed),
44408
+ () => settle(false)
44409
+ );
44410
+ const pollTimer = window.setInterval(() => {
44411
+ if (disposed || firstRenderFailed)
44412
+ settle(false);
44413
+ }, 100);
44414
+ });
44415
+ const appResult = {
44288
44416
  onPptMediaPermissionRequest: (callback) => {
44289
44417
  var _a2, _b2;
44290
44418
  const slide = (_a2 = docsViewer == null ? void 0 : docsViewer.slideController) == null ? void 0 : _a2.slide;
@@ -44312,6 +44440,10 @@ const SlideApp = {
44312
44440
  translateX: 0.5,
44313
44441
  translateY: 0.5
44314
44442
  });
44443
+ container.handleNormalizeTranslate(0.5, 0.5, {
44444
+ triggerScrollBar: true,
44445
+ triggerSync: false
44446
+ });
44315
44447
  container.scaleContainer(applyScale);
44316
44448
  },
44317
44449
  getViewScale: () => {
@@ -44412,6 +44544,21 @@ const SlideApp = {
44412
44544
  return false;
44413
44545
  }
44414
44546
  };
44547
+ const setupReadyTimeout = (_f = appOptions == null ? void 0 : appOptions.setupReadyTimeout) != null ? _f : DEFAULT_SLIDE_SETUP_READY_TIMEOUT;
44548
+ return waitForFirstRender(setupReadyTimeout).then(() => {
44549
+ if (firstRenderFailed) {
44550
+ throw new Error("[Slide] first render failed before ready");
44551
+ }
44552
+ if (!disposed && !(slideControllerRef == null ? void 0 : slideControllerRef.ready)) {
44553
+ log("[Slide] setup ready wait timed out, slide keeps loading in background");
44554
+ }
44555
+ return appResult;
44556
+ });
44557
+ },
44558
+ async teardown(context) {
44559
+ var _a, _b, _c;
44560
+ await ((_b = (_a = SlideApp.__teardownByContext) == null ? void 0 : _a.get(context)) == null ? void 0 : _b());
44561
+ (_c = SlideApp.__teardownByContext) == null ? void 0 : _c.delete(context);
44415
44562
  }
44416
44563
  };
44417
44564
  var Slide$1 = Slide.Slide;