@netless/app-slide 0.0.56 → 0.1.0

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
@@ -17,99 +17,6 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- function clamp$1(value, min, max) {
21
- return Math.min(Math.max(value, min), max);
22
- }
23
- function isObj(obj) {
24
- return typeof obj === "object" && obj !== null;
25
- }
26
- function deepClone(obj) {
27
- return JSON.parse(JSON.stringify(obj));
28
- }
29
- class Logger {
30
- constructor(enable) {
31
- this.enable = enable;
32
- this.apps = {};
33
- this.level = "debug";
34
- this._onMessage = (ev) => {
35
- if (isObj(ev.data)) {
36
- if (typeof ev.data.slide === "boolean") {
37
- this.enable = ev.data.slide;
38
- } else if (ev.data.slide === "__instance") {
39
- console.log(this);
40
- }
41
- }
42
- };
43
- window.addEventListener("message", this._onMessage);
44
- }
45
- log(...args) {
46
- if (this.enable) {
47
- console.log(...args);
48
- }
49
- }
50
- verbose(...args) {
51
- if (this.enable && this.level === "verbose") {
52
- console.log(...args);
53
- }
54
- }
55
- dispose(appId) {
56
- this.enable = false;
57
- delete this.apps[appId];
58
- window.removeEventListener("message", this._onMessage);
59
- }
60
- }
61
- const logger = new Logger(false);
62
- const log = logger.log.bind(logger);
63
- const verbose = logger.verbose.bind(logger);
64
- let useFreezer = false;
65
- const FreezerLength = 2;
66
- const apps = {
67
- map: new Map(),
68
- queue: [],
69
- validateQueue() {
70
- log("[Slide] freezer: validate", this.queue);
71
- while (this.queue.length > FreezerLength) {
72
- const appId = this.queue.pop();
73
- const slide = this.map.get(appId);
74
- if (slide) {
75
- log("[Slide] freezer: validate-freeze", appId, this.queue);
76
- slide.freeze();
77
- }
78
- }
79
- },
80
- set(appId, slide) {
81
- log("[Slide] freezer: add", appId, this.queue);
82
- this.map.set(appId, slide);
83
- if (!this.queue.includes(appId)) {
84
- this.queue.unshift(appId);
85
- }
86
- this.validateQueue();
87
- },
88
- delete(appId) {
89
- log("[Slide] freezer: delete", appId, this.queue);
90
- this.map.delete(appId);
91
- this.queue = this.queue.filter((id) => id !== appId);
92
- },
93
- focus(appId) {
94
- const slide = this.map.get(appId);
95
- const index = this.queue.indexOf(appId);
96
- if (index > -1) {
97
- this.queue.splice(index, 1);
98
- }
99
- this.queue.unshift(appId);
100
- this.validateQueue();
101
- log("[Slide] freezer: focus", appId, this.queue);
102
- if (slide) {
103
- slide.unfreeze();
104
- }
105
- }
106
- };
107
- const addHooks = (emitter) => {
108
- useFreezer = true;
109
- emitter.on("focus", ({ appId }) => {
110
- apps.focus(appId);
111
- });
112
- };
113
20
  const e = "!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", s = e.length, t = Array(20), r = () => {
114
21
  for (let r2 = 0; r2 < 20; r2++)
115
22
  t[r2] = e.charAt(Math.random() * s);
@@ -117,7 +24,7 @@ const e = "!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqr
117
24
  };
118
25
  class o {
119
26
  constructor() {
120
- this.disposers = new Map();
27
+ this.disposers = /* @__PURE__ */ new Map();
121
28
  }
122
29
  add(e2, s2 = r()) {
123
30
  return this.flush(s2), this.disposers.set(s2, e2()), s2;
@@ -165,27 +72,6 @@ class o {
165
72
  }), this.disposers.clear();
166
73
  }
167
74
  }
168
- function isObject(val) {
169
- return val != null && typeof val === "object" && !Array.isArray(val);
170
- }
171
- function ensureAttributes(context, initAttrs) {
172
- let attrs = context.getAttributes();
173
- if (!attrs) {
174
- context.setAttributes(initAttrs);
175
- attrs = context.getAttributes();
176
- }
177
- if (!attrs) {
178
- throw new Error("[NetlessAppMonaco] No attributes");
179
- }
180
- if (isObject(initAttrs)) {
181
- Object.keys(initAttrs).forEach((key) => {
182
- if (!Object.prototype.hasOwnProperty.call(attrs, key)) {
183
- context.updateAttributes([key], initAttrs[key]);
184
- }
185
- });
186
- }
187
- return attrs;
188
- }
189
75
  var Slide = function(t2) {
190
76
  var e2 = {};
191
77
  function n(i) {
@@ -203,7 +89,7 @@ var Slide = function(t2) {
203
89
  return t3;
204
90
  if (4 & e3 && typeof t3 == "object" && t3 && t3.__esModule)
205
91
  return t3;
206
- var i = Object.create(null);
92
+ var i = /* @__PURE__ */ Object.create(null);
207
93
  if (n.r(i), Object.defineProperty(i, "default", { enumerable: true, value: t3 }), 2 & e3 && typeof t3 != "string")
208
94
  for (var r2 in t3)
209
95
  n.d(i, r2, function(e4) {
@@ -239,7 +125,7 @@ var Slide = function(t2) {
239
125
  function u() {
240
126
  this._events = new o2(), this._eventsCount = 0;
241
127
  }
242
- Object.create && (o2.prototype = Object.create(null), new o2().__proto__ || (r2 = false)), u.prototype.eventNames = function() {
128
+ Object.create && (o2.prototype = /* @__PURE__ */ Object.create(null), new o2().__proto__ || (r2 = false)), u.prototype.eventNames = function() {
243
129
  var t3, e3, n2 = [];
244
130
  if (this._eventsCount === 0)
245
131
  return n2;
@@ -6052,7 +5938,7 @@ var Slide = function(t2) {
6052
5938
  function u() {
6053
5939
  this._events = new o2(), this._eventsCount = 0;
6054
5940
  }
6055
- Object.create && (o2.prototype = Object.create(null), new o2().__proto__ || (r2 = false)), u.prototype.eventNames = function() {
5941
+ Object.create && (o2.prototype = /* @__PURE__ */ Object.create(null), new o2().__proto__ || (r2 = false)), u.prototype.eventNames = function() {
6056
5942
  var t3, e3, n2 = [];
6057
5943
  if (this._eventsCount === 0)
6058
5944
  return n2;
@@ -12251,7 +12137,7 @@ var Slide = function(t2) {
12251
12137
  } };
12252
12138
  }
12253
12139
  function Wo(t3, e3) {
12254
- const n2 = e3.isWebGL2, i2 = new WeakMap();
12140
+ const n2 = e3.isWebGL2, i2 = /* @__PURE__ */ new WeakMap();
12255
12141
  return { get: function(t4) {
12256
12142
  return t4.isInterleavedBufferAttribute && (t4 = t4.data), i2.get(t4);
12257
12143
  }, remove: function(e4) {
@@ -12583,7 +12469,7 @@ var Slide = function(t2) {
12583
12469
  };
12584
12470
  }
12585
12471
  function es(t3) {
12586
- let e3 = new WeakMap();
12472
+ let e3 = /* @__PURE__ */ new WeakMap();
12587
12473
  function n2(t4, e4) {
12588
12474
  return e4 === pt ? t4.mapping = ct : e4 === ft && (t4.mapping = dt), t4;
12589
12475
  }
@@ -12612,7 +12498,7 @@ var Slide = function(t2) {
12612
12498
  }
12613
12499
  return r3;
12614
12500
  }, dispose: function() {
12615
- e3 = new WeakMap();
12501
+ e3 = /* @__PURE__ */ new WeakMap();
12616
12502
  } };
12617
12503
  }
12618
12504
  function ns(t3) {
@@ -12649,7 +12535,7 @@ var Slide = function(t2) {
12649
12535
  } };
12650
12536
  }
12651
12537
  function is(t3, e3, n2, i2) {
12652
- const r3 = {}, o3 = new WeakMap();
12538
+ const r3 = {}, o3 = /* @__PURE__ */ new WeakMap();
12653
12539
  function s3(t4) {
12654
12540
  const a3 = t4.target;
12655
12541
  a3.index !== null && e3.remove(a3.index);
@@ -12788,7 +12674,7 @@ var Slide = function(t2) {
12788
12674
  } };
12789
12675
  }
12790
12676
  function us(t3, e3, n2, i2) {
12791
- let r3 = new WeakMap();
12677
+ let r3 = /* @__PURE__ */ new WeakMap();
12792
12678
  function o3(t4) {
12793
12679
  const e4 = t4.target;
12794
12680
  e4.removeEventListener("dispose", o3), n2.remove(e4.instanceMatrix), e4.instanceColor !== null && n2.remove(e4.instanceColor);
@@ -12797,7 +12683,7 @@ var Slide = function(t2) {
12797
12683
  const s3 = i2.render.frame, a2 = t4.geometry, l2 = e3.get(t4, a2);
12798
12684
  return r3.get(l2) !== s3 && (e3.update(l2), r3.set(l2, s3)), t4.isInstancedMesh && (t4.hasEventListener("dispose", o3) === false && t4.addEventListener("dispose", o3), n2.update(t4.instanceMatrix, 34962), t4.instanceColor !== null && n2.update(t4.instanceColor, 34962)), l2;
12799
12685
  }, dispose: function() {
12800
- r3 = new WeakMap();
12686
+ r3 = /* @__PURE__ */ new WeakMap();
12801
12687
  } };
12802
12688
  }
12803
12689
  Zo.physical = { uniforms: Po([Zo.standard.uniforms, { clearcoat: { value: 0 }, clearcoatMap: { value: null }, clearcoatRoughness: { value: 0 }, clearcoatRoughnessMap: { value: null }, clearcoatNormalScale: { value: new ei(1, 1) }, clearcoatNormalMap: { value: null }, sheen: { value: new Dr(0) }, transmission: { value: 0 }, transmissionMap: { value: null }, transmissionSamplerSize: { value: new ei() }, transmissionSamplerMap: { value: null }, thickness: { value: 0 }, thicknessMap: { value: null }, attenuationDistance: { value: 0 }, attenuationColor: { value: new Dr(0) } }]), vertexShader: qo.meshphysical_vert, fragmentShader: qo.meshphysical_frag };
@@ -13451,7 +13337,7 @@ var Slide = function(t2) {
13451
13337
  }, programs: s3 };
13452
13338
  }
13453
13339
  function Da() {
13454
- let t3 = new WeakMap();
13340
+ let t3 = /* @__PURE__ */ new WeakMap();
13455
13341
  return { get: function(e3) {
13456
13342
  let n2 = t3.get(e3);
13457
13343
  return n2 === void 0 && (n2 = {}, t3.set(e3, n2)), n2;
@@ -13460,7 +13346,7 @@ var Slide = function(t2) {
13460
13346
  }, update: function(e3, n2, i2) {
13461
13347
  t3.get(e3)[n2] = i2;
13462
13348
  }, dispose: function() {
13463
- t3 = new WeakMap();
13349
+ t3 = /* @__PURE__ */ new WeakMap();
13464
13350
  } };
13465
13351
  }
13466
13352
  function Fa(t3, e3) {
@@ -13498,12 +13384,12 @@ var Slide = function(t2) {
13498
13384
  } };
13499
13385
  }
13500
13386
  function ka(t3) {
13501
- let e3 = new WeakMap();
13387
+ let e3 = /* @__PURE__ */ new WeakMap();
13502
13388
  return { get: function(n2, i2) {
13503
13389
  let r3;
13504
13390
  return e3.has(n2) === false ? (r3 = new Ua(t3), e3.set(n2, [r3])) : i2 >= e3.get(n2).length ? (r3 = new Ua(t3), e3.get(n2).push(r3)) : r3 = e3.get(n2)[i2], r3;
13505
13391
  }, dispose: function() {
13506
- e3 = new WeakMap();
13392
+ e3 = /* @__PURE__ */ new WeakMap();
13507
13393
  } };
13508
13394
  }
13509
13395
  function Ga() {
@@ -13640,12 +13526,12 @@ var Slide = function(t2) {
13640
13526
  } };
13641
13527
  }
13642
13528
  function Wa(t3, e3) {
13643
- let n2 = new WeakMap();
13529
+ let n2 = /* @__PURE__ */ new WeakMap();
13644
13530
  return { get: function(i2, r3 = 0) {
13645
13531
  let o3;
13646
13532
  return n2.has(i2) === false ? (o3 = new Va(t3, e3), n2.set(i2, [o3])) : r3 >= n2.get(i2).length ? (o3 = new Va(t3, e3), n2.get(i2).push(o3)) : o3 = n2.get(i2)[r3], o3;
13647
13533
  }, dispose: function() {
13648
- n2 = new WeakMap();
13534
+ n2 = /* @__PURE__ */ new WeakMap();
13649
13535
  } };
13650
13536
  }
13651
13537
  class Xa extends Rr {
@@ -13983,7 +13869,7 @@ var Slide = function(t2) {
13983
13869
  } };
13984
13870
  }
13985
13871
  function Ja(t3, e3, n2, i2, r3, o3, s3) {
13986
- const a2 = r3.isWebGL2, l2 = r3.maxTextures, u2 = r3.maxCubemapSize, h2 = r3.maxTextureSize, c2 = r3.maxSamples, d2 = new WeakMap();
13872
+ const a2 = r3.isWebGL2, l2 = r3.maxTextures, u2 = r3.maxCubemapSize, h2 = r3.maxTextureSize, c2 = r3.maxSamples, d2 = /* @__PURE__ */ new WeakMap();
13987
13873
  let p2, f2 = false;
13988
13874
  try {
13989
13875
  f2 = typeof OffscreenCanvas != "undefined" && new OffscreenCanvas(1, 1).getContext("2d") !== null;
@@ -14460,7 +14346,7 @@ var Slide = function(t2) {
14460
14346
  super();
14461
14347
  const n2 = this, i2 = t3.state;
14462
14348
  let r3 = null, o3 = 1, s3 = null, a2 = "local-floor", l2 = null, u2 = null, h2 = null, c2 = null;
14463
- const d2 = [], p2 = new Map(), f2 = new Lo();
14349
+ const d2 = [], p2 = /* @__PURE__ */ new Map(), f2 = new Lo();
14464
14350
  f2.layers.enable(1), f2.viewport = new li();
14465
14351
  const m2 = new Lo();
14466
14352
  m2.layers.enable(2), m2.viewport = new li();
@@ -14870,7 +14756,7 @@ var Slide = function(t2) {
14870
14756
  e4.isScene !== true && (e4 = j2);
14871
14757
  const i3 = Z2.get(t4), r4 = d2.state.lights, o4 = d2.state.shadowsArray, s4 = r4.state.version, a3 = et2.getParameters(t4, r4.state, o4, e4, n3), l3 = et2.getProgramCacheKey(a3);
14872
14758
  let u3 = i3.programs;
14873
- i3.environment = t4.isMeshStandardMaterial ? e4.environment : null, i3.fog = e4.fog, i3.envMap = K2.get(t4.envMap || i3.environment), u3 === void 0 && (t4.addEventListener("dispose", wt2), u3 = new Map(), i3.programs = u3);
14759
+ i3.environment = t4.isMeshStandardMaterial ? e4.environment : null, i3.fog = e4.fog, i3.envMap = K2.get(t4.envMap || i3.environment), u3 === void 0 && (t4.addEventListener("dispose", wt2), u3 = /* @__PURE__ */ new Map(), i3.programs = u3);
14874
14760
  let h3 = u3.get(l3);
14875
14761
  if (h3 !== void 0) {
14876
14762
  if (i3.currentProgram === h3 && i3.lightsStateVersion === s4)
@@ -22440,7 +22326,7 @@ var Slide = function(t2) {
22440
22326
  i2 === void 0 ? console.warn("PixiJS Deprecation Warning: ", e3 + "\nDeprecated since v" + t3) : (i2 = i2.split("\n").splice(n2).join("\n"), console.groupCollapsed ? (console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s", "color:#614108;background:#fffbe6", "font-weight:normal;color:#614108;background:#fffbe6", e3 + "\nDeprecated since v" + t3), console.warn(i2), console.groupEnd()) : (console.warn("PixiJS Deprecation Warning: ", e3 + "\nDeprecated since v" + t3), console.warn(i2))), Yv[e3] = true;
22441
22327
  }
22442
22328
  }
22443
- var Jv = {}, Kv = Object.create(null), $v = Object.create(null);
22329
+ var Jv = {}, Kv = /* @__PURE__ */ Object.create(null), $v = /* @__PURE__ */ Object.create(null);
22444
22330
  function Qv() {
22445
22331
  var t3;
22446
22332
  for (t3 in Kv)
@@ -28216,7 +28102,7 @@ var Slide = function(t2) {
28216
28102
  return n2.dropShadow && (m2 += n2.dropShadowDistance), new t3(e3, n2, p2, m2, l2, u2, f2 + n2.leading, h2, s3);
28217
28103
  }, t3.wordWrap = function(e3, n2, i2) {
28218
28104
  i2 === void 0 && (i2 = t3._canvas);
28219
- for (var r3 = i2.getContext("2d"), o3 = 0, s3 = "", a2 = "", l2 = Object.create(null), u2 = n2.letterSpacing, h2 = n2.whiteSpace, c2 = t3.collapseSpaces(h2), d2 = t3.collapseNewlines(h2), p2 = !c2, f2 = n2.wordWrapWidth + u2, m2 = t3.tokenize(e3), g2 = 0; g2 < m2.length; g2++) {
28105
+ for (var r3 = i2.getContext("2d"), o3 = 0, s3 = "", a2 = "", l2 = /* @__PURE__ */ Object.create(null), u2 = n2.letterSpacing, h2 = n2.whiteSpace, c2 = t3.collapseSpaces(h2), d2 = t3.collapseNewlines(h2), p2 = !c2, f2 = n2.wordWrapWidth + u2, m2 = t3.tokenize(e3), g2 = 0; g2 < m2.length; g2++) {
28220
28106
  var v2 = m2[g2];
28221
28107
  if (t3.isNewline(v2)) {
28222
28108
  if (!d2) {
@@ -30188,7 +30074,7 @@ void main() {
30188
30074
  calcFps() {
30189
30075
  requestAnimationFrame((t3) => {
30190
30076
  const e3 = t3 - this.prevTime;
30191
- this.valueTotal += e3, this.times += 1, this.times > 20 && (this.value = Math.floor(800 * this.times / this.valueTotal), this.valueTotal = 0, this.times = 0, this.destroyed || this.emit("update", this.value)), this.prevTime = t3, this.destroyed || this.calcFps();
30077
+ this.valueTotal += e3, this.times += 1, this.times > 20 && (this.value = Math.floor(1e3 * this.times / this.valueTotal), this.valueTotal = 0, this.times = 0, this.destroyed || this.emit("update", this.value)), this.prevTime = t3, this.destroyed || this.calcFps();
30192
30078
  });
30193
30079
  }
30194
30080
  destroy() {
@@ -30459,7 +30345,7 @@ void main() {
30459
30345
  };
30460
30346
  class aM {
30461
30347
  constructor(t3) {
30462
- this.gifs = Object.create(null), this.textures = Object.create(null), this.frames = Object.create(null), this.spriteSheets = [], this.loader = t3;
30348
+ this.gifs = /* @__PURE__ */ Object.create(null), this.textures = /* @__PURE__ */ Object.create(null), this.frames = /* @__PURE__ */ Object.create(null), this.spriteSheets = [], this.loader = t3;
30463
30349
  }
30464
30350
  getTexture(t3) {
30465
30351
  return this.textures[t3] || null;
@@ -30492,7 +30378,7 @@ void main() {
30492
30378
  });
30493
30379
  }
30494
30380
  destroy() {
30495
- this.spriteSheets.forEach((t3) => t3.destroy(true)), this.spriteSheets = [], this.gifs = Object.create(null), this.textures = Object.create(null), this.frames = Object.create(null);
30381
+ this.spriteSheets.forEach((t3) => t3.destroy(true)), this.spriteSheets = [], this.gifs = /* @__PURE__ */ Object.create(null), this.textures = /* @__PURE__ */ Object.create(null), this.frames = /* @__PURE__ */ Object.create(null);
30496
30382
  }
30497
30383
  }
30498
30384
  var lM = n(3), uM = n.n(lM);
@@ -30590,7 +30476,7 @@ void main() {
30590
30476
  };
30591
30477
  class gM {
30592
30478
  constructor() {
30593
- this.imgElements = [], this.svgElements = [], this.idToHashMap = Object.create(null), this.textures = Object.create(null), this.graphics = [], this.hashToIdMap = Object.create(null);
30479
+ this.imgElements = [], this.svgElements = [], this.idToHashMap = /* @__PURE__ */ Object.create(null), this.textures = /* @__PURE__ */ Object.create(null), this.graphics = [], this.hashToIdMap = /* @__PURE__ */ Object.create(null);
30594
30480
  }
30595
30481
  render(t3, e3, n2) {
30596
30482
  return mM(this, void 0, void 0, function* () {
@@ -30687,7 +30573,7 @@ void main() {
30687
30573
  Object.keys(this.textures).forEach((t3) => {
30688
30574
  var e3;
30689
30575
  (e3 = this.textures[t3]) === null || e3 === void 0 || e3.texture.destroy(true);
30690
- }), this.textures = Object.create(null), this.imgElements.forEach((t3) => fM.collectObject(t3)), this.svgElements.forEach((t3) => pM.collectObject(t3)), this.graphics = [];
30576
+ }), this.textures = /* @__PURE__ */ Object.create(null), this.imgElements.forEach((t3) => fM.collectObject(t3)), this.svgElements.forEach((t3) => pM.collectObject(t3)), this.graphics = [];
30691
30577
  }
30692
30578
  }
30693
30579
  class vM {
@@ -30706,7 +30592,7 @@ void main() {
30706
30592
  }
30707
30593
  class _M {
30708
30594
  constructor(t3) {
30709
- this.eventHub = t3, this.targets = Object.create(null);
30595
+ this.eventHub = t3, this.targets = /* @__PURE__ */ Object.create(null);
30710
30596
  }
30711
30597
  getTargets() {
30712
30598
  return Object.keys(this.targets).map((t3) => this.targets[t3]);
@@ -30723,7 +30609,7 @@ void main() {
30723
30609
  return t3.type !== "shape" ? o3 : (t3.type === "shape" && t3.txEl && (o3 = (i2 = o3 == null ? void 0 : o3.getTextElement(t3.txEl.type, t3.txEl.range)) !== null && i2 !== void 0 ? i2 : null), t3.type === "shape" && t3.bg && n2.index === 0 && (e3 = false, o3 = (r3 = o3 == null ? void 0 : o3.getBgElement()) !== null && r3 !== void 0 ? r3 : null, this.eventHub.emit("IterateTimeNodeEnd", n2.id)), e3 && o3 ? o3.getIterateEntry(n2.type, n2.index, n2.id) : (o3 || this.eventHub.emit("IterateTimeNodeEnd", n2.id), o3));
30724
30610
  }
30725
30611
  clearTargets() {
30726
- this.targets = Object.create(null);
30612
+ this.targets = /* @__PURE__ */ Object.create(null);
30727
30613
  }
30728
30614
  }
30729
30615
  class yM {
@@ -34004,7 +33890,7 @@ void main(void){
34004
33890
  };
34005
33891
  class kR {
34006
33892
  constructor(t3, e3, n2, i2, r3, o3, s3) {
34007
- this.loader = t3, this.mode = e3, this.renderer = n2, this.ticker = i2, this.view = r3, this.clock = o3, this.objPoolGroup = s3, this.currentStageIndex = 0, this.cacheCount = BR.isDesktop() ? 2 : 1, this.stageStates = Object.create(null), this.stageJsons = Object.create(null), this.stageCtxs = Object.create(null), this.stageImpls = Object.create(null), this.taskId = "", this.url = "", this.microTaskManager = new RR(i2);
33893
+ this.loader = t3, this.mode = e3, this.renderer = n2, this.ticker = i2, this.view = r3, this.clock = o3, this.objPoolGroup = s3, this.currentStageIndex = 0, this.cacheCount = BR.isDesktop() ? 2 : 1, this.stageStates = /* @__PURE__ */ Object.create(null), this.stageJsons = /* @__PURE__ */ Object.create(null), this.stageCtxs = /* @__PURE__ */ Object.create(null), this.stageImpls = /* @__PURE__ */ Object.create(null), this.taskId = "", this.url = "", this.microTaskManager = new RR(i2);
34008
33894
  }
34009
33895
  setSnapshotCache(t3) {
34010
33896
  this.snapshotCache = t3;
@@ -34015,7 +33901,7 @@ void main(void){
34015
33901
  createCtx(t3) {
34016
33902
  const { task: e3 } = this.stageStates[t3];
34017
33903
  e3.addMTask(() => {
34018
- const e4 = new aM(this.loader), n2 = new a.a(), i2 = { mode: this.mode, renderer: this.renderer, graphicsTexture: new gM(), stageWidth: 0, stageHeight: 0, ticker: this.ticker, timingTargets: new _M(n2), eventHub: n2, view: this.view, medias: Object.create(null), lastViewedIndex: 0, conflictTimeNodeManager: new vM(), clock: this.clock, spriteTexture: e4, slideIndex: t3, objectPoolGroup: this.objPoolGroup, hasBackgroundFillShape: false, slideScopeEventHub: new a.a() };
33904
+ const e4 = new aM(this.loader), n2 = new a.a(), i2 = { mode: this.mode, renderer: this.renderer, graphicsTexture: new gM(), stageWidth: 0, stageHeight: 0, ticker: this.ticker, timingTargets: new _M(n2), eventHub: n2, view: this.view, medias: /* @__PURE__ */ Object.create(null), lastViewedIndex: 0, conflictTimeNodeManager: new vM(), clock: this.clock, spriteTexture: e4, slideIndex: t3, objectPoolGroup: this.objPoolGroup, hasBackgroundFillShape: false, slideScopeEventHub: new a.a() };
34019
33905
  return this.stageCtxs[t3] = i2, Promise.resolve();
34020
33906
  });
34021
33907
  }
@@ -34147,7 +34033,7 @@ void main(void){
34147
34033
  }, this.fps.on("update", (t4) => {
34148
34034
  if (t4 < this.config.minFPS) {
34149
34035
  if (this.config.autoResolution) {
34150
- const t5 = this.scale * this.config.resolution * 0.7, e4 = this.app.renderer.resolution, n3 = Math.max(t5, e4 - 0.1);
34036
+ const t5 = 0.7 * this.scale, e4 = this.app.renderer.resolution, n3 = Math.max(t5, e4 - 0.1);
34151
34037
  n3 >= t5 && this.updateResolution(n3);
34152
34038
  }
34153
34039
  if (this.config.autoFPS) {
@@ -34262,7 +34148,7 @@ void main(void){
34262
34148
  updateResolution(t3) {
34263
34149
  this.app.ticker.addOnce(() => {
34264
34150
  let e3 = BR.isDesktop() ? t3 : 1;
34265
- for (; e3 * this.designWidth > 2560 || e3 * this.designHeight > 2560; )
34151
+ for (; e3 * this.designWidth > 5120 || e3 * this.designHeight > 5120; )
34266
34152
  e3 -= 0.1;
34267
34153
  this.app.renderer.resolution = e3, this.app.renderer.plugins.interaction.resolution = this.app.renderer.resolution, this.app.renderer.resize(this.designWidth, this.designHeight);
34268
34154
  });
@@ -34401,7 +34287,7 @@ void main(void){
34401
34287
  return true;
34402
34288
  var i2 = (n2 = (e3 = t3) === null || e3 === void 0 ? void 0 : e3.ownerDocument) === null || n2 === void 0 ? void 0 : n2.defaultView;
34403
34289
  return !!(i2 && t3 instanceof i2.Element);
34404
- }, tP = typeof window != "undefined" ? window : {}, eP = new WeakMap(), nP = /auto|scroll/, iP = /^tb|vertical/, rP = /msie|trident/i.test(tP.navigator && tP.navigator.userAgent), oP = function(t3) {
34290
+ }, tP = typeof window != "undefined" ? window : {}, eP = /* @__PURE__ */ new WeakMap(), nP = /auto|scroll/, iP = /^tb|vertical/, rP = /msie|trident/i.test(tP.navigator && tP.navigator.userAgent), oP = function(t3) {
34405
34291
  return parseFloat(t3 || "0");
34406
34292
  }, sP = function(t3, e3, n2) {
34407
34293
  return t3 === void 0 && (t3 = 0), e3 === void 0 && (e3 = 0), n2 === void 0 && (n2 = false), new ZR((n2 ? e3 : t3) || 0, (n2 ? t3 : e3) || 0);
@@ -34547,7 +34433,7 @@ void main(void){
34547
34433
  }, t3;
34548
34434
  }(), EP = function(t3, e3) {
34549
34435
  this.activeTargets = [], this.skippedTargets = [], this.observationTargets = [], this.observer = t3, this.callback = e3;
34550
- }, MP = new WeakMap(), AP = function(t3, e3) {
34436
+ }, MP = /* @__PURE__ */ new WeakMap(), AP = function(t3, e3) {
34551
34437
  for (var n2 = 0; n2 < t3.length; n2 += 1)
34552
34438
  if (t3[n2].target === e3)
34553
34439
  return n2;
@@ -34721,7 +34607,7 @@ void main(void){
34721
34607
  });
34722
34608
  }
34723
34609
  return t3.prototype.replaceIdleTask = function() {
34724
- for (var t4, e3 = this, n2 = new Set(), i2 = 0, r3 = this.tasks.length; i2 < r3; i2++)
34610
+ for (var t4, e3 = this, n2 = /* @__PURE__ */ new Set(), i2 = 0, r3 = this.tasks.length; i2 < r3; i2++)
34725
34611
  this.tasks[i2].state === "idle" && ((t4 = this.tasks[i2 + 1]) === null || t4 === void 0 ? void 0 : t4.state) === "idle" && n2.add(i2);
34726
34612
  Array.from(n2).forEach(function(t5) {
34727
34613
  e3.tasks.splice(t5, 1);
@@ -35701,11 +35587,13 @@ void main(void){
35701
35587
  return t3.prototype.createStats = function() {
35702
35588
  var t4 = this;
35703
35589
  this.stateId = setInterval(function() {
35704
- t4.player.view && (t4.controller.runTimeFps.setValue(t4.player.runtime.fps), t4.controller.runTimeResolution.setValue(t4.player.view.width + "*" + t4.player.view.height));
35590
+ t4.player.view && (t4.controller.runTimeFps.setValue(t4.player.fps.value), t4.controller.drawCall.setValue(t4.player.runtime.drawCall), t4.controller.runTimeResolution.setValue(t4.player.view.width + "*" + t4.player.view.height));
35705
35591
  }, 500);
35706
35592
  }, t3.prototype.createControllerGUI = function() {
35707
35593
  var t4, e3, n2, i2, r3, o3 = new GC({ autoPlace: true, closed: true });
35708
- return o3.domElement.style.opacity = ".6", o3.domElement.style.transformOrigin = "100% 0", o3.domElement.style.transform = "scale(1.4)", this.target.appendChild(o3.domElement), o3.domElement.style.position = "absolute", o3.domElement.style.right = "0", o3.domElement.style.top = "0", o3.domElement.style.zIndex = "2", this.controller = { runTimeFps: o3.add({ FPS: 0 }, "FPS", 0), runTimeResolution: o3.add({ "\u5206\u8FA8\u7387": "" }, "\u5206\u8FA8\u7387", ""), autoResolution: o3.add({ "\u81EA\u52A8\u5206\u8FA8\u7387": (t4 = this.data.autoResolution) !== null && t4 !== void 0 && t4 }, "\u81EA\u52A8\u5206\u8FA8\u7387", true), autoFps: o3.add({ "\u81EA\u52A8fps": (e3 = this.data.autoFPS) === null || e3 === void 0 || e3 }, "\u81EA\u52A8fps", true), moreCalculation: o3.add({ "\u989D\u5916\u8BA1\u7B97": 0 }, "\u989D\u5916\u8BA1\u7B97", 0, 100), minFPS: o3.add({ "\u6700\u4F4Efps": (n2 = this.data.minFPS) !== null && n2 !== void 0 ? n2 : 40 }, "\u6700\u4F4Efps", 0, 60), maxFPS: o3.add({ "\u6700\u9AD8fps": (i2 = this.data.maxFPS) !== null && i2 !== void 0 ? i2 : 50 }, "\u6700\u9AD8fps", 0, 60), resolution: o3.add({ "\u76EE\u6807\u5206\u8FA8\u500D\u7387": (r3 = this.data.resolution) !== null && r3 !== void 0 ? r3 : window.devicePixelRatio }, "\u76EE\u6807\u5206\u8FA8\u500D\u7387", 0.5, 4) }, this.controller.runTimeFps.disabled = true, this.controller.runTimeResolution.disabled = true, o3;
35594
+ o3.domElement.style.opacity = ".6", o3.domElement.style.transformOrigin = "100% 0", o3.domElement.style.transform = "scale(1)", this.target.appendChild(o3.domElement), o3.domElement.style.position = "absolute", o3.domElement.style.right = "0", o3.domElement.style.top = "0", o3.domElement.style.zIndex = "2";
35595
+ var s3 = o3.add({ FPS: 0 }, "FPS", 0), a2 = o3.add({ drawCall: 0 }, "drawCall", 0), l2 = o3.add({ "\u5206\u8FA8\u7387": "" }, "\u5206\u8FA8\u7387", ""), u2 = o3.add({ "\u989D\u5916\u8BA1\u7B97": 0 }, "\u989D\u5916\u8BA1\u7B97", 0, 200), h2 = o3.addFolder("renderOptions");
35596
+ return this.controller = { runTimeResolution: l2, runTimeFps: s3, drawCall: a2, moreCalculation: u2, minFPS: h2.add({ "\u6700\u4F4Efps": (t4 = this.data.minFPS) !== null && t4 !== void 0 ? t4 : 40 }, "\u6700\u4F4Efps", 0, 60), maxFPS: h2.add({ "\u6700\u9AD8fps": (e3 = this.data.maxFPS) !== null && e3 !== void 0 ? e3 : 50 }, "\u6700\u9AD8fps", 0, 60), resolution: h2.add({ "\u76EE\u6807\u5206\u8FA8\u500D\u7387": (n2 = this.data.resolution) !== null && n2 !== void 0 ? n2 : window.devicePixelRatio }, "\u76EE\u6807\u5206\u8FA8\u500D\u7387", 0.5, 6), autoResolution: h2.add({ "\u81EA\u52A8\u5206\u8FA8\u7387": (i2 = this.data.autoResolution) !== null && i2 !== void 0 && i2 }, "\u81EA\u52A8\u5206\u8FA8\u7387", true), autoFps: h2.add({ "\u81EA\u52A8fps": (r3 = this.data.autoFPS) === null || r3 === void 0 || r3 }, "\u81EA\u52A8fps", true), transactionBgColor: h2.addColor({ "\u5207\u9875\u80CC\u666F\u8272": this.data.transactionBgColor }, "\u5207\u9875\u80CC\u666F\u8272") }, this.controller.runTimeFps.disabled = true, this.controller.runTimeResolution.disabled = true, o3;
35709
35597
  }, t3.prototype.addEventListener = function() {
35710
35598
  var t4, e3 = this;
35711
35599
  this.controller.autoFps.onChange(function(t5) {
@@ -35718,6 +35606,8 @@ void main(void){
35718
35606
  e3.data.autoResolution = t5, e3.player.updateConfig(e3.data);
35719
35607
  }), this.controller.resolution.onChange(function(t5) {
35720
35608
  e3.data.resolution = t5, e3.player.updateConfig(e3.data);
35609
+ }), this.controller.transactionBgColor.onChange(function(t5) {
35610
+ e3.data.transactionBgColor = t5, e3.player.updateConfig(e3.data);
35721
35611
  }), this.controller.moreCalculation.onChange(function(n2) {
35722
35612
  t4 && e3.player.app.ticker.remove(t4), n2 > 0 && (t4 = function() {
35723
35613
  for (var t5 = ""; t5.length < 8e3 * n2; )
@@ -35746,7 +35636,7 @@ void main(void){
35746
35636
  }, t3;
35747
35637
  }(), jC = function() {
35748
35638
  function t3() {
35749
- this.autoUnlock = Object.create(null), this.locks = Object.create(null);
35639
+ this.autoUnlock = /* @__PURE__ */ Object.create(null), this.locks = /* @__PURE__ */ Object.create(null);
35750
35640
  }
35751
35641
  return t3.prototype.addLock = function(t4, e3) {
35752
35642
  var n2 = this;
@@ -35893,9 +35783,9 @@ void main(void){
35893
35783
  });
35894
35784
  });
35895
35785
  }
35896
- var $C = { syncDispatch: "syncDispatch", syncReceive: "syncReceive", renderStart: "renderStart", renderEnd: "renderEnd", renderError: "renderError", slideChange: "slideChange", mainSeqStepStart: "mainSeqStepStart", mainSeqStepEnd: "mainSeqStepEnd", animateStart: "animateStart", animateEnd: "animateEnd", stateChange: "stateChange" }, QC = { taskId: "", url: "", currentSlideIndex: -1, mainSeqStep: -1, mainSeqState: null, mediaState: Object.create(null), interactiveSeqState: Object.create(null) }, tI = "";
35786
+ var $C = { syncDispatch: "syncDispatch", syncReceive: "syncReceive", renderStart: "renderStart", renderEnd: "renderEnd", renderError: "renderError", slideChange: "slideChange", mainSeqStepStart: "mainSeqStepStart", mainSeqStepEnd: "mainSeqStepEnd", animateStart: "animateStart", animateEnd: "animateEnd", stateChange: "stateChange" }, QC = { taskId: "", url: "", currentSlideIndex: -1, mainSeqStep: -1, mainSeqState: null, mediaState: /* @__PURE__ */ Object.create(null), interactiveSeqState: /* @__PURE__ */ Object.create(null) }, tI = "";
35897
35787
  try {
35898
- tI = "0.2.2";
35788
+ tI = "0.2.6";
35899
35789
  } catch (t3) {
35900
35790
  tI = "dev";
35901
35791
  }
@@ -36020,7 +35910,7 @@ void main(void){
36020
35910
  }), n2.renderingTaskManager.eventHub.on("task-error", function(t4) {
36021
35911
  var e5 = t4.error, i2 = t4.task;
36022
35912
  n2.emit($C.renderError, { error: e5, index: i2.slideIndex });
36023
- }), window.addEventListener("__slide_log__", n2.handleLogDownload), window.addEventListener("__slide_state__", n2.handleSlideStateLog), window.addEventListener("__slide_ref__", n2.handleSlideRef), n2.persistLogId = window.setInterval(n2.persistLog, 5e3), n2.resizeView = Object(l.debounce)(n2.resizeView.bind(n2), 50), n2.player = n2.initPlayer(e4), n2.player.view && n2.frame.appendChild(n2.player.view), n2.handleViewClick = Object(l.debounce)(n2.handleViewClick, 300), n2;
35913
+ }), window.addEventListener("__slide_log__", n2.handleLogDownload), window.addEventListener("__slide_state__", n2.handleSlideStateLog), window.addEventListener("__slide_ref__", n2.handleSlideRef), n2.persistLogId = window.setInterval(n2.persistLog, 5e3), n2.resizeView = Object(l.debounce)(n2.resizeView.bind(n2), 50), n2.player = n2.initPlayer(e4), (e4 == null ? void 0 : e4.controller) && n2.createController(), n2.player.view && n2.frame.appendChild(n2.player.view), n2.handleViewClick = Object(l.debounce)(n2.handleViewClick, 300), n2;
36024
35914
  }
36025
35915
  return VC(e3, t3), e3.prototype.initPlayer = function(t4) {
36026
35916
  var e4, n2, i2, r3 = this, o3 = new jR(this.mode);
@@ -36057,7 +35947,7 @@ void main(void){
36057
35947
  }), o3.on(zR.mediaSeek, function(t5) {
36058
35948
  var e5 = { type: "pause", time: 0 };
36059
35949
  t5.isPlaying ? (e5.type = "play", r3.__slideState.mediaState[t5.id] ? e5.time = r3.__slideState.mediaState[t5.id].time - 1e3 * t5.time : e5.time = r3.timestamp() - 1e3 * t5.time, r3.__slideState.mediaState[t5.id] = e5) : (e5.type = "pause", e5.time = t5.time, r3.__slideState.mediaState[t5.id] = e5), r3.emitSyncDispatch({ slideIndex: r3.__slideState.currentSlideIndex, type: "mediaSeek", id: t5.id, time: t5.time, state: e5 }), r3.emitStateChange();
36060
- }), o3.on(zR.requestPrevSlide, this.handlePrevSlide), o3.on(zR.requestNextSlide, this.handleNextSlide), o3.on(zR.requestGotoSlide, this.handleGotoSlide), (e4 = o3.view) === null || e4 === void 0 || e4.addEventListener("touchend", this.handleViewTouchEnd), (n2 = o3.view) === null || n2 === void 0 || n2.addEventListener("touchstart", this.handleViewTouchStart), (i2 = o3.view) === null || i2 === void 0 || i2.addEventListener("click", this.handleViewClick), o3.on(zR.userInput, this.userInputHandle), (t4 == null ? void 0 : t4.controller) && this.createController(), o3;
35950
+ }), o3.on(zR.requestPrevSlide, this.handlePrevSlide), o3.on(zR.requestNextSlide, this.handleNextSlide), o3.on(zR.requestGotoSlide, this.handleGotoSlide), (e4 = o3.view) === null || e4 === void 0 || e4.addEventListener("touchend", this.handleViewTouchEnd), (n2 = o3.view) === null || n2 === void 0 || n2.addEventListener("touchstart", this.handleViewTouchStart), (i2 = o3.view) === null || i2 === void 0 || i2.addEventListener("click", this.handleViewClick), o3.on(zR.userInput, this.userInputHandle), o3;
36061
35951
  }, e3.prototype.createController = function() {
36062
35952
  this.player && (this.playerController = new HC({ player: this.player, params: this.player.config || {}, target: this.frame }));
36063
35953
  }, e3.prototype.setMedianControllerAttribute = function() {
@@ -36182,21 +36072,21 @@ void main(void){
36182
36072
  }, e3.prototype.poseRenderSlide = function(t4, e4) {
36183
36073
  this.isLoading = true, this.mode === "interactive" ? this.emitSyncDispatch({ slideIndex: this.__slideState.currentSlideIndex, type: "renderSlide", index: t4, isForward: e4 }) : this.mode === "sync" ? (this.doRenderSlide(t4, e4), this.emitSyncDispatch({ slideIndex: this.__slideState.currentSlideIndex, type: "renderSlide", index: t4, isForward: e4 })) : this.doRenderSlide(t4, e4);
36184
36074
  }, e3.prototype.doRenderSlide = function(t4, e4) {
36185
- var n2, i2 = this;
36075
+ var n2, i2, r3, o3 = this;
36186
36076
  if (e4 === void 0 && (e4 = true), !this.player)
36187
36077
  return Promise.resolve();
36188
36078
  if (this.needCreateNewPlayer() && (this.iosResetCache = [], this.iosNewPlayer = this.initPlayer(this.config), this.iosNewPlayer.setResourceData(this.__slideState.taskId, this.__slideState.url)), this.iosNewPlayer) {
36189
- var r3 = this.player.getSnapshot();
36190
- this.cacheImage.src = r3, this.frame.appendChild(this.cacheImage), this.player.destroy(), this.player = this.iosNewPlayer, this.iosNewPlayer = void 0, this.needClearCacheImage = true, ((n2 = this == null ? void 0 : this.player) === null || n2 === void 0 ? void 0 : n2.view) && (this.player.view.style.visibility = "hidden", this.frame.appendChild(this.player.view));
36079
+ var s3 = this.player.getSnapshot();
36080
+ this.cacheImage.src = s3, this.frame.appendChild(this.cacheImage), this.player.destroy(), (n2 = this.playerController) === null || n2 === void 0 || n2.destroy(), this.player = this.iosNewPlayer, this.iosNewPlayer = void 0, ((i2 = this.config) === null || i2 === void 0 ? void 0 : i2.controller) && this.createController(), this.needClearCacheImage = true, ((r3 = this == null ? void 0 : this.player) === null || r3 === void 0 ? void 0 : r3.view) && (this.player.view.style.visibility = "hidden", this.frame.appendChild(this.player.view));
36191
36081
  }
36192
- var o3 = Math.random().toString(32).substr(2);
36082
+ var a2 = Math.random().toString(32).substr(2);
36193
36083
  return this.player.isForward = e4, this.renderingTaskManager.addTask(function() {
36194
- return i2._renderSlide(t4);
36195
- }, t4, o3), new Promise(function(t5) {
36196
- i2.renderingTaskManager.eventHub.once("task-end-" + o3, t5);
36084
+ return o3._renderSlide(t4);
36085
+ }, t4, a2), new Promise(function(t5) {
36086
+ o3.renderingTaskManager.eventHub.once("task-end-" + a2, t5);
36197
36087
  });
36198
36088
  }, e3.prototype.nextStep = function() {
36199
- !this.isLoading && this.player && (this.player.mainSeqHasNextStep() ? this.mode === "interactive" ? this.emitSyncDispatch({ slideIndex: this.__slideState.currentSlideIndex, type: "nextStep", next: this.player.mainSeqStep() + 1 }) : this.mode === "sync" ? (this.doNextStep(), this.emitSyncDispatch({ slideIndex: this.__slideState.currentSlideIndex, type: "nextStep", next: this.player.mainSeqStep() })) : this.doNextStep() : this.handleNextSlide());
36089
+ !this.isLoading && this.player && this.interactive && (this.player.mainSeqHasNextStep() ? this.mode === "interactive" ? this.emitSyncDispatch({ slideIndex: this.__slideState.currentSlideIndex, type: "nextStep", next: this.player.mainSeqStep() + 1 }) : this.mode === "sync" ? (this.doNextStep(), this.emitSyncDispatch({ slideIndex: this.__slideState.currentSlideIndex, type: "nextStep", next: this.player.mainSeqStep() })) : this.doNextStep() : this.handleNextSlide());
36200
36090
  }, e3.prototype.doNextStep = function() {
36201
36091
  if (this.player) {
36202
36092
  this.player.nextStep();
@@ -36204,7 +36094,7 @@ void main(void){
36204
36094
  this.__slideState.mainSeqStep = t4, this.emitStateChange();
36205
36095
  }
36206
36096
  }, e3.prototype.prevStep = function() {
36207
- !this.isLoading && this.player && (this.player.mainSeqHasPrevStep() ? this.mode === "interactive" ? this.emitSyncDispatch({ type: "prevStep", slideIndex: this.__slideState.currentSlideIndex, next: this.player.mainSeqStep() - 1 }) : this.mode === "sync" ? (this.doPrevStep(), this.emitSyncDispatch({ slideIndex: this.__slideState.currentSlideIndex, type: "prevStep", next: this.player.mainSeqStep() })) : this.doPrevStep() : this.handlePrevSlide());
36097
+ !this.isLoading && this.player && this.interactive && (this.player.mainSeqHasPrevStep() ? this.mode === "interactive" ? this.emitSyncDispatch({ type: "prevStep", slideIndex: this.__slideState.currentSlideIndex, next: this.player.mainSeqStep() - 1 }) : this.mode === "sync" ? (this.doPrevStep(), this.emitSyncDispatch({ slideIndex: this.__slideState.currentSlideIndex, type: "prevStep", next: this.player.mainSeqStep() })) : this.doPrevStep() : this.handlePrevSlide());
36208
36098
  }, e3.prototype.doPrevStep = function() {
36209
36099
  if (this.player) {
36210
36100
  this.player.prevStep();
@@ -36257,23 +36147,23 @@ void main(void){
36257
36147
  });
36258
36148
  });
36259
36149
  }, e3.prototype.release = function() {
36260
- var t4;
36150
+ var t4, e4;
36261
36151
  return XC(this, void 0, void 0, function() {
36262
- var e4, n2, i2, r3, o3 = this;
36263
- return qC(this, function(s3) {
36264
- switch (s3.label) {
36152
+ var n2, i2, r3, o3, s3 = this;
36153
+ return qC(this, function(a2) {
36154
+ switch (a2.label) {
36265
36155
  case 0:
36266
36156
  if (this.isReleasing)
36267
36157
  return [2, KC(function() {
36268
- return !o3.isReleasing;
36158
+ return !s3.isReleasing;
36269
36159
  }, 6e4)];
36270
- for (n2 in this.isReleasing = true, this.player = this.initPlayer(this.config), this.player.view && (this.frame.appendChild(this.player.view), this.player.view.style.visibility = "hidden"), e4 = this.__slideState, this.__slideState = Object(l.cloneDeep)(QC), e4.mediaState)
36271
- (i2 = e4.mediaState[n2]).type === "play" && (r3 = Math.max((t4 = i2.frozenTime) !== null && t4 !== void 0 ? t4 : 0, i2.time), i2.time = this.timestamp() - (r3 - i2.time), i2.frozenTime = void 0);
36272
- return [4, this.setSlideState(e4)];
36160
+ for (i2 in this.isReleasing = true, this.player = this.initPlayer(this.config), ((t4 = this.config) === null || t4 === void 0 ? void 0 : t4.controller) && this.createController(), this.player.view && (this.frame.appendChild(this.player.view), this.player.view.style.visibility = "hidden"), n2 = this.__slideState, this.__slideState = Object(l.cloneDeep)(QC), n2.mediaState)
36161
+ (r3 = n2.mediaState[i2]).type === "play" && (o3 = Math.max((e4 = r3.frozenTime) !== null && e4 !== void 0 ? e4 : 0, r3.time), r3.time = this.timestamp() - (o3 - r3.time), r3.frozenTime = void 0);
36162
+ return [4, this.setSlideState(n2)];
36273
36163
  case 1:
36274
- return s3.sent(), [4, this.player.clock.delay(333)];
36164
+ return a2.sent(), [4, this.player.clock.delay(333)];
36275
36165
  case 2:
36276
- s3.sent(), this.player.view && (this.player.view.style.visibility = "visible");
36166
+ a2.sent(), this.player.view && (this.player.view.style.visibility = "visible");
36277
36167
  try {
36278
36168
  this.frame.removeChild(this.cacheImage);
36279
36169
  } catch (t5) {
@@ -36287,7 +36177,7 @@ void main(void){
36287
36177
  this.playerController && this.playerController.destroy(), this.frameResizeObserver.disconnect(), (t4 = this.player) === null || t4 === void 0 || t4.removeAllListeners(), (e4 = this.player) === null || e4 === void 0 || e4.destroy(), (n2 = this.player) === null || n2 === void 0 || n2.removeAllListeners(), window.removeEventListener("__slide_log__", this.handleLogDownload), window.removeEventListener("__slide_state__", this.handleSlideStateLog), window.removeEventListener("__slide_ref__", this.handleSlideRef), window.clearInterval(this.persistLogId), YC && YC.removeItem(this.logId).catch(function() {
36288
36178
  });
36289
36179
  try {
36290
- ((i2 = this.player) === null || i2 === void 0 ? void 0 : i2.view) && this.anchor.removeChild(this.player.view);
36180
+ ((i2 = this.player) === null || i2 === void 0 ? void 0 : i2.view) && this.anchor.removeChild(this.player.view), this.anchor.removeChild(this.frame);
36291
36181
  } catch (t5) {
36292
36182
  }
36293
36183
  }, e3.disposeLocalCache = function() {
@@ -36295,6 +36185,15 @@ void main(void){
36295
36185
  }, e3;
36296
36186
  }(a.a);
36297
36187
  }]);
36188
+ function clamp$1(value, min, max) {
36189
+ return Math.min(Math.max(value, min), max);
36190
+ }
36191
+ function isObj(obj) {
36192
+ return typeof obj === "object" && obj !== null;
36193
+ }
36194
+ function deepClone(obj) {
36195
+ return JSON.parse(JSON.stringify(obj));
36196
+ }
36298
36197
  var colorString = { exports: {} };
36299
36198
  var colorName = {
36300
36199
  "aliceblue": [240, 248, 255],
@@ -36652,6 +36551,41 @@ function hexDouble(num) {
36652
36551
  return str.length < 2 ? "0" + str : str;
36653
36552
  }
36654
36553
  var ColorString = colorString.exports;
36554
+ class Logger {
36555
+ constructor(enable) {
36556
+ this.enable = enable;
36557
+ this.apps = {};
36558
+ this.level = "debug";
36559
+ this._onMessage = (ev) => {
36560
+ if (isObj(ev.data)) {
36561
+ if (typeof ev.data.slide === "boolean") {
36562
+ this.enable = ev.data.slide;
36563
+ } else if (ev.data.slide === "__instance") {
36564
+ console.log(this);
36565
+ }
36566
+ }
36567
+ };
36568
+ window.addEventListener("message", this._onMessage);
36569
+ }
36570
+ log(...args) {
36571
+ if (this.enable) {
36572
+ console.log(...args);
36573
+ }
36574
+ }
36575
+ verbose(...args) {
36576
+ if (this.enable && this.level === "verbose") {
36577
+ console.log(...args);
36578
+ }
36579
+ }
36580
+ dispose(appId) {
36581
+ this.enable = false;
36582
+ delete this.apps[appId];
36583
+ window.removeEventListener("message", this._onMessage);
36584
+ }
36585
+ }
36586
+ const logger = new Logger(false);
36587
+ const log = logger.log.bind(logger);
36588
+ const verbose = logger.verbose.bind(logger);
36655
36589
  function guessBgColor(el) {
36656
36590
  try {
36657
36591
  const bg = window.getComputedStyle(el).backgroundColor;
@@ -36748,29 +36682,21 @@ class SlideController {
36748
36682
  payload: event
36749
36683
  };
36750
36684
  log("[Slide] dispatch", event);
36751
- this.room.dispatchMagixEvent(this.channel, payload);
36685
+ this.context.dispatchMagixEvent(Slide.SLIDE_EVENTS.syncDispatch, payload);
36752
36686
  }
36753
36687
  };
36754
36688
  this.magixEventListener = (ev) => {
36755
- if (ev.event === this.channel && isObj(ev.payload)) {
36756
- const { type, payload } = ev.payload;
36757
- if (type === Slide.SLIDE_EVENTS.syncDispatch) {
36758
- this.syncStateOnce();
36759
- log("[Slide] receive", payload);
36760
- this.slide.emit(Slide.SLIDE_EVENTS.syncReceive, payload);
36761
- }
36689
+ const { type, payload } = ev.payload;
36690
+ if (type === Slide.SLIDE_EVENTS.syncDispatch) {
36691
+ this.syncStateOnce();
36692
+ log("[Slide] receive", payload);
36693
+ this.slide.emit(Slide.SLIDE_EVENTS.syncReceive, payload);
36762
36694
  }
36763
36695
  };
36764
36696
  this.onStateChange = (state) => {
36765
36697
  if (this.context.getIsWritable()) {
36766
36698
  verbose("[Slide] state change", JSON.stringify(state, null, 2));
36767
- this.context.updateAttributes(["state"], state);
36768
- }
36769
- };
36770
- this.onSeeked = () => {
36771
- const state = this.context.getAttributes().state;
36772
- if (state) {
36773
- this.slide.setSlideState(deepClone(state));
36699
+ this.context.storage.setState({ state });
36774
36700
  }
36775
36701
  };
36776
36702
  this.pollCount = 0;
@@ -36835,7 +36761,6 @@ class SlideController {
36835
36761
  this.onTransitionEnd = onTransitionEnd;
36836
36762
  this.onError = onError;
36837
36763
  this.context = context;
36838
- this.channel = `channel-${context.appId}`;
36839
36764
  this.room = context.getRoom();
36840
36765
  this.player = this.room ? void 0 : context.getDisplayer();
36841
36766
  this.slide = this.createSlide(anchor);
@@ -36875,17 +36800,9 @@ class SlideController {
36875
36800
  });
36876
36801
  return disposer;
36877
36802
  });
36878
- this.sideEffect.add(() => {
36879
- context.emitter.on("seek", this.onSeeked);
36880
- return () => context.emitter.off("seek", this.onSeeked);
36881
- });
36882
- this.sideEffect.add(() => {
36883
- const displayer = context.getDisplayer();
36884
- displayer.addMagixEventListener(this.channel, this.magixEventListener, {
36885
- fireSelfEventAfterCommit: true
36886
- });
36887
- return () => displayer.removeMagixEventListener(this.channel);
36888
- });
36803
+ this.sideEffect.add(() => context.addMagixEventListener(Slide.SLIDE_EVENTS.syncDispatch, this.magixEventListener, {
36804
+ fireSelfEventAfterCommit: true
36805
+ }));
36889
36806
  slide.on(Slide.SLIDE_EVENTS.slideChange, this.onPageChanged);
36890
36807
  slide.on(Slide.SLIDE_EVENTS.renderStart, this.onTransitionStart);
36891
36808
  slide.on(Slide.SLIDE_EVENTS.renderEnd, this.onTransitionEnd);
@@ -36898,7 +36815,7 @@ class SlideController {
36898
36815
  }
36899
36816
  syncStateOnce() {
36900
36817
  if (this.syncStateOnceFlag) {
36901
- const { state } = __spreadValues(__spreadValues({}, EmptyAttributes), this.context.getAttributes());
36818
+ const { state } = __spreadValues(__spreadValues({}, EmptyAttributes), this.context.storage.state);
36902
36819
  if (state) {
36903
36820
  log("[Slide] sync with state (once)", deepClone(state));
36904
36821
  this.slide.setSlideState(deepClone(state));
@@ -37916,7 +37833,7 @@ class DocsViewer {
37916
37833
  return `${this.namespace}-${className}`;
37917
37834
  }
37918
37835
  }
37919
- const ClickThroughAppliances = new Set(["clicker"]);
37836
+ const ClickThroughAppliances = /* @__PURE__ */ new Set(["clicker"]);
37920
37837
  class SlideDocsViewer {
37921
37838
  constructor({ box, view, mountSlideController, mountWhiteboard }) {
37922
37839
  this.slideController = null;
@@ -38060,6 +37977,55 @@ class SlideDocsViewer {
38060
37977
  return `${this.namespace}-${className}`;
38061
37978
  }
38062
37979
  }
37980
+ let useFreezer = false;
37981
+ const FreezerLength = 2;
37982
+ const apps = {
37983
+ map: /* @__PURE__ */ new Map(),
37984
+ queue: [],
37985
+ validateQueue() {
37986
+ log("[Slide] freezer: validate", this.queue);
37987
+ while (this.queue.length > FreezerLength) {
37988
+ const appId = this.queue.pop();
37989
+ const slide = this.map.get(appId);
37990
+ if (slide) {
37991
+ log("[Slide] freezer: validate-freeze", appId, this.queue);
37992
+ slide.freeze();
37993
+ }
37994
+ }
37995
+ },
37996
+ set(appId, slide) {
37997
+ log("[Slide] freezer: add", appId, this.queue);
37998
+ this.map.set(appId, slide);
37999
+ if (!this.queue.includes(appId)) {
38000
+ this.queue.unshift(appId);
38001
+ }
38002
+ this.validateQueue();
38003
+ },
38004
+ delete(appId) {
38005
+ log("[Slide] freezer: delete", appId, this.queue);
38006
+ this.map.delete(appId);
38007
+ this.queue = this.queue.filter((id) => id !== appId);
38008
+ },
38009
+ focus(appId) {
38010
+ const slide = this.map.get(appId);
38011
+ const index = this.queue.indexOf(appId);
38012
+ if (index > -1) {
38013
+ this.queue.splice(index, 1);
38014
+ }
38015
+ this.queue.unshift(appId);
38016
+ this.validateQueue();
38017
+ log("[Slide] freezer: focus", appId, this.queue);
38018
+ if (slide) {
38019
+ slide.unfreeze();
38020
+ }
38021
+ }
38022
+ };
38023
+ const addHooks = (emitter) => {
38024
+ useFreezer = true;
38025
+ emitter.on("focus", ({ appId }) => {
38026
+ apps.focus(appId);
38027
+ });
38028
+ };
38063
38029
  var styles = ".netless-app-slide-content{position:relative;height:100%;overflow:hidden}.netless-app-slide-preview-mask{display:none;position:absolute;z-index:200;top:0;left:0;width:100%;height:100%}.netless-app-slide-preview{display:flex;flex-direction:column;align-items:center;position:absolute;z-index:300;top:0;left:0;width:33%;max-width:200px;height:100%;padding-top:10px;transform:translate(-100%);background:rgba(237,237,240,.9);box-shadow:inset -1px 0 #0000001c;transition:transform .4s}.netless-app-slide-preview-active .netless-app-slide-preview-mask{display:block}.netless-app-slide-preview-active .netless-app-slide-preview{transform:translate(0)}.netless-app-slide-preview-page{position:relative;display:block;width:55%;margin-bottom:10px;font-size:0;color:transparent;outline:none;border:7px solid transparent;border-radius:4px;transition:border-color .3s;user-select:none}.netless-app-slide-preview-page:hover,.netless-app-slide-preview-page.netless-app-slide-preview-page-active{border-color:#444e601a}.netless-app-slide-preview-page>img{width:100%;height:auto;box-sizing:border-box;border:1px solid rgba(0,0,0,.5);border-radius:1px;background-color:#fff;box-shadow:0 2px 8px #0000004d}.netless-app-slide-preview-page-name{position:absolute;top:1px;left:-10px;transform:translate(-100%);text-align:right;font-size:12px;color:#5f5f5f;user-select:none}.netless-app-slide-footer{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;border-top:1px solid #eeeef7;color:#191919}.netless-app-slide-float-footer{width:100%;min-height:26px;position:absolute;left:0;bottom:0;z-index:2000;background:rgba(249,249,252,.9);transition:opacity .4s}.netless-app-slide-footer-btn{box-sizing:border-box;width:26px;height:26px;font-size:0;margin:0;padding:3px;border:none;border-radius:1px;outline:none;color:currentColor;background:transparent;transition:background .4s;cursor:pointer;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0)}.netless-app-slide-footer-btn:hover{background:rgba(237,237,240,.9)}@media (hover: none){.netless-app-slide-footer-btn:hover{background:transparent!important}}.netless-app-slide-footer-btn>svg{width:100%;height:100%}.netless-app-slide-footer-btn>svg:nth-of-type(2){display:none}.netless-app-slide-footer-btn.netless-app-slide-footer-btn-playing>svg:nth-of-type(1){display:none}.netless-app-slide-footer-btn.netless-app-slide-footer-btn-playing>svg:nth-of-type(2){display:initial}.netless-app-slide-footer-btn~.netless-app-slide-footer-btn{margin-left:15px}.netless-app-slide-page-jumps{flex:1;display:flex;justify-content:center;align-items:center}.netless-app-slide-page-number{margin-left:auto;font-size:13px;user-select:none;white-space:nowrap;word-break:keep-all}.netless-app-slide-page-number-input{border:none;outline:none;width:3em;margin:0;padding:0 2px;text-align:right;font-size:13px;line-height:1;font-weight:400;font-family:inherit;border-radius:2px;color:currentColor;background:transparent;transition:background .4s;user-select:text;-webkit-tap-highlight-color:rgba(0,0,0,0)}.netless-app-slide-page-number-input:hover,.netless-app-slide-page-number-input:focus,.netless-app-slide-page-number-input:active{background:#fff;box-shadow:#63636333 0 2px 8px}.netless-app-slide-readonly.netless-app-slide-footer{display:none}.telebox-color-scheme-dark .netless-app-slide-page-number-input{color:#a6a6a8}.telebox-color-scheme-dark .netless-app-slide-page-number-input:active,.telebox-color-scheme-dark .netless-app-slide-page-number-input:focus,.telebox-color-scheme-dark .netless-app-slide-page-number-input:hover{color:#222}.telebox-color-scheme-dark .netless-app-slide-footer{color:#a6a6a8;background:#2d2d33;border-top:none}.telebox-color-scheme-dark .netless-app-slide-footer-btn:hover{background:#212126}.telebox-color-scheme-dark .netless-app-slide-preview{background:rgba(50,50,50,.9)}.netless-app-slide-wb-view{position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;overflow:hidden}.netless-app-slide-slide{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.netless-app-slide-slide canvas{transform:scale(var(--netless-app-slide-scale, 1))}\n";
38064
38030
  function previewSlide({
38065
38031
  container,
@@ -38217,16 +38183,15 @@ class SlidePreviewer {
38217
38183
  return `${this.namespace}-${className}`;
38218
38184
  }
38219
38185
  }
38220
- const version = "0.0.56";
38186
+ const version = "0.1.0";
38221
38187
  const SlideApp = {
38222
38188
  kind: "Slide",
38223
38189
  setup(context) {
38224
38190
  console.log("[Slide] setup @ " + version);
38225
38191
  if (context.getIsWritable()) {
38226
- ensureAttributes(context, EmptyAttributes);
38192
+ context.storage.ensureState(EmptyAttributes);
38227
38193
  }
38228
- const attributes = context.getAttributes();
38229
- if (!(attributes == null ? void 0 : attributes.taskId)) {
38194
+ if (!context.storage.state.taskId) {
38230
38195
  throw new Error("[Slide] no taskId");
38231
38196
  }
38232
38197
  const view = context.getView();
@@ -38313,6 +38278,56 @@ const SlideApp = {
38313
38278
  }
38314
38279
  });
38315
38280
  docsViewer.mount();
38281
+ return {
38282
+ slide: () => {
38283
+ var _a;
38284
+ return (_a = docsViewer == null ? void 0 : docsViewer.slideController) == null ? void 0 : _a.slide;
38285
+ },
38286
+ nextStep: () => {
38287
+ var _a;
38288
+ if (docsViewer && docsViewer.slideController) {
38289
+ (_a = docsViewer == null ? void 0 : docsViewer.slideController) == null ? void 0 : _a.slide.nextStep();
38290
+ return true;
38291
+ }
38292
+ return false;
38293
+ },
38294
+ prevStep: () => {
38295
+ var _a;
38296
+ if (docsViewer && docsViewer.slideController) {
38297
+ (_a = docsViewer == null ? void 0 : docsViewer.slideController) == null ? void 0 : _a.slide.prevStep();
38298
+ return true;
38299
+ }
38300
+ return false;
38301
+ },
38302
+ position: () => {
38303
+ const controller = docsViewer == null ? void 0 : docsViewer.slideController;
38304
+ if (controller) {
38305
+ return [controller.page, controller.pageCount];
38306
+ }
38307
+ },
38308
+ nextPage: () => {
38309
+ const controller = docsViewer == null ? void 0 : docsViewer.slideController;
38310
+ if (controller) {
38311
+ const { page, pageCount } = controller;
38312
+ if (pageCount > 0 && page < pageCount) {
38313
+ controller.jumpToPage(page + 1);
38314
+ return true;
38315
+ }
38316
+ }
38317
+ return false;
38318
+ },
38319
+ prevPage: () => {
38320
+ const controller = docsViewer == null ? void 0 : docsViewer.slideController;
38321
+ if (controller) {
38322
+ const { page, pageCount } = controller;
38323
+ if (pageCount > 0 && page > 1) {
38324
+ controller.jumpToPage(page - 1);
38325
+ return true;
38326
+ }
38327
+ }
38328
+ return false;
38329
+ }
38330
+ };
38316
38331
  }
38317
38332
  };
38318
38333
  export { DefaultUrl, FreezerLength, SlidePreviewer, addHooks, apps, SlideApp as default, previewSlide, version };