pptx-react-viewer 2.14.0 → 2.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/{AiChatPanel-BJDFFVJG.js → AiChatPanel-JWCGIYBL.js} +22 -22
  3. package/dist/AiChatPanel-JWCGIYBL.js.br +0 -0
  4. package/dist/AiChatPanel-JWCGIYBL.js.gz +0 -0
  5. package/dist/{AiChatPanel-UJUN6HB3.mjs → AiChatPanel-YDX2WONS.mjs} +3 -3
  6. package/dist/AiChatPanel-YDX2WONS.mjs.br +0 -0
  7. package/dist/AiChatPanel-YDX2WONS.mjs.gz +0 -0
  8. package/dist/{Model3DScene-F53NQFY7.js → Model3DScene-4FFR5CF5.js} +2 -2
  9. package/dist/Model3DScene-4FFR5CF5.js.br +0 -0
  10. package/dist/Model3DScene-4FFR5CF5.js.gz +0 -0
  11. package/dist/{Model3DScene-LVFHZUVF.mjs → Model3DScene-ZVWROBJT.mjs} +1 -1
  12. package/dist/Model3DScene-ZVWROBJT.mjs.br +0 -0
  13. package/dist/Model3DScene-ZVWROBJT.mjs.gz +0 -0
  14. package/dist/{SurfaceChart3DScene-MVBQTD6J.mjs → SurfaceChart3DScene-PJLRTJLR.mjs} +1 -1
  15. package/dist/{SurfaceChart3DScene-MVBQTD6J.mjs.br → SurfaceChart3DScene-PJLRTJLR.mjs.br} +0 -0
  16. package/dist/SurfaceChart3DScene-PJLRTJLR.mjs.gz +0 -0
  17. package/dist/{SurfaceChart3DScene-IDJDIHVC.js → SurfaceChart3DScene-WEH6CLAU.js} +2 -2
  18. package/dist/SurfaceChart3DScene-WEH6CLAU.js.br +0 -0
  19. package/dist/SurfaceChart3DScene-WEH6CLAU.js.gz +0 -0
  20. package/dist/{chunk-5MMC7ZR3.mjs → chunk-7TFVXCBY.mjs} +406 -222
  21. package/dist/chunk-7TFVXCBY.mjs.br +0 -0
  22. package/dist/chunk-7TFVXCBY.mjs.gz +0 -0
  23. package/dist/{chunk-HOIF5RQI.js → chunk-BHDUV2LM.js} +1052 -1052
  24. package/dist/chunk-BHDUV2LM.js.br +0 -0
  25. package/dist/chunk-BHDUV2LM.js.gz +0 -0
  26. package/dist/{chunk-GROIHKI5.mjs → chunk-ESUQSKGF.mjs} +9 -9
  27. package/dist/chunk-ESUQSKGF.mjs.br +0 -0
  28. package/dist/chunk-ESUQSKGF.mjs.gz +0 -0
  29. package/dist/{chunk-SMECSYCT.js → chunk-KFGVJONB.js} +245 -245
  30. package/dist/chunk-KFGVJONB.js.br +0 -0
  31. package/dist/chunk-KFGVJONB.js.gz +0 -0
  32. package/dist/{chunk-T4NHPN76.mjs → chunk-LCDAL2JQ.mjs} +2 -2
  33. package/dist/chunk-LCDAL2JQ.mjs.br +0 -0
  34. package/dist/chunk-LCDAL2JQ.mjs.gz +0 -0
  35. package/dist/{chunk-QVQDC7HZ.js → chunk-LZDGIEN3.js} +3 -3
  36. package/dist/chunk-LZDGIEN3.js.br +0 -0
  37. package/dist/chunk-LZDGIEN3.js.gz +0 -0
  38. package/dist/{chunk-7TEZJZ2O.js → chunk-OEK3VKSO.js} +334 -334
  39. package/dist/chunk-OEK3VKSO.js.br +0 -0
  40. package/dist/chunk-OEK3VKSO.js.gz +0 -0
  41. package/dist/{chunk-2KRHLUCG.mjs → chunk-YAWRDLCV.mjs} +1 -1
  42. package/dist/chunk-YAWRDLCV.mjs.br +0 -0
  43. package/dist/chunk-YAWRDLCV.mjs.gz +0 -0
  44. package/dist/{chunk-R7MGJCZN.mjs → chunk-YUPKCGB5.mjs} +2 -2
  45. package/dist/chunk-YUPKCGB5.mjs.br +0 -0
  46. package/dist/chunk-YUPKCGB5.mjs.gz +0 -0
  47. package/dist/{chunk-PB7KVDNV.js → chunk-Z3FYYUGI.js} +410 -221
  48. package/dist/chunk-Z3FYYUGI.js.br +0 -0
  49. package/dist/chunk-Z3FYYUGI.js.gz +0 -0
  50. package/dist/index.js +39 -39
  51. package/dist/index.js.br +0 -0
  52. package/dist/index.js.gz +0 -0
  53. package/dist/index.mjs +5 -5
  54. package/dist/index.mjs.br +0 -0
  55. package/dist/index.mjs.gz +0 -0
  56. package/dist/internals.js +78 -78
  57. package/dist/internals.js.br +0 -0
  58. package/dist/internals.js.gz +0 -0
  59. package/dist/internals.mjs +3 -3
  60. package/dist/internals.mjs.br +0 -0
  61. package/dist/internals.mjs.gz +0 -0
  62. package/dist/viewer/index.d.ts +60 -2
  63. package/dist/viewer/index.d.ts.map +1 -1
  64. package/dist/viewer/index.js +41 -21
  65. package/dist/viewer/index.js.br +0 -0
  66. package/dist/viewer/index.js.gz +0 -0
  67. package/dist/viewer/index.mjs +5 -5
  68. package/dist/viewer/index.mjs.br +0 -0
  69. package/dist/viewer/index.mjs.gz +0 -0
  70. package/package.json +2 -2
  71. package/dist/AiChatPanel-BJDFFVJG.js.br +0 -0
  72. package/dist/AiChatPanel-BJDFFVJG.js.gz +0 -0
  73. package/dist/AiChatPanel-UJUN6HB3.mjs.br +0 -0
  74. package/dist/AiChatPanel-UJUN6HB3.mjs.gz +0 -0
  75. package/dist/Model3DScene-F53NQFY7.js.br +0 -0
  76. package/dist/Model3DScene-F53NQFY7.js.gz +0 -0
  77. package/dist/Model3DScene-LVFHZUVF.mjs.br +0 -0
  78. package/dist/Model3DScene-LVFHZUVF.mjs.gz +0 -0
  79. package/dist/SurfaceChart3DScene-IDJDIHVC.js.br +0 -0
  80. package/dist/SurfaceChart3DScene-IDJDIHVC.js.gz +0 -0
  81. package/dist/SurfaceChart3DScene-MVBQTD6J.mjs.gz +0 -0
  82. package/dist/chunk-2KRHLUCG.mjs.br +0 -0
  83. package/dist/chunk-2KRHLUCG.mjs.gz +0 -0
  84. package/dist/chunk-5MMC7ZR3.mjs.br +0 -0
  85. package/dist/chunk-5MMC7ZR3.mjs.gz +0 -0
  86. package/dist/chunk-7TEZJZ2O.js.br +0 -0
  87. package/dist/chunk-7TEZJZ2O.js.gz +0 -0
  88. package/dist/chunk-GROIHKI5.mjs.br +0 -0
  89. package/dist/chunk-GROIHKI5.mjs.gz +0 -0
  90. package/dist/chunk-HOIF5RQI.js.br +0 -0
  91. package/dist/chunk-HOIF5RQI.js.gz +0 -0
  92. package/dist/chunk-PB7KVDNV.js.br +0 -0
  93. package/dist/chunk-PB7KVDNV.js.gz +0 -0
  94. package/dist/chunk-QVQDC7HZ.js.br +0 -0
  95. package/dist/chunk-QVQDC7HZ.js.gz +0 -0
  96. package/dist/chunk-R7MGJCZN.mjs.br +0 -0
  97. package/dist/chunk-R7MGJCZN.mjs.gz +0 -0
  98. package/dist/chunk-SMECSYCT.js.br +0 -0
  99. package/dist/chunk-SMECSYCT.js.gz +0 -0
  100. package/dist/chunk-T4NHPN76.mjs.br +0 -0
  101. package/dist/chunk-T4NHPN76.mjs.gz +0 -0
@@ -20769,7 +20769,7 @@ var PptxNativeAnimationService = class {
20769
20769
  const accel = parseTimingPercentFraction(cTn["@_accel"]);
20770
20770
  const decel = parseTimingPercentFraction(cTn["@_decel"]);
20771
20771
  let trigger = currentTrigger;
20772
- if (nodeType === "afterPrevious" || nodeType === "afterPrev") {
20772
+ if (nodeType === "afterEffect" || nodeType === "afterPrevious" || nodeType === "afterPrev") {
20773
20773
  trigger = "afterPrevious";
20774
20774
  } else if (nodeType === "withPrevious" || nodeType === "withEffect") {
20775
20775
  trigger = "withPrevious";
@@ -115127,6 +115127,375 @@ function slideStatusLabel(verb, current, total) {
115127
115127
  function isExportAbortError(err) {
115128
115128
  return err instanceof DOMException && err.name === "AbortError";
115129
115129
  }
115130
+ var AUTOSAVE_DB_NAME = "pptx-viewer-autosave";
115131
+ var AUTOSAVE_DB_VERSION = 1;
115132
+ var AUTOSAVE_STORE_NAME = "recoveryVersions";
115133
+ function openAutosaveDb() {
115134
+ return new Promise((resolve2, reject) => {
115135
+ const req = indexedDB.open(AUTOSAVE_DB_NAME, AUTOSAVE_DB_VERSION);
115136
+ req.onupgradeneeded = () => {
115137
+ const db = req.result;
115138
+ if (!db.objectStoreNames.contains(AUTOSAVE_STORE_NAME)) {
115139
+ db.createObjectStore(AUTOSAVE_STORE_NAME, { keyPath: "key" });
115140
+ }
115141
+ };
115142
+ req.onsuccess = () => resolve2(req.result);
115143
+ req.onerror = () => reject(req.error);
115144
+ });
115145
+ }
115146
+ async function deleteOldestAutosaveEntry() {
115147
+ const db = await openAutosaveDb();
115148
+ return new Promise((resolve2) => {
115149
+ try {
115150
+ const tx = db.transaction(AUTOSAVE_STORE_NAME, "readwrite");
115151
+ const store = tx.objectStore(AUTOSAVE_STORE_NAME);
115152
+ let oldestKey = null;
115153
+ let oldestTimestamp = Infinity;
115154
+ const cursorReq = store.openCursor();
115155
+ cursorReq.onsuccess = () => {
115156
+ const cursor = cursorReq.result;
115157
+ if (cursor) {
115158
+ const value = cursor.value;
115159
+ if (typeof value.timestamp === "number" && value.timestamp < oldestTimestamp) {
115160
+ oldestTimestamp = value.timestamp;
115161
+ oldestKey = cursor.primaryKey;
115162
+ }
115163
+ cursor.continue();
115164
+ } else if (oldestKey !== null) {
115165
+ store.delete(oldestKey);
115166
+ }
115167
+ };
115168
+ tx.oncomplete = () => {
115169
+ db.close();
115170
+ resolve2(oldestKey !== null);
115171
+ };
115172
+ tx.onerror = () => {
115173
+ db.close();
115174
+ resolve2(false);
115175
+ };
115176
+ } catch {
115177
+ try {
115178
+ db.close();
115179
+ } catch {
115180
+ }
115181
+ resolve2(false);
115182
+ }
115183
+ });
115184
+ }
115185
+ function putAutosaveRecord(filePath, data) {
115186
+ return openAutosaveDb().then(
115187
+ (db) => new Promise((resolve2, reject) => {
115188
+ const tx = db.transaction(AUTOSAVE_STORE_NAME, "readwrite");
115189
+ const store = tx.objectStore(AUTOSAVE_STORE_NAME);
115190
+ store.put({
115191
+ key: filePath,
115192
+ data,
115193
+ timestamp: Date.now(),
115194
+ size: data.byteLength
115195
+ });
115196
+ tx.oncomplete = () => {
115197
+ db.close();
115198
+ resolve2(true);
115199
+ };
115200
+ tx.onerror = () => {
115201
+ db.close();
115202
+ reject(tx.error);
115203
+ };
115204
+ })
115205
+ );
115206
+ }
115207
+ async function getAutosaveSnapshot(filePath) {
115208
+ const db = await openAutosaveDb();
115209
+ return new Promise((resolve2) => {
115210
+ const tx = db.transaction(AUTOSAVE_STORE_NAME, "readonly");
115211
+ const store = tx.objectStore(AUTOSAVE_STORE_NAME);
115212
+ const req = store.get(filePath);
115213
+ req.onsuccess = () => {
115214
+ db.close();
115215
+ resolve2(req.result);
115216
+ };
115217
+ req.onerror = () => {
115218
+ db.close();
115219
+ resolve2(void 0);
115220
+ };
115221
+ });
115222
+ }
115223
+ async function listAutosaveSnapshots() {
115224
+ const db = await openAutosaveDb();
115225
+ return new Promise((resolve2) => {
115226
+ const results = [];
115227
+ try {
115228
+ const tx = db.transaction(AUTOSAVE_STORE_NAME, "readonly");
115229
+ const store = tx.objectStore(AUTOSAVE_STORE_NAME);
115230
+ const cursorReq = store.openCursor();
115231
+ cursorReq.onsuccess = () => {
115232
+ const cursor = cursorReq.result;
115233
+ if (cursor) {
115234
+ const val2 = cursor.value;
115235
+ results.push({ key: val2.key, timestamp: val2.timestamp, size: val2.size });
115236
+ cursor.continue();
115237
+ }
115238
+ };
115239
+ tx.oncomplete = () => {
115240
+ db.close();
115241
+ resolve2(results);
115242
+ };
115243
+ tx.onerror = () => {
115244
+ db.close();
115245
+ resolve2([]);
115246
+ };
115247
+ } catch {
115248
+ try {
115249
+ db.close();
115250
+ } catch {
115251
+ }
115252
+ resolve2([]);
115253
+ }
115254
+ });
115255
+ }
115256
+ async function deleteAutosaveSnapshot(filePath) {
115257
+ const db = await openAutosaveDb();
115258
+ return new Promise((resolve2) => {
115259
+ try {
115260
+ const tx = db.transaction(AUTOSAVE_STORE_NAME, "readwrite");
115261
+ const store = tx.objectStore(AUTOSAVE_STORE_NAME);
115262
+ store.delete(filePath);
115263
+ tx.oncomplete = () => {
115264
+ db.close();
115265
+ resolve2(true);
115266
+ };
115267
+ tx.onerror = () => {
115268
+ db.close();
115269
+ resolve2(false);
115270
+ };
115271
+ } catch {
115272
+ try {
115273
+ db.close();
115274
+ } catch {
115275
+ }
115276
+ resolve2(false);
115277
+ }
115278
+ });
115279
+ }
115280
+ async function saveAutosaveSnapshot(filePath, data) {
115281
+ try {
115282
+ return await putAutosaveRecord(filePath, data);
115283
+ } catch (err) {
115284
+ const errName = err instanceof Error || err instanceof DOMException ? err.name : "";
115285
+ if (errName !== "QuotaExceededError") {
115286
+ throw err;
115287
+ }
115288
+ const deleted = await deleteOldestAutosaveEntry();
115289
+ if (!deleted) {
115290
+ throw err;
115291
+ }
115292
+ return putAutosaveRecord(filePath, data);
115293
+ }
115294
+ }
115295
+ function secureRandomBytes(length) {
115296
+ const bytes = new Uint8Array(length);
115297
+ if (typeof crypto !== "undefined" && typeof crypto.getRandomValues === "function") {
115298
+ crypto.getRandomValues(bytes);
115299
+ return bytes;
115300
+ }
115301
+ throw new Error("secure-random: no cryptographic RNG available (crypto.getRandomValues missing)");
115302
+ }
115303
+ function secureRandomUuid() {
115304
+ if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
115305
+ return crypto.randomUUID();
115306
+ }
115307
+ const bytes = secureRandomBytes(16);
115308
+ bytes[6] = bytes[6] & 15 | 64;
115309
+ bytes[8] = bytes[8] & 63 | 128;
115310
+ const hex10 = Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
115311
+ return `${hex10.slice(0, 8)}-${hex10.slice(8, 12)}-${hex10.slice(12, 16)}-${hex10.slice(16, 20)}-${hex10.slice(20)}`;
115312
+ }
115313
+ function secureRandomToken(length = 8) {
115314
+ const bytes = secureRandomBytes(length);
115315
+ let out = "";
115316
+ for (const b of bytes) {
115317
+ out += (b % 36).toString(36);
115318
+ }
115319
+ return out;
115320
+ }
115321
+ var DB_NAME = "pptx-viewer-session";
115322
+ var DB_VERSION = 1;
115323
+ var STORE_NAME = "openDeck";
115324
+ var TAB_ID_KEY = "pptx-viewer-session-tab";
115325
+ var MAX_AGE_MS = 24 * 60 * 60 * 1e3;
115326
+ function hasIndexedDb() {
115327
+ return typeof indexedDB !== "undefined";
115328
+ }
115329
+ function getSessionTabId(create = false) {
115330
+ try {
115331
+ if (typeof sessionStorage === "undefined") {
115332
+ return null;
115333
+ }
115334
+ const existing = sessionStorage.getItem(TAB_ID_KEY);
115335
+ if (existing) {
115336
+ return existing;
115337
+ }
115338
+ if (!create) {
115339
+ return null;
115340
+ }
115341
+ const id = secureRandomToken(12);
115342
+ sessionStorage.setItem(TAB_ID_KEY, id);
115343
+ return id;
115344
+ } catch {
115345
+ return null;
115346
+ }
115347
+ }
115348
+ function openDb() {
115349
+ return new Promise((resolve2, reject) => {
115350
+ const request = indexedDB.open(DB_NAME, DB_VERSION);
115351
+ request.onupgradeneeded = () => {
115352
+ const db = request.result;
115353
+ if (!db.objectStoreNames.contains(STORE_NAME)) {
115354
+ db.createObjectStore(STORE_NAME, { keyPath: "key" });
115355
+ }
115356
+ };
115357
+ request.onsuccess = () => resolve2(request.result);
115358
+ request.onerror = () => reject(request.error);
115359
+ });
115360
+ }
115361
+ function toBytes(value) {
115362
+ if (value instanceof Uint8Array) {
115363
+ return value;
115364
+ }
115365
+ if (value instanceof ArrayBuffer) {
115366
+ return new Uint8Array(value);
115367
+ }
115368
+ return null;
115369
+ }
115370
+ function writeRecord(record, dropOthers) {
115371
+ return openDb().then(
115372
+ (db) => new Promise((resolve2, reject) => {
115373
+ const tx = db.transaction(STORE_NAME, "readwrite");
115374
+ const store = tx.objectStore(STORE_NAME);
115375
+ const cutoff = Date.now() - MAX_AGE_MS;
115376
+ const cursorReq = store.openCursor();
115377
+ cursorReq.onsuccess = () => {
115378
+ const cursor = cursorReq.result;
115379
+ if (!cursor) {
115380
+ return;
115381
+ }
115382
+ const value = cursor.value;
115383
+ const stale = typeof value.timestamp !== "number" || value.timestamp < cutoff;
115384
+ if (value.key !== record.key && (dropOthers || stale)) {
115385
+ cursor.delete();
115386
+ }
115387
+ cursor.continue();
115388
+ };
115389
+ store.put(record);
115390
+ tx.oncomplete = () => {
115391
+ db.close();
115392
+ resolve2(true);
115393
+ };
115394
+ tx.onerror = () => {
115395
+ db.close();
115396
+ reject(tx.error);
115397
+ };
115398
+ })
115399
+ );
115400
+ }
115401
+ async function rememberSessionDeck(fileName, data) {
115402
+ const key = getSessionTabId(true);
115403
+ if (!key || !hasIndexedDb() || data.byteLength === 0) {
115404
+ return false;
115405
+ }
115406
+ const record = {
115407
+ key,
115408
+ fileName,
115409
+ data: new Uint8Array(data),
115410
+ timestamp: Date.now()
115411
+ };
115412
+ try {
115413
+ return await writeRecord(record, false);
115414
+ } catch (err) {
115415
+ const name = err instanceof Error || err instanceof DOMException ? err.name : "";
115416
+ if (name !== "QuotaExceededError") {
115417
+ return false;
115418
+ }
115419
+ try {
115420
+ return await writeRecord(record, true);
115421
+ } catch {
115422
+ return false;
115423
+ }
115424
+ }
115425
+ }
115426
+ async function loadSessionDeck() {
115427
+ const key = getSessionTabId(false);
115428
+ if (!key || !hasIndexedDb()) {
115429
+ return null;
115430
+ }
115431
+ try {
115432
+ const db = await openDb();
115433
+ const record = await new Promise((resolve2) => {
115434
+ const tx = db.transaction(STORE_NAME, "readonly");
115435
+ const request = tx.objectStore(STORE_NAME).get(key);
115436
+ request.onsuccess = () => {
115437
+ db.close();
115438
+ resolve2(request.result);
115439
+ };
115440
+ request.onerror = () => {
115441
+ db.close();
115442
+ resolve2(void 0);
115443
+ };
115444
+ });
115445
+ if (!record) {
115446
+ return null;
115447
+ }
115448
+ const data = toBytes(record.data);
115449
+ const timestamp = typeof record.timestamp === "number" ? record.timestamp : 0;
115450
+ if (!data || data.byteLength === 0 || Date.now() - timestamp > MAX_AGE_MS) {
115451
+ return null;
115452
+ }
115453
+ return {
115454
+ fileName: typeof record.fileName === "string" ? record.fileName : "",
115455
+ data,
115456
+ timestamp
115457
+ };
115458
+ } catch {
115459
+ return null;
115460
+ }
115461
+ }
115462
+ async function forgetSessionDeck() {
115463
+ const key = getSessionTabId(false);
115464
+ if (!key || !hasIndexedDb()) {
115465
+ return;
115466
+ }
115467
+ try {
115468
+ const db = await openDb();
115469
+ await new Promise((resolve2) => {
115470
+ const tx = db.transaction(STORE_NAME, "readwrite");
115471
+ tx.objectStore(STORE_NAME).delete(key);
115472
+ tx.oncomplete = () => {
115473
+ db.close();
115474
+ resolve2();
115475
+ };
115476
+ tx.onerror = () => {
115477
+ db.close();
115478
+ resolve2();
115479
+ };
115480
+ });
115481
+ } catch {
115482
+ }
115483
+ }
115484
+ async function restoreSessionDeck() {
115485
+ const deck = await loadSessionDeck();
115486
+ if (!deck?.fileName) {
115487
+ return deck;
115488
+ }
115489
+ try {
115490
+ const snapshot = await getAutosaveSnapshot(deck.fileName);
115491
+ const bytes = snapshot ? toBytes(snapshot.data) : null;
115492
+ if (snapshot && bytes && bytes.byteLength > 0 && snapshot.timestamp > deck.timestamp) {
115493
+ return { fileName: deck.fileName, data: bytes, timestamp: snapshot.timestamp };
115494
+ }
115495
+ } catch {
115496
+ }
115497
+ return deck;
115498
+ }
115130
115499
  var PPTX_OPEN_ACCEPT = ".pptx,.ppsx,.pptm,.potx,.ppt,.json";
115131
115500
  function openFilePicker(options = {}) {
115132
115501
  return new Promise((resolve2) => {
@@ -115165,7 +115534,9 @@ async function openPptxFile(options = {}) {
115165
115534
  if (!file) {
115166
115535
  return null;
115167
115536
  }
115168
- return { file, buffer: await file.arrayBuffer() };
115537
+ const buffer = await file.arrayBuffer();
115538
+ void rememberSessionDeck(file.name, new Uint8Array(buffer));
115539
+ return { file, buffer };
115169
115540
  }
115170
115541
  function mobileSlideCounter(currentIndex, total) {
115171
115542
  if (total <= 0) {
@@ -115257,32 +115628,6 @@ function formatRelativeTime(ts) {
115257
115628
  const days = Math.floor(hours / 24);
115258
115629
  return `${days}d ago`;
115259
115630
  }
115260
- function secureRandomBytes(length) {
115261
- const bytes = new Uint8Array(length);
115262
- if (typeof crypto !== "undefined" && typeof crypto.getRandomValues === "function") {
115263
- crypto.getRandomValues(bytes);
115264
- return bytes;
115265
- }
115266
- throw new Error("secure-random: no cryptographic RNG available (crypto.getRandomValues missing)");
115267
- }
115268
- function secureRandomUuid() {
115269
- if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
115270
- return crypto.randomUUID();
115271
- }
115272
- const bytes = secureRandomBytes(16);
115273
- bytes[6] = bytes[6] & 15 | 64;
115274
- bytes[8] = bytes[8] & 63 | 128;
115275
- const hex10 = Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
115276
- return `${hex10.slice(0, 8)}-${hex10.slice(8, 12)}-${hex10.slice(12, 16)}-${hex10.slice(16, 20)}-${hex10.slice(20)}`;
115277
- }
115278
- function secureRandomToken(length = 8) {
115279
- const bytes = secureRandomBytes(length);
115280
- let out = "";
115281
- for (const b of bytes) {
115282
- out += (b % 36).toString(36);
115283
- }
115284
- return out;
115285
- }
115286
115631
  var DEFAULT_BROADCAST_SERVER_URL = "ws://localhost:1234";
115287
115632
  function resolveTransportForServerUrl(serverUrl) {
115288
115633
  return serverUrl.trim().length === 0 ? "webrtc" : "websocket";
@@ -115602,9 +115947,9 @@ var PRESENTATION_CHANNEL_NAME = "pptx-viewer-presenter";
115602
115947
  var PRESENTATION_HASH = "#pptx-audience";
115603
115948
  var PRESENTATION_NONCE_KEY = "nonce";
115604
115949
  var PRESENTATION_MESSAGE_ORIGIN = "pptx-viewer-presenter";
115605
- var DB_NAME = "pptx-viewer-presentation";
115606
- var DB_VERSION = 1;
115607
- var STORE_NAME = "decks";
115950
+ var DB_NAME2 = "pptx-viewer-presentation";
115951
+ var DB_VERSION2 = 1;
115952
+ var STORE_NAME2 = "decks";
115608
115953
  var MAX_DECK_AGE_MS = 5 * 60 * 1e3;
115609
115954
  function createPresentationSessionId() {
115610
115955
  return secureRandomUuid();
@@ -115716,11 +116061,11 @@ async function swapPresentationWindows(presenter, audience) {
115716
116061
  }
115717
116062
  function openDeckDb() {
115718
116063
  return new Promise((resolve2, reject) => {
115719
- const request = indexedDB.open(DB_NAME, DB_VERSION);
116064
+ const request = indexedDB.open(DB_NAME2, DB_VERSION2);
115720
116065
  request.onupgradeneeded = () => {
115721
116066
  const db = request.result;
115722
- if (!db.objectStoreNames.contains(STORE_NAME)) {
115723
- db.createObjectStore(STORE_NAME);
116067
+ if (!db.objectStoreNames.contains(STORE_NAME2)) {
116068
+ db.createObjectStore(STORE_NAME2);
115724
116069
  }
115725
116070
  };
115726
116071
  request.onsuccess = () => resolve2(request.result);
@@ -115730,9 +116075,9 @@ function openDeckDb() {
115730
116075
  async function storePresentationDeck(sessionId, content) {
115731
116076
  const db = await openDeckDb();
115732
116077
  return new Promise((resolve2, reject) => {
115733
- const tx = db.transaction(STORE_NAME, "readwrite");
116078
+ const tx = db.transaction(STORE_NAME2, "readwrite");
115734
116079
  const bytes = content instanceof Uint8Array ? content : new Uint8Array(content);
115735
- tx.objectStore(STORE_NAME).put(
116080
+ tx.objectStore(STORE_NAME2).put(
115736
116081
  { bytes, createdAt: Date.now() },
115737
116082
  sessionId
115738
116083
  );
@@ -115750,7 +116095,7 @@ async function loadPresentationDeck(sessionId) {
115750
116095
  try {
115751
116096
  const db = await openDeckDb();
115752
116097
  return await new Promise((resolve2, reject) => {
115753
- const request = db.transaction(STORE_NAME, "readonly").objectStore(STORE_NAME).get(sessionId);
116098
+ const request = db.transaction(STORE_NAME2, "readonly").objectStore(STORE_NAME2).get(sessionId);
115754
116099
  request.onsuccess = () => {
115755
116100
  db.close();
115756
116101
  const record = request.result;
@@ -115776,8 +116121,8 @@ async function clearPresentationDeck(sessionId) {
115776
116121
  try {
115777
116122
  const db = await openDeckDb();
115778
116123
  await new Promise((resolve2) => {
115779
- const tx = db.transaction(STORE_NAME, "readwrite");
115780
- tx.objectStore(STORE_NAME).delete(sessionId);
116124
+ const tx = db.transaction(STORE_NAME2, "readwrite");
116125
+ tx.objectStore(STORE_NAME2).delete(sessionId);
115781
116126
  tx.oncomplete = () => {
115782
116127
  db.close();
115783
116128
  resolve2();
@@ -115931,18 +116276,18 @@ function createViewerZoomStore(initial) {
115931
116276
  reduceViewerZoom
115932
116277
  );
115933
116278
  }
115934
- var DB_NAME2 = "pptx-viewer-audience";
115935
- var DB_VERSION2 = 1;
115936
- var STORE_NAME2 = "content";
116279
+ var DB_NAME3 = "pptx-viewer-audience";
116280
+ var DB_VERSION3 = 1;
116281
+ var STORE_NAME3 = "content";
115937
116282
  var CONTENT_KEY = "pptx-bytes";
115938
116283
  var MAX_CONTENT_AGE_MS = 5 * 60 * 1e3;
115939
- function openDb() {
116284
+ function openDb2() {
115940
116285
  return new Promise((resolve2, reject) => {
115941
- const request = indexedDB.open(DB_NAME2, DB_VERSION2);
116286
+ const request = indexedDB.open(DB_NAME3, DB_VERSION3);
115942
116287
  request.onupgradeneeded = () => {
115943
116288
  const db = request.result;
115944
- if (!db.objectStoreNames.contains(STORE_NAME2)) {
115945
- db.createObjectStore(STORE_NAME2);
116289
+ if (!db.objectStoreNames.contains(STORE_NAME3)) {
116290
+ db.createObjectStore(STORE_NAME3);
115946
116291
  }
115947
116292
  };
115948
116293
  request.onsuccess = () => resolve2(request.result);
@@ -115953,10 +116298,10 @@ async function storeAudienceContent(content, sessionId) {
115953
116298
  if (sessionId) {
115954
116299
  return storePresentationDeck(sessionId, content);
115955
116300
  }
115956
- const db = await openDb();
116301
+ const db = await openDb2();
115957
116302
  return new Promise((resolve2, reject) => {
115958
- const tx = db.transaction(STORE_NAME2, "readwrite");
115959
- const store = tx.objectStore(STORE_NAME2);
116303
+ const tx = db.transaction(STORE_NAME3, "readwrite");
116304
+ const store = tx.objectStore(STORE_NAME3);
115960
116305
  const bytes = content instanceof Uint8Array ? content : new Uint8Array(content);
115961
116306
  const record = { bytes, createdAt: Date.now() };
115962
116307
  store.put(record, CONTENT_KEY);
@@ -115975,10 +116320,10 @@ async function loadAudienceContent(sessionId) {
115975
116320
  return loadPresentationDeck(sessionId);
115976
116321
  }
115977
116322
  try {
115978
- const db = await openDb();
116323
+ const db = await openDb2();
115979
116324
  return new Promise((resolve2, reject) => {
115980
- const tx = db.transaction(STORE_NAME2, "readonly");
115981
- const store = tx.objectStore(STORE_NAME2);
116325
+ const tx = db.transaction(STORE_NAME3, "readonly");
116326
+ const store = tx.objectStore(STORE_NAME3);
115982
116327
  const request = store.get(CONTENT_KEY);
115983
116328
  request.onsuccess = () => {
115984
116329
  db.close();
@@ -116016,10 +116361,10 @@ async function clearAudienceContent(sessionId) {
116016
116361
  return clearPresentationDeck(sessionId);
116017
116362
  }
116018
116363
  try {
116019
- const db = await openDb();
116364
+ const db = await openDb2();
116020
116365
  return new Promise((resolve2) => {
116021
- const tx = db.transaction(STORE_NAME2, "readwrite");
116022
- const store = tx.objectStore(STORE_NAME2);
116366
+ const tx = db.transaction(STORE_NAME3, "readwrite");
116367
+ const store = tx.objectStore(STORE_NAME3);
116023
116368
  store.delete(CONTENT_KEY);
116024
116369
  tx.oncomplete = () => {
116025
116370
  db.close();
@@ -119806,171 +120151,6 @@ function filterCommands(query, resolveLabel) {
119806
120151
  (entry2) => resolveLabel(entry2.labelKey).toLowerCase().includes(lowerQuery)
119807
120152
  );
119808
120153
  }
119809
- var AUTOSAVE_DB_NAME = "pptx-viewer-autosave";
119810
- var AUTOSAVE_DB_VERSION = 1;
119811
- var AUTOSAVE_STORE_NAME = "recoveryVersions";
119812
- function openAutosaveDb() {
119813
- return new Promise((resolve2, reject) => {
119814
- const req = indexedDB.open(AUTOSAVE_DB_NAME, AUTOSAVE_DB_VERSION);
119815
- req.onupgradeneeded = () => {
119816
- const db = req.result;
119817
- if (!db.objectStoreNames.contains(AUTOSAVE_STORE_NAME)) {
119818
- db.createObjectStore(AUTOSAVE_STORE_NAME, { keyPath: "key" });
119819
- }
119820
- };
119821
- req.onsuccess = () => resolve2(req.result);
119822
- req.onerror = () => reject(req.error);
119823
- });
119824
- }
119825
- async function deleteOldestAutosaveEntry() {
119826
- const db = await openAutosaveDb();
119827
- return new Promise((resolve2) => {
119828
- try {
119829
- const tx = db.transaction(AUTOSAVE_STORE_NAME, "readwrite");
119830
- const store = tx.objectStore(AUTOSAVE_STORE_NAME);
119831
- let oldestKey = null;
119832
- let oldestTimestamp = Infinity;
119833
- const cursorReq = store.openCursor();
119834
- cursorReq.onsuccess = () => {
119835
- const cursor = cursorReq.result;
119836
- if (cursor) {
119837
- const value = cursor.value;
119838
- if (typeof value.timestamp === "number" && value.timestamp < oldestTimestamp) {
119839
- oldestTimestamp = value.timestamp;
119840
- oldestKey = cursor.primaryKey;
119841
- }
119842
- cursor.continue();
119843
- } else if (oldestKey !== null) {
119844
- store.delete(oldestKey);
119845
- }
119846
- };
119847
- tx.oncomplete = () => {
119848
- db.close();
119849
- resolve2(oldestKey !== null);
119850
- };
119851
- tx.onerror = () => {
119852
- db.close();
119853
- resolve2(false);
119854
- };
119855
- } catch {
119856
- try {
119857
- db.close();
119858
- } catch {
119859
- }
119860
- resolve2(false);
119861
- }
119862
- });
119863
- }
119864
- function putAutosaveRecord(filePath, data) {
119865
- return openAutosaveDb().then(
119866
- (db) => new Promise((resolve2, reject) => {
119867
- const tx = db.transaction(AUTOSAVE_STORE_NAME, "readwrite");
119868
- const store = tx.objectStore(AUTOSAVE_STORE_NAME);
119869
- store.put({
119870
- key: filePath,
119871
- data,
119872
- timestamp: Date.now(),
119873
- size: data.byteLength
119874
- });
119875
- tx.oncomplete = () => {
119876
- db.close();
119877
- resolve2(true);
119878
- };
119879
- tx.onerror = () => {
119880
- db.close();
119881
- reject(tx.error);
119882
- };
119883
- })
119884
- );
119885
- }
119886
- async function getAutosaveSnapshot(filePath) {
119887
- const db = await openAutosaveDb();
119888
- return new Promise((resolve2) => {
119889
- const tx = db.transaction(AUTOSAVE_STORE_NAME, "readonly");
119890
- const store = tx.objectStore(AUTOSAVE_STORE_NAME);
119891
- const req = store.get(filePath);
119892
- req.onsuccess = () => {
119893
- db.close();
119894
- resolve2(req.result);
119895
- };
119896
- req.onerror = () => {
119897
- db.close();
119898
- resolve2(void 0);
119899
- };
119900
- });
119901
- }
119902
- async function listAutosaveSnapshots() {
119903
- const db = await openAutosaveDb();
119904
- return new Promise((resolve2) => {
119905
- const results = [];
119906
- try {
119907
- const tx = db.transaction(AUTOSAVE_STORE_NAME, "readonly");
119908
- const store = tx.objectStore(AUTOSAVE_STORE_NAME);
119909
- const cursorReq = store.openCursor();
119910
- cursorReq.onsuccess = () => {
119911
- const cursor = cursorReq.result;
119912
- if (cursor) {
119913
- const val2 = cursor.value;
119914
- results.push({ key: val2.key, timestamp: val2.timestamp, size: val2.size });
119915
- cursor.continue();
119916
- }
119917
- };
119918
- tx.oncomplete = () => {
119919
- db.close();
119920
- resolve2(results);
119921
- };
119922
- tx.onerror = () => {
119923
- db.close();
119924
- resolve2([]);
119925
- };
119926
- } catch {
119927
- try {
119928
- db.close();
119929
- } catch {
119930
- }
119931
- resolve2([]);
119932
- }
119933
- });
119934
- }
119935
- async function deleteAutosaveSnapshot(filePath) {
119936
- const db = await openAutosaveDb();
119937
- return new Promise((resolve2) => {
119938
- try {
119939
- const tx = db.transaction(AUTOSAVE_STORE_NAME, "readwrite");
119940
- const store = tx.objectStore(AUTOSAVE_STORE_NAME);
119941
- store.delete(filePath);
119942
- tx.oncomplete = () => {
119943
- db.close();
119944
- resolve2(true);
119945
- };
119946
- tx.onerror = () => {
119947
- db.close();
119948
- resolve2(false);
119949
- };
119950
- } catch {
119951
- try {
119952
- db.close();
119953
- } catch {
119954
- }
119955
- resolve2(false);
119956
- }
119957
- });
119958
- }
119959
- async function saveAutosaveSnapshot(filePath, data) {
119960
- try {
119961
- return await putAutosaveRecord(filePath, data);
119962
- } catch (err) {
119963
- const errName = err instanceof Error || err instanceof DOMException ? err.name : "";
119964
- if (errName !== "QuotaExceededError") {
119965
- throw err;
119966
- }
119967
- const deleted = await deleteOldestAutosaveEntry();
119968
- if (!deleted) {
119969
- throw err;
119970
- }
119971
- return putAutosaveRecord(filePath, data);
119972
- }
119973
- }
119974
120154
  var BACKSTAGE_NAV = [
119975
120155
  { id: "home", label: "Home", labelKey: "pptx.backstage.nav.home" },
119976
120156
  { id: "new", label: "New", labelKey: "pptx.backstage.nav.new" },
@@ -120086,7 +120266,11 @@ async function readBackstageRecentFile(key) {
120086
120266
  if (typeof indexedDB === "undefined") {
120087
120267
  return void 0;
120088
120268
  }
120089
- return (await getAutosaveSnapshot(key))?.data;
120269
+ const data = (await getAutosaveSnapshot(key))?.data;
120270
+ if (data) {
120271
+ void rememberSessionDeck(key, data);
120272
+ }
120273
+ return data;
120090
120274
  }
120091
120275
  function formatBackstageDate(timestamp, now = Date.now(), translate) {
120092
120276
  const elapsed = Math.max(0, now - timestamp);
@@ -123324,6 +123508,7 @@ exports.findMediaElementByElementId = findMediaElementByElementId;
123324
123508
  exports.findSmartArtNodeText = findSmartArtNodeText;
123325
123509
  exports.firstShowSlideIndex = firstShowSlideIndex;
123326
123510
  exports.flattenTagCollections = flattenTagCollections;
123511
+ exports.forgetSessionDeck = forgetSessionDeck;
123327
123512
  exports.formatAxisValue = formatAxisValue;
123328
123513
  exports.formatAxisValueWithUnits = formatAxisValueWithUnits;
123329
123514
  exports.formatBackstageDate = formatBackstageDate;
@@ -123393,6 +123578,7 @@ exports.getPrintableArea = getPrintableArea;
123393
123578
  exports.getResolvedShapeClipPath = getResolvedShapeClipPath;
123394
123579
  exports.getRoundRectRadiusPx = getRoundRectRadiusPx;
123395
123580
  exports.getSecondaryValueAxis = getSecondaryValueAxis;
123581
+ exports.getSessionTabId = getSessionTabId;
123396
123582
  exports.getShapeAdjustmentHandleDescriptor = getShapeAdjustmentHandleDescriptor;
123397
123583
  exports.getSlideBackgroundStyle = getSlideBackgroundStyle;
123398
123584
  exports.getSlideTransitionAnimations = getSlideTransitionAnimations;
@@ -123446,6 +123632,7 @@ exports.lastShowSlideIndex = lastShowSlideIndex;
123446
123632
  exports.listAutosaveSnapshots = listAutosaveSnapshots;
123447
123633
  exports.listBackstageRecentFiles = listBackstageRecentFiles;
123448
123634
  exports.loadAudienceContent = loadAudienceContent;
123635
+ exports.loadSessionDeck = loadSessionDeck;
123449
123636
  exports.makeCloneId = makeCloneId;
123450
123637
  exports.makeSlideId = makeSlideId;
123451
123638
  exports.mapEditorKey = mapEditorKey;
@@ -123532,6 +123719,7 @@ exports.rectToCells = rectToCells;
123532
123719
  exports.registerCollaborationTeardown = registerCollaborationTeardown;
123533
123720
  exports.registerPersistentAudio = registerPersistentAudio;
123534
123721
  exports.remapTextToSegments = remapTextToSegments;
123722
+ exports.rememberSessionDeck = rememberSessionDeck;
123535
123723
  exports.removeChartCategory = removeChartCategory;
123536
123724
  exports.removeChartSeries = removeChartSeries;
123537
123725
  exports.removeLastTableElementColumn = removeLastTableElementColumn;
@@ -123572,6 +123760,7 @@ exports.resolveTransportForServerUrl = resolveTransportForServerUrl;
123572
123760
  exports.resolveUnderlineDecorationStyle = resolveUnderlineDecorationStyle;
123573
123761
  exports.resolveViewerAddinRows = resolveViewerAddinRows;
123574
123762
  exports.restoreSegmentSelection = restoreSegmentSelection;
123763
+ exports.restoreSessionDeck = restoreSessionDeck;
123575
123764
  exports.revealedSmartArtNodeCount = revealedSmartArtNodeCount;
123576
123765
  exports.rulerDragToGuidePosition = rulerDragToGuidePosition;
123577
123766
  exports.runMediaCommand = runMediaCommand;