@netless/app-slide 0.2.106-beta.5 → 0.2.106

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
@@ -12845,15 +12845,15 @@ var Slide = function(t) {
12845
12845
  }), i.d(e, "PreloadCancelledError", function() {
12846
12846
  return Nm;
12847
12847
  }), i.d(e, "LOCAL_GIF_RUNTIME_CAPABILITY", function() {
12848
- return Rw;
12848
+ return Iw;
12849
12849
  }), i.d(e, "delay", function() {
12850
- return Ow;
12851
- }), i.d(e, "waitUntil", function() {
12852
12850
  return Lw;
12853
- }), i.d(e, "SLIDE_EVENTS", function() {
12851
+ }), i.d(e, "waitUntil", function() {
12854
12852
  return Nw;
12853
+ }), i.d(e, "SLIDE_EVENTS", function() {
12854
+ return Dw;
12855
12855
  }), i.d(e, "Slide", function() {
12856
- return Bw;
12856
+ return Uw;
12857
12857
  });
12858
12858
  const n = [];
12859
12859
  for (let t2 = 0; t2 < 256; t2++)
@@ -33513,20 +33513,20 @@ void main(void){
33513
33513
  }
33514
33514
  }
33515
33515
  }
33516
- function qy(t2, e2, i2) {
33516
+ function qy(t2, e2, i2, n2) {
33517
33517
  if (!t2 || t2.isTargetAlive && !t2.isTargetAlive())
33518
33518
  return;
33519
- const n2 = e2.split(".");
33520
- n2.reduce((r2, o2, s2) => {
33521
- if (r2)
33522
- return s2 !== n2.length - 1 ? r2[o2] : void (r2[o2] = i2);
33523
- console.warn(`${t2} not support ${e2}`);
33519
+ const r2 = e2.split(".");
33520
+ r2.reduce((o2, s2, a2) => {
33521
+ if (o2)
33522
+ return a2 !== r2.length - 1 ? o2[s2] : void (o2[s2] = i2);
33523
+ null == n2 || n2.logger.warn(`${t2} not support ${e2}`, n2.taskId);
33524
33524
  }, t2);
33525
33525
  }
33526
- function Zy(t2, e2) {
33526
+ function Zy(t2, e2, i2) {
33527
33527
  if (!e2 || !t2 || t2.isTargetAlive && !t2.isTargetAlive())
33528
33528
  return null;
33529
- return e2.split(".").reduce((i2, n2) => i2 ? i2[n2] : (console.warn(`${t2} not support ${e2}`), null), t2);
33529
+ return e2.split(".").reduce((n2, r2) => n2 ? n2[r2] : (null == i2 || i2.logger.warn(`${t2} not support ${e2}`, i2.taskId), null), t2);
33530
33530
  }
33531
33531
  class Jy {
33532
33532
  constructor(t2) {
@@ -33558,19 +33558,19 @@ void main(void){
33558
33558
  class Ky extends Jy {
33559
33559
  constructor(t2) {
33560
33560
  super(t2), this.isConflict = false, this.activeWhenConflict = "next", this.startVal = null, this.updateStartValue = () => {
33561
- this.timingTarget && (this.startVal = Zy(this.timingTarget, this.json.cBhvr.attrList[0]));
33561
+ this.timingTarget && (this.startVal = Zy(this.timingTarget, this.json.cBhvr.attrList[0], this.ctx));
33562
33562
  }, this.onSeekToStart = () => {
33563
33563
  const t3 = this.json.cBhvr.attrList[0];
33564
- null !== this.startVal && this.timingTarget && qy(this.timingTarget, t3, this.startVal);
33564
+ null !== this.startVal && this.timingTarget && qy(this.timingTarget, t3, this.startVal, this.ctx);
33565
33565
  }, this.onSeekToEnd = () => {
33566
33566
  const t3 = this.json.cBhvr.attrList[0], e2 = this.json.cBhvr.to || this.json.to;
33567
- e2 && this.timingTarget && qy(this.timingTarget, t3, e2);
33567
+ e2 && this.timingTarget && qy(this.timingTarget, t3, e2, this.ctx);
33568
33568
  }, this.commonTimeNode.on("timeNodeStart", this.updateStartValue), this.commonTimeNode.on("timeNodeCreate", this.updateStartValue), this.commonTimeNode.on("timeUpdate", ({ duration: t3, delta: e2 }) => {
33569
33569
  if (e2 / t3 >= 1) {
33570
33570
  const t4 = this.json.cBhvr.attrList[0];
33571
- this.json.cBhvr.attrList.length > 1 && console.warn("this.json.cBhvr.attrList.length > 0");
33571
+ this.json.cBhvr.attrList.length > 1 && this.ctx.logger.warn("set behavior has multiple attributes", this.ctx.taskId);
33572
33572
  const e3 = this.json.cBhvr.to || this.json.to;
33573
- e3 && this.timingTarget && qy(this.timingTarget, t4, e3);
33573
+ e3 && this.timingTarget && qy(this.timingTarget, t4, e3, this.ctx);
33574
33574
  }
33575
33575
  });
33576
33576
  }
@@ -33656,7 +33656,7 @@ void main(void){
33656
33656
  class r_ extends Jy {
33657
33657
  constructor(t2) {
33658
33658
  super(t2), this.isConflict = true, this.activeWhenConflict = "next", this.startVal = null, this.createVal = null, this.vars = { ppt_x: 0, ppt_y: 0, ppt_w: 0, ppt_h: 0, ppt_r: 0 }, this.keyFrames = [], this.isColorAnim = false, this.onTimeNodeStart = () => {
33659
- this.timingTarget && (this.startVal = Zy(this.timingTarget, this.json.cBhvr.attrList[0]));
33659
+ this.timingTarget && (this.startVal = Zy(this.timingTarget, this.json.cBhvr.attrList[0], this.ctx));
33660
33660
  }, this.updateVars = () => {
33661
33661
  var t3, e2, i2, n2;
33662
33662
  (null === (t3 = this.timingTarget) || void 0 === t3 ? void 0 : t3.ppt_h) && (this.vars.ppt_h = this.timingTarget.ppt_h), (null === (e2 = this.timingTarget) || void 0 === e2 ? void 0 : e2.ppt_w) && (this.vars.ppt_w = this.timingTarget.ppt_w), (null === (i2 = this.timingTarget) || void 0 === i2 ? void 0 : i2.ppt_x) && (this.vars.ppt_x = this.timingTarget.ppt_x), (null === (n2 = this.timingTarget) || void 0 === n2 ? void 0 : n2.ppt_y) && (this.vars.ppt_y = this.timingTarget.ppt_y), this.isColorAnim;
@@ -33664,17 +33664,17 @@ void main(void){
33664
33664
  const i2 = e2 / t3, n2 = this.keyFrames.findIndex((t4) => i2 <= t4[0]), { attrList: r2 } = this.json.cBhvr;
33665
33665
  if (n2 < 0) {
33666
33666
  const t4 = this.keyFrames[this.keyFrames.length - 1];
33667
- return void (this.timingTarget && r2 && r2[0] && (t4 ? qy(this.timingTarget, r2[0], t4[1].resolveValue(this.vars)) : this.ctx.logger.error("no keyframe found for anim behavior", this.ctx.taskId)));
33667
+ return void (this.timingTarget && r2 && r2[0] && (t4 ? qy(this.timingTarget, r2[0], t4[1].resolveValue(this.vars), this.ctx) : this.ctx.logger.error("no keyframe found for anim behavior", this.ctx.taskId)));
33668
33668
  }
33669
33669
  const o2 = n2 - 1, s2 = this.keyFrames[n2], a2 = this.keyFrames[o2] || s2, l2 = s2[0] - a2[0] == 0 ? 1 : (i2 - a2[0]) / (s2[0] - a2[0]), h2 = s2[1].interpolationFrom(a2[1], l2, this.vars);
33670
- this.timingTarget && r2 && r2[0] && qy(this.timingTarget, r2[0], h2);
33670
+ this.timingTarget && r2 && r2[0] && qy(this.timingTarget, r2[0], h2, this.ctx);
33671
33671
  }, this.onSeekToStart = () => {
33672
- null !== this.startVal && this.timingTarget && qy(this.timingTarget, this.json.cBhvr.attrList[0], this.startVal);
33672
+ null !== this.startVal && this.timingTarget && qy(this.timingTarget, this.json.cBhvr.attrList[0], this.startVal, this.ctx);
33673
33673
  }, this.onSeekToEnd = () => {
33674
33674
  this.onTimeUpdate({ duration: 1, delta: 1, isReverse: false });
33675
33675
  }, this.onDestroy = () => {
33676
- null !== this.createVal && this.timingTarget && qy(this.timingTarget, this.json.cBhvr.attrList[0], this.createVal);
33677
- }, this.initKeyFrames(), this.commonTimeNode.on("timeUpdate", this.onTimeUpdate), this.commonTimeNode.on("timelineStart", this.updateVars), this.commonTimeNode.on("timeNodeStart", this.onTimeNodeStart), this.commonTimeNode.on("timeNodeCreate", this.onTimeNodeStart), this.commonTimeNode.on("timeNodeDestroy", this.onDestroy), this.createVal = Zy(this.timingTarget, this.json.cBhvr.attrList[0]);
33676
+ null !== this.createVal && this.timingTarget && qy(this.timingTarget, this.json.cBhvr.attrList[0], this.createVal, this.ctx);
33677
+ }, this.initKeyFrames(), this.commonTimeNode.on("timeUpdate", this.onTimeUpdate), this.commonTimeNode.on("timelineStart", this.updateVars), this.commonTimeNode.on("timeNodeStart", this.onTimeNodeStart), this.commonTimeNode.on("timeNodeCreate", this.onTimeNodeStart), this.commonTimeNode.on("timeNodeDestroy", this.onDestroy), this.createVal = Zy(this.timingTarget, this.json.cBhvr.attrList[0], this.ctx);
33678
33678
  }
33679
33679
  get modifyAttrKey() {
33680
33680
  return this.json.cBhvr.attrList[0];
@@ -33719,7 +33719,7 @@ void main(void){
33719
33719
  for (const t3 of this.json.tavLst)
33720
33720
  if (t3.val && this.timingTarget) {
33721
33721
  let i2 = null;
33722
- "string" === t3.val.type ? "num" === e2 ? i2 = new i_(t3, this.timingTarget) : "str" === e2 && (i2 = new e_(t3, this.timingTarget)) : "number" === t3.val.type ? i2 = new t_(t3, this.timingTarget) : "color" === t3.val.type ? (this.isColorAnim = true, i2 = new n_(t3, this.timingTarget)) : "boolean" === t3.val.type && console.warn("not implements"), i2 && this.keyFrames.push([t3.time, i2]);
33722
+ "string" === t3.val.type ? "num" === e2 ? i2 = new i_(t3, this.timingTarget) : "str" === e2 && (i2 = new e_(t3, this.timingTarget)) : "number" === t3.val.type ? i2 = new t_(t3, this.timingTarget) : "color" === t3.val.type ? (this.isColorAnim = true, i2 = new n_(t3, this.timingTarget)) : "boolean" === t3.val.type && this.ctx.logger.warn("boolean animation value is not implemented", this.ctx.taskId), i2 && this.keyFrames.push([t3.time, i2]);
33723
33723
  }
33724
33724
  }
33725
33725
  }
@@ -33902,7 +33902,7 @@ void main(void){
33902
33902
  } else if ("Z" === i3)
33903
33903
  e2.closePath();
33904
33904
  else if ("E" === i3)
33905
- console.warn("not implements");
33905
+ this.ctx.logger.warn("motion path command E is not implemented", this.ctx.taskId);
33906
33906
  else if ("c" === i3) {
33907
33907
  const [t4, i4, r2, o2, s2, a2] = n2.map((t5) => Number(t5)), l2 = e2.currentPoint;
33908
33908
  e2.bezierCurveTo(t4 + l2.x, i4 + l2.y, r2 + l2.x, o2 + l2.y, s2 + l2.x, a2 + l2.y);
@@ -33957,12 +33957,12 @@ void main(void){
33957
33957
  return;
33958
33958
  this.isTimelineStart = true, t3.isReverse || this.updateCurrentValue(), this.from.isInit() || this.from.fromHexString(this.currentColorString), this.to.isInit() || this.from.by(this.by, this.to);
33959
33959
  const e2 = this.json.cBhvr.attrList[0], [i2] = e2.split(".");
33960
- qy(this.timingTarget, i2 + ".on", "true");
33960
+ qy(this.timingTarget, i2 + ".on", "true", this.ctx);
33961
33961
  }, this.onTimeNodeEnd = () => {
33962
33962
  const t3 = this.json.cBhvr.attrList[0];
33963
33963
  if ("remove" === this.json.cBhvr.ctn.fill) {
33964
33964
  const [e2] = t3.split(".");
33965
- qy(this.timingTarget, e2 + ".on", "false");
33965
+ qy(this.timingTarget, e2 + ".on", "false", this.ctx);
33966
33966
  }
33967
33967
  this.isTimelineStart = false;
33968
33968
  }, this.onSeekToStart = () => {
@@ -33973,19 +33973,19 @@ void main(void){
33973
33973
  const i2 = "ppt_c.color" === e2 || "text.color" === e2;
33974
33974
  if ((null === (t3 = this.timingTarget.fill) || void 0 === t3 ? void 0 : t3.designColor.toUpperCase()) === this.from.toHexString().toUpperCase() || i2) {
33975
33975
  const [t4] = e2.split(".");
33976
- qy(this.timingTarget, t4 + ".on", "false");
33976
+ qy(this.timingTarget, t4 + ".on", "false", this.ctx);
33977
33977
  }
33978
33978
  }
33979
33979
  }, this.onTimeNodeStart = () => {
33980
33980
  if (this.timingTarget) {
33981
- const t3 = this.json.cBhvr.attrList[0], e2 = Zy(this.timingTarget, t3);
33981
+ const t3 = this.json.cBhvr.attrList[0], e2 = Zy(this.timingTarget, t3, this.ctx);
33982
33982
  e2 && (this.startColorString = e2);
33983
33983
  }
33984
33984
  }, this.onTimeUpdate = ({ delta: t3, duration: e2 }) => {
33985
33985
  const i2 = t3 / e2;
33986
33986
  if (this.to.interpolationFrom(this.from, i2, this.target), this.timingTarget) {
33987
33987
  const t4 = this.json.cBhvr.attrList[0];
33988
- qy(this.timingTarget, t4, this.target.toHexString());
33988
+ qy(this.timingTarget, t4, this.target.toHexString(), this.ctx);
33989
33989
  }
33990
33990
  }, this.onSeekToEnd = () => {
33991
33991
  this.isTimelineStart || this.onTimelineStart({ isReverse: false, activeCount: 0, id: "" }), this.onTimeUpdate({ duration: 1, delta: 1 });
@@ -34000,7 +34000,7 @@ void main(void){
34000
34000
  }
34001
34001
  updateCurrentValue() {
34002
34002
  if (this.timingTarget) {
34003
- const t2 = this.json.cBhvr.attrList[0], e2 = Zy(this.timingTarget, t2);
34003
+ const t2 = this.json.cBhvr.attrList[0], e2 = Zy(this.timingTarget, t2, this.ctx);
34004
34004
  e2 && (this.currentColorString = e2);
34005
34005
  }
34006
34006
  }
@@ -37154,8 +37154,8 @@ geometry=${JSON.stringify(o2)}`;
37154
37154
  t2(() => this.clearAutoForwardTimer()), t2(() => this.lifecycleClock.dispose()), t2(() => this.app.view.removeEventListener("webglcontextlost", this.onWebGLLost)), t2(() => cg.collectObjectByGroup(this.objPoolGroup)), t2(() => Xx.collectObjectByGroup(this.objPoolGroup)), t2(() => {
37155
37155
  var t3;
37156
37156
  return null === (t3 = this.transactionPlayer) || void 0 === t3 ? void 0 : t3.destroy();
37157
- }), t2(() => this.loader.destroy()), t2(() => this.fps.destroy()), t2(() => this.stagePool.destroyAllStage()), t2(() => this.stagePool.destroy()), t2(() => function(t3) {
37158
- var e2, i2, n2, r2, o2, s2;
37157
+ }), t2(() => this.loader.destroy()), t2(() => this.fps.destroy()), t2(() => this.stagePool.destroyAllStage()), t2(() => this.stagePool.destroy()), t2(() => function(t3, e2) {
37158
+ var i2, n2, r2, o2, s2;
37159
37159
  let a2 = null, l2 = null;
37160
37160
  try {
37161
37161
  a2 = t3.view;
@@ -37166,14 +37166,17 @@ geometry=${JSON.stringify(o2)}`;
37166
37166
  } catch (t4) {
37167
37167
  }
37168
37168
  try {
37169
- null === (n2 = null === (i2 = null === (e2 = null == l2 ? void 0 : l2.filter) || void 0 === e2 ? void 0 : e2.texturePool) || void 0 === i2 ? void 0 : i2.clear) || void 0 === n2 || n2.call(i2, true);
37169
+ null === (r2 = null === (n2 = null === (i2 = null == l2 ? void 0 : l2.filter) || void 0 === i2 ? void 0 : i2.texturePool) || void 0 === n2 ? void 0 : n2.clear) || void 0 === r2 || r2.call(n2, true);
37170
37170
  } catch (t4) {
37171
37171
  }
37172
37172
  try {
37173
- const t4 = null == l2 ? void 0 : l2.gl, e3 = null === (r2 = null == t4 ? void 0 : t4.getExtension) || void 0 === r2 ? void 0 : r2.call(t4, "WEBGL_lose_context");
37174
- (null == e3 ? void 0 : e3.loseContext) && true !== (null === (o2 = null == t4 ? void 0 : t4.isContextLost) || void 0 === o2 ? void 0 : o2.call(t4)) && e3.loseContext(), console.info("[Slide][webgl] release requested", { hasContext: Boolean(t4), hasLoseContext: Boolean(null == e3 ? void 0 : e3.loseContext), contextLost: null === (s2 = null == t4 ? void 0 : t4.isContextLost) || void 0 === s2 ? void 0 : s2.call(t4) });
37173
+ const t4 = null == l2 ? void 0 : l2.gl, e3 = null === (o2 = null == t4 ? void 0 : t4.getExtension) || void 0 === o2 ? void 0 : o2.call(t4, "WEBGL_lose_context");
37174
+ (null == e3 ? void 0 : e3.loseContext) && true !== (null === (s2 = null == t4 ? void 0 : t4.isContextLost) || void 0 === s2 ? void 0 : s2.call(t4)) && e3.loseContext();
37175
37175
  } catch (t4) {
37176
- console.warn("[Slide][webgl] release failed", t4);
37176
+ try {
37177
+ e2 ? e2(t4) : console.warn("[Slide][webgl] release failed", t4);
37178
+ } catch (t5) {
37179
+ }
37177
37180
  }
37178
37181
  try {
37179
37182
  t3.destroy(true, { children: true, texture: true, baseTexture: true });
@@ -37181,7 +37184,9 @@ geometry=${JSON.stringify(o2)}`;
37181
37184
  } finally {
37182
37185
  (null == a2 ? void 0 : a2.parentNode) && a2.parentNode.removeChild(a2);
37183
37186
  }
37184
- }(this.app)), t2(() => this.globalEventHub.removeAllListeners()), t2(() => this.removeAllListeners()), t2(() => this.tracker({ name: "slidePlayerDestroy", result: "", reason: "", payload: {} }));
37187
+ }(this.app, (t3) => {
37188
+ this.logger.warn("[Slide][webgl] release failed", this.taskId, t3);
37189
+ })), t2(() => this.globalEventHub.removeAllListeners()), t2(() => this.removeAllListeners()), t2(() => this.tracker({ name: "slidePlayerDestroy", result: "", reason: "", payload: {} }));
37185
37190
  } finally {
37186
37191
  this.lifecycle = "disposed";
37187
37192
  }
@@ -38750,24 +38755,29 @@ geometry=${JSON.stringify(o2)}`;
38750
38755
  return !!this.available && !!this.locks[t3];
38751
38756
  }, t2;
38752
38757
  }(), mw = function() {
38753
- function t2() {
38754
- var t3 = this;
38755
- this.tasks = [], this.isDestroy = false, this.isScheduling = false, this.schedule = function() {
38756
- t3.isScheduling = true;
38757
- var e2 = t3.tasks.shift();
38758
- e2 && !t3.isDestroy ? (e2.status = "running", Promise.resolve().then(e2.fn).catch(function() {
38758
+ function t2(t3) {
38759
+ var e2 = this;
38760
+ this.onWarning = t3, this.tasks = [], this.isDestroy = false, this.isScheduling = false, this.schedule = function() {
38761
+ e2.isScheduling = true;
38762
+ var t4 = e2.tasks.shift();
38763
+ t4 && !e2.isDestroy ? (t4.status = "running", Promise.resolve().then(t4.fn).catch(function() {
38759
38764
  }).finally(function() {
38760
- !t3.isDestroy && t3.tasks.length > 0 ? setTimeout(t3.schedule) : t3.isScheduling = false;
38761
- })) : t3.isScheduling = false;
38765
+ !e2.isDestroy && e2.tasks.length > 0 ? setTimeout(e2.schedule) : e2.isScheduling = false;
38766
+ })) : e2.isScheduling = false;
38762
38767
  };
38763
38768
  }
38764
- return t2.prototype.cancelPending = function(t3) {
38769
+ return t2.prototype.warn = function(t3) {
38770
+ try {
38771
+ this.onWarning ? this.onWarning("frozen task cancellation callback failed", t3) : console.warn("[Slide] frozen task cancellation callback failed", t3);
38772
+ } catch (t4) {
38773
+ }
38774
+ }, t2.prototype.cancelPending = function(t3) {
38765
38775
  for (var e2, i2 = 0, n2 = this.tasks.splice(0); i2 < n2.length; i2++) {
38766
38776
  var r2 = n2[i2];
38767
38777
  try {
38768
38778
  null === (e2 = r2.onCancelled) || void 0 === e2 || e2.call(r2, new Error("Slide " + r2.type + " task " + t3));
38769
38779
  } catch (t4) {
38770
- console.warn("[Slide] frozen task cancellation callback failed", t4);
38780
+ this.warn(t4);
38771
38781
  }
38772
38782
  }
38773
38783
  }, t2.prototype.addTask = function(t3, e2, i2) {
@@ -38775,7 +38785,7 @@ geometry=${JSON.stringify(o2)}`;
38775
38785
  try {
38776
38786
  null == i2 || i2(new Error("Slide " + t3 + " task cancelled after destroy"));
38777
38787
  } catch (t4) {
38778
- console.warn("[Slide] frozen task cancellation callback failed", t4);
38788
+ this.warn(t4);
38779
38789
  }
38780
38790
  else {
38781
38791
  this.cancelPending("superseded");
@@ -39264,7 +39274,7 @@ geometry=${JSON.stringify(o2)}`;
39264
39274
  return bw(this, function(c2) {
39265
39275
  switch (c2.label) {
39266
39276
  case 0:
39267
- return o2 = document.createElement("div"), (s2 = new Bw({ anchor: o2, renderOptions: { minFPS: 1, maxFPS: 1, resolution: 1, maxResolutionLevel: i2, forceCanvas: true }, mode: "local", interactive: false, useLocalCache: true })).setResource(t2, e2), [4, s2.getSlideCountAsync()];
39277
+ return o2 = document.createElement("div"), (s2 = new Uw({ anchor: o2, renderOptions: { minFPS: 1, maxFPS: 1, resolution: 1, maxResolutionLevel: i2, forceCanvas: true }, mode: "local", interactive: false, useLocalCache: true })).setResource(t2, e2), [4, s2.getSlideCountAsync()];
39268
39278
  case 1:
39269
39279
  a2 = c2.sent(), c2.label = 2;
39270
39280
  case 2:
@@ -39435,18 +39445,23 @@ geometry=${JSON.stringify(o2)}`;
39435
39445
  }([o3, a3]);
39436
39446
  };
39437
39447
  }
39438
- }, Rw = "netless-slide-local-gif-production-client-geometry", Iw = function(t2) {
39448
+ }, Rw = function(t2, e2, i2) {
39449
+ if (i2 || 2 === arguments.length)
39450
+ for (var n2, r2 = 0, o2 = e2.length; r2 < o2; r2++)
39451
+ !n2 && r2 in e2 || (n2 || (n2 = Array.prototype.slice.call(e2, 0, r2)), n2[r2] = e2[r2]);
39452
+ return t2.concat(n2 || Array.prototype.slice.call(e2));
39453
+ }, Iw = "netless-slide-local-gif-production-client-geometry", Pw = function(t2) {
39439
39454
  function e2() {
39440
39455
  var e3 = null !== t2 && t2.apply(this, arguments) || this;
39441
39456
  return e3.code = "PLAYER_RENDER_TIMEOUT", e3;
39442
39457
  }
39443
39458
  return Sw(e2, t2), e2;
39444
- }(Error), Pw = window.ResizeObserver || qb, Ow = function(t2) {
39459
+ }(Error), Ow = window.ResizeObserver || qb, Lw = function(t2) {
39445
39460
  return new Promise(function(e2) {
39446
39461
  return setTimeout(e2, t2);
39447
39462
  });
39448
39463
  };
39449
- function Lw(t2, e2) {
39464
+ function Nw(t2, e2) {
39450
39465
  return Mw(this, void 0, void 0, function() {
39451
39466
  var i2;
39452
39467
  return Cw(this, function(n2) {
@@ -39454,7 +39469,7 @@ geometry=${JSON.stringify(o2)}`;
39454
39469
  case 0:
39455
39470
  i2 = Date.now(), n2.label = 1;
39456
39471
  case 1:
39457
- return !t2() && Date.now() - i2 < e2 ? [4, Ow(50)] : [3, 3];
39472
+ return !t2() && Date.now() - i2 < e2 ? [4, Lw(50)] : [3, 3];
39458
39473
  case 2:
39459
39474
  return n2.sent(), i2 = Date.now(), [3, 1];
39460
39475
  case 3:
@@ -39463,27 +39478,29 @@ geometry=${JSON.stringify(o2)}`;
39463
39478
  });
39464
39479
  });
39465
39480
  }
39466
- 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 = "";
39481
+ var Dw = { 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" }, Fw = { taskId: "", url: "", currentSlideIndex: -1, mainSeqStep: -1, mainSeqState: null, mediaState: /* @__PURE__ */ Object.create(null), interactiveSeqState: /* @__PURE__ */ Object.create(null) }, kw = "";
39467
39482
  try {
39468
- Fw = "1.4.62-beta.1";
39483
+ kw = "1.4.62";
39469
39484
  } catch (t2) {
39470
- Fw = "-dev-";
39485
+ kw = "-dev-";
39471
39486
  }
39472
- var kw = null;
39487
+ var Bw = null;
39473
39488
  try {
39474
- (kw = r.createInstance({ name: "__slide_local_log__", driver: r.INDEXEDDB, version: 1 })).ready(function(t2) {
39489
+ (Bw = r.createInstance({ name: "__slide_local_log__", driver: r.INDEXEDDB, version: 1 })).ready(function(t2) {
39475
39490
  }).catch(function(t2) {
39476
39491
  });
39477
39492
  } catch (t2) {
39478
39493
  }
39479
39494
  navigator.userAgent.toUpperCase().includes("HUAWEI") && document.createElement("canvas").getContext("2d").fillText("\u9065\u9065\u9886\u5148", 0, 10);
39480
- var Bw = function(t2) {
39495
+ var Uw = function(t2) {
39481
39496
  function e2(i3) {
39482
39497
  var r3 = t2.call(this) || this;
39483
- r3.iosResetCache = [], r3.iosResetPending = false, r3.version = Fw, r3.__slideState = hb()(Dw), r3.userInputTime = 0, r3.isSyncingSlideState = false, r3.frozenTaskManager = new mw(), r3.randomId = function() {
39498
+ r3.iosResetCache = [], r3.iosResetPending = false, r3.version = kw, r3.__slideState = hb()(Fw), r3.userInputTime = 0, r3.isSyncingSlideState = false, r3.frozenTaskManager = new mw(function(t3, e3) {
39499
+ r3.logger.warn(t3, r3.taskId, e3);
39500
+ }), r3.randomId = function() {
39484
39501
  const t3 = 4294967295 * Math.random() | 0, e3 = 4294967295 * Math.random() | 0, i4 = 4294967295 * Math.random() | 0, r4 = 4294967295 * Math.random() | 0;
39485
39502
  return (n[255 & t3] + n[t3 >> 8 & 255] + n[t3 >> 16 & 255] + n[t3 >> 24 & 255] + "-" + n[255 & e3] + n[e3 >> 8 & 255] + "-" + n[e3 >> 16 & 15 | 64] + n[e3 >> 24 & 255] + "-" + n[63 & i4 | 128] + n[i4 >> 8 & 255] + "-" + n[i4 >> 16 & 255] + n[i4 >> 24 & 255] + n[255 & r4] + n[r4 >> 8 & 255] + n[r4 >> 16 & 255] + n[r4 >> 24 & 255]).toUpperCase();
39486
- }(), r3.resize = false, r3.isAnimating = false, r3.renderingTaskManager = new tT(), r3.lifecycle = "alive", r3.lifecycleGeneration = 0, r3.playerDestroyCallbacks = [], r3.renderVisibilityTimers = /* @__PURE__ */ new Set(), r3.isLoading = false, r3.isReleasing = false, r3.interactive = true, r3.canRetryWithoutPlayer = false, r3.syncCatchUpInputBlocked = false, r3.playerGeneration = 0, r3.playerGenerations = /* @__PURE__ */ new WeakMap(), r3.playerSwapRenderTimeoutMs = 6e4, r3.pptMediaPermissionCallbacks = /* @__PURE__ */ new Set(), r3.pptMediaPermissionNotified = false, r3.pptMediaPermissionRenotifyPending = false, r3.renderingIndex = 0, r3.frameWidth = 1, r3.frameHeight = 1, r3.frame = document.createElement("div"), r3.canvasContainer = document.createElement("div"), r3.medianController = document.createElement("div"), r3.frameResizeObserver = new Pw(function() {
39503
+ }(), r3.resize = false, r3.isAnimating = false, r3.renderingTaskManager = new tT(), r3.lifecycle = "alive", r3.lifecycleGeneration = 0, r3.playerDestroyCallbacks = [], r3.renderVisibilityTimers = /* @__PURE__ */ new Set(), r3.isLoading = false, r3.isReleasing = false, r3.interactive = true, r3.canRetryWithoutPlayer = false, r3.syncCatchUpInputBlocked = false, r3.playerGeneration = 0, r3.playerGenerations = /* @__PURE__ */ new WeakMap(), r3.playerSwapRenderTimeoutMs = 6e4, r3.pptMediaPermissionCallbacks = /* @__PURE__ */ new Set(), r3.pptMediaPermissionNotified = false, r3.pptMediaPermissionRenotifyPending = false, r3.renderingIndex = 0, r3.frameWidth = 1, r3.frameHeight = 1, r3.frame = document.createElement("div"), r3.canvasContainer = document.createElement("div"), r3.medianController = document.createElement("div"), r3.frameResizeObserver = new Ow(function() {
39487
39504
  return r3.frameResizeHandler();
39488
39505
  }), r3.timestamp = function() {
39489
39506
  return Date.now();
@@ -39538,7 +39555,7 @@ geometry=${JSON.stringify(o2)}`;
39538
39555
  return Cw(this, function(h2) {
39539
39556
  switch (h2.label) {
39540
39557
  case 0:
39541
- return sg()(t3.incrId) && (t3.incrId && t3.incrId - this._receiveIncrId != 1 && this.emit(Nw.syncEventLag), this._receiveIncrId = t3.incrId || 0), this.logger.info("sync receive " + JSON.stringify(t3), this.taskId), "nextStep" !== t3.type ? [3, 1] : (this.mainSeqStep !== t3.next - 1 && this.mainSeqStep + 1 !== this.mainSeqLength && this.player ? (this.setMainSeqStep(t3.next, "start"), this.player.nextTick(function() {
39558
+ return sg()(t3.incrId) && (t3.incrId && t3.incrId - this._receiveIncrId != 1 && this.emit(Dw.syncEventLag), this._receiveIncrId = t3.incrId || 0), this.logger.info("sync receive " + JSON.stringify(t3), this.taskId), "nextStep" !== t3.type ? [3, 1] : (this.mainSeqStep !== t3.next - 1 && this.mainSeqStep + 1 !== this.mainSeqLength && this.player ? (this.setMainSeqStep(t3.next, "start"), this.player.nextTick(function() {
39542
39559
  l2.doNextStep(true, t3.clientId || "");
39543
39560
  })) : this.doNextStep(true, t3.clientId || ""), [3, 6]);
39544
39561
  case 1:
@@ -39589,10 +39606,12 @@ geometry=${JSON.stringify(o2)}`;
39589
39606
  var o3 = null === (n2 = r3.config.logger) || void 0 === n2 ? void 0 : n2.info;
39590
39607
  o3 && o3("[" + i4 + "] " + t3);
39591
39608
  }, warn: function(t3, i4) {
39592
- var n2;
39593
- e2.appendLogString("WARN - " + new Date().toISOString() + " - {" + r3.randomId + "}[" + i4 + "] " + t3 + "\n"), e2.trackLogger.addLog(t3, "warn", i4, r3.randomId);
39594
- var o3 = null === (n2 = r3.config.logger) || void 0 === n2 ? void 0 : n2.warn;
39595
- o3 && o3("[" + i4 + "] " + t3);
39609
+ for (var n2, o3 = [], s2 = 2; s2 < arguments.length; s2++)
39610
+ o3[s2 - 2] = arguments[s2];
39611
+ var a2 = o3.length ? t3 + ": " + o3.map(String).join(" ") : t3;
39612
+ e2.appendLogString("WARN - " + new Date().toISOString() + " - {" + r3.randomId + "}[" + i4 + "] " + a2 + "\n"), e2.trackLogger.addLog(a2, "warn", i4, r3.randomId);
39613
+ var l2 = null === (n2 = r3.config.logger) || void 0 === n2 ? void 0 : n2.warn;
39614
+ l2 && l2.apply(void 0, Rw(["[" + i4 + "] " + t3], o3, false));
39596
39615
  }, error: function(t3, i4) {
39597
39616
  var n2;
39598
39617
  e2.appendLogString("ERROR - " + new Date().toISOString() + " - {" + r3.randomId + "}[" + i4 + "] " + t3 + "\n"), e2.trackLogger.addLog(t3, "error", i4, r3.randomId);
@@ -39602,7 +39621,7 @@ geometry=${JSON.stringify(o2)}`;
39602
39621
  var o2 = cw(r3.mode, r3.config.syncEventQueuePolicy);
39603
39622
  return r3.config.syncEventQueuePolicy = o2, r3.syncQueue = new pw(r3.receiveSyncHandler, { policy: o2, onCompact: r3.handleSyncQueueCompact, onCompactedRenderComplete: r3.handleSyncQueueCompactRenderComplete, onCatchUpStateChange: r3.handleSyncQueueCatchUpStateChange, shouldTrackCatchUpEvent: function(t3) {
39604
39623
  return !r3.selfSyncEvents.has(t3);
39605
- } }), r3.lock = new fw("interactive" === r3.mode), r3.cacheImage.style.position = "absolute", r3.cacheImage.style.display = "block", r3.cacheImage.style.zIndex = "100", r3.setMedianControllerAttribute(), r3.canvasContainer.style.position = "relative", r3.canvasContainer.style.fontSize = "0", r3.canvasContainer.appendChild(r3.medianController), r3.frame.appendChild(r3.canvasContainer), r3.frame.appendChild(r3.cacheImage), r3.config.disableFrameResizeObserver || r3.frameResizeObserver.observe(r3.frame), r3.on(Nw.syncReceive, function(t3) {
39624
+ } }), r3.lock = new fw("interactive" === r3.mode), r3.cacheImage.style.position = "absolute", r3.cacheImage.style.display = "block", r3.cacheImage.style.zIndex = "100", r3.setMedianControllerAttribute(), r3.canvasContainer.style.position = "relative", r3.canvasContainer.style.fontSize = "0", r3.canvasContainer.appendChild(r3.medianController), r3.frame.appendChild(r3.canvasContainer), r3.frame.appendChild(r3.cacheImage), r3.config.disableFrameResizeObserver || r3.frameResizeObserver.observe(r3.frame), r3.on(Dw.syncReceive, function(t3) {
39606
39625
  (r3.lock.unlock(t3.type, t3.uuid) || !!r3.config.clientId && t3.clientId === r3.config.clientId) && r3.selfSyncEvents.add(t3), !r3.player && r3.config.skipActionWhenFrozen || "sync" === r3.mode && r3.config.clientId === t3.clientId || r3.syncQueue.addTask(t3);
39607
39626
  }), r3.renderingTaskManager.eventHub.on("task-error", function(t3) {
39608
39627
  var e3 = t3.error, i4 = t3.task, n2 = Sm.transform(e3);
@@ -39622,7 +39641,7 @@ geometry=${JSON.stringify(o2)}`;
39622
39641
  return [3, 5];
39623
39642
  i3.label = 1;
39624
39643
  case 1:
39625
- return i3.trys.push([1, 3, , 4]), [4, null == kw ? void 0 : kw.setItem("run_time_log_" + e2._tempLogIndex, e2._tempLog)];
39644
+ return i3.trys.push([1, 3, , 4]), [4, null == Bw ? void 0 : Bw.setItem("run_time_log_" + e2._tempLogIndex, e2._tempLog)];
39626
39645
  case 2:
39627
39646
  return i3.sent(), [3, 4];
39628
39647
  case 3:
@@ -39644,11 +39663,11 @@ geometry=${JSON.stringify(o2)}`;
39644
39663
  case 0:
39645
39664
  return e2.remoteLogAddress = t3, [4, e2.flushLog(true)];
39646
39665
  case 1:
39647
- if (a2.sent(), !kw)
39666
+ if (a2.sent(), !Bw)
39648
39667
  return [3, 13];
39649
39668
  i3 = [], a2.label = 2;
39650
39669
  case 2:
39651
- return a2.trys.push([2, 4, , 5]), [4, kw.keys()];
39670
+ return a2.trys.push([2, 4, , 5]), [4, Bw.keys()];
39652
39671
  case 3:
39653
39672
  return i3 = (a2.sent() || []).sort(function(t4, e3) {
39654
39673
  return parseInt(t4.replace("run_time_log_", "")) - parseInt(e3.replace("run_time_log_", ""));
@@ -39662,7 +39681,7 @@ geometry=${JSON.stringify(o2)}`;
39662
39681
  return [3, 13];
39663
39682
  o2 = r3[n2], o2.replace("run_time_log_", ""), s2 = "", a2.label = 7;
39664
39683
  case 7:
39665
- return a2.trys.push([7, 9, , 10]), [4, kw.getItem(o2)];
39684
+ return a2.trys.push([7, 9, , 10]), [4, Bw.getItem(o2)];
39666
39685
  case 8:
39667
39686
  return s2 = a2.sent() || "", [3, 10];
39668
39687
  case 9:
@@ -39699,7 +39718,7 @@ geometry=${JSON.stringify(o2)}`;
39699
39718
  t4 instanceof Qb || e3.logger.error(t4, e3.taskId);
39700
39719
  });
39701
39720
  }, e2.prototype.reportError = function(t3, i3) {
39702
- this.emit(Nw.renderError, { error: t3, index: i3 }), window.postMessage({ type: "@slide/_error_", errorType: t3.errorType, errorMsg: t3.errorMsg, slideId: this.randomId, slideIndex: i3 || -1, customMessage: "@slide/_error_" }, "*"), e2.trackLogger.uploadLog(true);
39721
+ this.emit(Dw.renderError, { error: t3, index: i3 }), window.postMessage({ type: "@slide/_error_", errorType: t3.errorType, errorMsg: t3.errorMsg, slideId: this.randomId, slideIndex: i3 || -1, customMessage: "@slide/_error_" }, "*"), e2.trackLogger.uploadLog(true);
39703
39722
  }, e2.prototype.initSlideConfig = function(t3) {
39704
39723
  return t3.timestamp && (this.timestamp = t3.timestamp), t3.rtcAudio && (eb.RtcAudioClazz = t3.rtcAudio), false !== t3.enableWebAudio && (t3.enableWebAudio = true), this.mode = t3.mode, this.anchor = t3.anchor, this.anchor.appendChild(this.frame), this.enableGlobalClick = !el()(t3.enableGlobalClick) && t3.enableGlobalClick, this.resize = t3.resize || false, this.interactive = t3.interactive, this.frame.style.cssText = t3.fixedFrameSize ? "width:" + t3.fixedFrameSize.width + "px;height:" + t3.fixedFrameSize.height + "px;" : "width:100%;height:100%", this.frame.style.cssText += "display:flex;justify-content:center;align-items:center;visibility:hidden;position:relative;z-index:1;", t3.fixedFrameSize && (this.frameWidth = t3.fixedFrameSize.width, this.frameHeight = t3.fixedFrameSize.height), t3.disableClickDebounce = t3.disableClickDebounce || false, t3;
39705
39724
  }, e2.prototype.initPlayer = function(t3) {
@@ -39713,11 +39732,11 @@ geometry=${JSON.stringify(o2)}`;
39713
39732
  }), s2.on(tb.mediaPermissionResolved, function() {
39714
39733
  r3.handlePptMediaPermissionResolved();
39715
39734
  }), s2.on(tb.renderStart, function(t4) {
39716
- r3.isLoading = true, r3.emit(Nw.renderStart, t4), window.postMessage({ type: "@slide/_render_start_", taskId: r3.taskId, index: t4 }, "*");
39735
+ r3.isLoading = true, r3.emit(Dw.renderStart, t4), window.postMessage({ type: "@slide/_render_start_", taskId: r3.taskId, index: t4 }, "*");
39717
39736
  }), s2.on(tb.renderEnd, function(t4) {
39718
- r3.isLoading = false, r3.player && (r3.designHeight = r3.player.designHeight, r3.designWidth = r3.player.designWidth, r3.cacheImage.style.width = r3.player.designWidth + "px", r3.cacheImage.style.height = r3.player.designHeight + "px", r3.cacheImage.style.maxWidth = r3.player.designWidth + "px", r3.cacheImage.style.minWidth = r3.player.designHeight + "px", r3._slideCount = r3.player.slideCount), r3.emit(Nw.renderEnd, t4), window.postMessage({ type: "@slide/_render_end_", taskId: r3.taskId, index: t4 }, "*");
39737
+ r3.isLoading = false, r3.player && (r3.designHeight = r3.player.designHeight, r3.designWidth = r3.player.designWidth, r3.cacheImage.style.width = r3.player.designWidth + "px", r3.cacheImage.style.height = r3.player.designHeight + "px", r3.cacheImage.style.maxWidth = r3.player.designWidth + "px", r3.cacheImage.style.minWidth = r3.player.designHeight + "px", r3._slideCount = r3.player.slideCount), r3.emit(Dw.renderEnd, t4), window.postMessage({ type: "@slide/_render_end_", taskId: r3.taskId, index: t4 }, "*");
39719
39738
  }), s2.on(tb.slideChange, function(t4) {
39720
- r3.__slideState.currentSlideIndex = t4, r3.emitStateChange(), r3.emit(Nw.slideChange, t4);
39739
+ r3.__slideState.currentSlideIndex = t4, r3.emitStateChange(), r3.emit(Dw.slideChange, t4);
39721
39740
  }), s2.on(tb.mainSeqStateChange, function(t4) {
39722
39741
  r3.__slideState.mainSeqState = t4, r3.emitStateChange();
39723
39742
  }), s2.on(tb.mainSeqStepChange, function(t4) {
@@ -39726,16 +39745,16 @@ geometry=${JSON.stringify(o2)}`;
39726
39745
  var e4 = t4.id, i4 = t4.state;
39727
39746
  r3.__slideState.interactiveSeqState[e4] = i4, r3.emitStateChange();
39728
39747
  }), s2.on(tb.animateStart, function() {
39729
- true !== r3.isAnimating && (r3.isAnimating = true, r3.emit(Nw.animateStart));
39748
+ true !== r3.isAnimating && (r3.isAnimating = true, r3.emit(Dw.animateStart));
39730
39749
  }), s2.on(tb.animateEnd, function() {
39731
- false !== r3.isAnimating && (r3.isAnimating = false, r3.emit(Nw.animateEnd));
39750
+ false !== r3.isAnimating && (r3.isAnimating = false, r3.emit(Dw.animateEnd));
39732
39751
  }), s2.on(tb.interactiveSeqAction, function(t4) {
39733
39752
  var e4 = t4.action, i4 = t4.seqId;
39734
39753
  r3.emitSyncDispatch({ slideIndex: r3.__slideState.currentSlideIndex, type: "interactiveAnim", action: e4, seqId: i4 }), r3.emitStateChange();
39735
39754
  }), s2.on(tb.mainSeqStepStart, function(t4) {
39736
- r3.emit(Nw.mainSeqStepStart, t4);
39755
+ r3.emit(Dw.mainSeqStepStart, t4);
39737
39756
  }), s2.on(tb.mainSeqStepEnd, function(t4) {
39738
- r3.emit(Nw.mainSeqStepEnd, t4);
39757
+ r3.emit(Dw.mainSeqStepEnd, t4);
39739
39758
  }), s2.on(tb.mediaPlay, function(t4) {
39740
39759
  var e4, i4 = null !== (e4 = r3.__slideState.mediaState[t4.id]) && void 0 !== e4 ? e4 : {};
39741
39760
  i4.type = "play", i4.time = r3.timestamp() - 1e3 * t4.time, r3.__slideState.mediaState[t4.id] = i4, t4._stateOnly ? "interactive" === r3.config.mode && r3.receiveSyncHandler({ slideIndex: r3.__slideState.currentSlideIndex, type: "mediaPlay", id: t4.id, state: i4 }).catch(function(t5) {
@@ -39758,7 +39777,7 @@ geometry=${JSON.stringify(o2)}`;
39758
39777
  }), s2.on(tb.requestNextSlide, function(t4) {
39759
39778
  r3.handleNextSlide(t4);
39760
39779
  }), s2.on(tb.useraddLink, function(t4) {
39761
- r3.emit(Nw.useraddLink, r3.taskId, r3.renderingIndex, t4);
39780
+ r3.emit(Dw.useraddLink, r3.taskId, r3.renderingIndex, t4);
39762
39781
  }), s2.on(tb.requestGotoSlide, function(t4) {
39763
39782
  var e4;
39764
39783
  r3.syncCatchUpInputBlocked || ((null === (e4 = r3.config.navigatorDelegate) || void 0 === e4 ? void 0 : e4.gotoPage) ? r3.config.navigatorDelegate.gotoPage(t4) : r3.handleGotoSlide(t4));
@@ -39899,7 +39918,7 @@ geometry=${JSON.stringify(o2)}`;
39899
39918
  return [2];
39900
39919
  this.initInteractiveSeq(t3), this.__slideState.interactiveSeqState = t3.interactiveSeqState;
39901
39920
  }
39902
- return null == e3 || e3(), [4, Ow(1500)];
39921
+ return null == e3 || e3(), [4, Lw(1500)];
39903
39922
  case 9:
39904
39923
  if (d2.sent(), !s2())
39905
39924
  return [2];
@@ -40065,7 +40084,7 @@ geometry=${JSON.stringify(o2)}`;
40065
40084
  case 0:
40066
40085
  i3 = this.playerSwapRenderTimeoutMs, r3 = new Promise(function(t4, r4) {
40067
40086
  n2 = setTimeout(function() {
40068
- r4(new Iw("player render slide " + e3 + " timeout after " + i3 + "ms"));
40087
+ r4(new Pw("player render slide " + e3 + " timeout after " + i3 + "ms"));
40069
40088
  }, i3);
40070
40089
  }), o2.label = 1;
40071
40090
  case 1:
@@ -40171,7 +40190,7 @@ geometry=${JSON.stringify(o2)}`;
40171
40190
  var t3, e3;
40172
40191
  return null !== (e3 = null === (t3 = this.player) || void 0 === t3 ? void 0 : t3.getSnapshot()) && void 0 !== e3 ? e3 : null;
40173
40192
  }, e2.prototype.nextStep = function() {
40174
- !this.isLoading && this.player && this.interactive && !this.syncCatchUpInputBlocked ? (this.hasNextStep() || this.emit(Nw.slideStepEnd), this.player.mainSeqHasNextStep() ? "interactive" === this.mode ? this.emitSyncDispatch({ slideIndex: this.__slideState.currentSlideIndex, type: "nextStep", next: this.player.mainSeqStep() + 1 }) : "sync" === this.mode ? (this.doNextStep(false, ""), this.emitSyncDispatch({ slideIndex: this.__slideState.currentSlideIndex, type: "nextStep", next: this.player.mainSeqStep() })) : this.doNextStep(false, "") : this.handleNextSlide()) : this.logger.info("prevent nextStep. isLoading: " + this.isLoading + ", player: " + !!this.player + ", interactive: " + this.interactive + ", syncCatchUpInputBlocked: " + this.syncCatchUpInputBlocked, this.taskId);
40193
+ !this.isLoading && this.player && this.interactive && !this.syncCatchUpInputBlocked ? (this.hasNextStep() || this.emit(Dw.slideStepEnd), this.player.mainSeqHasNextStep() ? "interactive" === this.mode ? this.emitSyncDispatch({ slideIndex: this.__slideState.currentSlideIndex, type: "nextStep", next: this.player.mainSeqStep() + 1 }) : "sync" === this.mode ? (this.doNextStep(false, ""), this.emitSyncDispatch({ slideIndex: this.__slideState.currentSlideIndex, type: "nextStep", next: this.player.mainSeqStep() })) : this.doNextStep(false, "") : this.handleNextSlide()) : this.logger.info("prevent nextStep. isLoading: " + this.isLoading + ", player: " + !!this.player + ", interactive: " + this.interactive + ", syncCatchUpInputBlocked: " + this.syncCatchUpInputBlocked, this.taskId);
40175
40194
  }, e2.prototype.doNextStep = function(t3, e3) {
40176
40195
  if (this.player) {
40177
40196
  var i3 = !this.config.clientId || e3 === this.config.clientId;
@@ -40180,7 +40199,7 @@ geometry=${JSON.stringify(o2)}`;
40180
40199
  this.__slideState.mainSeqStep = n2, this.emitStateChange();
40181
40200
  }
40182
40201
  }, e2.prototype.prevStep = function() {
40183
- !this.isLoading && this.player && this.interactive && !this.syncCatchUpInputBlocked ? (this.hasPrevStep() || this.emit(Nw.slideStepStart), this.player.mainSeqHasPrevStep() ? "interactive" === this.mode ? this.emitSyncDispatch({ type: "prevStep", slideIndex: this.__slideState.currentSlideIndex, next: this.player.mainSeqStep() - 1 }) : "sync" === this.mode ? (this.doPrevStep(), this.emitSyncDispatch({ slideIndex: this.__slideState.currentSlideIndex, type: "prevStep", next: this.player.mainSeqStep() })) : this.doPrevStep() : this.handlePrevSlide()) : this.logger.info("prevent prevStep. isLoading: " + this.isLoading + ", player: " + !!this.player + ", interactive: " + this.interactive + ", syncCatchUpInputBlocked: " + this.syncCatchUpInputBlocked, this.taskId);
40202
+ !this.isLoading && this.player && this.interactive && !this.syncCatchUpInputBlocked ? (this.hasPrevStep() || this.emit(Dw.slideStepStart), this.player.mainSeqHasPrevStep() ? "interactive" === this.mode ? this.emitSyncDispatch({ type: "prevStep", slideIndex: this.__slideState.currentSlideIndex, next: this.player.mainSeqStep() - 1 }) : "sync" === this.mode ? (this.doPrevStep(), this.emitSyncDispatch({ slideIndex: this.__slideState.currentSlideIndex, type: "prevStep", next: this.player.mainSeqStep() })) : this.doPrevStep() : this.handlePrevSlide()) : this.logger.info("prevent prevStep. isLoading: " + this.isLoading + ", player: " + !!this.player + ", interactive: " + this.interactive + ", syncCatchUpInputBlocked: " + this.syncCatchUpInputBlocked, this.taskId);
40184
40203
  }, e2.prototype.doPrevStep = function(t3) {
40185
40204
  if (void 0 === t3 && (t3 = false), this.player) {
40186
40205
  this.player.prevStep(t3);
@@ -40192,14 +40211,14 @@ geometry=${JSON.stringify(o2)}`;
40192
40211
  }, e2.prototype.emitStateChange = function() {
40193
40212
  if ("local" !== this.mode && !this.isSyncingSlideState) {
40194
40213
  var t3 = this.slideState;
40195
- !ob()(this.lastEmitedState, t3) && this.isSlideStateReady(t3) && (this.lastEmitedState = t3, this.emit(Nw.stateChange, t3), this.logger.info("stateChange dispatch " + JSON.stringify(this.slideState), this.taskId));
40214
+ !ob()(this.lastEmitedState, t3) && this.isSlideStateReady(t3) && (this.lastEmitedState = t3, this.emit(Dw.stateChange, t3), this.logger.info("stateChange dispatch " + JSON.stringify(this.slideState), this.taskId));
40196
40215
  }
40197
40216
  }, e2.prototype.emitSyncDispatch = function(t3) {
40198
40217
  if (!this.lock.isLocked(t3.type)) {
40199
40218
  var e3 = Math.random().toString(32).substr(2);
40200
40219
  this.lock.addLock(t3.type, e3);
40201
40220
  var i3 = Ew(Ew({}, t3), { uuid: e3, clientId: this.config.clientId });
40202
- "sync" === this.config.mode && (i3.incrId = this.dispatchIncrId), this.emit(Nw.syncDispatch, i3), this.logger.info("sync dispatch " + JSON.stringify(i3), this.taskId);
40221
+ "sync" === this.config.mode && (i3.incrId = this.dispatchIncrId), this.emit(Dw.syncDispatch, i3), this.logger.info("sync dispatch " + JSON.stringify(i3), this.taskId);
40203
40222
  }
40204
40223
  }, e2.prototype.setMainSeqStep = function(t3, e3) {
40205
40224
  var i3;
@@ -40258,7 +40277,7 @@ geometry=${JSON.stringify(o2)}`;
40258
40277
  case 2:
40259
40278
  if (d2.sent(), "alive" !== this.lifecycle || this.player)
40260
40279
  throw new Error("Slide release cancelled before player creation");
40261
- for (s2 in r3 = this.player = this.initPlayer(this.config), (null === (i3 = this.config) || void 0 === i3 ? void 0 : i3.controller) && this.createController(), this.player.view && (this.canvasContainer.appendChild(this.player.view), this.player.view.style.visibility = "hidden"), o2 = this.__slideState, this.__slideState = hb()(Dw), o2.mediaState)
40280
+ for (s2 in r3 = this.player = this.initPlayer(this.config), (null === (i3 = this.config) || void 0 === i3 ? void 0 : i3.controller) && this.createController(), this.player.view && (this.canvasContainer.appendChild(this.player.view), this.player.view.style.visibility = "hidden"), o2 = this.__slideState, this.__slideState = hb()(Fw), o2.mediaState)
40262
40281
  "play" === (a2 = o2.mediaState[s2]).type && (l2 = Math.max(null !== (n2 = a2.frozenTime) && void 0 !== n2 ? n2 : 0, a2.time), a2.time = this.timestamp() - (l2 - a2.time), a2.frozenTime = void 0);
40263
40282
  return null == e3 || e3(), h2 = Promise.resolve(), this.setSlideState(o2, function() {
40264
40283
  h2 = new Promise(function(t4) {
@@ -40325,7 +40344,7 @@ geometry=${JSON.stringify(o2)}`;
40325
40344
  case 0:
40326
40345
  t3 = 0, e3.label = 1;
40327
40346
  case 1:
40328
- return this.isLoading && t3 < 10 ? [4, Ow(100)] : [3, 3];
40347
+ return this.isLoading && t3 < 10 ? [4, Lw(100)] : [3, 3];
40329
40348
  case 2:
40330
40349
  return e3.sent(), t3 += 1, [3, 1];
40331
40350
  case 3:
@@ -40448,11 +40467,11 @@ geometry=${JSON.stringify(o2)}`;
40448
40467
  case 0:
40449
40468
  return [4, e2.flushLog(true)];
40450
40469
  case 1:
40451
- if (i3.sent(), !kw)
40470
+ if (i3.sent(), !Bw)
40452
40471
  return [3, 12];
40453
40472
  n2 = [], i3.label = 2;
40454
40473
  case 2:
40455
- return i3.trys.push([2, 4, , 5]), [4, kw.keys()];
40474
+ return i3.trys.push([2, 4, , 5]), [4, Bw.keys()];
40456
40475
  case 3:
40457
40476
  return n2 = (i3.sent() || []).sort(function(t4, e3) {
40458
40477
  return parseInt(t4.replace("run_time_log_", "")) - parseInt(e3.replace("run_time_log_", ""));
@@ -40468,7 +40487,7 @@ geometry=${JSON.stringify(o2)}`;
40468
40487
  return [3, 12];
40469
40488
  s2 = o2[r3], a2 = s2.replace("run_time_log_", ""), l2 = "", i3.label = 7;
40470
40489
  case 7:
40471
- return i3.trys.push([7, 9, , 10]), [4, kw.getItem(s2)];
40490
+ return i3.trys.push([7, 9, , 10]), [4, Bw.getItem(s2)];
40472
40491
  case 8:
40473
40492
  return l2 = i3.sent() || "", [3, 10];
40474
40493
  case 9:
@@ -40490,13 +40509,13 @@ geometry=${JSON.stringify(o2)}`;
40490
40509
  case 0:
40491
40510
  return i3.trys.push([0, 7, , 8]), [4, e2.flushLog(true)];
40492
40511
  case 1:
40493
- return i3.sent(), t3 = "", kw ? [4, kw.keys()] : [3, 6];
40512
+ return i3.sent(), t3 = "", Bw ? [4, Bw.keys()] : [3, 6];
40494
40513
  case 2:
40495
40514
  n2 = (i3.sent() || []).sort(function(t4, e3) {
40496
40515
  return parseInt(t4.replace("run_time_log_", "")) - parseInt(e3.replace("run_time_log_", ""));
40497
40516
  }), r3 = 0, o2 = n2, i3.label = 3;
40498
40517
  case 3:
40499
- return r3 < o2.length ? (s2 = o2[r3], a2 = t3, [4, kw.getItem(s2)]) : [3, 6];
40518
+ return r3 < o2.length ? (s2 = o2[r3], a2 = t3, [4, Bw.getItem(s2)]) : [3, 6];
40500
40519
  case 4:
40501
40520
  t3 = a2 + (i3.sent() || ""), i3.label = 5;
40502
40521
  case 5:
@@ -40537,35 +40556,35 @@ geometry=${JSON.stringify(o2)}`;
40537
40556
  };
40538
40557
  })], e2.prototype, "initSlideConfig", null), e2;
40539
40558
  }(Ka.a);
40540
- null == kw || kw.clear().catch(function() {
40541
- }), window.addEventListener("__slide_log__", Bw.handleLogDownload), window.addEventListener("message", function(t2) {
40559
+ null == Bw || Bw.clear().catch(function() {
40560
+ }), window.addEventListener("__slide_log__", Uw.handleLogDownload), window.addEventListener("message", function(t2) {
40542
40561
  var e2;
40543
40562
  if ("@slide/_request_log_" === t2.data.type)
40544
- Bw.handleLogReport(t2.data.sessionId).catch(function() {
40563
+ Uw.handleLogReport(t2.data.sessionId).catch(function() {
40545
40564
  });
40546
40565
  else if ("@slide/_request_frozen_" === t2.data.type)
40547
- Bw.handleFrozenAllSlide();
40566
+ Uw.handleFrozenAllSlide();
40548
40567
  else if ("@slide/_request_release_" === t2.data.type)
40549
- Bw.handleReleaseAllSlide();
40568
+ Uw.handleReleaseAllSlide();
40550
40569
  else if ("@slide/_update_volume_" === t2.data.type) {
40551
40570
  var i2 = 0.5;
40552
40571
  try {
40553
40572
  i2 = parseFloat(t2.data.volume.toString());
40554
40573
  } catch (t3) {
40555
40574
  }
40556
- Bw.volumeAdjuster.volume = i2;
40575
+ Uw.volumeAdjuster.volume = i2;
40557
40576
  } else if ("@slide/_get_volume_" === t2.data.type)
40558
- window.postMessage({ type: "@slide/_report_volume_", volume: Bw.volumeAdjuster.volume, customMessage: "@slide/_report_volume_" }, "*");
40577
+ window.postMessage({ type: "@slide/_report_volume_", volume: Uw.volumeAdjuster.volume, customMessage: "@slide/_report_volume_" }, "*");
40559
40578
  else if ("@slide/_preload_slide_" === t2.data.type) {
40560
40579
  var n2 = null !== (e2 = t2.data.sessionId) && void 0 !== e2 ? e2 : Math.random().toString(32).substr(2);
40561
- Bw.preloadResource(t2.data.taskId, t2.data.prefix, t2.data.maxResolutionLevel, function(e3) {
40580
+ Uw.preloadResource(t2.data.taskId, t2.data.prefix, t2.data.maxResolutionLevel, function(e3) {
40562
40581
  window.postMessage({ type: "@slide/_preload_slide_progress_", sessionId: n2, taskId: t2.data.taskId, progress: e3 }, "*");
40563
40582
  }, t2.data.pages).catch(function(e3) {
40564
40583
  window.postMessage({ type: "@slide/_preload_slide_error_", sessionId: n2, taskId: t2.data.taskId, error: e3 }, "*");
40565
40584
  });
40566
40585
  }
40567
40586
  }), window.setInterval(function() {
40568
- Bw.flushLog().catch(function() {
40587
+ Uw.flushLog().catch(function() {
40569
40588
  });
40570
40589
  }, 2e3);
40571
40590
  }]);
@@ -41017,6 +41036,25 @@ function hexDouble(num) {
41017
41036
  return str.length < 2 ? "0" + str : str;
41018
41037
  }
41019
41038
  var ColorString = colorString.exports;
41039
+ const getAppLogger = (context) => {
41040
+ var _a;
41041
+ try {
41042
+ return (_a = context.getWindowManager()) == null ? void 0 : _a.Logger;
41043
+ } catch {
41044
+ return void 0;
41045
+ }
41046
+ };
41047
+ const reportAppLog = (appLogger, level, ...args) => {
41048
+ try {
41049
+ if (appLogger)
41050
+ appLogger[level](...args);
41051
+ else if (level === "info" || level === "debug")
41052
+ console.log(...args);
41053
+ else
41054
+ console[level](...args);
41055
+ } catch {
41056
+ }
41057
+ };
41020
41058
  class Logger {
41021
41059
  constructor(enable) {
41022
41060
  this.enable = enable;
@@ -41065,32 +41103,27 @@ class Logger {
41065
41103
  window.removeEventListener("message", this._onMessage);
41066
41104
  }
41067
41105
  log(...args) {
41068
- if (this.roomLogger) {
41069
- this.roomLogger.info(...args);
41070
- } else if (this.enable) {
41071
- console.log(...args);
41072
- }
41106
+ if (this.roomLogger || this.enable)
41107
+ reportAppLog(this.roomLogger, "info", ...args);
41073
41108
  }
41074
41109
  verbose(...args) {
41075
- if (this.roomLogger) {
41076
- this.roomLogger.debug(...args);
41077
- } else if (this.enable && this.level === "verbose") {
41078
- console.log(...args);
41110
+ if (this.roomLogger || this.enable && this.level === "verbose") {
41111
+ reportAppLog(this.roomLogger, "debug", ...args);
41079
41112
  }
41080
41113
  }
41081
41114
  warn(...args) {
41082
- if (this.roomLogger) {
41083
- this.roomLogger.warn(...args);
41084
- } else {
41085
- console.warn(...args);
41086
- }
41115
+ reportAppLog(this.roomLogger, "warn", ...args);
41116
+ }
41117
+ error(...args) {
41118
+ reportAppLog(this.roomLogger, "error", ...args);
41087
41119
  }
41088
41120
  }
41089
41121
  const logger = /* @__PURE__ */ new Logger(false);
41090
41122
  const log = /* @__PURE__ */ logger.log.bind(logger);
41091
41123
  const verbose = /* @__PURE__ */ logger.verbose.bind(logger);
41092
- const setRoomLogger = (displayer) => {
41093
- logger.roomLogger = displayer.logger;
41124
+ const setRoomLogger = (context) => {
41125
+ var _a;
41126
+ logger.roomLogger = (_a = getAppLogger(context)) != null ? _a : null;
41094
41127
  };
41095
41128
  function guessBgColor(el) {
41096
41129
  try {
@@ -41218,13 +41251,21 @@ function runNextSlideWebGLTask() {
41218
41251
  slideWebGLRunning = true;
41219
41252
  const startedAt = performance.now();
41220
41253
  log("[Slide][player-queue] start", task.label, "pending", slideWebGLTasks.length);
41221
- void Promise.resolve().then(task.run).then(() => {
41222
- log("[Slide][player-queue] done", task.label, "ms", Math.round(performance.now() - startedAt));
41223
- task.resolve();
41224
- }, (error) => {
41225
- log("[Slide][player-queue] failed", task.label, error);
41226
- task.reject(error);
41227
- }).finally(() => {
41254
+ void Promise.resolve().then(task.run).then(
41255
+ () => {
41256
+ log(
41257
+ "[Slide][player-queue] done",
41258
+ task.label,
41259
+ "ms",
41260
+ Math.round(performance.now() - startedAt)
41261
+ );
41262
+ task.resolve();
41263
+ },
41264
+ (error) => {
41265
+ log("[Slide][player-queue] failed", task.label, error);
41266
+ task.reject(error);
41267
+ }
41268
+ ).finally(() => {
41228
41269
  slideWebGLRunning = false;
41229
41270
  runNextSlideWebGLTask();
41230
41271
  });
@@ -41293,9 +41334,13 @@ class SlideControllerBase {
41293
41334
  return;
41294
41335
  }
41295
41336
  if (this._toFreeze === 1) {
41296
- this.freeze();
41337
+ void this.freeze().catch(
41338
+ (error) => logger.error("[Slide] deferred freeze failed", this.context.appId, error)
41339
+ );
41297
41340
  } else if (this._toFreeze === -1) {
41298
- this.unfreeze();
41341
+ void this.unfreeze().catch(
41342
+ (error) => logger.error("[Slide] deferred unfreeze failed", this.context.appId, error)
41343
+ );
41299
41344
  }
41300
41345
  } else if (this.pollCount < MaxPollCount) {
41301
41346
  this.pollCount++;
@@ -41337,7 +41382,7 @@ class SlideControllerBase {
41337
41382
  else
41338
41383
  await this.freeze();
41339
41384
  },
41340
- (error) => logger.warn("[Slide] resource transition failed", this.context.appId, error)
41385
+ (error) => logger.error("[Slide] resource transition failed", this.context.appId, error)
41341
41386
  );
41342
41387
  this.shouldBeActive = () => {
41343
41388
  var _a, _b, _c;
@@ -41369,19 +41414,26 @@ class SlideControllerBase {
41369
41414
  if (this.ready) {
41370
41415
  log("[Slide] freeze", this.context.appId);
41371
41416
  if (this.invisibleBehavior === "frozen") {
41372
- await enqueueSlideWebGLTransition(() => {
41373
- if (this.destroyed)
41374
- return Promise.resolve();
41375
- const destroyed = new Promise((resolve, reject) => {
41376
- const result = this.slide.frozen.call(this.slide, () => {
41377
- log("[Slide][player] frozen callback", this.context.appId);
41378
- resolve();
41379
- }, reject);
41380
- if (result)
41381
- void result.then(resolve, reject);
41382
- });
41383
- return Promise.race([destroyed, this.destroyedSignal]);
41384
- }, false, `freeze:${this.context.appId}`);
41417
+ await enqueueSlideWebGLTransition(
41418
+ () => {
41419
+ if (this.destroyed)
41420
+ return Promise.resolve();
41421
+ const destroyed = new Promise((resolve, reject) => {
41422
+ const result = this.slide.frozen.call(
41423
+ this.slide,
41424
+ () => {
41425
+ resolve();
41426
+ },
41427
+ reject
41428
+ );
41429
+ if (result)
41430
+ void result.then(resolve, reject);
41431
+ });
41432
+ return Promise.race([destroyed, this.destroyedSignal]);
41433
+ },
41434
+ false,
41435
+ `freeze:${this.context.appId}`
41436
+ );
41385
41437
  } else {
41386
41438
  this.slide.pause();
41387
41439
  }
@@ -41408,32 +41460,43 @@ class SlideControllerBase {
41408
41460
  if (this.ready) {
41409
41461
  log("[Slide] unfreeze", this.context.appId);
41410
41462
  if (this.invisibleBehavior === "frozen") {
41411
- await enqueueSlideWebGLTransition(() => {
41412
- if (this.destroyed)
41413
- return Promise.resolve();
41414
- const created = new Promise((resolve, reject) => {
41415
- const result = this.slide.release.call(this.slide, () => {
41416
- log("[Slide][player] restored callback", this.context.appId);
41417
- if (this.isLazySetupMode() && !this.shouldBeActive())
41418
- return;
41419
- this.slide.notifyFrameResize();
41420
- const state = this.context.storage.state.state;
41421
- if (state) {
41422
- log("[Slide] sync storage", JSON.stringify(state));
41423
- void this.slide.setSlideState(state).catch((error) => {
41424
- this.resourceStateUnknown = true;
41425
- logger.warn("[Slide] storage sync after release failed", this.context.appId, error);
41426
- });
41427
- }
41428
- }, () => {
41429
- log("[Slide][player] created callback", this.context.appId);
41430
- resolve();
41431
- }, reject);
41432
- if (result)
41433
- void result.then(resolve, reject);
41434
- });
41435
- return Promise.race([created, this.destroyedSignal]);
41436
- }, false, `release:${this.context.appId}`);
41463
+ await enqueueSlideWebGLTransition(
41464
+ () => {
41465
+ if (this.destroyed)
41466
+ return Promise.resolve();
41467
+ const created = new Promise((resolve, reject) => {
41468
+ const result = this.slide.release.call(
41469
+ this.slide,
41470
+ () => {
41471
+ if (this.isLazySetupMode() && !this.shouldBeActive())
41472
+ return;
41473
+ this.slide.notifyFrameResize();
41474
+ const state = this.context.storage.state.state;
41475
+ if (state) {
41476
+ log("[Slide] sync storage", JSON.stringify(state));
41477
+ void this.slide.setSlideState(state).catch((error) => {
41478
+ this.resourceStateUnknown = true;
41479
+ logger.error(
41480
+ "[Slide] storage sync after release failed",
41481
+ this.context.appId,
41482
+ error
41483
+ );
41484
+ });
41485
+ }
41486
+ },
41487
+ () => {
41488
+ resolve();
41489
+ },
41490
+ reject
41491
+ );
41492
+ if (result)
41493
+ void result.then(resolve, reject);
41494
+ });
41495
+ return Promise.race([created, this.destroyedSignal]);
41496
+ },
41497
+ false,
41498
+ `release:${this.context.appId}`
41499
+ );
41437
41500
  } else {
41438
41501
  this.slide.resume();
41439
41502
  this.slide.notifyFrameResize();
@@ -41476,7 +41539,9 @@ class SlideControllerBase {
41476
41539
  }
41477
41540
  if (state === "minimized") {
41478
41541
  log("[Slide] freeze because app state is minimized");
41479
- this.freeze();
41542
+ void this.freeze().catch(
41543
+ (error) => logger.error("[Slide] minimized freeze failed", this.context.appId, error)
41544
+ );
41480
41545
  }
41481
41546
  };
41482
41547
  this.onAppStatusChangeHandler = (payload) => {
@@ -41487,7 +41552,9 @@ class SlideControllerBase {
41487
41552
  }
41488
41553
  if (appId === this.context.appId && status === "minimized") {
41489
41554
  log("[Slide] freeze because app status is minimized");
41490
- this.freeze();
41555
+ void this.freeze().catch(
41556
+ (error) => logger.error("[Slide] minimized freeze failed", this.context.appId, error)
41557
+ );
41491
41558
  }
41492
41559
  };
41493
41560
  this.getAppStatus = () => {
@@ -41512,26 +41579,30 @@ class SlideControllerBase {
41512
41579
  }
41513
41580
  };
41514
41581
  this.onVisibilityChange = async () => {
41515
- this.visible = document.visibilityState === "visible";
41516
- if (this.isLazySetupMode() || this.managedActivity) {
41517
- await this.reconcileActivity().catch(() => void 0);
41518
- return;
41519
- }
41520
- const appStatus = this.getAppStatus();
41521
- if (!this.visible) {
41522
- this.savedIsFrozen = this.isFrozen;
41523
- log("[Slide] freeze because tab becomes invisible");
41524
- if (!this.isFrozen)
41525
- await this.freeze();
41526
- return;
41527
- }
41528
- if (appStatus === "minimized") {
41529
- log("[Slide] do nothing because app state is minimized");
41530
- return;
41531
- }
41532
- if (!this.savedIsFrozen) {
41533
- log("[Slide] unfreeze because tab becomes visible", { savedIsFrozen: this.savedIsFrozen });
41534
- await this.unfreeze();
41582
+ try {
41583
+ this.visible = document.visibilityState === "visible";
41584
+ if (this.isLazySetupMode() || this.managedActivity) {
41585
+ await this.reconcileActivity().catch(() => void 0);
41586
+ return;
41587
+ }
41588
+ const appStatus = this.getAppStatus();
41589
+ if (!this.visible) {
41590
+ this.savedIsFrozen = this.isFrozen;
41591
+ log("[Slide] freeze because tab becomes invisible");
41592
+ if (!this.isFrozen)
41593
+ await this.freeze();
41594
+ return;
41595
+ }
41596
+ if (appStatus === "minimized") {
41597
+ log("[Slide] do nothing because app state is minimized");
41598
+ return;
41599
+ }
41600
+ if (!this.savedIsFrozen) {
41601
+ log("[Slide] unfreeze because tab becomes visible", { savedIsFrozen: this.savedIsFrozen });
41602
+ await this.unfreeze();
41603
+ }
41604
+ } catch (error) {
41605
+ logger.error("[Slide] visibility transition failed", this.context.appId, error);
41535
41606
  }
41536
41607
  };
41537
41608
  const {
@@ -41558,7 +41629,7 @@ class SlideControllerBase {
41558
41629
  this.context = context;
41559
41630
  this.room = context.getRoom();
41560
41631
  this.player = this.room ? void 0 : context.getDisplayer();
41561
- setRoomLogger(this.room || this.player);
41632
+ setRoomLogger(context);
41562
41633
  this.syncStateOnceFlag = !this.context.isAddApp;
41563
41634
  this.visible = document.visibilityState === "visible";
41564
41635
  this.savedIsFrozen = false;
@@ -41593,6 +41664,10 @@ class SlideControllerBase {
41593
41664
  } else if (context.isAddApp) {
41594
41665
  log("[Slide] init by renderSlide", 1);
41595
41666
  slide.renderSlide(1);
41667
+ } else if (taskId) {
41668
+ void slide.doRenderSlide(1).catch((error) => {
41669
+ logger.error("[Slide] initial local render failed", context.appId, error);
41670
+ });
41596
41671
  }
41597
41672
  this.pollReadyState();
41598
41673
  }
@@ -41687,7 +41762,29 @@ class SlideControllerBase {
41687
41762
  resourceTimeout: options.resourceTimeout,
41688
41763
  rtcAudio: options.rtcAudio,
41689
41764
  useLocalCache: options.useLocalCache,
41690
- logger: options.logger,
41765
+ logger: {
41766
+ ...options.logger,
41767
+ error: (message, ...details) => {
41768
+ var _a2, _b2;
41769
+ logger.error(message, ...details);
41770
+ if (options.logger !== logger.roomLogger) {
41771
+ try {
41772
+ (_b2 = (_a2 = options.logger) == null ? void 0 : _a2.error) == null ? void 0 : _b2.call(_a2, message, ...details);
41773
+ } catch {
41774
+ }
41775
+ }
41776
+ },
41777
+ warn: (message, ...details) => {
41778
+ var _a2, _b2;
41779
+ logger.warn(message, ...details);
41780
+ if (options.logger !== logger.roomLogger) {
41781
+ try {
41782
+ (_b2 = (_a2 = options.logger) == null ? void 0 : _a2.warn) == null ? void 0 : _b2.call(_a2, message, ...details);
41783
+ } catch {
41784
+ }
41785
+ }
41786
+ }
41787
+ },
41691
41788
  whiteTracker: defaults.whiteTracker,
41692
41789
  timestamp: this.timestamp,
41693
41790
  customLinks: attribute.customLinks,
@@ -41704,16 +41801,23 @@ class SlideControllerBase {
41704
41801
  if (!this.destroyed) {
41705
41802
  log("[Slide] destroy slide (once)");
41706
41803
  this.destroyed = true;
41707
- this.destroyPromise = enqueueSlideWebGLTransition(() => new Promise((resolve, reject) => {
41708
- try {
41709
- this.slide.destroy.call(this.slide, () => {
41710
- log("[Slide][player] destroy callback", this.context.appId);
41711
- resolve();
41712
- }, reject);
41713
- } catch (error) {
41714
- reject(error);
41715
- }
41716
- }), true, `destroy:${this.context.appId}`);
41804
+ this.destroyPromise = enqueueSlideWebGLTransition(
41805
+ () => new Promise((resolve, reject) => {
41806
+ try {
41807
+ this.slide.destroy.call(
41808
+ this.slide,
41809
+ () => {
41810
+ resolve();
41811
+ },
41812
+ reject
41813
+ );
41814
+ } catch (error) {
41815
+ reject(error);
41816
+ }
41817
+ }),
41818
+ true,
41819
+ `destroy:${this.context.appId}`
41820
+ );
41717
41821
  this.resolveDestroyedSignal();
41718
41822
  }
41719
41823
  return (_a = this.destroyPromise) != null ? _a : Promise.resolve();
@@ -43771,25 +43875,24 @@ class SlideDocsViewer {
43771
43875
  if ((_b = this.slideController) == null ? void 0 : _b.onRenderError) {
43772
43876
  this.slideController.onRenderError(error, index);
43773
43877
  }
43774
- logger.warn("[Slide] render error", error);
43878
+ logger.error("[Slide] render error", this.appId, error);
43775
43879
  };
43776
43880
  this.onRenderStart = () => {
43777
- logger.log("[Slide][notes] hide", this.appId, "scene", this.whiteboardView.focusScenePath);
43778
43881
  this.$whiteboardView.classList.add(this.wrapClassName("wb-view-hidden"));
43882
+ logger.log("[Slide][notes] hide", this.appId, "scene", this.whiteboardView.focusScenePath);
43779
43883
  this.viewer.setPlaying();
43780
43884
  };
43781
43885
  this.onRenderEnd = () => {
43782
43886
  };
43783
43887
  this.onPageChanged = () => {
43784
43888
  clearTimeout(this._onPageChangedTimer);
43785
- logger.log("[Slide][notes] show scheduled", this.appId, "scene", this.whiteboardView.focusScenePath);
43786
43889
  this._onPageChangedTimer = setTimeout(this._onPageChanged, 200);
43787
43890
  };
43788
43891
  this._onPageChangedTimer = 0;
43789
43892
  this._onPageChanged = () => {
43790
- logger.log("[Slide][notes] show", this.appId, "scene", this.whiteboardView.focusScenePath);
43791
43893
  this.$overlay.style.opacity = "";
43792
43894
  this.$whiteboardView.classList.remove(this.wrapClassName("wb-view-hidden"));
43895
+ logger.log("[Slide][notes] show", this.appId, "scene", this.whiteboardView.focusScenePath);
43793
43896
  };
43794
43897
  this.refreshPages = () => {
43795
43898
  if (this.slideController) {
@@ -44160,13 +44263,19 @@ class SlideDocsViewer {
44160
44263
  this.offBoxSizeChange = void 0;
44161
44264
  (_b = this.contentResizeObserver) == null ? void 0 : _b.disconnect();
44162
44265
  this.contentResizeObserver = void 0;
44163
- if (this.slideController) {
44164
- const controller = this.slideController;
44165
- this.slideController = null;
44166
- await controller.destroy();
44266
+ try {
44267
+ if (this.slideController) {
44268
+ const controller = this.slideController;
44269
+ this.slideController = null;
44270
+ await controller.destroy();
44271
+ }
44272
+ } finally {
44273
+ try {
44274
+ this.viewer.unmount();
44275
+ } finally {
44276
+ this.resizableContainer.destroy(this.box);
44277
+ }
44167
44278
  }
44168
- this.viewer.unmount();
44169
- this.resizableContainer.destroy(this.box);
44170
44279
  return this;
44171
44280
  });
44172
44281
  }
@@ -44179,8 +44288,11 @@ class SlideDocsViewer {
44179
44288
  if (!this.destroyPromise) {
44180
44289
  this.destroyPromise = Promise.resolve().then(async () => {
44181
44290
  this.sideEffect.flushAll();
44182
- await this.unmount();
44183
- this.viewer.destroy();
44291
+ try {
44292
+ await this.unmount();
44293
+ } finally {
44294
+ this.viewer.destroy();
44295
+ }
44184
44296
  });
44185
44297
  }
44186
44298
  return this.destroyPromise;
@@ -44231,54 +44343,114 @@ function setFreezerLength(length) {
44231
44343
  const inspect = (arr) => {
44232
44344
  return "[" + arr + "]";
44233
44345
  };
44346
+ const FreezerRetryDelay = 500;
44234
44347
  const apps = {
44235
44348
  map: /* @__PURE__ */ new Map(),
44236
44349
  boxes: /* @__PURE__ */ new Map(),
44237
44350
  queue: [],
44238
- validateQueue() {
44351
+ focusedAppId: void 0,
44352
+ runTransition(appId, slide, action, retried = false) {
44353
+ try {
44354
+ const result = action === "freeze" ? slide.freeze() : slide.unfreeze();
44355
+ void Promise.resolve(result).catch(
44356
+ (error) => this.onTransitionFailure(appId, slide, action, error, retried)
44357
+ );
44358
+ } catch (error) {
44359
+ void Promise.resolve().then(
44360
+ () => this.onTransitionFailure(appId, slide, action, error, retried)
44361
+ );
44362
+ }
44363
+ },
44364
+ onTransitionFailure(appId, slide, action, error, retried) {
44365
+ logger.warn(`[Slide] freezer: ${action} failed`, appId, error);
44366
+ if (this.map.get(appId) !== slide)
44367
+ return;
44368
+ if (action === "freeze" && !this.queue.includes(appId))
44369
+ this.queue.push(appId);
44370
+ if (retried)
44371
+ return;
44372
+ if (action === "freeze" ? this.focusedAppId === appId : this.focusedAppId !== appId)
44373
+ return;
44374
+ setTimeout(() => {
44375
+ if (this.map.get(appId) !== slide)
44376
+ return;
44377
+ if (action === "freeze") {
44378
+ if (this.focusedAppId !== appId && this.queue.length > FreezerLength) {
44379
+ this.validateQueue(true);
44380
+ }
44381
+ } else if (this.focusedAppId === appId) {
44382
+ this.runTransition(appId, slide, action, true);
44383
+ }
44384
+ }, FreezerRetryDelay);
44385
+ },
44386
+ validateQueue(retried = false) {
44239
44387
  this.queue.sort((a, b) => {
44240
44388
  var _a, _b, _c, _d;
44241
44389
  const za = (_b = (_a = this.boxes.get(a)) == null ? void 0 : _a.zIndex) != null ? _b : 0;
44242
44390
  const zb = (_d = (_c = this.boxes.get(b)) == null ? void 0 : _c.zIndex) != null ? _d : 0;
44243
44391
  return -(za - zb);
44244
44392
  });
44245
- log("[Slide] freezer: validate", inspect(this.queue));
44393
+ const validated = [...this.queue];
44394
+ const frozen = [];
44395
+ const missing = [];
44246
44396
  while (this.queue.length > FreezerLength) {
44247
44397
  const appId = this.queue.pop();
44248
44398
  const slide = this.map.get(appId);
44249
44399
  if (slide) {
44250
- log("[Slide] freezer: validate-freeze", appId, inspect(this.queue));
44251
- slide.freeze();
44400
+ this.runTransition(appId, slide, "freeze", retried);
44401
+ frozen.push(appId);
44402
+ } else {
44403
+ missing.push(appId);
44252
44404
  }
44253
44405
  }
44406
+ return { validated, frozen, missing };
44254
44407
  },
44255
44408
  set(appId, slide, box) {
44256
- log("[Slide] freezer: add", appId, inspect(this.queue));
44257
44409
  this.map.set(appId, slide);
44258
44410
  this.boxes.set(appId, box);
44259
44411
  if (!this.queue.includes(appId)) {
44260
44412
  this.queue.unshift(appId);
44261
44413
  }
44262
- this.validateQueue();
44414
+ const { validated, frozen, missing } = this.validateQueue();
44415
+ log(
44416
+ "[Slide] freezer: add",
44417
+ appId,
44418
+ inspect(this.queue),
44419
+ "validate",
44420
+ inspect(validated),
44421
+ ...frozen.length ? ["freeze-requested", inspect(frozen)] : [],
44422
+ ...missing.length ? ["missing", inspect(missing)] : []
44423
+ );
44263
44424
  },
44264
44425
  delete(appId) {
44265
44426
  this.map.delete(appId);
44266
44427
  this.boxes.delete(appId);
44267
44428
  this.queue = this.queue.filter((id) => id !== appId);
44429
+ if (this.focusedAppId === appId)
44430
+ this.focusedAppId = void 0;
44268
44431
  log("[Slide] freezer: delete", appId, inspect(this.queue));
44269
44432
  },
44270
44433
  focus(appId) {
44434
+ this.focusedAppId = appId;
44271
44435
  const slide = this.map.get(appId);
44272
44436
  const index = this.queue.indexOf(appId);
44273
44437
  if (index > -1) {
44274
44438
  this.queue.splice(index, 1);
44275
44439
  }
44276
44440
  this.queue.unshift(appId);
44277
- this.validateQueue();
44278
- log("[Slide] freezer: focus", appId, inspect(this.queue));
44441
+ const { validated, frozen, missing } = this.validateQueue();
44279
44442
  if (slide) {
44280
- slide.unfreeze();
44281
- }
44443
+ this.runTransition(appId, slide, "unfreeze");
44444
+ }
44445
+ log(
44446
+ slide ? "[Slide] freezer: focus" : "[Slide] freezer: focus-missing",
44447
+ appId,
44448
+ inspect(this.queue),
44449
+ "validate",
44450
+ inspect(validated),
44451
+ ...frozen.length ? ["freeze-requested", inspect(frozen)] : [],
44452
+ ...missing.length ? ["missing", inspect(missing)] : []
44453
+ );
44282
44454
  }
44283
44455
  };
44284
44456
  const on_created_callbacks = /* @__PURE__ */ new Set();
@@ -44473,12 +44645,13 @@ class SlidePreviewer {
44473
44645
  }
44474
44646
  }
44475
44647
  const usePlugin = /* @__PURE__ */ Slide.Slide.usePlugin.bind(Slide.Slide);
44476
- const version = "0.2.106-beta.5";
44648
+ const version = "0.2.106";
44477
44649
  const DEFAULT_SLIDE_SETUP_READY_TIMEOUT = 5e3;
44478
44650
  const SlideApp = {
44479
44651
  kind: "Slide",
44480
44652
  setup(context) {
44481
44653
  var _a, _b, _c, _d, _e, _f, _g;
44654
+ setRoomLogger(context);
44482
44655
  console.log("[Slide] setup @ " + version);
44483
44656
  if (context.getIsWritable()) {
44484
44657
  context.storage.ensureState(EmptyAttributes);
@@ -44642,10 +44815,14 @@ const SlideApp = {
44642
44815
  return teardownPromise;
44643
44816
  };
44644
44817
  offDestroy = context.emitter.on("destroy", teardown);
44645
- const mounting = enqueueSlideWebGLTransition(() => {
44646
- if (!disposed)
44647
- docsViewer == null ? void 0 : docsViewer.mount();
44648
- }, false, `setup:${context.appId}`);
44818
+ const mounting = enqueueSlideWebGLTransition(
44819
+ () => {
44820
+ if (!disposed)
44821
+ docsViewer == null ? void 0 : docsViewer.mount();
44822
+ },
44823
+ false,
44824
+ `setup:${context.appId}`
44825
+ );
44649
44826
  const waitForFirstRender = (timeoutMs) => new Promise((resolve) => {
44650
44827
  let settled = false;
44651
44828
  let timedOut = false;