pptx-react-viewer 3.16.6 → 3.17.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/CHANGELOG.md +36 -0
- package/README.md +25 -3
- package/dist/{AiChatPanel-6IBPORZC.mjs → AiChatPanel-4LKH44IE.mjs} +3 -3
- package/dist/AiChatPanel-4LKH44IE.mjs.br +0 -0
- package/dist/AiChatPanel-4LKH44IE.mjs.gz +0 -0
- package/dist/{AiChatPanel-WDNBYHX7.js → AiChatPanel-VWVGQ5DD.js} +24 -24
- package/dist/AiChatPanel-VWVGQ5DD.js.br +0 -0
- package/dist/AiChatPanel-VWVGQ5DD.js.gz +0 -0
- package/dist/{Area3DChartScene-MRPRTJWY.js → Area3DChartScene-D7GSJGPQ.js} +2 -2
- package/dist/Area3DChartScene-D7GSJGPQ.js.br +0 -0
- package/dist/Area3DChartScene-D7GSJGPQ.js.gz +0 -0
- package/dist/{Area3DChartScene-EMOWMHHK.mjs → Area3DChartScene-X5SM67PZ.mjs} +1 -1
- package/dist/Area3DChartScene-X5SM67PZ.mjs.br +0 -0
- package/dist/Area3DChartScene-X5SM67PZ.mjs.gz +0 -0
- package/dist/{Bar3DChartScene-J3GJEGDJ.mjs → Bar3DChartScene-HWIFFGI3.mjs} +1 -1
- package/dist/{Bar3DChartScene-J3GJEGDJ.mjs.br → Bar3DChartScene-HWIFFGI3.mjs.br} +0 -0
- package/dist/Bar3DChartScene-HWIFFGI3.mjs.gz +0 -0
- package/dist/{Bar3DChartScene-THALZEYK.js → Bar3DChartScene-M72WQW5Y.js} +2 -2
- package/dist/Bar3DChartScene-M72WQW5Y.js.br +0 -0
- package/dist/Bar3DChartScene-M72WQW5Y.js.gz +0 -0
- package/dist/{Line3DChartScene-Y7MODOK2.mjs → Line3DChartScene-7MPZWVF3.mjs} +1 -1
- package/dist/Line3DChartScene-7MPZWVF3.mjs.br +0 -0
- package/dist/Line3DChartScene-7MPZWVF3.mjs.gz +0 -0
- package/dist/{Line3DChartScene-B26WZNO3.js → Line3DChartScene-YOZEEQZ3.js} +2 -2
- package/dist/Line3DChartScene-YOZEEQZ3.js.br +0 -0
- package/dist/Line3DChartScene-YOZEEQZ3.js.gz +0 -0
- package/dist/{Model3DScene-XM3JN7M6.mjs → Model3DScene-57LVY5QW.mjs} +1 -1
- package/dist/Model3DScene-57LVY5QW.mjs.br +0 -0
- package/dist/Model3DScene-57LVY5QW.mjs.gz +0 -0
- package/dist/{Model3DScene-27GN3D3U.js → Model3DScene-5IJSNGDZ.js} +2 -2
- package/dist/Model3DScene-5IJSNGDZ.js.br +0 -0
- package/dist/Model3DScene-5IJSNGDZ.js.gz +0 -0
- package/dist/{PieChart3DScene-URSRUABE.js → PieChart3DScene-UBI6X66Q.js} +2 -2
- package/dist/PieChart3DScene-UBI6X66Q.js.br +0 -0
- package/dist/PieChart3DScene-UBI6X66Q.js.gz +0 -0
- package/dist/{PieChart3DScene-4GP2B3PY.mjs → PieChart3DScene-WD5B6NP3.mjs} +1 -1
- package/dist/{PieChart3DScene-4GP2B3PY.mjs.br → PieChart3DScene-WD5B6NP3.mjs.br} +0 -0
- package/dist/PieChart3DScene-WD5B6NP3.mjs.gz +0 -0
- package/dist/{PowerPointViewer-Cl6jBPNw.d.ts → PowerPointViewer-Cde_wzd0.d.ts} +2 -2
- package/dist/{PowerPointViewer-Cl6jBPNw.d.ts.map → PowerPointViewer-Cde_wzd0.d.ts.map} +1 -1
- package/dist/{SurfaceChart3DScene-4OQNB3JY.js → SurfaceChart3DScene-JGNPYQ32.js} +2 -2
- package/dist/SurfaceChart3DScene-JGNPYQ32.js.br +0 -0
- package/dist/SurfaceChart3DScene-JGNPYQ32.js.gz +0 -0
- package/dist/{SurfaceChart3DScene-YJ4EYMWQ.mjs → SurfaceChart3DScene-JZGU6BBD.mjs} +1 -1
- package/dist/{SurfaceChart3DScene-YJ4EYMWQ.mjs.br → SurfaceChart3DScene-JZGU6BBD.mjs.br} +0 -0
- package/dist/SurfaceChart3DScene-JZGU6BBD.mjs.gz +0 -0
- package/dist/{audience-content-store-CB2WVM1K.d.ts → audience-content-store-A8Km8rBo.d.ts} +2 -2
- package/dist/{audience-content-store-CB2WVM1K.d.ts.map → audience-content-store-A8Km8rBo.d.ts.map} +1 -1
- package/dist/{chunk-U2H7CQ34.mjs → chunk-23PW4Y4R.mjs} +1 -1
- package/dist/chunk-23PW4Y4R.mjs.br +0 -0
- package/dist/chunk-23PW4Y4R.mjs.gz +0 -0
- package/dist/{chunk-TTCWWF47.js → chunk-3UGVURWU.js} +555 -499
- package/dist/chunk-3UGVURWU.js.br +0 -0
- package/dist/chunk-3UGVURWU.js.gz +0 -0
- package/dist/{chunk-VRMITIZZ.js → chunk-4SPZ5IZN.js} +1239 -506
- package/dist/chunk-4SPZ5IZN.js.br +0 -0
- package/dist/chunk-4SPZ5IZN.js.gz +0 -0
- package/dist/{chunk-LTQRC4WB.js → chunk-72LYFUGL.js} +1323 -1310
- package/dist/chunk-72LYFUGL.js.br +0 -0
- package/dist/chunk-72LYFUGL.js.gz +0 -0
- package/dist/{chunk-YUIXPWFT.mjs → chunk-7YJBRPCT.mjs} +9 -5
- package/dist/chunk-7YJBRPCT.mjs.br +0 -0
- package/dist/chunk-7YJBRPCT.mjs.gz +0 -0
- package/dist/{chunk-QLZHTIH6.mjs → chunk-7YOA4HNP.mjs} +106 -50
- package/dist/chunk-7YOA4HNP.mjs.br +0 -0
- package/dist/chunk-7YOA4HNP.mjs.gz +0 -0
- package/dist/{chunk-RWVMSJ7C.mjs → chunk-EDMJYVCS.mjs} +44 -31
- package/dist/chunk-EDMJYVCS.mjs.br +0 -0
- package/dist/chunk-EDMJYVCS.mjs.gz +0 -0
- package/dist/{chunk-C7H7NM2W.js → chunk-KVXB22D3.js} +13 -9
- package/dist/chunk-KVXB22D3.js.br +0 -0
- package/dist/chunk-KVXB22D3.js.gz +0 -0
- package/dist/{chunk-BJL5MJ7A.js → chunk-NJ3WCYYG.js} +169 -169
- package/dist/chunk-NJ3WCYYG.js.br +0 -0
- package/dist/{chunk-BJL5MJ7A.js.gz → chunk-NJ3WCYYG.js.gz} +0 -0
- package/dist/{chunk-PO2PYVHF.mjs → chunk-QTGCOL5H.mjs} +1233 -507
- package/dist/chunk-QTGCOL5H.mjs.br +0 -0
- package/dist/chunk-QTGCOL5H.mjs.gz +0 -0
- package/dist/index.d.ts +33 -3
- package/dist/index.js +45 -45
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/index.mjs +5 -5
- package/dist/index.mjs.br +0 -0
- package/dist/index.mjs.gz +0 -0
- package/dist/internals.d.ts +38 -3
- package/dist/internals.d.ts.map +1 -1
- package/dist/internals.js +78 -78
- package/dist/internals.js.br +0 -0
- package/dist/internals.js.gz +0 -0
- package/dist/internals.mjs +3 -3
- package/dist/internals.mjs.br +0 -0
- package/dist/internals.mjs.gz +0 -0
- package/dist/pptx-viewer.css +1 -1
- package/dist/pptx-viewer.css.br +0 -0
- package/dist/pptx-viewer.css.gz +0 -0
- package/dist/{types-Bzdkiakq.d.ts → types-BqB2ZCwS.d.ts} +3 -3
- package/dist/{types-Bzdkiakq.d.ts.map → types-BqB2ZCwS.d.ts.map} +1 -1
- package/dist/{useViewerBuildingBlocks-FbK-4ORi.d.ts → useViewerBuildingBlocks-DkUGmlkP.d.ts} +4 -4
- package/dist/{useViewerBuildingBlocks-FbK-4ORi.d.ts.map → useViewerBuildingBlocks-DkUGmlkP.d.ts.map} +1 -1
- package/dist/viewer/index.d.ts +31 -1
- package/dist/viewer/index.js +26 -26
- package/dist/viewer/index.js.br +0 -0
- package/dist/viewer/index.js.gz +0 -0
- package/dist/viewer/index.mjs +5 -5
- package/dist/viewer/index.mjs.br +0 -0
- package/dist/viewer/index.mjs.gz +0 -0
- package/package.json +1 -1
- package/dist/AiChatPanel-6IBPORZC.mjs.br +0 -0
- package/dist/AiChatPanel-6IBPORZC.mjs.gz +0 -0
- package/dist/AiChatPanel-WDNBYHX7.js.br +0 -0
- package/dist/AiChatPanel-WDNBYHX7.js.gz +0 -0
- package/dist/Area3DChartScene-EMOWMHHK.mjs.br +0 -0
- package/dist/Area3DChartScene-EMOWMHHK.mjs.gz +0 -0
- package/dist/Area3DChartScene-MRPRTJWY.js.br +0 -0
- package/dist/Area3DChartScene-MRPRTJWY.js.gz +0 -0
- package/dist/Bar3DChartScene-J3GJEGDJ.mjs.gz +0 -0
- package/dist/Bar3DChartScene-THALZEYK.js.br +0 -0
- package/dist/Bar3DChartScene-THALZEYK.js.gz +0 -0
- package/dist/Line3DChartScene-B26WZNO3.js.br +0 -0
- package/dist/Line3DChartScene-B26WZNO3.js.gz +0 -0
- package/dist/Line3DChartScene-Y7MODOK2.mjs.br +0 -0
- package/dist/Line3DChartScene-Y7MODOK2.mjs.gz +0 -0
- package/dist/Model3DScene-27GN3D3U.js.br +0 -0
- package/dist/Model3DScene-27GN3D3U.js.gz +0 -0
- package/dist/Model3DScene-XM3JN7M6.mjs.br +0 -0
- package/dist/Model3DScene-XM3JN7M6.mjs.gz +0 -0
- package/dist/PieChart3DScene-4GP2B3PY.mjs.gz +0 -0
- package/dist/PieChart3DScene-URSRUABE.js.br +0 -0
- package/dist/PieChart3DScene-URSRUABE.js.gz +0 -0
- package/dist/SurfaceChart3DScene-4OQNB3JY.js.br +0 -0
- package/dist/SurfaceChart3DScene-4OQNB3JY.js.gz +0 -0
- package/dist/SurfaceChart3DScene-YJ4EYMWQ.mjs.gz +0 -0
- package/dist/chunk-BJL5MJ7A.js.br +0 -0
- package/dist/chunk-C7H7NM2W.js.br +0 -0
- package/dist/chunk-C7H7NM2W.js.gz +0 -0
- package/dist/chunk-LTQRC4WB.js.br +0 -0
- package/dist/chunk-LTQRC4WB.js.gz +0 -0
- package/dist/chunk-PO2PYVHF.mjs.br +0 -0
- package/dist/chunk-PO2PYVHF.mjs.gz +0 -0
- package/dist/chunk-QLZHTIH6.mjs.br +0 -0
- package/dist/chunk-QLZHTIH6.mjs.gz +0 -0
- package/dist/chunk-RWVMSJ7C.mjs.br +0 -0
- package/dist/chunk-RWVMSJ7C.mjs.gz +0 -0
- package/dist/chunk-TTCWWF47.js.br +0 -0
- package/dist/chunk-TTCWWF47.js.gz +0 -0
- package/dist/chunk-U2H7CQ34.mjs.br +0 -0
- package/dist/chunk-U2H7CQ34.mjs.gz +0 -0
- package/dist/chunk-VRMITIZZ.js.br +0 -0
- package/dist/chunk-VRMITIZZ.js.gz +0 -0
- package/dist/chunk-YUIXPWFT.mjs.br +0 -0
- package/dist/chunk-YUIXPWFT.mjs.gz +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkNJ3WCYYG_js = require('./chunk-NJ3WCYYG.js');
|
|
4
|
+
var chunk4SPZ5IZN_js = require('./chunk-4SPZ5IZN.js');
|
|
5
5
|
var chunk3AJ54EAB_js = require('./chunk-3AJ54EAB.js');
|
|
6
6
|
var react = require('react');
|
|
7
7
|
var reactI18next = require('react-i18next');
|
|
@@ -9,7 +9,7 @@ var reactI18next = require('react-i18next');
|
|
|
9
9
|
function useVirtualizedSlides({
|
|
10
10
|
totalItems,
|
|
11
11
|
itemHeight,
|
|
12
|
-
overscan =
|
|
12
|
+
overscan = chunk4SPZ5IZN_js.DEFAULT_VIRTUAL_OVERSCAN
|
|
13
13
|
}) {
|
|
14
14
|
const scrollContainerRef = react.useRef(null);
|
|
15
15
|
const [scrollTop, setScrollTop] = react.useState(0);
|
|
@@ -39,7 +39,7 @@ function useVirtualizedSlides({
|
|
|
39
39
|
resizeObserver?.disconnect();
|
|
40
40
|
};
|
|
41
41
|
}, []);
|
|
42
|
-
const range =
|
|
42
|
+
const range = chunk4SPZ5IZN_js.computeVirtualRange(totalItems, itemHeight, scrollTop, viewportHeight, overscan);
|
|
43
43
|
const safeItemHeight = Math.max(itemHeight, 1);
|
|
44
44
|
const scrollToIndex = react.useCallback(
|
|
45
45
|
(index, behavior = "smooth") => {
|
|
@@ -80,7 +80,7 @@ function usePresenceTracking({
|
|
|
80
80
|
}) {
|
|
81
81
|
const [remoteUsers, setRemoteUsers] = react.useState([]);
|
|
82
82
|
const projectorRef = react.useRef(null);
|
|
83
|
-
projectorRef.current ??=
|
|
83
|
+
projectorRef.current ??= chunk4SPZ5IZN_js.createPresenceProjector();
|
|
84
84
|
const projector = projectorRef.current;
|
|
85
85
|
const lastBroadcastRef = react.useRef(0);
|
|
86
86
|
const pendingBroadcastRef = react.useRef(null);
|
|
@@ -105,7 +105,7 @@ function usePresenceTracking({
|
|
|
105
105
|
awareness.setLocalStateField("presence", state);
|
|
106
106
|
lastBroadcastRef.current = Date.now();
|
|
107
107
|
};
|
|
108
|
-
if (elapsed >=
|
|
108
|
+
if (elapsed >= chunk4SPZ5IZN_js.BROADCAST_THROTTLE_MS) {
|
|
109
109
|
if (pendingBroadcastRef.current) {
|
|
110
110
|
clearTimeout(pendingBroadcastRef.current);
|
|
111
111
|
pendingBroadcastRef.current = null;
|
|
@@ -115,7 +115,7 @@ function usePresenceTracking({
|
|
|
115
115
|
pendingBroadcastRef.current = setTimeout(() => {
|
|
116
116
|
pendingBroadcastRef.current = null;
|
|
117
117
|
flush();
|
|
118
|
-
},
|
|
118
|
+
}, chunk4SPZ5IZN_js.BROADCAST_THROTTLE_MS - elapsed);
|
|
119
119
|
}
|
|
120
120
|
},
|
|
121
121
|
[awareness, userName, userColor, userAvatar, role]
|
|
@@ -195,7 +195,7 @@ function useYjsProvider({ config }) {
|
|
|
195
195
|
const departureRef = react.useRef(null);
|
|
196
196
|
const gateRef = react.useRef(null);
|
|
197
197
|
if (!gateRef.current) {
|
|
198
|
-
gateRef.current =
|
|
198
|
+
gateRef.current = chunk4SPZ5IZN_js.createSyncGate(() => setSynced(true));
|
|
199
199
|
}
|
|
200
200
|
const teardown = react.useCallback(() => {
|
|
201
201
|
if (timeoutRef.current) {
|
|
@@ -215,7 +215,7 @@ function useYjsProvider({ config }) {
|
|
|
215
215
|
const buildCleanup = react.useCallback(
|
|
216
216
|
(provider, yDoc) => () => {
|
|
217
217
|
announceDeparture();
|
|
218
|
-
|
|
218
|
+
chunk4SPZ5IZN_js.clearLocalAwareness(provider.awareness);
|
|
219
219
|
provider.destroy();
|
|
220
220
|
yDoc.destroy();
|
|
221
221
|
setDoc(null);
|
|
@@ -240,9 +240,9 @@ function useYjsProvider({ config }) {
|
|
|
240
240
|
if (config.authToken) {
|
|
241
241
|
opts.password = config.authToken;
|
|
242
242
|
}
|
|
243
|
-
const roomId =
|
|
243
|
+
const roomId = chunk4SPZ5IZN_js.validateRoomId(config.roomId);
|
|
244
244
|
const provider = new WebrtcProvider(roomId, yDoc, opts);
|
|
245
|
-
departureRef.current =
|
|
245
|
+
departureRef.current = chunk4SPZ5IZN_js.createDepartureChannel(roomId, provider.awareness);
|
|
246
246
|
setDoc(yDoc);
|
|
247
247
|
setAwareness(provider.awareness);
|
|
248
248
|
setClientId(provider.awareness.clientID);
|
|
@@ -284,13 +284,13 @@ function useYjsProvider({ config }) {
|
|
|
284
284
|
if (!config) {
|
|
285
285
|
return;
|
|
286
286
|
}
|
|
287
|
-
const roomId =
|
|
288
|
-
const transport = config.transport ??
|
|
287
|
+
const roomId = chunk4SPZ5IZN_js.validateRoomId(config.roomId);
|
|
288
|
+
const transport = config.transport ?? chunk4SPZ5IZN_js.resolveTransportForServerUrl(config.serverUrl);
|
|
289
289
|
if (transport === "webrtc") {
|
|
290
290
|
await initWebrtc();
|
|
291
291
|
return;
|
|
292
292
|
}
|
|
293
|
-
if (
|
|
293
|
+
if (chunk4SPZ5IZN_js.isMixedContentBlocked(config.serverUrl)) {
|
|
294
294
|
console.warn(
|
|
295
295
|
`[pptx-viewer] Refusing to connect: insecure ws:// server "${config.serverUrl}" is blocked from a secure (https) page. Use a wss:// URL.`
|
|
296
296
|
);
|
|
@@ -304,7 +304,7 @@ function useYjsProvider({ config }) {
|
|
|
304
304
|
const provider = new WebsocketProvider(config.serverUrl, roomId, yDoc, {
|
|
305
305
|
params: config.authToken ? { token: config.authToken } : void 0
|
|
306
306
|
});
|
|
307
|
-
departureRef.current =
|
|
307
|
+
departureRef.current = chunk4SPZ5IZN_js.createDepartureChannel(roomId, provider.awareness);
|
|
308
308
|
let connected = false;
|
|
309
309
|
const handleStatus = (event) => {
|
|
310
310
|
if (event.status === "connected") {
|
|
@@ -344,7 +344,7 @@ function useYjsProvider({ config }) {
|
|
|
344
344
|
provider.off("status", handleStatus);
|
|
345
345
|
provider.off("sync", handleSynced);
|
|
346
346
|
announceDeparture();
|
|
347
|
-
|
|
347
|
+
chunk4SPZ5IZN_js.clearLocalAwareness(provider.awareness);
|
|
348
348
|
provider.destroy();
|
|
349
349
|
yDoc.destroy();
|
|
350
350
|
setDoc(null);
|
|
@@ -353,7 +353,7 @@ function useYjsProvider({ config }) {
|
|
|
353
353
|
cleanupRef.current = null;
|
|
354
354
|
setStatus("error");
|
|
355
355
|
}
|
|
356
|
-
},
|
|
356
|
+
}, chunk4SPZ5IZN_js.CONNECTION_TIMEOUT_MS);
|
|
357
357
|
}
|
|
358
358
|
setDoc(yDoc);
|
|
359
359
|
setAwareness(provider.awareness);
|
|
@@ -362,7 +362,7 @@ function useYjsProvider({ config }) {
|
|
|
362
362
|
provider.off("status", handleStatus);
|
|
363
363
|
provider.off("sync", handleSynced);
|
|
364
364
|
announceDeparture();
|
|
365
|
-
|
|
365
|
+
chunk4SPZ5IZN_js.clearLocalAwareness(provider.awareness);
|
|
366
366
|
provider.destroy();
|
|
367
367
|
yDoc.destroy();
|
|
368
368
|
setDoc(null);
|
|
@@ -388,7 +388,7 @@ function useYjsProvider({ config }) {
|
|
|
388
388
|
]);
|
|
389
389
|
react.useEffect(() => {
|
|
390
390
|
init();
|
|
391
|
-
const disposeTeardown =
|
|
391
|
+
const disposeTeardown = chunk4SPZ5IZN_js.registerCollaborationTeardown({
|
|
392
392
|
leave: teardown,
|
|
393
393
|
rejoin: init
|
|
394
394
|
});
|
|
@@ -409,7 +409,7 @@ function useCollaborativeState({
|
|
|
409
409
|
canvasWidth,
|
|
410
410
|
canvasHeight
|
|
411
411
|
}) {
|
|
412
|
-
const userColor =
|
|
412
|
+
const userColor = chunk4SPZ5IZN_js.sanitizeColor(config?.userColor, "#6366f1");
|
|
413
413
|
const { status, awareness, doc, clientId, synced, retry } = useYjsProvider({ config });
|
|
414
414
|
const { remoteUsers, broadcastPresence } = usePresenceTracking({
|
|
415
415
|
awareness,
|
|
@@ -527,8 +527,8 @@ function useEditorHistory(input) {
|
|
|
527
527
|
width: canvasSize.width,
|
|
528
528
|
height: canvasSize.height,
|
|
529
529
|
activeSlideIndex,
|
|
530
|
-
slides: slides.map(
|
|
531
|
-
templateElementsBySlideId:
|
|
530
|
+
slides: slides.map(chunk4SPZ5IZN_js.cloneSlide),
|
|
531
|
+
templateElementsBySlideId: chunk4SPZ5IZN_js.cloneTemplateElementsBySlideId(templateElementsBySlideId),
|
|
532
532
|
...actionLabel ? { actionLabel } : {}
|
|
533
533
|
};
|
|
534
534
|
},
|
|
@@ -541,9 +541,9 @@ function useEditorHistory(input) {
|
|
|
541
541
|
width: snapshot.width,
|
|
542
542
|
height: snapshot.height
|
|
543
543
|
});
|
|
544
|
-
setSlides(snapshot.slides.map(
|
|
544
|
+
setSlides(snapshot.slides.map(chunk4SPZ5IZN_js.cloneSlide));
|
|
545
545
|
setTemplateElementsBySlideId(
|
|
546
|
-
|
|
546
|
+
chunk4SPZ5IZN_js.cloneTemplateElementsBySlideId(snapshot.templateElementsBySlideId)
|
|
547
547
|
);
|
|
548
548
|
setActiveSlideIndex(Math.min(snapshot.activeSlideIndex, maxSlideIndex));
|
|
549
549
|
setSelectedElementIds([]);
|
|
@@ -582,8 +582,8 @@ function useEditorHistory(input) {
|
|
|
582
582
|
const currentSnapshot = buildHistorySnapshot();
|
|
583
583
|
historyFutureRef.current.push(currentSnapshot);
|
|
584
584
|
isApplyingHistoryRef.current = true;
|
|
585
|
-
const nextSnapshot =
|
|
586
|
-
lastHistorySnapshotRef.current =
|
|
585
|
+
const nextSnapshot = chunkNJ3WCYYG_js.cloneHistorySnapshot(previousSnapshot);
|
|
586
|
+
lastHistorySnapshotRef.current = chunkNJ3WCYYG_js.cloneHistorySnapshot(nextSnapshot);
|
|
587
587
|
lastHistorySerializedRef.current = serializeDocument(nextSnapshot);
|
|
588
588
|
applyHistorySnapshot(nextSnapshot);
|
|
589
589
|
updateHistoryAvailability();
|
|
@@ -604,8 +604,8 @@ function useEditorHistory(input) {
|
|
|
604
604
|
const currentSnapshot = buildHistorySnapshot();
|
|
605
605
|
historyPastRef.current.push(currentSnapshot);
|
|
606
606
|
isApplyingHistoryRef.current = true;
|
|
607
|
-
const targetSnapshot =
|
|
608
|
-
lastHistorySnapshotRef.current =
|
|
607
|
+
const targetSnapshot = chunkNJ3WCYYG_js.cloneHistorySnapshot(nextSnapshot);
|
|
608
|
+
lastHistorySnapshotRef.current = chunkNJ3WCYYG_js.cloneHistorySnapshot(targetSnapshot);
|
|
609
609
|
lastHistorySerializedRef.current = serializeDocument(targetSnapshot);
|
|
610
610
|
applyHistorySnapshot(targetSnapshot);
|
|
611
611
|
updateHistoryAvailability();
|
|
@@ -623,7 +623,7 @@ function useEditorHistory(input) {
|
|
|
623
623
|
historyPastRef.current = [];
|
|
624
624
|
historyFutureRef.current = [];
|
|
625
625
|
if (initialSnapshot) {
|
|
626
|
-
const clonedInitial =
|
|
626
|
+
const clonedInitial = chunkNJ3WCYYG_js.cloneHistorySnapshot(initialSnapshot);
|
|
627
627
|
lastHistorySnapshotRef.current = clonedInitial;
|
|
628
628
|
lastHistorySerializedRef.current = serializeDocument(clonedInitial);
|
|
629
629
|
} else {
|
|
@@ -671,19 +671,19 @@ function useEditorHistory(input) {
|
|
|
671
671
|
}
|
|
672
672
|
const previousSnapshot = lastHistorySnapshotRef.current;
|
|
673
673
|
if (!previousSnapshot) {
|
|
674
|
-
lastHistorySnapshotRef.current =
|
|
674
|
+
lastHistorySnapshotRef.current = chunkNJ3WCYYG_js.cloneHistorySnapshot(snapshot);
|
|
675
675
|
lastHistorySerializedRef.current = serialized;
|
|
676
676
|
lastCheapHashRef.current = cheapHash;
|
|
677
677
|
updateHistoryAvailability();
|
|
678
678
|
return;
|
|
679
679
|
}
|
|
680
680
|
onDirtyRef.current?.();
|
|
681
|
-
historyPastRef.current.push(
|
|
681
|
+
historyPastRef.current.push(chunkNJ3WCYYG_js.cloneHistorySnapshot(previousSnapshot));
|
|
682
682
|
while (historyPastRef.current.length > Math.max(1, maxHistoryEntries)) {
|
|
683
683
|
historyPastRef.current.shift();
|
|
684
684
|
}
|
|
685
685
|
historyFutureRef.current = [];
|
|
686
|
-
lastHistorySnapshotRef.current =
|
|
686
|
+
lastHistorySnapshotRef.current = chunkNJ3WCYYG_js.cloneHistorySnapshot(snapshot);
|
|
687
687
|
lastHistorySerializedRef.current = serialized;
|
|
688
688
|
lastCheapHashRef.current = cheapHash;
|
|
689
689
|
updateHistoryAvailability();
|
|
@@ -732,39 +732,75 @@ function useViewerStore(store, selector, isEqual = Object.is) {
|
|
|
732
732
|
);
|
|
733
733
|
return react.useSyncExternalStore(subscribe2, getSnapshot2, getSnapshot2);
|
|
734
734
|
}
|
|
735
|
+
var DEFAULT_FIT = { fitPadding: { horizontal: 4, vertical: 16 }, maxFitScale: 1 };
|
|
736
|
+
function useViewportFit(canvasSize, viewportRef, options) {
|
|
737
|
+
const [editorDimensions, setEditorDimensions] = react.useState(null);
|
|
738
|
+
const { fitPadding, maxFitScale } = chunk4SPZ5IZN_js.resolveViewportFitOptions(options, DEFAULT_FIT);
|
|
739
|
+
const { horizontal, vertical } = fitPadding;
|
|
740
|
+
const effectiveEditorDimensions = editorDimensions ?? canvasSize;
|
|
741
|
+
const { scale: fitScale } = chunk4SPZ5IZN_js.calculateViewportFit({
|
|
742
|
+
viewportWidth: effectiveEditorDimensions.width,
|
|
743
|
+
viewportHeight: effectiveEditorDimensions.height,
|
|
744
|
+
canvasWidth: canvasSize.width,
|
|
745
|
+
canvasHeight: canvasSize.height,
|
|
746
|
+
maxFitScale
|
|
747
|
+
});
|
|
748
|
+
react.useEffect(() => {
|
|
749
|
+
let observer = null;
|
|
750
|
+
let raf = 0;
|
|
751
|
+
const measure = (element) => {
|
|
752
|
+
const { availableWidth: width, availableHeight: height } = chunk4SPZ5IZN_js.calculateViewportFit({
|
|
753
|
+
viewportWidth: element.clientWidth,
|
|
754
|
+
viewportHeight: element.clientHeight,
|
|
755
|
+
canvasWidth: canvasSize.width,
|
|
756
|
+
canvasHeight: canvasSize.height,
|
|
757
|
+
fitPadding: { horizontal, vertical }
|
|
758
|
+
});
|
|
759
|
+
if (width > 0 && height > 0) {
|
|
760
|
+
setEditorDimensions({ width, height });
|
|
761
|
+
}
|
|
762
|
+
};
|
|
763
|
+
const attach = () => {
|
|
764
|
+
const element = viewportRef.current;
|
|
765
|
+
if (!element) {
|
|
766
|
+
raf = requestAnimationFrame(attach);
|
|
767
|
+
return;
|
|
768
|
+
}
|
|
769
|
+
observer = new ResizeObserver(() => measure(element));
|
|
770
|
+
observer.observe(element);
|
|
771
|
+
measure(element);
|
|
772
|
+
};
|
|
773
|
+
attach();
|
|
774
|
+
return () => {
|
|
775
|
+
cancelAnimationFrame(raf);
|
|
776
|
+
observer?.disconnect();
|
|
777
|
+
};
|
|
778
|
+
}, [viewportRef, canvasSize.width, canvasSize.height, horizontal, vertical]);
|
|
779
|
+
return { editorDimensions, setEditorDimensions, effectiveEditorDimensions, fitScale };
|
|
780
|
+
}
|
|
735
781
|
|
|
736
782
|
// src/viewer/hooks/useZoomViewport.ts
|
|
737
783
|
var selectZoom = (state) => state.zoom;
|
|
738
784
|
function useZoomViewport({
|
|
739
785
|
canvasSize,
|
|
740
|
-
selectedElements
|
|
786
|
+
selectedElements,
|
|
787
|
+
fitPadding,
|
|
788
|
+
maxFitScale
|
|
741
789
|
}) {
|
|
742
790
|
const editWrapperRef = react.useRef(null);
|
|
743
791
|
const canvasStageRef = react.useRef(null);
|
|
744
792
|
const canvasViewportRef = react.useRef(null);
|
|
745
793
|
const renderScaleRef = react.useRef(1);
|
|
746
|
-
const wheelBufferRef = react.useRef(
|
|
794
|
+
const wheelBufferRef = react.useRef(chunk4SPZ5IZN_js.createWheelStepBuffer());
|
|
747
795
|
const storeRef = react.useRef(null);
|
|
748
|
-
storeRef.current ??=
|
|
796
|
+
storeRef.current ??= chunk4SPZ5IZN_js.createViewerZoomStore();
|
|
749
797
|
const store = storeRef.current;
|
|
750
798
|
const scale = useViewerStore(store, selectZoom);
|
|
751
799
|
const setScale = react.useCallback(
|
|
752
800
|
(next) => store.dispatch({ type: "set-zoom", zoom: next }),
|
|
753
801
|
[store]
|
|
754
802
|
);
|
|
755
|
-
const
|
|
756
|
-
const effectiveEditorDimensions = editorDimensions || {
|
|
757
|
-
width: canvasSize.width,
|
|
758
|
-
height: canvasSize.height
|
|
759
|
-
};
|
|
760
|
-
const fitScale = react.useMemo(() => {
|
|
761
|
-
if (!effectiveEditorDimensions.width || !effectiveEditorDimensions.height) {
|
|
762
|
-
return 1;
|
|
763
|
-
}
|
|
764
|
-
const widthScale = effectiveEditorDimensions.width / canvasSize.width;
|
|
765
|
-
const heightScale = effectiveEditorDimensions.height / canvasSize.height;
|
|
766
|
-
return Math.min(widthScale, heightScale, 1);
|
|
767
|
-
}, [canvasSize, effectiveEditorDimensions.height, effectiveEditorDimensions.width]);
|
|
803
|
+
const { editorDimensions, setEditorDimensions, effectiveEditorDimensions, fitScale } = useViewportFit(canvasSize, canvasViewportRef, { fitPadding, maxFitScale });
|
|
768
804
|
const editorScale = fitScale * scale;
|
|
769
805
|
react.useEffect(() => {
|
|
770
806
|
renderScaleRef.current = editorScale;
|
|
@@ -772,33 +808,6 @@ function useZoomViewport({
|
|
|
772
808
|
react.useEffect(() => {
|
|
773
809
|
store.dispatch({ type: "set-fit-scale", fitScale });
|
|
774
810
|
}, [store, fitScale]);
|
|
775
|
-
react.useEffect(() => {
|
|
776
|
-
let observer = null;
|
|
777
|
-
let raf = 0;
|
|
778
|
-
const VERTICAL_MARGIN = 32;
|
|
779
|
-
const measure = (el) => {
|
|
780
|
-
const width = Math.max(0, el.clientWidth - 8);
|
|
781
|
-
const height = Math.max(0, el.clientHeight - VERTICAL_MARGIN);
|
|
782
|
-
if (width > 0 && height > 0) {
|
|
783
|
-
setEditorDimensions({ width, height });
|
|
784
|
-
}
|
|
785
|
-
};
|
|
786
|
-
const attach = () => {
|
|
787
|
-
const el = canvasViewportRef.current;
|
|
788
|
-
if (!el) {
|
|
789
|
-
raf = requestAnimationFrame(attach);
|
|
790
|
-
return;
|
|
791
|
-
}
|
|
792
|
-
observer = new ResizeObserver(() => measure(el));
|
|
793
|
-
observer.observe(el);
|
|
794
|
-
measure(el);
|
|
795
|
-
};
|
|
796
|
-
attach();
|
|
797
|
-
return () => {
|
|
798
|
-
cancelAnimationFrame(raf);
|
|
799
|
-
observer?.disconnect();
|
|
800
|
-
};
|
|
801
|
-
}, []);
|
|
802
811
|
const centerBoundsInViewport = react.useCallback(
|
|
803
812
|
(bounds, nextScale) => {
|
|
804
813
|
const wrapper = editWrapperRef.current;
|
|
@@ -806,7 +815,7 @@ function useZoomViewport({
|
|
|
806
815
|
if (!wrapper || !canvasViewport) {
|
|
807
816
|
return;
|
|
808
817
|
}
|
|
809
|
-
const boundedScale =
|
|
818
|
+
const boundedScale = chunk4SPZ5IZN_js.clampZoomScale(nextScale);
|
|
810
819
|
const nextEditorScale = fitScale * boundedScale;
|
|
811
820
|
const centerX = (bounds.minX + bounds.maxX) / 2;
|
|
812
821
|
const centerY = (bounds.minY + bounds.maxY) / 2;
|
|
@@ -843,29 +852,29 @@ function useZoomViewport({
|
|
|
843
852
|
selectedElements.forEach((element) => {
|
|
844
853
|
minX = Math.min(minX, element.x);
|
|
845
854
|
minY = Math.min(minY, element.y);
|
|
846
|
-
maxX = Math.max(maxX, element.x + Math.max(element.width,
|
|
847
|
-
maxY = Math.max(maxY, element.y + Math.max(element.height,
|
|
855
|
+
maxX = Math.max(maxX, element.x + Math.max(element.width, chunkNJ3WCYYG_js.MIN_ELEMENT_SIZE));
|
|
856
|
+
maxY = Math.max(maxY, element.y + Math.max(element.height, chunkNJ3WCYYG_js.MIN_ELEMENT_SIZE));
|
|
848
857
|
});
|
|
849
858
|
if (!Number.isFinite(minX) || !Number.isFinite(minY) || !Number.isFinite(maxX) || !Number.isFinite(maxY)) {
|
|
850
859
|
return;
|
|
851
860
|
}
|
|
852
861
|
const selectionBounds = { minX, minY, maxX, maxY };
|
|
853
|
-
const boundsWidth = Math.max(selectionBounds.maxX - selectionBounds.minX,
|
|
854
|
-
const boundsHeight = Math.max(selectionBounds.maxY - selectionBounds.minY,
|
|
862
|
+
const boundsWidth = Math.max(selectionBounds.maxX - selectionBounds.minX, chunkNJ3WCYYG_js.MIN_ELEMENT_SIZE);
|
|
863
|
+
const boundsHeight = Math.max(selectionBounds.maxY - selectionBounds.minY, chunkNJ3WCYYG_js.MIN_ELEMENT_SIZE);
|
|
855
864
|
const availableWidth = Math.max(
|
|
856
|
-
effectiveEditorDimensions.width -
|
|
857
|
-
|
|
865
|
+
effectiveEditorDimensions.width - chunkNJ3WCYYG_js.ZOOM_TO_SELECTION_PADDING,
|
|
866
|
+
chunkNJ3WCYYG_js.MIN_ELEMENT_SIZE
|
|
858
867
|
);
|
|
859
868
|
const availableHeight = Math.max(
|
|
860
|
-
effectiveEditorDimensions.height -
|
|
861
|
-
|
|
869
|
+
effectiveEditorDimensions.height - chunkNJ3WCYYG_js.ZOOM_TO_SELECTION_PADDING,
|
|
870
|
+
chunkNJ3WCYYG_js.MIN_ELEMENT_SIZE
|
|
862
871
|
);
|
|
863
872
|
const targetEditorScale = Math.min(
|
|
864
873
|
availableWidth / boundsWidth,
|
|
865
874
|
availableHeight / boundsHeight
|
|
866
875
|
);
|
|
867
876
|
const safeFitScale = fitScale > Number.EPSILON ? fitScale : Number.EPSILON;
|
|
868
|
-
const nextScale =
|
|
877
|
+
const nextScale = chunk4SPZ5IZN_js.clampZoomScale(targetEditorScale / safeFitScale);
|
|
869
878
|
setScale(nextScale);
|
|
870
879
|
window.requestAnimationFrame(() => {
|
|
871
880
|
window.requestAnimationFrame(() => {
|
|
@@ -882,14 +891,14 @@ function useZoomViewport({
|
|
|
882
891
|
]);
|
|
883
892
|
const handleWheel = react.useCallback(
|
|
884
893
|
(event) => {
|
|
885
|
-
const mapped =
|
|
894
|
+
const mapped = chunk4SPZ5IZN_js.mapEditingWheel(event, wheelBufferRef.current, true);
|
|
886
895
|
if (mapped.intent !== "zoom") {
|
|
887
896
|
return;
|
|
888
897
|
}
|
|
889
898
|
event.preventDefault();
|
|
890
899
|
store.dispatch({
|
|
891
900
|
type: "set-zoom",
|
|
892
|
-
zoom:
|
|
901
|
+
zoom: chunk4SPZ5IZN_js.clampZoomScale(store.getState().zoom + mapped.deltaScale)
|
|
893
902
|
});
|
|
894
903
|
},
|
|
895
904
|
[store]
|
|
@@ -984,8 +993,8 @@ function scheduleOpeningAutoPlayGroup(controller, ctx) {
|
|
|
984
993
|
if (!group) {
|
|
985
994
|
return;
|
|
986
995
|
}
|
|
987
|
-
|
|
988
|
-
|
|
996
|
+
chunk4SPZ5IZN_js.playGroup(controller, group, ctx);
|
|
997
|
+
chunk4SPZ5IZN_js.scheduleAutoAdvanceChain(controller, ctx);
|
|
989
998
|
}, firstGroup.autoAdvanceDelayMs ?? 0);
|
|
990
999
|
ctx.timers.push(timer);
|
|
991
1000
|
}
|
|
@@ -1004,7 +1013,7 @@ function scheduleEntranceAnimationTimers(slide, setPresentationAnimations, prese
|
|
|
1004
1013
|
}))
|
|
1005
1014
|
);
|
|
1006
1015
|
entranceAnimations.forEach((animation, animationIndex) => {
|
|
1007
|
-
const delay =
|
|
1016
|
+
const delay = chunk4SPZ5IZN_js.computeEntranceAnimationDelay(animation.delayMs, animationIndex);
|
|
1008
1017
|
const timer = window.setTimeout(() => {
|
|
1009
1018
|
setPresentationAnimations(
|
|
1010
1019
|
(previousAnimations) => previousAnimations.map(
|
|
@@ -1037,7 +1046,7 @@ function useAnimationPlayback(input) {
|
|
|
1037
1046
|
const presentationTimersRef = react.useRef([]);
|
|
1038
1047
|
const controllerRef = react.useRef(null);
|
|
1039
1048
|
const buildRafRef = react.useRef(null);
|
|
1040
|
-
const activeAnimationGroupRef = react.useRef(
|
|
1049
|
+
const activeAnimationGroupRef = react.useRef(chunk4SPZ5IZN_js.createActiveAnimationGroup());
|
|
1041
1050
|
const seededCompletedRef = react.useRef(false);
|
|
1042
1051
|
const mediaTimeNodeElementIdsRef = react.useRef(/* @__PURE__ */ new Map());
|
|
1043
1052
|
const lastSeedCompletedRef = react.useRef(false);
|
|
@@ -1054,15 +1063,15 @@ function useAnimationPlayback(input) {
|
|
|
1054
1063
|
}, [onPlayActionSound]);
|
|
1055
1064
|
react.useEffect(() => {
|
|
1056
1065
|
return () => {
|
|
1057
|
-
|
|
1066
|
+
chunk4SPZ5IZN_js.cancelBuildReveal(buildRafRef);
|
|
1058
1067
|
};
|
|
1059
1068
|
}, []);
|
|
1060
1069
|
const clearPresentationTimers = react.useCallback(() => {
|
|
1061
|
-
|
|
1070
|
+
chunk4SPZ5IZN_js.clearPlaybackTimers(buildPlaybackContext(), activeAnimationGroupRef.current);
|
|
1062
1071
|
}, [buildPlaybackContext]);
|
|
1063
1072
|
const resetSlideTimeline = react.useCallback(
|
|
1064
1073
|
(slideIndex) => {
|
|
1065
|
-
|
|
1074
|
+
chunk4SPZ5IZN_js.cancelBuildReveal(buildRafRef);
|
|
1066
1075
|
const slide = slides[slideIndex];
|
|
1067
1076
|
if (!slide) {
|
|
1068
1077
|
controllerRef.current = null;
|
|
@@ -1073,14 +1082,14 @@ function useAnimationPlayback(input) {
|
|
|
1073
1082
|
setHoverTriggerShapeIds(/* @__PURE__ */ new Set());
|
|
1074
1083
|
return;
|
|
1075
1084
|
}
|
|
1076
|
-
const controller =
|
|
1085
|
+
const controller = chunk4SPZ5IZN_js.PresentationAnimationController.fromSlide(slide, {
|
|
1077
1086
|
slideHeightPx: canvasSize?.height,
|
|
1078
1087
|
slideWidthPx: canvasSize?.width,
|
|
1079
1088
|
themeColorMap,
|
|
1080
1089
|
pixelateMosaic: pixelateMosaicAnimation
|
|
1081
1090
|
});
|
|
1082
1091
|
controllerRef.current = controller;
|
|
1083
|
-
mediaTimeNodeElementIdsRef.current =
|
|
1092
|
+
mediaTimeNodeElementIdsRef.current = chunk4SPZ5IZN_js.resolveMediaTimeNodeElementIds(
|
|
1084
1093
|
slide.nativeAnimations ?? []
|
|
1085
1094
|
);
|
|
1086
1095
|
setPresentationKeyframesCss(controller.keyframesCss);
|
|
@@ -1094,7 +1103,7 @@ function useAnimationPlayback(input) {
|
|
|
1094
1103
|
if (!animationsEnabled) {
|
|
1095
1104
|
return false;
|
|
1096
1105
|
}
|
|
1097
|
-
return
|
|
1106
|
+
return chunk4SPZ5IZN_js.advanceMainSequence(
|
|
1098
1107
|
controllerRef.current,
|
|
1099
1108
|
buildPlaybackContext(),
|
|
1100
1109
|
activeAnimationGroupRef.current
|
|
@@ -1110,7 +1119,7 @@ function useAnimationPlayback(input) {
|
|
|
1110
1119
|
if (!group) {
|
|
1111
1120
|
return false;
|
|
1112
1121
|
}
|
|
1113
|
-
|
|
1122
|
+
chunk4SPZ5IZN_js.playGroup(controller, group, buildPlaybackContext());
|
|
1114
1123
|
return true;
|
|
1115
1124
|
},
|
|
1116
1125
|
[buildPlaybackContext]
|
|
@@ -1129,7 +1138,7 @@ function useAnimationPlayback(input) {
|
|
|
1129
1138
|
if (!group) {
|
|
1130
1139
|
return false;
|
|
1131
1140
|
}
|
|
1132
|
-
|
|
1141
|
+
chunk4SPZ5IZN_js.playGroup(controller, group, buildPlaybackContext());
|
|
1133
1142
|
return true;
|
|
1134
1143
|
},
|
|
1135
1144
|
[animationsEnabled, buildPlaybackContext]
|
|
@@ -1210,12 +1219,12 @@ function useAnimationPlayback(input) {
|
|
|
1210
1219
|
presentationTimersRef
|
|
1211
1220
|
};
|
|
1212
1221
|
}
|
|
1213
|
-
var PRESENTER_CHANNEL_NAME =
|
|
1214
|
-
var AUDIENCE_HASH =
|
|
1215
|
-
var PRESENTER_MSG_ORIGIN =
|
|
1216
|
-
var AUDIENCE_NONCE_KEY =
|
|
1222
|
+
var PRESENTER_CHANNEL_NAME = chunk4SPZ5IZN_js.PRESENTATION_CHANNEL_NAME;
|
|
1223
|
+
var AUDIENCE_HASH = chunk4SPZ5IZN_js.PRESENTATION_HASH;
|
|
1224
|
+
var PRESENTER_MSG_ORIGIN = chunk4SPZ5IZN_js.PRESENTATION_MESSAGE_ORIGIN;
|
|
1225
|
+
var AUDIENCE_NONCE_KEY = chunk4SPZ5IZN_js.PRESENTATION_NONCE_KEY;
|
|
1217
1226
|
function generateSessionId() {
|
|
1218
|
-
return
|
|
1227
|
+
return chunk4SPZ5IZN_js.createPresentationSessionId();
|
|
1219
1228
|
}
|
|
1220
1229
|
function parseAudienceNonce() {
|
|
1221
1230
|
const hash = window.location.hash;
|
|
@@ -1251,7 +1260,7 @@ function usePresenterWindow(input) {
|
|
|
1251
1260
|
}, []);
|
|
1252
1261
|
const swapDisplays = react.useCallback(async () => {
|
|
1253
1262
|
const audience = audienceWindowRef.current;
|
|
1254
|
-
return audience && !audience.closed ?
|
|
1263
|
+
return audience && !audience.closed ? chunk4SPZ5IZN_js.swapPresentationWindows(window, audience) : false;
|
|
1255
1264
|
}, []);
|
|
1256
1265
|
const syncSlideToAudience = react.useCallback(
|
|
1257
1266
|
(slideIndex) => {
|
|
@@ -1315,7 +1324,7 @@ function usePresenterWindow(input) {
|
|
|
1315
1324
|
pollTimerRef.current = null;
|
|
1316
1325
|
}
|
|
1317
1326
|
if (closingSessionId) {
|
|
1318
|
-
void
|
|
1327
|
+
void chunk4SPZ5IZN_js.clearAudienceContent(closingSessionId);
|
|
1319
1328
|
}
|
|
1320
1329
|
}, [getChannel]);
|
|
1321
1330
|
const openAudienceWindow = react.useCallback(() => {
|
|
@@ -1333,10 +1342,10 @@ function usePresenterWindow(input) {
|
|
|
1333
1342
|
audienceWindowRef.current = blankWin;
|
|
1334
1343
|
const sessionId = generateSessionId();
|
|
1335
1344
|
sessionIdRef.current = sessionId;
|
|
1336
|
-
const audienceUrl =
|
|
1337
|
-
void
|
|
1345
|
+
const audienceUrl = chunk4SPZ5IZN_js.buildPresentationAudienceUrl(window.location.href, sessionId);
|
|
1346
|
+
void chunk4SPZ5IZN_js.resolveAudienceScreenPlacement(window).then((placement) => {
|
|
1338
1347
|
if (placement && audienceWindowRef.current === blankWin && !blankWin.closed) {
|
|
1339
|
-
|
|
1348
|
+
chunk4SPZ5IZN_js.placeAudienceWindow(blankWin, placement);
|
|
1340
1349
|
}
|
|
1341
1350
|
return void 0;
|
|
1342
1351
|
});
|
|
@@ -1366,7 +1375,7 @@ function usePresenterWindow(input) {
|
|
|
1366
1375
|
}
|
|
1367
1376
|
};
|
|
1368
1377
|
if (content) {
|
|
1369
|
-
void
|
|
1378
|
+
void chunk4SPZ5IZN_js.storeAudienceContent(content, sessionId).then(() => navigateOrClose(true)).catch(() => navigateOrClose(false));
|
|
1370
1379
|
} else {
|
|
1371
1380
|
navigateOrClose(true);
|
|
1372
1381
|
}
|
|
@@ -1392,7 +1401,7 @@ function usePresenterWindow(input) {
|
|
|
1392
1401
|
}
|
|
1393
1402
|
const handleMessage = (event) => {
|
|
1394
1403
|
const message = event.data;
|
|
1395
|
-
if (
|
|
1404
|
+
if (chunk4SPZ5IZN_js.isPresentationSessionMessage(message) && message.type === "audience-ready" && message.sessionId === sessionIdRef.current) {
|
|
1396
1405
|
syncStateToAudience(snapshotRef.current);
|
|
1397
1406
|
}
|
|
1398
1407
|
};
|
|
@@ -1421,7 +1430,7 @@ function usePresenterWindow(input) {
|
|
|
1421
1430
|
react.useEffect(() => {
|
|
1422
1431
|
const handleBeforeUnload = () => {
|
|
1423
1432
|
if (sessionIdRef.current) {
|
|
1424
|
-
void
|
|
1433
|
+
void chunk4SPZ5IZN_js.clearAudienceContent(sessionIdRef.current);
|
|
1425
1434
|
}
|
|
1426
1435
|
};
|
|
1427
1436
|
window.addEventListener("beforeunload", handleBeforeUnload);
|
|
@@ -1483,7 +1492,7 @@ function useAudienceMode(input) {
|
|
|
1483
1492
|
}
|
|
1484
1493
|
channel.onmessage = (event) => {
|
|
1485
1494
|
const data = event.data;
|
|
1486
|
-
if (!
|
|
1495
|
+
if (!chunk4SPZ5IZN_js.isPresentationSessionMessage(data) || data.origin !== PRESENTER_MSG_ORIGIN) {
|
|
1487
1496
|
return;
|
|
1488
1497
|
}
|
|
1489
1498
|
if (expectedSessionId && data.sessionId !== expectedSessionId) {
|
|
@@ -1499,16 +1508,16 @@ function useAudienceMode(input) {
|
|
|
1499
1508
|
}
|
|
1500
1509
|
if (data.type === "presenter-exit") {
|
|
1501
1510
|
if (expectedSessionId) {
|
|
1502
|
-
void
|
|
1511
|
+
void chunk4SPZ5IZN_js.clearAudienceContent(expectedSessionId);
|
|
1503
1512
|
}
|
|
1504
|
-
if (
|
|
1513
|
+
if (chunk4SPZ5IZN_js.endAudienceDisplay(window)) {
|
|
1505
1514
|
handlers.onPresenterEnded?.();
|
|
1506
1515
|
}
|
|
1507
1516
|
}
|
|
1508
1517
|
};
|
|
1509
1518
|
if (expectedSessionId) {
|
|
1510
1519
|
channel.postMessage({
|
|
1511
|
-
origin:
|
|
1520
|
+
origin: chunk4SPZ5IZN_js.PRESENTATION_MESSAGE_ORIGIN,
|
|
1512
1521
|
type: "audience-ready",
|
|
1513
1522
|
sessionId: expectedSessionId
|
|
1514
1523
|
});
|
|
@@ -1522,7 +1531,7 @@ function useAudienceMode(input) {
|
|
|
1522
1531
|
}, []);
|
|
1523
1532
|
}
|
|
1524
1533
|
function usePresentationKeyboard(input) {
|
|
1525
|
-
const wheelBufferRef = react.useRef(
|
|
1534
|
+
const wheelBufferRef = react.useRef(chunk4SPZ5IZN_js.createWheelStepBuffer());
|
|
1526
1535
|
const {
|
|
1527
1536
|
mode,
|
|
1528
1537
|
movePresentationSlide,
|
|
@@ -1543,14 +1552,14 @@ function usePresentationKeyboard(input) {
|
|
|
1543
1552
|
presentationSlideIndex,
|
|
1544
1553
|
setShowRehearsalSummary
|
|
1545
1554
|
} = input;
|
|
1546
|
-
const keyBufferRef = react.useRef(
|
|
1555
|
+
const keyBufferRef = react.useRef(chunk4SPZ5IZN_js.createPresentationKeyBuffer());
|
|
1547
1556
|
react.useEffect(() => {
|
|
1548
|
-
if (mode !== "present" || !
|
|
1549
|
-
keyBufferRef.current =
|
|
1557
|
+
if (mode !== "present" || !chunk4SPZ5IZN_js.acceptsPresentationInput()) {
|
|
1558
|
+
keyBufferRef.current = chunk4SPZ5IZN_js.createPresentationKeyBuffer();
|
|
1550
1559
|
return;
|
|
1551
1560
|
}
|
|
1552
1561
|
const handleKeyDown = (event) => {
|
|
1553
|
-
const mapped =
|
|
1562
|
+
const mapped = chunk4SPZ5IZN_js.mapPresentationKey(event, keyBufferRef.current);
|
|
1554
1563
|
if (mapped.action === "none") {
|
|
1555
1564
|
return;
|
|
1556
1565
|
}
|
|
@@ -1570,12 +1579,12 @@ function usePresentationKeyboard(input) {
|
|
|
1570
1579
|
movePresentationSlide(-1);
|
|
1571
1580
|
return;
|
|
1572
1581
|
case "first": {
|
|
1573
|
-
const first =
|
|
1582
|
+
const first = chunk4SPZ5IZN_js.firstShowSlideIndex(showSlideIndexes);
|
|
1574
1583
|
navigateToSlide(first ?? 0);
|
|
1575
1584
|
return;
|
|
1576
1585
|
}
|
|
1577
1586
|
case "last": {
|
|
1578
|
-
const last =
|
|
1587
|
+
const last = chunk4SPZ5IZN_js.lastShowSlideIndex(showSlideIndexes);
|
|
1579
1588
|
navigateToSlide(last ?? Math.max(0, slideCount - 1));
|
|
1580
1589
|
return;
|
|
1581
1590
|
}
|
|
@@ -1613,10 +1622,10 @@ function usePresentationKeyboard(input) {
|
|
|
1613
1622
|
}
|
|
1614
1623
|
};
|
|
1615
1624
|
const handleWheel = (event) => {
|
|
1616
|
-
if (mode !== "present" || !
|
|
1625
|
+
if (mode !== "present" || !chunk4SPZ5IZN_js.acceptsPresentationInput()) {
|
|
1617
1626
|
return;
|
|
1618
1627
|
}
|
|
1619
|
-
const mapped =
|
|
1628
|
+
const mapped = chunk4SPZ5IZN_js.mapPresentationWheel(event, wheelBufferRef.current);
|
|
1620
1629
|
if (mapped.intent === "next-slide") {
|
|
1621
1630
|
event.preventDefault();
|
|
1622
1631
|
movePresentationSlide(1);
|
|
@@ -1749,7 +1758,7 @@ function useRehearsalTimings(input) {
|
|
|
1749
1758
|
|
|
1750
1759
|
// src/viewer/hooks/presentation-mode/presentation-actions.ts
|
|
1751
1760
|
function handlePresentationActionImpl(action, deps) {
|
|
1752
|
-
|
|
1761
|
+
chunk4SPZ5IZN_js.runPresentationAction(
|
|
1753
1762
|
action,
|
|
1754
1763
|
{ slideCount: deps.slidesLength, ...deps.elementId ? { elementId: deps.elementId } : {} },
|
|
1755
1764
|
{
|
|
@@ -1778,13 +1787,13 @@ function handlePresentationActionImpl(action, deps) {
|
|
|
1778
1787
|
function executeSlideTransition(nextSlideIndex, deps) {
|
|
1779
1788
|
const incomingSlide = deps.slides[nextSlideIndex];
|
|
1780
1789
|
const transition = deps.reverse ? deps.slides[deps.currentSlideIndex]?.transition : incomingSlide?.transition;
|
|
1781
|
-
const durationMs = deps.playTransition ?
|
|
1790
|
+
const durationMs = deps.playTransition ? chunk4SPZ5IZN_js.resolveTransitionDurationMs(transition) : 0;
|
|
1782
1791
|
deps.clearPresentationTimers();
|
|
1783
1792
|
deps.setPresentationSlideIndex(nextSlideIndex);
|
|
1784
1793
|
deps.onSetActiveSlideIndex(nextSlideIndex);
|
|
1785
1794
|
deps.setPresentationSlideVisible(true);
|
|
1786
1795
|
deps.seedSlideAnimations(nextSlideIndex, { completed: deps.seedCompleted });
|
|
1787
|
-
const soundAction =
|
|
1796
|
+
const soundAction = chunk4SPZ5IZN_js.resolveTransitionSoundAction(transition);
|
|
1788
1797
|
if (soundAction.kind === "play" && deps.onPlayActionSound) {
|
|
1789
1798
|
deps.onPlayActionSound(soundAction.soundPath, { loop: soundAction.loop });
|
|
1790
1799
|
} else if (soundAction.kind === "stop" && deps.onStopActionSound) {
|
|
@@ -1848,7 +1857,7 @@ function useSlideNavigation(input) {
|
|
|
1848
1857
|
});
|
|
1849
1858
|
const scheduleAutoAdvanceForSlide = react.useCallback(
|
|
1850
1859
|
(slideIndex) => {
|
|
1851
|
-
const delayMs =
|
|
1860
|
+
const delayMs = chunk4SPZ5IZN_js.resolveAutoAdvanceDelayMs(slides[slideIndex], { useTimings });
|
|
1852
1861
|
if (delayMs === void 0) {
|
|
1853
1862
|
return;
|
|
1854
1863
|
}
|
|
@@ -1871,7 +1880,7 @@ function useSlideNavigation(input) {
|
|
|
1871
1880
|
if (availableSlideIndexes.length === 0) {
|
|
1872
1881
|
return;
|
|
1873
1882
|
}
|
|
1874
|
-
const pastLastSlide = direction === 1 && !
|
|
1883
|
+
const pastLastSlide = direction === 1 && !chunk4SPZ5IZN_js.hasShowSlideAfter(presentationSlideIndex, availableSlideIndexes);
|
|
1875
1884
|
if (rehearsing && pastLastSlide) {
|
|
1876
1885
|
recordCurrentSlideTime(presentationSlideIndex);
|
|
1877
1886
|
try {
|
|
@@ -1889,9 +1898,9 @@ function useSlideNavigation(input) {
|
|
|
1889
1898
|
onAdvancePastLastSlide();
|
|
1890
1899
|
return;
|
|
1891
1900
|
}
|
|
1892
|
-
const nextSlideIndex = direction === 1 ?
|
|
1901
|
+
const nextSlideIndex = direction === 1 ? chunk4SPZ5IZN_js.nextShowSlideIndex(presentationSlideIndex, availableSlideIndexes, {
|
|
1893
1902
|
loop: Boolean(loopContinuously) && !rehearsing
|
|
1894
|
-
}) :
|
|
1903
|
+
}) : chunk4SPZ5IZN_js.previousShowSlideIndex(presentationSlideIndex, availableSlideIndexes);
|
|
1895
1904
|
if (nextSlideIndex === void 0 || nextSlideIndex === presentationSlideIndex) {
|
|
1896
1905
|
return;
|
|
1897
1906
|
}
|
|
@@ -2072,7 +2081,7 @@ function createCustomShowRunner(deps) {
|
|
|
2072
2081
|
return;
|
|
2073
2082
|
}
|
|
2074
2083
|
origin = returnAfter ? { showId: deps.getActiveCustomShowId(), slideIndex: deps.getPresentationSlideIndex() } : null;
|
|
2075
|
-
const first =
|
|
2084
|
+
const first = chunk4SPZ5IZN_js.firstShowSlideIndex(chunk4SPZ5IZN_js.resolveShowSlideIndexes(deps.getSlides(), target));
|
|
2076
2085
|
deps.setActiveCustomShowId(customShowId);
|
|
2077
2086
|
if (first !== void 0) {
|
|
2078
2087
|
deps.navigateToSlide(first);
|
|
@@ -2150,33 +2159,33 @@ function usePresentationActionExtensions(input) {
|
|
|
2150
2159
|
}
|
|
2151
2160
|
}, [navigateToSlideViaRef]);
|
|
2152
2161
|
const onOpenFile = react.useCallback((target) => {
|
|
2153
|
-
|
|
2162
|
+
chunk4SPZ5IZN_js.safeOpenUrl(target);
|
|
2154
2163
|
}, []);
|
|
2155
2164
|
const onOpenPresentation = react.useCallback((target) => {
|
|
2156
|
-
|
|
2165
|
+
chunk4SPZ5IZN_js.safeOpenUrl(target);
|
|
2157
2166
|
}, []);
|
|
2158
2167
|
const onRunProgram = react.useCallback(
|
|
2159
2168
|
(target) => {
|
|
2160
|
-
onAddRunProgramNotice?.(
|
|
2169
|
+
onAddRunProgramNotice?.(chunk4SPZ5IZN_js.buildRunProgramNotice(target));
|
|
2161
2170
|
},
|
|
2162
2171
|
[onAddRunProgramNotice]
|
|
2163
2172
|
);
|
|
2164
2173
|
const onPlayMedia = react.useCallback(
|
|
2165
2174
|
(elementId) => {
|
|
2166
|
-
|
|
2175
|
+
chunk4SPZ5IZN_js.toggleStageElementMedia(containerRef.current, elementId);
|
|
2167
2176
|
},
|
|
2168
2177
|
[containerRef]
|
|
2169
2178
|
);
|
|
2170
2179
|
const onOleVerb = react.useCallback(
|
|
2171
2180
|
(verb, elementId) => {
|
|
2172
|
-
const target =
|
|
2181
|
+
const target = chunk4SPZ5IZN_js.resolveOleVerbTarget(slides[presentationSlideIndex], elementId, verb);
|
|
2173
2182
|
if (!target) {
|
|
2174
2183
|
return;
|
|
2175
2184
|
}
|
|
2176
2185
|
if (target.action === "download") {
|
|
2177
|
-
|
|
2186
|
+
chunk4SPZ5IZN_js.downloadDataUrl(target.url, target.fileName ?? "download");
|
|
2178
2187
|
} else {
|
|
2179
|
-
|
|
2188
|
+
chunk4SPZ5IZN_js.openUrlInNewTab(target.url);
|
|
2180
2189
|
}
|
|
2181
2190
|
},
|
|
2182
2191
|
[slides, presentationSlideIndex]
|
|
@@ -2207,22 +2216,22 @@ function usePresentationActionExtensions(input) {
|
|
|
2207
2216
|
};
|
|
2208
2217
|
}
|
|
2209
2218
|
function usePresenterConsole(slideIndex, active) {
|
|
2210
|
-
const timerRef = react.useRef(
|
|
2211
|
-
const [snapshot, setSnapshot] = react.useState(() =>
|
|
2219
|
+
const timerRef = react.useRef(chunk4SPZ5IZN_js.createPresenterTimer());
|
|
2220
|
+
const [snapshot, setSnapshot] = react.useState(() => chunk4SPZ5IZN_js.createInitialPresentationSnapshot(slideIndex));
|
|
2212
2221
|
const patch = react.useCallback((value) => {
|
|
2213
|
-
setSnapshot((current) =>
|
|
2222
|
+
setSnapshot((current) => chunk4SPZ5IZN_js.mergePresentationSnapshot(current, value));
|
|
2214
2223
|
}, []);
|
|
2215
2224
|
react.useEffect(() => patch({ slideIndex }), [patch, slideIndex]);
|
|
2216
2225
|
react.useEffect(() => {
|
|
2217
2226
|
if (!active) {
|
|
2218
2227
|
return;
|
|
2219
2228
|
}
|
|
2220
|
-
timerRef.current =
|
|
2229
|
+
timerRef.current = chunk4SPZ5IZN_js.resetPresenterTimer();
|
|
2221
2230
|
patch({ paused: false, elapsedMs: 0 });
|
|
2222
2231
|
const timer = window.setInterval(() => {
|
|
2223
2232
|
patch({
|
|
2224
2233
|
paused: timerRef.current.paused,
|
|
2225
|
-
elapsedMs:
|
|
2234
|
+
elapsedMs: chunk4SPZ5IZN_js.presenterElapsed(timerRef.current)
|
|
2226
2235
|
});
|
|
2227
2236
|
}, 1e3);
|
|
2228
2237
|
return () => window.clearInterval(timer);
|
|
@@ -2232,19 +2241,19 @@ function usePresenterConsole(slideIndex, active) {
|
|
|
2232
2241
|
applyAudienceSnapshot: setSnapshot,
|
|
2233
2242
|
setBlackout: (blackout) => patch({ blackout }),
|
|
2234
2243
|
toggleTimer: () => {
|
|
2235
|
-
timerRef.current =
|
|
2244
|
+
timerRef.current = chunk4SPZ5IZN_js.togglePresenterTimer(timerRef.current);
|
|
2236
2245
|
patch({
|
|
2237
2246
|
paused: timerRef.current.paused,
|
|
2238
|
-
elapsedMs:
|
|
2247
|
+
elapsedMs: chunk4SPZ5IZN_js.presenterElapsed(timerRef.current)
|
|
2239
2248
|
});
|
|
2240
2249
|
},
|
|
2241
2250
|
resetTimer: () => {
|
|
2242
|
-
timerRef.current =
|
|
2251
|
+
timerRef.current = chunk4SPZ5IZN_js.resetPresenterTimer();
|
|
2243
2252
|
patch({ paused: false, elapsedMs: 0 });
|
|
2244
2253
|
},
|
|
2245
2254
|
stepZoom: (direction) => setSnapshot(
|
|
2246
|
-
(current) =>
|
|
2247
|
-
zoom:
|
|
2255
|
+
(current) => chunk4SPZ5IZN_js.mergePresentationSnapshot(current, {
|
|
2256
|
+
zoom: chunk4SPZ5IZN_js.stepPresenterZoom(
|
|
2248
2257
|
current.zoom ?? { scale: 1, originX: 0.5, originY: 0.5 },
|
|
2249
2258
|
direction
|
|
2250
2259
|
)
|
|
@@ -2299,7 +2308,7 @@ function usePresentationMode(input) {
|
|
|
2299
2308
|
const [allSlidesOpen, setAllSlidesOpen] = react.useState(false);
|
|
2300
2309
|
const [endOfShowVisible, setEndOfShowVisible] = react.useState(false);
|
|
2301
2310
|
const [presentationStartTime, setPresentationStartTime] = react.useState(null);
|
|
2302
|
-
const showGuard = react.useMemo(() =>
|
|
2311
|
+
const showGuard = react.useMemo(() => chunk4SPZ5IZN_js.createPresenterShowGuard(), []);
|
|
2303
2312
|
const {
|
|
2304
2313
|
presentationAnimations,
|
|
2305
2314
|
presentationElementStates,
|
|
@@ -2399,7 +2408,7 @@ function usePresentationMode(input) {
|
|
|
2399
2408
|
actionExtensions.bindNavigateToSlide(navigateToSlide);
|
|
2400
2409
|
const movePresentationSlide = react.useCallback(
|
|
2401
2410
|
(direction, trigger = "explicit") => {
|
|
2402
|
-
if (!
|
|
2411
|
+
if (!chunk4SPZ5IZN_js.acceptsPresentationInput()) {
|
|
2403
2412
|
return;
|
|
2404
2413
|
}
|
|
2405
2414
|
if (endOfShowVisible) {
|
|
@@ -2468,7 +2477,7 @@ function usePresentationMode(input) {
|
|
|
2468
2477
|
onSetMode("present");
|
|
2469
2478
|
}, [containerRef, onSetMode, setRehearsing]);
|
|
2470
2479
|
const enterPresentModeFromBeginning = react.useCallback(() => {
|
|
2471
|
-
const first =
|
|
2480
|
+
const first = chunk4SPZ5IZN_js.firstShowSlideIndex(visibleSlideIndexes);
|
|
2472
2481
|
if (first !== void 0) {
|
|
2473
2482
|
onSetActiveSlideIndex(first);
|
|
2474
2483
|
}
|
|
@@ -2548,7 +2557,7 @@ function usePresentationMode(input) {
|
|
|
2548
2557
|
if (mode !== "present") {
|
|
2549
2558
|
return;
|
|
2550
2559
|
}
|
|
2551
|
-
return
|
|
2560
|
+
return chunk4SPZ5IZN_js.attachPresentationVisibilityPause({
|
|
2552
2561
|
root: containerRef.current ?? void 0,
|
|
2553
2562
|
onHidden: () => clearPresentationTimersRef.current(),
|
|
2554
2563
|
onVisible: () => scheduleAutoAdvanceRef.current(presentationSlideIndexRef.current)
|
|
@@ -2556,7 +2565,7 @@ function usePresentationMode(input) {
|
|
|
2556
2565
|
}, [mode, containerRef]);
|
|
2557
2566
|
react.useLayoutEffect(() => {
|
|
2558
2567
|
if (mode === "present") {
|
|
2559
|
-
const idx =
|
|
2568
|
+
const idx = chunk4SPZ5IZN_js.presentationEntrySlideIndex(
|
|
2560
2569
|
activeSlideIndexRef.current,
|
|
2561
2570
|
visibleSlideIndexesRef.current
|
|
2562
2571
|
);
|
|
@@ -2635,11 +2644,11 @@ function usePresentationMode(input) {
|
|
|
2635
2644
|
return void 0;
|
|
2636
2645
|
}
|
|
2637
2646
|
const incoming = slides[transitionOverlay.incomingSlideIndex];
|
|
2638
|
-
return
|
|
2647
|
+
return chunk4SPZ5IZN_js.buildMorphTransitionPlan(
|
|
2639
2648
|
slides[transitionOverlay.outgoingSlideIndex],
|
|
2640
2649
|
incoming,
|
|
2641
2650
|
transitionOverlay.durationMs,
|
|
2642
|
-
|
|
2651
|
+
chunk4SPZ5IZN_js.morphOptionToMode(transitionOverlay.transition.morphOption),
|
|
2643
2652
|
// `PresentationStage` stacks the incoming slide's elements above its
|
|
2644
2653
|
// template shapes (`zIndex = templateElements.length + index`), so a
|
|
2645
2654
|
// z-index journey has to start counting where the stage does.
|
|
@@ -2664,7 +2673,7 @@ function usePresentationMode(input) {
|
|
|
2664
2673
|
if (!morphPlan) {
|
|
2665
2674
|
return presentationKeyframesCss;
|
|
2666
2675
|
}
|
|
2667
|
-
const imageRules =
|
|
2676
|
+
const imageRules = chunk4SPZ5IZN_js.buildMorphAnimationRules(morphPlan, "", "incoming", "image");
|
|
2668
2677
|
return `${presentationKeyframesCss ?? ""}
|
|
2669
2678
|
${morphPlan.keyframesCss}
|
|
2670
2679
|
${imageRules}`;
|
|
@@ -2961,7 +2970,7 @@ function useFindReplace({
|
|
|
2961
2970
|
const [findResults, setFindResults] = react.useState([]);
|
|
2962
2971
|
const [findResultIndex, setFindResultIndex] = react.useState(-1);
|
|
2963
2972
|
const performFind = react.useCallback(() => {
|
|
2964
|
-
const results =
|
|
2973
|
+
const results = chunk4SPZ5IZN_js.findInSlides(slides, findQuery, { matchCase: findMatchCase });
|
|
2965
2974
|
if (!findQuery) {
|
|
2966
2975
|
setFindResults([]);
|
|
2967
2976
|
setFindResultIndex(-1);
|
|
@@ -2995,7 +3004,7 @@ function useFindReplace({
|
|
|
2995
3004
|
return;
|
|
2996
3005
|
}
|
|
2997
3006
|
onUpdateSlides(
|
|
2998
|
-
(prevSlides) =>
|
|
3007
|
+
(prevSlides) => chunk4SPZ5IZN_js.applyFindReplacements(prevSlides, toReplace, replaceQuery).slides
|
|
2999
3008
|
);
|
|
3000
3009
|
onMarkDirty();
|
|
3001
3010
|
},
|
|
@@ -3017,9 +3026,9 @@ function useFindReplace({
|
|
|
3017
3026
|
}, [findResults, applyReplacements, performFind]);
|
|
3018
3027
|
react.useEffect(() => {
|
|
3019
3028
|
const handler = (event) => {
|
|
3020
|
-
const { action } =
|
|
3029
|
+
const { action } = chunk4SPZ5IZN_js.mapEditorKey(event, {
|
|
3021
3030
|
canEdit: mode === "edit",
|
|
3022
|
-
isTextInputTarget:
|
|
3031
|
+
isTextInputTarget: chunk4SPZ5IZN_js.isEditorTextInputTarget(event.target)
|
|
3023
3032
|
});
|
|
3024
3033
|
if (action !== "find") {
|
|
3025
3034
|
return;
|
|
@@ -3130,7 +3139,7 @@ function addCommentToSlide(slides, slideIndex, text, authorName, elementId, ment
|
|
|
3130
3139
|
if (!slide) {
|
|
3131
3140
|
return { slides, didAdd: false };
|
|
3132
3141
|
}
|
|
3133
|
-
const next =
|
|
3142
|
+
const next = chunk4SPZ5IZN_js.addCommentToList(
|
|
3134
3143
|
slide.comments || [],
|
|
3135
3144
|
text,
|
|
3136
3145
|
authorName,
|
|
@@ -3151,7 +3160,7 @@ function removeCommentFromSlide(slides, slideIndex, commentId) {
|
|
|
3151
3160
|
if (!slide) {
|
|
3152
3161
|
return { slides, didDelete: false };
|
|
3153
3162
|
}
|
|
3154
|
-
const next =
|
|
3163
|
+
const next = chunk4SPZ5IZN_js.removeCommentFromList(slide.comments || [], commentId);
|
|
3155
3164
|
if (!next) {
|
|
3156
3165
|
return { slides, didDelete: false };
|
|
3157
3166
|
}
|
|
@@ -3162,7 +3171,7 @@ function editCommentInSlide(slides, slideIndex, commentId, newText) {
|
|
|
3162
3171
|
if (!slide) {
|
|
3163
3172
|
return { slides, didUpdate: false };
|
|
3164
3173
|
}
|
|
3165
|
-
const next =
|
|
3174
|
+
const next = chunk4SPZ5IZN_js.editCommentInList(slide.comments || [], commentId, newText);
|
|
3166
3175
|
if (!next) {
|
|
3167
3176
|
return { slides, didUpdate: false };
|
|
3168
3177
|
}
|
|
@@ -3173,7 +3182,7 @@ function toggleResolvedInSlide(slides, slideIndex, commentId) {
|
|
|
3173
3182
|
if (!slide) {
|
|
3174
3183
|
return { slides, didUpdate: false };
|
|
3175
3184
|
}
|
|
3176
|
-
const next =
|
|
3185
|
+
const next = chunk4SPZ5IZN_js.toggleCommentResolvedInList(slide.comments || [], commentId);
|
|
3177
3186
|
if (!next) {
|
|
3178
3187
|
return { slides, didUpdate: false };
|
|
3179
3188
|
}
|
|
@@ -3184,7 +3193,7 @@ function addReplyToSlide(slides, slideIndex, parentId, text, authorName, mention
|
|
|
3184
3193
|
if (!slide) {
|
|
3185
3194
|
return { slides, didAdd: false };
|
|
3186
3195
|
}
|
|
3187
|
-
const next =
|
|
3196
|
+
const next = chunk4SPZ5IZN_js.replyToCommentInList(slide.comments || [], parentId, text, authorName);
|
|
3188
3197
|
if (!next) {
|
|
3189
3198
|
return { slides, didAdd: false };
|
|
3190
3199
|
}
|
|
@@ -3571,7 +3580,7 @@ function useDerivedElementState(input) {
|
|
|
3571
3580
|
return [];
|
|
3572
3581
|
}
|
|
3573
3582
|
return [
|
|
3574
|
-
...
|
|
3583
|
+
...chunk4SPZ5IZN_js.visibleTemplateElements(activeSlide, templateElementsBySlideId[activeSlide.id] ?? [])
|
|
3575
3584
|
];
|
|
3576
3585
|
}, [activeSlide, templateElementsBySlideId]);
|
|
3577
3586
|
const activeMaster = slideMasters[activeMasterIndex];
|
|
@@ -3638,7 +3647,7 @@ function useViewerCoreState(_input) {
|
|
|
3638
3647
|
const marqueeStateRef = react.useRef(null);
|
|
3639
3648
|
const isDrawingRef = react.useRef(false);
|
|
3640
3649
|
const justInteractedRef = react.useRef(false);
|
|
3641
|
-
const livePatcher = react.useMemo(() =>
|
|
3650
|
+
const livePatcher = react.useMemo(() => chunk4SPZ5IZN_js.createCollaborationLivePatcher(), []);
|
|
3642
3651
|
react.useEffect(() => () => livePatcher.dispose(), [livePatcher]);
|
|
3643
3652
|
const slidesRef = react.useRef([]);
|
|
3644
3653
|
const [mode, setMode] = react.useState("edit");
|
|
@@ -3647,8 +3656,8 @@ function useViewerCoreState(_input) {
|
|
|
3647
3656
|
const [slides, setSlides] = react.useState([]);
|
|
3648
3657
|
const [templateElementsBySlideId, setTemplateElementsBySlideId] = react.useState({});
|
|
3649
3658
|
const [canvasSize, setCanvasSize] = react.useState({
|
|
3650
|
-
width:
|
|
3651
|
-
height:
|
|
3659
|
+
width: chunkNJ3WCYYG_js.DEFAULT_CANVAS_WIDTH,
|
|
3660
|
+
height: chunkNJ3WCYYG_js.DEFAULT_CANVAS_HEIGHT
|
|
3652
3661
|
});
|
|
3653
3662
|
const [slideSizeEmu, setSlideSizeEmu] = react.useState();
|
|
3654
3663
|
const [activeSlideIndex, setActiveSlideIndex] = react.useState(0);
|
|
@@ -3669,7 +3678,7 @@ function useViewerCoreState(_input) {
|
|
|
3669
3678
|
const resolved = typeof value === "function" ? value(inlineEditingTextRef.current) : value;
|
|
3670
3679
|
inlineEditingTextRef.current = resolved;
|
|
3671
3680
|
setInlineEditingTextBase(value);
|
|
3672
|
-
|
|
3681
|
+
chunk4SPZ5IZN_js.publishLiveInlineText(
|
|
3673
3682
|
livePatcher,
|
|
3674
3683
|
slidesRef.current[activeSlideIndexRef.current],
|
|
3675
3684
|
inlineEditingElementIdRef.current,
|
|
@@ -3964,8 +3973,8 @@ function useViewerState(input) {
|
|
|
3964
3973
|
}
|
|
3965
3974
|
|
|
3966
3975
|
// src/viewer/utils/glyph-outline-cache.ts
|
|
3967
|
-
var glyphOutlineFontCache = new
|
|
3968
|
-
var getGlyphOutline =
|
|
3976
|
+
var glyphOutlineFontCache = new chunk4SPZ5IZN_js.GlyphOutlineFontCache();
|
|
3977
|
+
var getGlyphOutline = chunk4SPZ5IZN_js.createGlyphOutlineLookup(glyphOutlineFontCache);
|
|
3969
3978
|
|
|
3970
3979
|
// src/viewer/hooks/useLoadContent.ts
|
|
3971
3980
|
function useLoadContent({
|
|
@@ -4024,8 +4033,8 @@ function useLoadContent({
|
|
|
4024
4033
|
}
|
|
4025
4034
|
let cancelled = false;
|
|
4026
4035
|
const token = ++renderTokenRef.current;
|
|
4027
|
-
const handler = new
|
|
4028
|
-
const resources =
|
|
4036
|
+
const handler = new chunk4SPZ5IZN_js.PptxHandler();
|
|
4037
|
+
const resources = chunk4SPZ5IZN_js.createPresentationLoadResources(handler);
|
|
4029
4038
|
const loadBlobUrls = resources.blobUrls;
|
|
4030
4039
|
(async () => {
|
|
4031
4040
|
try {
|
|
@@ -4046,12 +4055,12 @@ function useLoadContent({
|
|
|
4046
4055
|
}
|
|
4047
4056
|
const mediaElements = [];
|
|
4048
4057
|
for (const slide of parsed.slides) {
|
|
4049
|
-
|
|
4058
|
+
chunk4SPZ5IZN_js.collectMediaElements(slide.elements, mediaElements);
|
|
4050
4059
|
}
|
|
4051
4060
|
const nextMediaUrls = /* @__PURE__ */ new Map();
|
|
4052
4061
|
await Promise.all(
|
|
4053
4062
|
mediaElements.map(async (mediaElement) => {
|
|
4054
|
-
const resolved = await
|
|
4063
|
+
const resolved = await chunk4SPZ5IZN_js.resolveMediaElementSource(mediaElement, handler);
|
|
4055
4064
|
if (resolved.missing || !resolved.mediaPath || !resolved.url) {
|
|
4056
4065
|
mediaElement.mediaMissing = true;
|
|
4057
4066
|
return;
|
|
@@ -4062,7 +4071,7 @@ function useLoadContent({
|
|
|
4062
4071
|
}
|
|
4063
4072
|
})
|
|
4064
4073
|
);
|
|
4065
|
-
const { paths: imagePaths, refs: imageRefs } =
|
|
4074
|
+
const { paths: imagePaths, refs: imageRefs } = chunk4SPZ5IZN_js.collectImagePaths(parsed.slides);
|
|
4066
4075
|
let nextSlides = parsed.slides;
|
|
4067
4076
|
if (imagePaths.size > 0) {
|
|
4068
4077
|
const resolvedMap = /* @__PURE__ */ new Map();
|
|
@@ -4078,15 +4087,15 @@ function useLoadContent({
|
|
|
4078
4087
|
})
|
|
4079
4088
|
);
|
|
4080
4089
|
nextSlides = parsed.slides.map((s) => {
|
|
4081
|
-
const newElements =
|
|
4090
|
+
const newElements = chunk4SPZ5IZN_js.applyImagePathPatches(s.elements, resolvedMap, imageRefs);
|
|
4082
4091
|
return newElements === s.elements ? s : { ...s, elements: newElements };
|
|
4083
4092
|
});
|
|
4084
4093
|
}
|
|
4085
|
-
nextSlides = await
|
|
4094
|
+
nextSlides = await chunk4SPZ5IZN_js.resolveTableCellImageUrls(
|
|
4086
4095
|
nextSlides,
|
|
4087
4096
|
(path) => handler.getImageData(path)
|
|
4088
4097
|
);
|
|
4089
|
-
const nextTableStyleMap = await
|
|
4098
|
+
const nextTableStyleMap = await chunk4SPZ5IZN_js.resolveTableStyleImageUrls(
|
|
4090
4099
|
parsed.tableStyleMap,
|
|
4091
4100
|
(path) => handler.getImageData(path)
|
|
4092
4101
|
);
|
|
@@ -4105,12 +4114,12 @@ function useLoadContent({
|
|
|
4105
4114
|
}
|
|
4106
4115
|
resources.commit();
|
|
4107
4116
|
handlerRef.current = handler;
|
|
4108
|
-
const partition =
|
|
4117
|
+
const partition = chunk4SPZ5IZN_js.partitionTemplateElements(nextSlides);
|
|
4109
4118
|
setSlides(partition.slides);
|
|
4110
4119
|
setTemplateElementsBySlideId(partition.templateElementsBySlideId);
|
|
4111
4120
|
setCanvasSize({
|
|
4112
|
-
width: parsed.width ??
|
|
4113
|
-
height: parsed.height ??
|
|
4121
|
+
width: parsed.width ?? chunkNJ3WCYYG_js.DEFAULT_CANVAS_WIDTH,
|
|
4122
|
+
height: parsed.height ?? chunkNJ3WCYYG_js.DEFAULT_CANVAS_HEIGHT
|
|
4114
4123
|
});
|
|
4115
4124
|
setSlideSizeEmu(
|
|
4116
4125
|
typeof parsed.widthEmu === "number" && typeof parsed.heightEmu === "number" && parsed.widthEmu > 0 && parsed.heightEmu > 0 ? {
|
|
@@ -4123,7 +4132,7 @@ function useLoadContent({
|
|
|
4123
4132
|
setLayoutOptions(parsed.layoutOptions ?? []);
|
|
4124
4133
|
setSlideMasters(parsed.slideMasters ?? []);
|
|
4125
4134
|
setModernCommentAuthors(parsed.modernCommentAuthors ?? []);
|
|
4126
|
-
setRecentColors(
|
|
4135
|
+
setRecentColors(chunk4SPZ5IZN_js.seedRecentColors({ mruColors: parsed.mruColors }));
|
|
4127
4136
|
setTheme(parsed.theme);
|
|
4128
4137
|
setTableStyleMap(nextTableStyleMap);
|
|
4129
4138
|
setTableStylesDefaultId(parsed.tableStylesDefaultId);
|
|
@@ -4131,7 +4140,7 @@ function useLoadContent({
|
|
|
4131
4140
|
setThemeOptions(parsed.themeOptions ?? []);
|
|
4132
4141
|
setCustomShows(parsed.customShows ?? []);
|
|
4133
4142
|
setActiveCustomShowId(
|
|
4134
|
-
|
|
4143
|
+
chunk4SPZ5IZN_js.resolveAuthoredCustomShowId(parsed.presentationProperties, parsed.customShows) ?? null
|
|
4135
4144
|
);
|
|
4136
4145
|
setSections(parsed.sections ?? []);
|
|
4137
4146
|
setPresentationProperties(parsed.presentationProperties ?? {});
|
|
@@ -4155,11 +4164,11 @@ function useLoadContent({
|
|
|
4155
4164
|
setHasMacros(parsed.hasMacros === true);
|
|
4156
4165
|
setHasDigitalSignatures(parsed.hasDigitalSignatures === true);
|
|
4157
4166
|
setDigitalSignatureCount(parsed.digitalSignatureCount ?? 0);
|
|
4158
|
-
setGuides(
|
|
4159
|
-
setReadOnlyRecommendation(
|
|
4167
|
+
setGuides(chunk4SPZ5IZN_js.buildInitialGuides(parsed.presentationGuides, parsed.slides[0]?.guides));
|
|
4168
|
+
setReadOnlyRecommendation(chunk4SPZ5IZN_js.readOnlyRecommendation(parsed));
|
|
4160
4169
|
setModifyVerifier(parsed.modifyVerifier ?? void 0);
|
|
4161
4170
|
setCompatToasts(
|
|
4162
|
-
|
|
4171
|
+
chunk4SPZ5IZN_js.compatibilityWarningToasts([
|
|
4163
4172
|
...parsed.warnings ?? [],
|
|
4164
4173
|
...parsed.slides.flatMap((slide) => slide.warnings ?? [])
|
|
4165
4174
|
])
|
|
@@ -4171,7 +4180,7 @@ function useLoadContent({
|
|
|
4171
4180
|
onContentApplied?.();
|
|
4172
4181
|
} catch (err) {
|
|
4173
4182
|
if (!cancelled && token === renderTokenRef.current) {
|
|
4174
|
-
if (err instanceof
|
|
4183
|
+
if (err instanceof chunk4SPZ5IZN_js.EncryptedFileError) {
|
|
4175
4184
|
setIsEncrypted(true);
|
|
4176
4185
|
} else {
|
|
4177
4186
|
console.error("[pptx] Failed to load presentation content:", err);
|
|
@@ -4200,7 +4209,7 @@ function useLoadContent({
|
|
|
4200
4209
|
}
|
|
4201
4210
|
function useAutosave(input) {
|
|
4202
4211
|
const { isDirty, filePath, serializeSlides, enabled = true, getChangeSources } = input;
|
|
4203
|
-
const intervalMs =
|
|
4212
|
+
const intervalMs = chunk4SPZ5IZN_js.resolveAutosaveIntervalMs({
|
|
4204
4213
|
hostIntervalMs: input.intervalMs,
|
|
4205
4214
|
optionsIntervalSeconds: input.intervalSeconds
|
|
4206
4215
|
});
|
|
@@ -4231,7 +4240,7 @@ function useAutosave(input) {
|
|
|
4231
4240
|
return;
|
|
4232
4241
|
}
|
|
4233
4242
|
const sources = changeSourcesRef.current?.() ?? [];
|
|
4234
|
-
if (!
|
|
4243
|
+
if (!chunk4SPZ5IZN_js.shouldWriteAutosaveSnapshot({
|
|
4235
4244
|
filePath: path,
|
|
4236
4245
|
isDirty: isDirtyRef.current,
|
|
4237
4246
|
saving: isSavingRef.current,
|
|
@@ -4249,8 +4258,8 @@ function useAutosave(input) {
|
|
|
4249
4258
|
isSavingRef.current = false;
|
|
4250
4259
|
return;
|
|
4251
4260
|
}
|
|
4252
|
-
await
|
|
4253
|
-
lastSnapshotRef.current =
|
|
4261
|
+
await chunk4SPZ5IZN_js.saveAutosaveSnapshot(path, data);
|
|
4262
|
+
lastSnapshotRef.current = chunk4SPZ5IZN_js.autosaveSnapshotMark(path, sources);
|
|
4254
4263
|
setAutosaveStatus({ state: "saved", timestamp: Date.now() });
|
|
4255
4264
|
} catch (err) {
|
|
4256
4265
|
setAutosaveStatus({
|
|
@@ -4304,13 +4313,13 @@ function useElementOperations(input) {
|
|
|
4304
4313
|
inlineEditingText
|
|
4305
4314
|
} = input;
|
|
4306
4315
|
const liveTextSegments = react.useCallback(() => {
|
|
4307
|
-
if (!selectedElement || !
|
|
4316
|
+
if (!selectedElement || !chunk4SPZ5IZN_js.hasTextProperties(selectedElement)) {
|
|
4308
4317
|
return void 0;
|
|
4309
4318
|
}
|
|
4310
4319
|
if (selectedElement.id !== inlineEditingElementId) {
|
|
4311
4320
|
return selectedElement.textSegments;
|
|
4312
4321
|
}
|
|
4313
|
-
return
|
|
4322
|
+
return chunk4SPZ5IZN_js.remapTextToSegments(
|
|
4314
4323
|
inlineEditingText,
|
|
4315
4324
|
selectedElement.textSegments,
|
|
4316
4325
|
selectedElement.textStyle
|
|
@@ -4351,11 +4360,11 @@ function useElementOperations(input) {
|
|
|
4351
4360
|
(elementId, updates) => {
|
|
4352
4361
|
if (masterView?.target) {
|
|
4353
4362
|
applyMasterViewWrite(
|
|
4354
|
-
|
|
4363
|
+
chunk4SPZ5IZN_js.updateMasterViewElement(masterView, masterView.target, elementId, updates)
|
|
4355
4364
|
);
|
|
4356
4365
|
return;
|
|
4357
4366
|
}
|
|
4358
|
-
if (
|
|
4367
|
+
if (chunk4SPZ5IZN_js.isTemplateElementId(elementId)) {
|
|
4359
4368
|
const slideId = activeSlide?.id;
|
|
4360
4369
|
if (slideId) {
|
|
4361
4370
|
setTemplateElementsBySlideId((prev) => ({
|
|
@@ -4366,7 +4375,7 @@ function useElementOperations(input) {
|
|
|
4366
4375
|
}));
|
|
4367
4376
|
}
|
|
4368
4377
|
} else {
|
|
4369
|
-
setSlides((prev) =>
|
|
4378
|
+
setSlides((prev) => chunk4SPZ5IZN_js.updateElement(prev, activeSlideIndex, elementId, updates));
|
|
4370
4379
|
}
|
|
4371
4380
|
history.markDirty();
|
|
4372
4381
|
},
|
|
@@ -4391,7 +4400,7 @@ function useElementOperations(input) {
|
|
|
4391
4400
|
);
|
|
4392
4401
|
const updateSelectedShapeStyle = react.useCallback(
|
|
4393
4402
|
(updates) => {
|
|
4394
|
-
if (!selectedElement || !
|
|
4403
|
+
if (!selectedElement || !chunk4SPZ5IZN_js.hasShapeProperties(selectedElement)) {
|
|
4395
4404
|
return;
|
|
4396
4405
|
}
|
|
4397
4406
|
updateSelectedElement({
|
|
@@ -4402,19 +4411,32 @@ function useElementOperations(input) {
|
|
|
4402
4411
|
);
|
|
4403
4412
|
const updateSelectedTextStyle = react.useCallback(
|
|
4404
4413
|
(updates) => {
|
|
4405
|
-
if (!selectedElement || !
|
|
4414
|
+
if (!selectedElement || !chunk4SPZ5IZN_js.hasTextProperties(selectedElement)) {
|
|
4406
4415
|
return;
|
|
4407
4416
|
}
|
|
4408
4417
|
const isLiveEditing = selectedElement.id === inlineEditingElementId;
|
|
4409
4418
|
const currentSegments = liveTextSegments();
|
|
4410
|
-
const inlineSel =
|
|
4419
|
+
const inlineSel = chunk4SPZ5IZN_js.getInlineEditorSelection(currentSegments);
|
|
4420
|
+
if (updates.listType) {
|
|
4421
|
+
const result = chunk4SPZ5IZN_js.applyListStyleUpdate(
|
|
4422
|
+
{ ...selectedElement, textSegments: currentSegments },
|
|
4423
|
+
updates,
|
|
4424
|
+
inlineSel
|
|
4425
|
+
);
|
|
4426
|
+
chunk4SPZ5IZN_js.setPendingSelectionRestore(result.selection);
|
|
4427
|
+
updateSelectedElement({
|
|
4428
|
+
...result.patch,
|
|
4429
|
+
...isLiveEditing ? { text: inlineEditingText } : {}
|
|
4430
|
+
});
|
|
4431
|
+
return;
|
|
4432
|
+
}
|
|
4411
4433
|
if (inlineSel && currentSegments) {
|
|
4412
|
-
const { newSegments: newSegments2, newSelection } =
|
|
4434
|
+
const { newSegments: newSegments2, newSelection } = chunk4SPZ5IZN_js.applyStyleToSelectedSegments(
|
|
4413
4435
|
currentSegments,
|
|
4414
4436
|
inlineSel,
|
|
4415
4437
|
updates
|
|
4416
4438
|
);
|
|
4417
|
-
|
|
4439
|
+
chunk4SPZ5IZN_js.setPendingSelectionRestore(newSelection);
|
|
4418
4440
|
updateSelectedElement({
|
|
4419
4441
|
textSegments: newSegments2,
|
|
4420
4442
|
...isLiveEditing ? { text: inlineEditingText } : {}
|
|
@@ -4422,10 +4444,7 @@ function useElementOperations(input) {
|
|
|
4422
4444
|
return;
|
|
4423
4445
|
}
|
|
4424
4446
|
const newTextStyle = { ...selectedElement.textStyle, ...updates };
|
|
4425
|
-
const newSegments = currentSegments?.map((seg) => (
|
|
4426
|
-
...seg,
|
|
4427
|
-
style: { ...seg.style, ...updates }
|
|
4428
|
-
}));
|
|
4447
|
+
const newSegments = currentSegments?.map((seg) => chunk4SPZ5IZN_js.updateTextSegmentStyle(seg, updates));
|
|
4429
4448
|
updateSelectedElement({
|
|
4430
4449
|
textStyle: newTextStyle,
|
|
4431
4450
|
textSegments: newSegments,
|
|
@@ -4442,14 +4461,14 @@ function useElementOperations(input) {
|
|
|
4442
4461
|
);
|
|
4443
4462
|
const updateSelectedTextCase = react.useCallback(
|
|
4444
4463
|
(mode) => {
|
|
4445
|
-
if (!selectedElement || !
|
|
4464
|
+
if (!selectedElement || !chunk4SPZ5IZN_js.hasTextProperties(selectedElement)) {
|
|
4446
4465
|
return;
|
|
4447
4466
|
}
|
|
4448
4467
|
const isLiveEditing = selectedElement.id === inlineEditingElementId;
|
|
4449
4468
|
const currentSegments = liveTextSegments();
|
|
4450
|
-
const inlineSel =
|
|
4469
|
+
const inlineSel = chunk4SPZ5IZN_js.getInlineEditorSelection(currentSegments);
|
|
4451
4470
|
if (inlineSel && currentSegments) {
|
|
4452
|
-
const newSegments =
|
|
4471
|
+
const newSegments = chunk4SPZ5IZN_js.applyCaseTransformToSegments(currentSegments, inlineSel, mode);
|
|
4453
4472
|
updateSelectedElement({
|
|
4454
4473
|
textSegments: newSegments,
|
|
4455
4474
|
...isLiveEditing ? { text: inlineEditingText } : {}
|
|
@@ -4458,7 +4477,7 @@ function useElementOperations(input) {
|
|
|
4458
4477
|
}
|
|
4459
4478
|
const updates = {};
|
|
4460
4479
|
if (currentSegments && currentSegments.length > 0) {
|
|
4461
|
-
updates.textSegments =
|
|
4480
|
+
updates.textSegments = chunk4SPZ5IZN_js.applyCaseTransformToSegments(
|
|
4462
4481
|
currentSegments,
|
|
4463
4482
|
null,
|
|
4464
4483
|
mode
|
|
@@ -4466,7 +4485,7 @@ function useElementOperations(input) {
|
|
|
4466
4485
|
}
|
|
4467
4486
|
const baseText = isLiveEditing ? inlineEditingText : selectedElement.text;
|
|
4468
4487
|
if (typeof baseText === "string") {
|
|
4469
|
-
updates.text =
|
|
4488
|
+
updates.text = chunk4SPZ5IZN_js.transformTextCase(baseText, mode);
|
|
4470
4489
|
}
|
|
4471
4490
|
updateSelectedElement(updates);
|
|
4472
4491
|
},
|
|
@@ -4485,15 +4504,15 @@ function useElementOperations(input) {
|
|
|
4485
4504
|
[setSlides]
|
|
4486
4505
|
);
|
|
4487
4506
|
const masterViewTarget = masterView?.target ?? null;
|
|
4488
|
-
const activeElements = masterViewTarget ?
|
|
4507
|
+
const activeElements = masterViewTarget ? chunk4SPZ5IZN_js.masterViewElements(masterView, masterViewTarget) : editTemplateMode ? templateElements : activeSlide?.elements ?? [];
|
|
4489
4508
|
const updateActiveElements = react.useCallback(
|
|
4490
4509
|
(updater) => {
|
|
4491
4510
|
if (masterView?.target) {
|
|
4492
4511
|
applyMasterViewWrite(
|
|
4493
|
-
|
|
4512
|
+
chunk4SPZ5IZN_js.replaceMasterViewElements(
|
|
4494
4513
|
masterView,
|
|
4495
4514
|
masterView.target,
|
|
4496
|
-
updater(
|
|
4515
|
+
updater(chunk4SPZ5IZN_js.masterViewElements(masterView, masterView.target))
|
|
4497
4516
|
)
|
|
4498
4517
|
);
|
|
4499
4518
|
return;
|
|
@@ -4546,7 +4565,7 @@ function useSectionOperations(input) {
|
|
|
4546
4565
|
const { sections, setSections, slides, setSlides, markDirty } = input;
|
|
4547
4566
|
const addSection2 = react.useCallback(
|
|
4548
4567
|
(name, afterSlideIndex) => {
|
|
4549
|
-
const result =
|
|
4568
|
+
const result = chunk4SPZ5IZN_js.addSection(sections, slides, name, afterSlideIndex);
|
|
4550
4569
|
setSlides(result.slides);
|
|
4551
4570
|
setSections(result.sections);
|
|
4552
4571
|
markDirty();
|
|
@@ -4555,7 +4574,7 @@ function useSectionOperations(input) {
|
|
|
4555
4574
|
);
|
|
4556
4575
|
const renameSection2 = react.useCallback(
|
|
4557
4576
|
(sectionId, newName) => {
|
|
4558
|
-
const result =
|
|
4577
|
+
const result = chunk4SPZ5IZN_js.renameSection(sections, slides, sectionId, newName);
|
|
4559
4578
|
setSections(result.sections);
|
|
4560
4579
|
setSlides(result.slides);
|
|
4561
4580
|
markDirty();
|
|
@@ -4564,7 +4583,7 @@ function useSectionOperations(input) {
|
|
|
4564
4583
|
);
|
|
4565
4584
|
const deleteSection2 = react.useCallback(
|
|
4566
4585
|
(sectionId) => {
|
|
4567
|
-
const result =
|
|
4586
|
+
const result = chunk4SPZ5IZN_js.deleteSection(sections, slides, sectionId);
|
|
4568
4587
|
setSections(result.sections);
|
|
4569
4588
|
setSlides(result.slides);
|
|
4570
4589
|
markDirty();
|
|
@@ -4573,21 +4592,21 @@ function useSectionOperations(input) {
|
|
|
4573
4592
|
);
|
|
4574
4593
|
const moveSectionUp2 = react.useCallback(
|
|
4575
4594
|
(sectionId) => {
|
|
4576
|
-
setSections(
|
|
4595
|
+
setSections(chunk4SPZ5IZN_js.moveSectionUp(sections, sectionId));
|
|
4577
4596
|
markDirty();
|
|
4578
4597
|
},
|
|
4579
4598
|
[sections, setSections, markDirty]
|
|
4580
4599
|
);
|
|
4581
4600
|
const moveSectionDown2 = react.useCallback(
|
|
4582
4601
|
(sectionId) => {
|
|
4583
|
-
setSections(
|
|
4602
|
+
setSections(chunk4SPZ5IZN_js.moveSectionDown(sections, sectionId));
|
|
4584
4603
|
markDirty();
|
|
4585
4604
|
},
|
|
4586
4605
|
[sections, setSections, markDirty]
|
|
4587
4606
|
);
|
|
4588
4607
|
const moveSlidesToSection2 = react.useCallback(
|
|
4589
4608
|
(slideIndexes, targetSectionId) => {
|
|
4590
|
-
const result =
|
|
4609
|
+
const result = chunk4SPZ5IZN_js.moveSlidesToSection(sections, slides, slideIndexes, targetSectionId);
|
|
4591
4610
|
setSlides(result.slides);
|
|
4592
4611
|
setSections(result.sections);
|
|
4593
4612
|
markDirty();
|
|
@@ -4653,15 +4672,15 @@ function syncSelectionHandleOverlay(elementNode, elementId, geometry) {
|
|
|
4653
4672
|
// src/viewer/hooks/pointer-move-handlers.ts
|
|
4654
4673
|
function computeResizeGeometry(handle, startX, startY, startWidth, startHeight, dx, dy, snapToGrid, gridSpacingPx, lockAspect = false) {
|
|
4655
4674
|
const startBox = { x: startX, y: startY, width: startWidth, height: startHeight };
|
|
4656
|
-
let resized =
|
|
4675
|
+
let resized = chunk4SPZ5IZN_js.applyResize(startBox, handle, dx, dy, 1, { minSize: chunkNJ3WCYYG_js.MIN_ELEMENT_SIZE });
|
|
4657
4676
|
if (lockAspect) {
|
|
4658
|
-
resized =
|
|
4677
|
+
resized = chunk4SPZ5IZN_js.lockResizeAspect(resized, startBox, handle, chunkNJ3WCYYG_js.MIN_ELEMENT_SIZE);
|
|
4659
4678
|
}
|
|
4660
4679
|
const box = { x: resized.x, y: resized.y, width: resized.width, height: resized.height };
|
|
4661
4680
|
if (!snapToGrid) {
|
|
4662
4681
|
return box;
|
|
4663
4682
|
}
|
|
4664
|
-
return
|
|
4683
|
+
return chunk4SPZ5IZN_js.snapBoxToGrid(box, handle, gridSpacingPx, chunkNJ3WCYYG_js.MIN_ELEMENT_SIZE);
|
|
4665
4684
|
}
|
|
4666
4685
|
function resolveLiveTarget(input) {
|
|
4667
4686
|
const { livePatcher, editTemplateMode, activeSlide } = input;
|
|
@@ -4774,7 +4793,7 @@ function processDragMove(e, drag, editorScale, snapToGrid, snapToShape, gridSpac
|
|
|
4774
4793
|
width: el.width,
|
|
4775
4794
|
height: el.height
|
|
4776
4795
|
}));
|
|
4777
|
-
const snapResult =
|
|
4796
|
+
const snapResult = chunk4SPZ5IZN_js.computeSnapToShape(
|
|
4778
4797
|
targetX,
|
|
4779
4798
|
targetY,
|
|
4780
4799
|
primaryEl.width,
|
|
@@ -4816,7 +4835,7 @@ function processDragMove(e, drag, editorScale, snapToGrid, snapToShape, gridSpac
|
|
|
4816
4835
|
if (live) {
|
|
4817
4836
|
for (const id of Object.keys(drag.startPositionsById)) {
|
|
4818
4837
|
const start = drag.startPositionsById[id];
|
|
4819
|
-
|
|
4838
|
+
chunk4SPZ5IZN_js.publishLiveGeometry(live.patcher, live.slideId, id, {
|
|
4820
4839
|
x: start.x + appliedDx,
|
|
4821
4840
|
y: start.y + appliedDy
|
|
4822
4841
|
});
|
|
@@ -4848,8 +4867,8 @@ function processResizeMove(e, rs, editorScale, snapToGrid, gridSpacingPx, live)
|
|
|
4848
4867
|
rs.lastY = geo.y;
|
|
4849
4868
|
rs.lastWidth = geo.width;
|
|
4850
4869
|
rs.lastHeight = geo.height;
|
|
4851
|
-
const width = Math.max(geo.width,
|
|
4852
|
-
const height = Math.max(geo.height,
|
|
4870
|
+
const width = Math.max(geo.width, chunkNJ3WCYYG_js.MIN_ELEMENT_SIZE);
|
|
4871
|
+
const height = Math.max(geo.height, chunkNJ3WCYYG_js.MIN_ELEMENT_SIZE);
|
|
4853
4872
|
if (rs.domEl) {
|
|
4854
4873
|
rs.domEl.style.left = `${geo.x}px`;
|
|
4855
4874
|
rs.domEl.style.top = `${geo.y}px`;
|
|
@@ -4858,7 +4877,7 @@ function processResizeMove(e, rs, editorScale, snapToGrid, gridSpacingPx, live)
|
|
|
4858
4877
|
syncSelectionHandleOverlay(rs.domEl, rs.elementId, { x: geo.x, y: geo.y, width, height });
|
|
4859
4878
|
}
|
|
4860
4879
|
if (live) {
|
|
4861
|
-
|
|
4880
|
+
chunk4SPZ5IZN_js.publishLiveGeometry(live.patcher, live.slideId, rs.elementId, {
|
|
4862
4881
|
x: geo.x,
|
|
4863
4882
|
y: geo.y,
|
|
4864
4883
|
width,
|
|
@@ -4869,7 +4888,7 @@ function processResizeMove(e, rs, editorScale, snapToGrid, gridSpacingPx, live)
|
|
|
4869
4888
|
function processAdjustmentMove(e, adj, editorScale, updateElementById) {
|
|
4870
4889
|
const dx = (e.clientX - adj.startClientX) / editorScale;
|
|
4871
4890
|
const dy = (e.clientY - adj.startClientY) / editorScale;
|
|
4872
|
-
const adjustments =
|
|
4891
|
+
const adjustments = chunk4SPZ5IZN_js.getDraggedShapeAdjustments(adj, dx, dy);
|
|
4873
4892
|
if (!adj.moved && Math.hypot(dx, dy) > 2) {
|
|
4874
4893
|
adj.moved = true;
|
|
4875
4894
|
}
|
|
@@ -4944,13 +4963,13 @@ function processPointerUp(input) {
|
|
|
4944
4963
|
if (i !== activeSlideIndex) {
|
|
4945
4964
|
return s;
|
|
4946
4965
|
}
|
|
4947
|
-
const rerouted =
|
|
4966
|
+
const rerouted = chunk4SPZ5IZN_js.rerouteConnectorsForMovedElements(s.elements, movedIds);
|
|
4948
4967
|
if (rerouted.length === 0) {
|
|
4949
4968
|
return s;
|
|
4950
4969
|
}
|
|
4951
4970
|
return {
|
|
4952
4971
|
...s,
|
|
4953
|
-
elements:
|
|
4972
|
+
elements: chunk4SPZ5IZN_js.applyReroutedConnectors(s.elements, rerouted)
|
|
4954
4973
|
};
|
|
4955
4974
|
})
|
|
4956
4975
|
);
|
|
@@ -4970,14 +4989,16 @@ function processPointerUp(input) {
|
|
|
4970
4989
|
setSnapLines([]);
|
|
4971
4990
|
if (wasMoved) {
|
|
4972
4991
|
markDirty();
|
|
4992
|
+
}
|
|
4993
|
+
if (drag || rs || adj || marquee) {
|
|
4973
4994
|
setPointerCommitNonce((n) => n + 1);
|
|
4974
4995
|
}
|
|
4975
4996
|
}
|
|
4976
4997
|
function commitMarquee(marquee, editTemplateMode, templateElements, activeSlide, applySelection, clearSelection) {
|
|
4977
4998
|
const sourceElements = editTemplateMode ? templateElements : activeSlide?.elements ?? [];
|
|
4978
|
-
const hitIds =
|
|
4999
|
+
const hitIds = chunk4SPZ5IZN_js.computeMarqueeHitIds(marquee, sourceElements);
|
|
4979
5000
|
if (marquee.additive) {
|
|
4980
|
-
const merged =
|
|
5001
|
+
const merged = chunk4SPZ5IZN_js.mergeAdditiveSelection(marquee.baseSelectionIds, hitIds);
|
|
4981
5002
|
if (merged.length > 0) {
|
|
4982
5003
|
applySelection(merged[0], merged);
|
|
4983
5004
|
} else {
|
|
@@ -5000,8 +5021,8 @@ function commitDrag(drag, editTemplateMode, activeSlide, activeSlideIndex, setTe
|
|
|
5000
5021
|
}
|
|
5001
5022
|
return { ...el, x: start.x + dx, y: start.y + dy };
|
|
5002
5023
|
});
|
|
5003
|
-
const rerouted =
|
|
5004
|
-
return
|
|
5024
|
+
const rerouted = chunk4SPZ5IZN_js.rerouteConnectorsForMovedElements(movedElements, movedIds);
|
|
5025
|
+
return chunk4SPZ5IZN_js.applyReroutedConnectors(movedElements, rerouted);
|
|
5005
5026
|
};
|
|
5006
5027
|
if (editTemplateMode) {
|
|
5007
5028
|
const slideId = activeSlide?.id;
|
|
@@ -5157,17 +5178,17 @@ function useCanvasInteractions(input) {
|
|
|
5157
5178
|
return;
|
|
5158
5179
|
}
|
|
5159
5180
|
const el = elementLookup.get(editId);
|
|
5160
|
-
if (el &&
|
|
5181
|
+
if (el && chunk4SPZ5IZN_js.hasTextProperties(el)) {
|
|
5161
5182
|
const committedText = transformCommittedText ? transformCommittedText(inlineEditingText) : inlineEditingText;
|
|
5162
|
-
const textPatch =
|
|
5183
|
+
const textPatch = chunk4SPZ5IZN_js.buildInlineTextCommitPatch(el, committedText);
|
|
5163
5184
|
if (!textPatch) {
|
|
5164
5185
|
setInlineEditingElementId(null);
|
|
5165
5186
|
setInlineEditingText("");
|
|
5166
5187
|
return;
|
|
5167
5188
|
}
|
|
5168
5189
|
const editorEl = document.querySelector("[data-inline-editor]");
|
|
5169
|
-
const newHeight =
|
|
5170
|
-
const shrink =
|
|
5190
|
+
const newHeight = chunk4SPZ5IZN_js.resolveInlineEditAutoFitHeight(el.textStyle, el.height, editorEl);
|
|
5191
|
+
const shrink = chunk4SPZ5IZN_js.resolveInlineEditNormAutofitShrink(el.textStyle, el.height, editorEl);
|
|
5171
5192
|
ops.updateElementById(editId, {
|
|
5172
5193
|
...textPatch,
|
|
5173
5194
|
...newHeight !== void 0 ? { height: newHeight } : {},
|
|
@@ -5185,7 +5206,7 @@ function useCanvasInteractions(input) {
|
|
|
5185
5206
|
setInlineEditingText("");
|
|
5186
5207
|
};
|
|
5187
5208
|
const openEquationEditorForElement = (el) => {
|
|
5188
|
-
if (!
|
|
5209
|
+
if (!chunk4SPZ5IZN_js.hasTextProperties(el)) {
|
|
5189
5210
|
return false;
|
|
5190
5211
|
}
|
|
5191
5212
|
const eqSeg = el.textSegments?.find((seg) => seg.equationXml);
|
|
@@ -5215,7 +5236,7 @@ function useCanvasInteractions(input) {
|
|
|
5215
5236
|
justInteractedRef.current = false;
|
|
5216
5237
|
} else {
|
|
5217
5238
|
const el = elementLookup.get(elementId);
|
|
5218
|
-
if (el &&
|
|
5239
|
+
if (el && chunk4SPZ5IZN_js.hasTextProperties(el) && chunk4SPZ5IZN_js.canInteractWithElement(el, "textEdit")) {
|
|
5219
5240
|
if (!openEquationEditorForElement(el)) {
|
|
5220
5241
|
setInlineEditingElementId(elementId);
|
|
5221
5242
|
setInlineEditingText(el.text ?? "");
|
|
@@ -5234,7 +5255,7 @@ function useCanvasInteractions(input) {
|
|
|
5234
5255
|
if (openEquationEditorForElement(el)) {
|
|
5235
5256
|
return;
|
|
5236
5257
|
}
|
|
5237
|
-
if (
|
|
5258
|
+
if (chunk4SPZ5IZN_js.hasTextProperties(el) && chunk4SPZ5IZN_js.canInteractWithElement(el, "textEdit")) {
|
|
5238
5259
|
setInlineEditingElementId(elementId);
|
|
5239
5260
|
setInlineEditingText(el.text ?? "");
|
|
5240
5261
|
}
|
|
@@ -5257,7 +5278,7 @@ function useCanvasInteractions(input) {
|
|
|
5257
5278
|
justSelectedRef.current = false;
|
|
5258
5279
|
}
|
|
5259
5280
|
const ids = !wasSelected ? [elementId] : effectiveSelectedIds.length ? effectiveSelectedIds : [elementId];
|
|
5260
|
-
const movableIds =
|
|
5281
|
+
const movableIds = chunk4SPZ5IZN_js.filterInteractableIds(ids, (id) => elementLookup.get(id), "move");
|
|
5261
5282
|
if (movableIds.length === 0) {
|
|
5262
5283
|
return;
|
|
5263
5284
|
}
|
|
@@ -5327,7 +5348,7 @@ function useCanvasInteractions(input) {
|
|
|
5327
5348
|
const handleResizePointerDown = (elementId, e, handle) => {
|
|
5328
5349
|
e.stopPropagation();
|
|
5329
5350
|
const el = elementLookup.get(elementId);
|
|
5330
|
-
if (!el || !
|
|
5351
|
+
if (!el || !chunk4SPZ5IZN_js.canInteractWithElement(el, "resize")) {
|
|
5331
5352
|
return;
|
|
5332
5353
|
}
|
|
5333
5354
|
resizeStateRef.current = {
|
|
@@ -5349,7 +5370,7 @@ function useCanvasInteractions(input) {
|
|
|
5349
5370
|
};
|
|
5350
5371
|
const handleRotate = (elementId, rotationDeg) => {
|
|
5351
5372
|
const el = elementLookup.get(elementId);
|
|
5352
|
-
if (!el || !
|
|
5373
|
+
if (!el || !chunk4SPZ5IZN_js.canInteractWithElement(el, "rotate")) {
|
|
5353
5374
|
return;
|
|
5354
5375
|
}
|
|
5355
5376
|
ops.updateElementById(elementId, { rotation: rotationDeg });
|
|
@@ -5369,10 +5390,10 @@ function useCanvasInteractions(input) {
|
|
|
5369
5390
|
const handleAdjustmentPointerDown = (elementId, e, descriptor) => {
|
|
5370
5391
|
e.stopPropagation();
|
|
5371
5392
|
const el = elementLookup.get(elementId);
|
|
5372
|
-
if (!el || !
|
|
5393
|
+
if (!el || !chunk4SPZ5IZN_js.canInteractWithElement(el, "adjustHandle")) {
|
|
5373
5394
|
return;
|
|
5374
5395
|
}
|
|
5375
|
-
shapeAdjustmentDragStateRef.current =
|
|
5396
|
+
shapeAdjustmentDragStateRef.current = chunk4SPZ5IZN_js.beginShapeAdjustment(
|
|
5376
5397
|
el,
|
|
5377
5398
|
descriptor,
|
|
5378
5399
|
e.clientX,
|
|
@@ -5419,7 +5440,7 @@ function createFileHandlers(deps) {
|
|
|
5419
5440
|
h = Math.round(h * scale);
|
|
5420
5441
|
}
|
|
5421
5442
|
addElement({
|
|
5422
|
-
id:
|
|
5443
|
+
id: chunk4SPZ5IZN_js.generateElementId(),
|
|
5423
5444
|
type: "image",
|
|
5424
5445
|
x: Math.round((canvasSize.width - w) / 2),
|
|
5425
5446
|
y: Math.round((canvasSize.height - h) / 2),
|
|
@@ -5430,7 +5451,7 @@ function createFileHandlers(deps) {
|
|
|
5430
5451
|
};
|
|
5431
5452
|
img.onerror = () => {
|
|
5432
5453
|
addElement({
|
|
5433
|
-
id:
|
|
5454
|
+
id: chunk4SPZ5IZN_js.generateElementId(),
|
|
5434
5455
|
type: "image",
|
|
5435
5456
|
x: 100,
|
|
5436
5457
|
y: 100,
|
|
@@ -5449,14 +5470,14 @@ function createFileHandlers(deps) {
|
|
|
5449
5470
|
return;
|
|
5450
5471
|
}
|
|
5451
5472
|
e.target.value = "";
|
|
5452
|
-
const mediaType =
|
|
5473
|
+
const mediaType = chunk4SPZ5IZN_js.classifyMediaType(file.type);
|
|
5453
5474
|
if (!mediaType) {
|
|
5454
5475
|
return;
|
|
5455
5476
|
}
|
|
5456
5477
|
const elFilePath = file.path;
|
|
5457
5478
|
const insertMediaElement = (mediaSourceUrl, width, height) => {
|
|
5458
5479
|
addElement({
|
|
5459
|
-
id:
|
|
5480
|
+
id: chunk4SPZ5IZN_js.generateElementId(),
|
|
5460
5481
|
type: "media",
|
|
5461
5482
|
mediaType,
|
|
5462
5483
|
mediaMimeType: file.type || void 0,
|
|
@@ -5631,13 +5652,13 @@ function createStructuredElementHandlers(deps) {
|
|
|
5631
5652
|
return;
|
|
5632
5653
|
}
|
|
5633
5654
|
addElement({
|
|
5634
|
-
id:
|
|
5655
|
+
id: chunk4SPZ5IZN_js.generateElementId(),
|
|
5635
5656
|
type: "smartArt",
|
|
5636
5657
|
x: 100,
|
|
5637
5658
|
y: 120,
|
|
5638
5659
|
width: 600,
|
|
5639
5660
|
height: 340,
|
|
5640
|
-
smartArtData:
|
|
5661
|
+
smartArtData: chunk4SPZ5IZN_js.buildSmartArtPresetData(
|
|
5641
5662
|
layout,
|
|
5642
5663
|
defaultItems,
|
|
5643
5664
|
(i) => `node-${Date.now()}-${i}-${Math.random().toString(36).slice(2, 8)}`
|
|
@@ -5649,7 +5670,7 @@ function createStructuredElementHandlers(deps) {
|
|
|
5649
5670
|
return;
|
|
5650
5671
|
}
|
|
5651
5672
|
addElement({
|
|
5652
|
-
id:
|
|
5673
|
+
id: chunk4SPZ5IZN_js.generateElementId(),
|
|
5653
5674
|
type: "shape",
|
|
5654
5675
|
x: 120,
|
|
5655
5676
|
y: 200,
|
|
@@ -5687,7 +5708,7 @@ function createStructuredElementHandlers(deps) {
|
|
|
5687
5708
|
return;
|
|
5688
5709
|
}
|
|
5689
5710
|
const resolved = resolveHyperlinkEditResult(data);
|
|
5690
|
-
if (resolved.url && !
|
|
5711
|
+
if (resolved.url && !chunk4SPZ5IZN_js.isUrlSafe(resolved.url)) {
|
|
5691
5712
|
return;
|
|
5692
5713
|
}
|
|
5693
5714
|
const actionClick = {
|
|
@@ -5711,7 +5732,7 @@ function createStructuredElementHandlers(deps) {
|
|
|
5711
5732
|
const displayText = value || fieldTexts[fieldType] || fieldType;
|
|
5712
5733
|
const fieldGuid = `{${crypto.randomUUID().toUpperCase()}}`;
|
|
5713
5734
|
addElement({
|
|
5714
|
-
id:
|
|
5735
|
+
id: chunk4SPZ5IZN_js.generateElementId(),
|
|
5715
5736
|
type: "shape",
|
|
5716
5737
|
x: 120,
|
|
5717
5738
|
y: 200,
|
|
@@ -5733,11 +5754,11 @@ function createStructuredElementHandlers(deps) {
|
|
|
5733
5754
|
if (!activeSlide) {
|
|
5734
5755
|
return;
|
|
5735
5756
|
}
|
|
5736
|
-
const preset =
|
|
5757
|
+
const preset = chunk4SPZ5IZN_js.ACTION_BUTTON_PRESETS.find((p) => p.shapeType === shapeType);
|
|
5737
5758
|
if (!preset) {
|
|
5738
5759
|
return;
|
|
5739
5760
|
}
|
|
5740
|
-
const defaultPptxAction =
|
|
5761
|
+
const defaultPptxAction = chunk4SPZ5IZN_js.elementActionToPptxAction({
|
|
5741
5762
|
trigger: "click",
|
|
5742
5763
|
type: preset.defaultAction
|
|
5743
5764
|
});
|
|
@@ -5746,7 +5767,7 @@ function createStructuredElementHandlers(deps) {
|
|
|
5746
5767
|
defaultPptxAction.highlightClick = true;
|
|
5747
5768
|
}
|
|
5748
5769
|
addElement({
|
|
5749
|
-
id:
|
|
5770
|
+
id: chunk4SPZ5IZN_js.generateElementId(),
|
|
5750
5771
|
type: "shape",
|
|
5751
5772
|
x: 150,
|
|
5752
5773
|
y: 150,
|
|
@@ -5813,14 +5834,14 @@ function useInsertElements(input) {
|
|
|
5813
5834
|
return;
|
|
5814
5835
|
}
|
|
5815
5836
|
addElement({
|
|
5816
|
-
id:
|
|
5837
|
+
id: chunk4SPZ5IZN_js.generateElementId(),
|
|
5817
5838
|
type: "text",
|
|
5818
5839
|
x: 100,
|
|
5819
5840
|
y: 100,
|
|
5820
5841
|
width: 300,
|
|
5821
5842
|
height: 60,
|
|
5822
5843
|
text: "",
|
|
5823
|
-
textStyle: { fontSize:
|
|
5844
|
+
textStyle: { fontSize: chunkNJ3WCYYG_js.DEFAULT_TEXT_FONT_SIZE }
|
|
5824
5845
|
});
|
|
5825
5846
|
};
|
|
5826
5847
|
const handleAddShape = () => {
|
|
@@ -5828,7 +5849,7 @@ function useInsertElements(input) {
|
|
|
5828
5849
|
return;
|
|
5829
5850
|
}
|
|
5830
5851
|
addElement({
|
|
5831
|
-
id:
|
|
5852
|
+
id: chunk4SPZ5IZN_js.generateElementId(),
|
|
5832
5853
|
type: "shape",
|
|
5833
5854
|
x: 150,
|
|
5834
5855
|
y: 150,
|
|
@@ -5847,15 +5868,15 @@ function useInsertElements(input) {
|
|
|
5847
5868
|
return;
|
|
5848
5869
|
}
|
|
5849
5870
|
addElement({
|
|
5850
|
-
...
|
|
5851
|
-
id:
|
|
5871
|
+
...chunk4SPZ5IZN_js.newTableElement(chunkNJ3WCYYG_js.DEFAULT_TABLE_ROWS, chunkNJ3WCYYG_js.DEFAULT_TABLE_COLUMNS, 100, 200),
|
|
5872
|
+
id: chunk4SPZ5IZN_js.generateElementId()
|
|
5852
5873
|
});
|
|
5853
5874
|
};
|
|
5854
5875
|
const handleAddChart = (chartKind) => {
|
|
5855
5876
|
if (!activeSlide) {
|
|
5856
5877
|
return;
|
|
5857
5878
|
}
|
|
5858
|
-
addElement(
|
|
5879
|
+
addElement(chunk4SPZ5IZN_js.createDefaultChartElement(chartKind));
|
|
5859
5880
|
};
|
|
5860
5881
|
const structured = createStructuredElementHandlers({
|
|
5861
5882
|
activeSlide,
|
|
@@ -5897,6 +5918,7 @@ function useInsertElements(input) {
|
|
|
5897
5918
|
history.markDirty();
|
|
5898
5919
|
};
|
|
5899
5920
|
return {
|
|
5921
|
+
addElement,
|
|
5900
5922
|
handleAddTextBox,
|
|
5901
5923
|
handleAddShape,
|
|
5902
5924
|
handleAddTable,
|
|
@@ -5925,7 +5947,7 @@ function useClipboardHandlers(input) {
|
|
|
5925
5947
|
if (!selectedElement) {
|
|
5926
5948
|
return;
|
|
5927
5949
|
}
|
|
5928
|
-
setClipboardPayload(
|
|
5950
|
+
setClipboardPayload(chunk4SPZ5IZN_js.buildElementClipboardPayload(selectedElement, editTemplateMode));
|
|
5929
5951
|
};
|
|
5930
5952
|
const handleDelete = () => {
|
|
5931
5953
|
const idsToDelete = effectiveSelectedIds;
|
|
@@ -5942,7 +5964,7 @@ function useClipboardHandlers(input) {
|
|
|
5942
5964
|
handleDelete();
|
|
5943
5965
|
};
|
|
5944
5966
|
const insertClone = (source) => {
|
|
5945
|
-
const clone =
|
|
5967
|
+
const clone = chunk4SPZ5IZN_js.cloneElementForPaste(source, { intoTemplate: editTemplateMode });
|
|
5946
5968
|
ops.updateActiveElements((els) => [...els, clone]);
|
|
5947
5969
|
ops.applySelection(clone.id);
|
|
5948
5970
|
history.markDirty();
|
|
@@ -5977,7 +5999,7 @@ function resolveShapePath(el) {
|
|
|
5977
5999
|
return el.pathData;
|
|
5978
6000
|
}
|
|
5979
6001
|
if ("shapeType" in el && typeof el.shapeType === "string") {
|
|
5980
|
-
const clipPath =
|
|
6002
|
+
const clipPath = chunk4SPZ5IZN_js.getPresetShapeClipPath(el.shapeType);
|
|
5981
6003
|
if (clipPath) {
|
|
5982
6004
|
const svgPath = clipPathToSvgPath(clipPath, el.width, el.height);
|
|
5983
6005
|
if (svgPath) {
|
|
@@ -6028,7 +6050,7 @@ function clipPathToSvgPath(clipPath, width, height) {
|
|
|
6028
6050
|
return parts.join(" ");
|
|
6029
6051
|
}
|
|
6030
6052
|
function transformPathToGlobal(pathData, el) {
|
|
6031
|
-
const polys =
|
|
6053
|
+
const polys = chunk4SPZ5IZN_js.svgPathToPolygons(pathData);
|
|
6032
6054
|
if (polys.length === 0) {
|
|
6033
6055
|
return pathData;
|
|
6034
6056
|
}
|
|
@@ -6048,10 +6070,10 @@ function transformPathToGlobal(pathData, el) {
|
|
|
6048
6070
|
y: pt.y * scaleY + el.y
|
|
6049
6071
|
}))
|
|
6050
6072
|
);
|
|
6051
|
-
return
|
|
6073
|
+
return chunk4SPZ5IZN_js.polygonsToSvgPath(transformed);
|
|
6052
6074
|
}
|
|
6053
6075
|
function transformPathToLocal(pathData, x, y, _width, _height) {
|
|
6054
|
-
const polys =
|
|
6076
|
+
const polys = chunk4SPZ5IZN_js.svgPathToPolygons(pathData);
|
|
6055
6077
|
if (polys.length === 0) {
|
|
6056
6078
|
return pathData;
|
|
6057
6079
|
}
|
|
@@ -6061,10 +6083,10 @@ function transformPathToLocal(pathData, x, y, _width, _height) {
|
|
|
6061
6083
|
y: pt.y - y
|
|
6062
6084
|
}))
|
|
6063
6085
|
);
|
|
6064
|
-
return
|
|
6086
|
+
return chunk4SPZ5IZN_js.polygonsToSvgPath(transformed);
|
|
6065
6087
|
}
|
|
6066
6088
|
function pathBounds(pathData) {
|
|
6067
|
-
const polys =
|
|
6089
|
+
const polys = chunk4SPZ5IZN_js.svgPathToPolygons(pathData);
|
|
6068
6090
|
let minX = Infinity;
|
|
6069
6091
|
let minY = Infinity;
|
|
6070
6092
|
let maxX = -Infinity;
|
|
@@ -6123,7 +6145,7 @@ function useMergeShapesHandler(input) {
|
|
|
6123
6145
|
let allFragments = [];
|
|
6124
6146
|
let remaining = globalPaths[0];
|
|
6125
6147
|
for (let i = 1; i < globalPaths.length; i++) {
|
|
6126
|
-
const frags =
|
|
6148
|
+
const frags = chunk4SPZ5IZN_js.mergeShapes("fragment", remaining, globalPaths[i]);
|
|
6127
6149
|
if (Array.isArray(frags)) {
|
|
6128
6150
|
allFragments = frags;
|
|
6129
6151
|
}
|
|
@@ -6152,7 +6174,7 @@ function useMergeShapesHandler(input) {
|
|
|
6152
6174
|
bounds.height
|
|
6153
6175
|
);
|
|
6154
6176
|
const newEl = {
|
|
6155
|
-
id:
|
|
6177
|
+
id: chunk4SPZ5IZN_js.generateElementId(),
|
|
6156
6178
|
type: "shape",
|
|
6157
6179
|
x: bounds.x,
|
|
6158
6180
|
y: bounds.y,
|
|
@@ -6190,7 +6212,7 @@ function useMergeShapesHandler(input) {
|
|
|
6190
6212
|
} else {
|
|
6191
6213
|
let resultPath = globalPaths[0];
|
|
6192
6214
|
for (let i = 1; i < globalPaths.length; i++) {
|
|
6193
|
-
const result =
|
|
6215
|
+
const result = chunk4SPZ5IZN_js.mergeShapes(operation, resultPath, globalPaths[i]);
|
|
6194
6216
|
if (typeof result === "string") {
|
|
6195
6217
|
resultPath = result;
|
|
6196
6218
|
}
|
|
@@ -6211,7 +6233,7 @@ function useMergeShapesHandler(input) {
|
|
|
6211
6233
|
);
|
|
6212
6234
|
const primary = targets[0];
|
|
6213
6235
|
const newEl = {
|
|
6214
|
-
id:
|
|
6236
|
+
id: chunk4SPZ5IZN_js.generateElementId(),
|
|
6215
6237
|
type: "shape",
|
|
6216
6238
|
x: bounds.x,
|
|
6217
6239
|
y: bounds.y,
|
|
@@ -6274,10 +6296,10 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
6274
6296
|
if (ids.length < 2 || !activeSlide) {
|
|
6275
6297
|
return;
|
|
6276
6298
|
}
|
|
6277
|
-
if (!selectedElements.every((el) =>
|
|
6299
|
+
if (!selectedElements.every((el) => chunk4SPZ5IZN_js.canInteractWithElement(el, "group"))) {
|
|
6278
6300
|
return;
|
|
6279
6301
|
}
|
|
6280
|
-
const { elements, groupId } =
|
|
6302
|
+
const { elements, groupId } = chunk4SPZ5IZN_js.groupElements(ops.activeElements, ids, chunk4SPZ5IZN_js.generateElementId());
|
|
6281
6303
|
if (groupId === null) {
|
|
6282
6304
|
return;
|
|
6283
6305
|
}
|
|
@@ -6289,15 +6311,15 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
6289
6311
|
if (!selectedElement || selectedElement.type !== "group" || !activeSlide) {
|
|
6290
6312
|
return;
|
|
6291
6313
|
}
|
|
6292
|
-
if (!
|
|
6314
|
+
if (!chunk4SPZ5IZN_js.canInteractWithElement(selectedElement, "group")) {
|
|
6293
6315
|
return;
|
|
6294
6316
|
}
|
|
6295
6317
|
const group = selectedElement;
|
|
6296
|
-
const intoTemplate =
|
|
6318
|
+
const intoTemplate = chunk4SPZ5IZN_js.isTemplateElementId(group.id);
|
|
6297
6319
|
const childIds = group.children.map(
|
|
6298
|
-
(child) => intoTemplate ?
|
|
6320
|
+
(child) => intoTemplate ? chunk4SPZ5IZN_js.makeCloneId(true, child.id || group.id) : child.id || chunk4SPZ5IZN_js.generateElementId()
|
|
6299
6321
|
);
|
|
6300
|
-
const { elements, childIds: usedIds } =
|
|
6322
|
+
const { elements, childIds: usedIds } = chunk4SPZ5IZN_js.ungroupElements(
|
|
6301
6323
|
ops.activeElements,
|
|
6302
6324
|
group.id,
|
|
6303
6325
|
childIds,
|
|
@@ -6326,7 +6348,7 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
6326
6348
|
if (!edge) {
|
|
6327
6349
|
return;
|
|
6328
6350
|
}
|
|
6329
|
-
const positions =
|
|
6351
|
+
const positions = chunk4SPZ5IZN_js.alignElements(selectedElements, edge);
|
|
6330
6352
|
for (const [id, pos] of positions) {
|
|
6331
6353
|
const el = elementLookup.get(id);
|
|
6332
6354
|
if (!el) {
|
|
@@ -6344,7 +6366,7 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
6344
6366
|
if (!distAxis) {
|
|
6345
6367
|
return;
|
|
6346
6368
|
}
|
|
6347
|
-
const positions =
|
|
6369
|
+
const positions = chunk4SPZ5IZN_js.distributeElements(selectedElements, distAxis);
|
|
6348
6370
|
for (const [id, pos] of positions) {
|
|
6349
6371
|
const el = elementLookup.get(id);
|
|
6350
6372
|
if (!el) {
|
|
@@ -6355,14 +6377,14 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
6355
6377
|
history.markDirty();
|
|
6356
6378
|
};
|
|
6357
6379
|
const canDistribute = selectedElements.length >= 3;
|
|
6358
|
-
const selectionGroupable = selectedElements.every((el) =>
|
|
6380
|
+
const selectionGroupable = selectedElements.every((el) => chunk4SPZ5IZN_js.canInteractWithElement(el, "group"));
|
|
6359
6381
|
const handleMoveLayer = (direction) => {
|
|
6360
6382
|
if (!selectedElement || !activeSlide) {
|
|
6361
6383
|
return;
|
|
6362
6384
|
}
|
|
6363
6385
|
const id = selectedElement.id;
|
|
6364
6386
|
ops.updateActiveElements(
|
|
6365
|
-
(els) => direction === "forward" ?
|
|
6387
|
+
(els) => direction === "forward" ? chunk4SPZ5IZN_js.bringForward(els, id) : direction === "backward" ? chunk4SPZ5IZN_js.sendBackward(els, id) : els
|
|
6366
6388
|
);
|
|
6367
6389
|
history.markDirty();
|
|
6368
6390
|
};
|
|
@@ -6372,7 +6394,7 @@ function useGroupAlignLayerHandlers(input) {
|
|
|
6372
6394
|
}
|
|
6373
6395
|
const id = selectedElement.id;
|
|
6374
6396
|
ops.updateActiveElements(
|
|
6375
|
-
(els) => direction === "front" ?
|
|
6397
|
+
(els) => direction === "front" ? chunk4SPZ5IZN_js.bringToFront(els, id) : chunk4SPZ5IZN_js.sendToBack(els, id)
|
|
6376
6398
|
);
|
|
6377
6399
|
history.markDirty();
|
|
6378
6400
|
};
|
|
@@ -6507,7 +6529,7 @@ function useSlideManagement(input) {
|
|
|
6507
6529
|
} = input;
|
|
6508
6530
|
const handleAddSlideAfter = (afterIndex) => {
|
|
6509
6531
|
const insertAt = Math.max(0, Math.min(afterIndex + 1, slides.length));
|
|
6510
|
-
const newSlide =
|
|
6532
|
+
const newSlide = chunk4SPZ5IZN_js.createBlankSlide(slides.length + 1);
|
|
6511
6533
|
ops.updateSlides((prev) => {
|
|
6512
6534
|
const next = [...prev];
|
|
6513
6535
|
next.splice(insertAt, 0, newSlide);
|
|
@@ -6571,7 +6593,7 @@ function useSlideManagement(input) {
|
|
|
6571
6593
|
}
|
|
6572
6594
|
const clone = {
|
|
6573
6595
|
...src,
|
|
6574
|
-
id:
|
|
6596
|
+
id: chunk4SPZ5IZN_js.makeSlideId(),
|
|
6575
6597
|
elements: src.elements.map((el) => ({
|
|
6576
6598
|
...el,
|
|
6577
6599
|
id: `${el.id}-dup-${Math.random().toString(36).slice(2, 6)}`
|
|
@@ -6603,7 +6625,7 @@ function useSlideManagement(input) {
|
|
|
6603
6625
|
const handleInsertSlideFromLayout = (layoutPath, layoutName) => {
|
|
6604
6626
|
const insertAt = activeSlideIndex + 1;
|
|
6605
6627
|
const draft = {
|
|
6606
|
-
...
|
|
6628
|
+
...chunk4SPZ5IZN_js.createBlankSlide(slides.length + 1),
|
|
6607
6629
|
layoutPath,
|
|
6608
6630
|
...layoutName ? { layoutName } : {}
|
|
6609
6631
|
};
|
|
@@ -6636,9 +6658,9 @@ function useSlideManagement(input) {
|
|
|
6636
6658
|
};
|
|
6637
6659
|
const handleInsertSlideFromTemplate = (templateId) => {
|
|
6638
6660
|
const insertAt = activeSlideIndex + 1;
|
|
6639
|
-
const draft =
|
|
6661
|
+
const draft = chunk4SPZ5IZN_js.buildSlideTemplateSlide(templateId, chunk4SPZ5IZN_js.makeSlideId(), slides.length + 1, {
|
|
6640
6662
|
...canvasSize ? { slideWidth: canvasSize.width, slideHeight: canvasSize.height } : {},
|
|
6641
|
-
scheme:
|
|
6663
|
+
scheme: chunk4SPZ5IZN_js.templateSchemeFromTheme(theme?.colorScheme)
|
|
6642
6664
|
});
|
|
6643
6665
|
ops.updateSlides((prev) => insertSlideFromLayoutUpdater(prev, activeSlideIndex, draft));
|
|
6644
6666
|
setActiveSlideIndex(insertAt);
|
|
@@ -6676,7 +6698,7 @@ function createTableMergeHandlers(input) {
|
|
|
6676
6698
|
if (!nextCell || nextCell.hMerge || nextCell.vMerge) {
|
|
6677
6699
|
return;
|
|
6678
6700
|
}
|
|
6679
|
-
const newTableData =
|
|
6701
|
+
const newTableData = chunk4SPZ5IZN_js.mergeCells(
|
|
6680
6702
|
[
|
|
6681
6703
|
{ row: rowIndex, col: columnIndex },
|
|
6682
6704
|
{ row: rowIndex, col: nextColIdx }
|
|
@@ -6684,7 +6706,7 @@ function createTableMergeHandlers(input) {
|
|
|
6684
6706
|
td
|
|
6685
6707
|
);
|
|
6686
6708
|
const updates = { tableData: newTableData };
|
|
6687
|
-
const newRawXml =
|
|
6709
|
+
const newRawXml = chunk4SPZ5IZN_js.updateMergeAttrsInRawXml(selectedElement, newTableData);
|
|
6688
6710
|
if (newRawXml) {
|
|
6689
6711
|
updates.rawXml = newRawXml;
|
|
6690
6712
|
}
|
|
@@ -6710,7 +6732,7 @@ function createTableMergeHandlers(input) {
|
|
|
6710
6732
|
if (!targetNextCell || targetNextCell.hMerge || targetNextCell.vMerge) {
|
|
6711
6733
|
return;
|
|
6712
6734
|
}
|
|
6713
|
-
const newTableData =
|
|
6735
|
+
const newTableData = chunk4SPZ5IZN_js.mergeCells(
|
|
6714
6736
|
[
|
|
6715
6737
|
{ row: rowIndex, col: columnIndex },
|
|
6716
6738
|
{ row: targetNextRowIdx, col: columnIndex }
|
|
@@ -6718,7 +6740,7 @@ function createTableMergeHandlers(input) {
|
|
|
6718
6740
|
td
|
|
6719
6741
|
);
|
|
6720
6742
|
const updates = { tableData: newTableData };
|
|
6721
|
-
const newRawXml =
|
|
6743
|
+
const newRawXml = chunk4SPZ5IZN_js.updateMergeAttrsInRawXml(selectedElement, newTableData);
|
|
6722
6744
|
if (newRawXml) {
|
|
6723
6745
|
updates.rawXml = newRawXml;
|
|
6724
6746
|
}
|
|
@@ -6733,9 +6755,9 @@ function createTableMergeHandlers(input) {
|
|
|
6733
6755
|
return;
|
|
6734
6756
|
}
|
|
6735
6757
|
const td = selectedElement.tableData;
|
|
6736
|
-
const newTableData =
|
|
6758
|
+
const newTableData = chunk4SPZ5IZN_js.mergeCells(ts.selectedCells, td);
|
|
6737
6759
|
const updates = { tableData: newTableData };
|
|
6738
|
-
const newRawXml =
|
|
6760
|
+
const newRawXml = chunk4SPZ5IZN_js.updateMergeAttrsInRawXml(selectedElement, newTableData);
|
|
6739
6761
|
if (newRawXml) {
|
|
6740
6762
|
updates.rawXml = newRawXml;
|
|
6741
6763
|
}
|
|
@@ -6752,9 +6774,9 @@ function createTableMergeHandlers(input) {
|
|
|
6752
6774
|
}
|
|
6753
6775
|
const { rowIndex, columnIndex } = ts;
|
|
6754
6776
|
const td = selectedElement.tableData;
|
|
6755
|
-
const newTableData =
|
|
6777
|
+
const newTableData = chunk4SPZ5IZN_js.splitCell(rowIndex, columnIndex, td);
|
|
6756
6778
|
const updates = { tableData: newTableData };
|
|
6757
|
-
const newRawXml =
|
|
6779
|
+
const newRawXml = chunk4SPZ5IZN_js.updateMergeAttrsInRawXml(selectedElement, newTableData);
|
|
6758
6780
|
if (newRawXml) {
|
|
6759
6781
|
updates.rawXml = newRawXml;
|
|
6760
6782
|
}
|
|
@@ -6788,10 +6810,10 @@ function createTableStructHandlers(input) {
|
|
|
6788
6810
|
const text = transformCommittedText ? transformCommittedText(rawText) : rawText;
|
|
6789
6811
|
const updates = {};
|
|
6790
6812
|
if (el.tableData) {
|
|
6791
|
-
updates.tableData =
|
|
6813
|
+
updates.tableData = chunk4SPZ5IZN_js.setCellText(el, rowIndex, colIndex, text).tableData;
|
|
6792
6814
|
}
|
|
6793
6815
|
if (el.rawXml) {
|
|
6794
|
-
const newRawXml =
|
|
6816
|
+
const newRawXml = chunk4SPZ5IZN_js.updateCellTextInRawXml(el, rowIndex, colIndex, text);
|
|
6795
6817
|
if (newRawXml) {
|
|
6796
6818
|
updates.rawXml = newRawXml;
|
|
6797
6819
|
}
|
|
@@ -6815,7 +6837,7 @@ function createTableStructHandlers(input) {
|
|
|
6815
6837
|
const { rowIndex, columnIndex: colIndex } = ts;
|
|
6816
6838
|
const updates = {};
|
|
6817
6839
|
if (selectedElement.rawXml) {
|
|
6818
|
-
const newRawXml =
|
|
6840
|
+
const newRawXml = chunk4SPZ5IZN_js.updateCellTextStyleInRawXml(
|
|
6819
6841
|
selectedElement,
|
|
6820
6842
|
rowIndex,
|
|
6821
6843
|
colIndex,
|
|
@@ -6879,7 +6901,7 @@ function createTableStructHandlers(input) {
|
|
|
6879
6901
|
return;
|
|
6880
6902
|
}
|
|
6881
6903
|
const rowIdx = ts?.rowIndex ?? 0;
|
|
6882
|
-
const next =
|
|
6904
|
+
const next = chunk4SPZ5IZN_js.insertTableElementRow(selectedElement, rowIdx, position);
|
|
6883
6905
|
ops.updateSelectedElement({ tableData: next.tableData, rawXml: next.rawXml });
|
|
6884
6906
|
history.markDirty();
|
|
6885
6907
|
};
|
|
@@ -6888,7 +6910,7 @@ function createTableStructHandlers(input) {
|
|
|
6888
6910
|
return;
|
|
6889
6911
|
}
|
|
6890
6912
|
const rowIdx = ts?.rowIndex ?? 0;
|
|
6891
|
-
const next =
|
|
6913
|
+
const next = chunk4SPZ5IZN_js.removeTableElementRow(selectedElement, rowIdx);
|
|
6892
6914
|
if (next === selectedElement) {
|
|
6893
6915
|
return;
|
|
6894
6916
|
}
|
|
@@ -6900,7 +6922,7 @@ function createTableStructHandlers(input) {
|
|
|
6900
6922
|
return;
|
|
6901
6923
|
}
|
|
6902
6924
|
const colIdx = ts?.columnIndex ?? 0;
|
|
6903
|
-
const next =
|
|
6925
|
+
const next = chunk4SPZ5IZN_js.insertTableElementColumn(selectedElement, colIdx, position);
|
|
6904
6926
|
ops.updateSelectedElement({ tableData: next.tableData, rawXml: next.rawXml });
|
|
6905
6927
|
history.markDirty();
|
|
6906
6928
|
};
|
|
@@ -6909,7 +6931,7 @@ function createTableStructHandlers(input) {
|
|
|
6909
6931
|
return;
|
|
6910
6932
|
}
|
|
6911
6933
|
const colIdx = ts?.columnIndex ?? 0;
|
|
6912
|
-
const next =
|
|
6934
|
+
const next = chunk4SPZ5IZN_js.removeTableElementColumn(selectedElement, colIdx);
|
|
6913
6935
|
if (next === selectedElement) {
|
|
6914
6936
|
return;
|
|
6915
6937
|
}
|
|
@@ -6945,8 +6967,8 @@ async function renderToCanvas(element, options = {}) {
|
|
|
6945
6967
|
return html2canvasPro(element, {
|
|
6946
6968
|
...options,
|
|
6947
6969
|
onclone: async (doc, clonedEl) => {
|
|
6948
|
-
await
|
|
6949
|
-
|
|
6970
|
+
await chunk4SPZ5IZN_js.normalizeColorsForCapture(doc, clonedEl);
|
|
6971
|
+
chunk4SPZ5IZN_js.preprocessCssForCapture(clonedEl);
|
|
6950
6972
|
if (typeof userOnClone === "function") {
|
|
6951
6973
|
userOnClone(doc, clonedEl);
|
|
6952
6974
|
}
|
|
@@ -6976,7 +6998,7 @@ function useExportSaveAs(input) {
|
|
|
6976
6998
|
slideSizeEmu
|
|
6977
6999
|
} = input;
|
|
6978
7000
|
const handleSaveAsFormat = async (format) => {
|
|
6979
|
-
const downloadName =
|
|
7001
|
+
const downloadName = chunk4SPZ5IZN_js.savedPresentationFileName(filePath, format);
|
|
6980
7002
|
try {
|
|
6981
7003
|
const data = await serializeSlides(format);
|
|
6982
7004
|
if (!data) {
|
|
@@ -6984,16 +7006,16 @@ function useExportSaveAs(input) {
|
|
|
6984
7006
|
}
|
|
6985
7007
|
const mimeType = format === "ppt" ? "application/vnd.ms-powerpoint" : "application/vnd.openxmlformats-officedocument.presentationml.presentation";
|
|
6986
7008
|
const blob = new Blob([data], { type: mimeType });
|
|
6987
|
-
|
|
7009
|
+
chunk4SPZ5IZN_js.downloadBlob(blob, downloadName);
|
|
6988
7010
|
} catch (err) {
|
|
6989
7011
|
console.error(`[PowerPointViewer] Save as .${format} failed:`, err);
|
|
6990
7012
|
}
|
|
6991
7013
|
};
|
|
6992
7014
|
const handleExportJson = () => {
|
|
6993
7015
|
const sourceName = filePath ? filePath.replace(/\\/gu, "/").split("/").pop() : void 0;
|
|
6994
|
-
const slideSize =
|
|
7016
|
+
const slideSize = chunk4SPZ5IZN_js.resolveSlideSizeSelection({ current: slideSizeEmu, canvas: canvasSize }).size;
|
|
6995
7017
|
const data = {
|
|
6996
|
-
slides:
|
|
7018
|
+
slides: chunk4SPZ5IZN_js.buildSaveSlides(slides, templateElementsBySlideId),
|
|
6997
7019
|
width: canvasSize.width,
|
|
6998
7020
|
height: canvasSize.height,
|
|
6999
7021
|
widthEmu: slideSize.widthEmu,
|
|
@@ -7012,7 +7034,7 @@ function useExportSaveAs(input) {
|
|
|
7012
7034
|
handoutMaster
|
|
7013
7035
|
};
|
|
7014
7036
|
try {
|
|
7015
|
-
|
|
7037
|
+
chunk4SPZ5IZN_js.exportDeckJson(data, sourceName);
|
|
7016
7038
|
} catch (err) {
|
|
7017
7039
|
console.error("[PowerPointViewer] JSON export failed:", err);
|
|
7018
7040
|
}
|
|
@@ -7077,7 +7099,7 @@ function buildRasterOptions(element, scale, backgroundColor, mode) {
|
|
|
7077
7099
|
}
|
|
7078
7100
|
async function renderElementToRaster(element, scale = 2, backgroundColor, mode = "auto") {
|
|
7079
7101
|
const { width, height } = measureNaturalSize(element);
|
|
7080
|
-
return
|
|
7102
|
+
return chunk4SPZ5IZN_js.rasterizeElement(
|
|
7081
7103
|
element,
|
|
7082
7104
|
width,
|
|
7083
7105
|
height,
|
|
@@ -7087,7 +7109,7 @@ async function renderElementToRaster(element, scale = 2, backgroundColor, mode =
|
|
|
7087
7109
|
}
|
|
7088
7110
|
async function renderElementToTiles(element, scale = 2, backgroundColor, mode = "auto") {
|
|
7089
7111
|
const { width, height } = measureNaturalSize(element);
|
|
7090
|
-
return
|
|
7112
|
+
return chunk4SPZ5IZN_js.rasterizeElementTiles(
|
|
7091
7113
|
element,
|
|
7092
7114
|
width,
|
|
7093
7115
|
height,
|
|
@@ -7097,7 +7119,7 @@ async function renderElementToTiles(element, scale = 2, backgroundColor, mode =
|
|
|
7097
7119
|
}
|
|
7098
7120
|
async function renderElementToTiledCanvas(element, scale = 2, backgroundColor, mode = "auto") {
|
|
7099
7121
|
const { width, height } = measureNaturalSize(element);
|
|
7100
|
-
return
|
|
7122
|
+
return chunk4SPZ5IZN_js.rasterizeElementTiledToCanvas(
|
|
7101
7123
|
element,
|
|
7102
7124
|
width,
|
|
7103
7125
|
height,
|
|
@@ -7119,11 +7141,11 @@ function waitForRender(ms = 100) {
|
|
|
7119
7141
|
async function exportSlideToPngBlob(slideElement, options = {}) {
|
|
7120
7142
|
const { scale = 2, backgroundColor } = options;
|
|
7121
7143
|
const result = await renderElementToRaster(slideElement, scale, backgroundColor);
|
|
7122
|
-
return
|
|
7144
|
+
return chunk4SPZ5IZN_js.rasterResultToPngBlob(result);
|
|
7123
7145
|
}
|
|
7124
7146
|
async function exportSlideAsPng(slideElement, slideIndex, options = {}) {
|
|
7125
7147
|
const blob = await exportSlideToPngBlob(slideElement, options);
|
|
7126
|
-
|
|
7148
|
+
chunk4SPZ5IZN_js.downloadBlob(blob, `slide-${slideIndex + 1}.png`);
|
|
7127
7149
|
}
|
|
7128
7150
|
async function copySlideToClipboard(slideElement, options = {}) {
|
|
7129
7151
|
const blob = await exportSlideToPngBlob(slideElement, options);
|
|
@@ -7152,13 +7174,13 @@ async function captureAllSlidesAsPngDataUrls(slideStageRef, totalSlides, setActi
|
|
|
7152
7174
|
// src/viewer/utils/export-pdf.ts
|
|
7153
7175
|
function tilesToPdfPage(tilesResult) {
|
|
7154
7176
|
return tilesResult.tiles.map((tile) => ({
|
|
7155
|
-
image:
|
|
7156
|
-
placement:
|
|
7177
|
+
image: chunk4SPZ5IZN_js.canvasToJpegData(tile.canvas),
|
|
7178
|
+
placement: chunk4SPZ5IZN_js.placeTileOnPage(
|
|
7157
7179
|
tile,
|
|
7158
7180
|
tilesResult.fullWidth,
|
|
7159
7181
|
tilesResult.fullHeight,
|
|
7160
|
-
|
|
7161
|
-
|
|
7182
|
+
chunk4SPZ5IZN_js.PDF_SLIDES_PAGE_WIDTH_PT,
|
|
7183
|
+
chunk4SPZ5IZN_js.PDF_SLIDES_PAGE_HEIGHT_PT
|
|
7162
7184
|
)
|
|
7163
7185
|
}));
|
|
7164
7186
|
}
|
|
@@ -7185,8 +7207,8 @@ async function exportAllSlidesAsPdf(slideStageRef, totalSlides, setActiveSlide,
|
|
|
7185
7207
|
if (pages.length === 0) {
|
|
7186
7208
|
throw new Error(chunk3AJ54EAB_js.translationsEn["pptx.export.errorNoSlidesPdf"]);
|
|
7187
7209
|
}
|
|
7188
|
-
const pdfBlobUrl =
|
|
7189
|
-
|
|
7210
|
+
const pdfBlobUrl = chunkNJ3WCYYG_js.buildPdfFromTiledImageData(pages);
|
|
7211
|
+
chunk4SPZ5IZN_js.downloadDataUrl(pdfBlobUrl, filename);
|
|
7190
7212
|
}
|
|
7191
7213
|
async function exportAllSlidesAsNotesPdf(slideStageRef, totalSlides, setActiveSlide, currentSlideIndex, slideNotes, filename = "presentation-notes.pdf", options = {}) {
|
|
7192
7214
|
const { scale = 2, onProgress, signal } = options;
|
|
@@ -7215,8 +7237,8 @@ async function exportAllSlidesAsNotesPdf(slideStageRef, totalSlides, setActiveSl
|
|
|
7215
7237
|
if (pages.length === 0) {
|
|
7216
7238
|
throw new Error(chunk3AJ54EAB_js.translationsEn["pptx.export.errorNoSlidesNotesPdf"]);
|
|
7217
7239
|
}
|
|
7218
|
-
const pdfDataUrl =
|
|
7219
|
-
|
|
7240
|
+
const pdfDataUrl = chunkNJ3WCYYG_js.buildNotesPdf(pages);
|
|
7241
|
+
chunk4SPZ5IZN_js.downloadDataUrl(pdfDataUrl, filename);
|
|
7220
7242
|
}
|
|
7221
7243
|
|
|
7222
7244
|
// src/viewer/utils/export-video.ts
|
|
@@ -7260,7 +7282,7 @@ async function exportAllSlidesAsVideo(slideStageRef, totalSlides, setActiveSlide
|
|
|
7260
7282
|
const fps = 30;
|
|
7261
7283
|
const stream = recordingCanvas.captureStream(fps);
|
|
7262
7284
|
const recorder = new MediaRecorder(stream, {
|
|
7263
|
-
mimeType:
|
|
7285
|
+
mimeType: chunk4SPZ5IZN_js.pickSupportedMimeType([...chunk4SPZ5IZN_js.WEBM_MIME_CANDIDATES]),
|
|
7264
7286
|
videoBitsPerSecond: 5e6
|
|
7265
7287
|
});
|
|
7266
7288
|
const chunks = [];
|
|
@@ -7283,8 +7305,8 @@ async function exportAllSlidesAsVideo(slideStageRef, totalSlides, setActiveSlide
|
|
|
7283
7305
|
const duration = slideTimingsMs?.[i] ?? slideDurationMs;
|
|
7284
7306
|
ctx.clearRect(0, 0, recordingCanvas.width, recordingCanvas.height);
|
|
7285
7307
|
ctx.drawImage(slideCanvases[i], 0, 0);
|
|
7286
|
-
const frameInterval =
|
|
7287
|
-
const framesNeeded =
|
|
7308
|
+
const frameInterval = chunk4SPZ5IZN_js.fpsToFrameIntervalMs(fps);
|
|
7309
|
+
const framesNeeded = chunk4SPZ5IZN_js.segmentFrameCount(duration, fps);
|
|
7288
7310
|
for (let f = 0; f < framesNeeded; f++) {
|
|
7289
7311
|
if (signal?.aborted) {
|
|
7290
7312
|
recorder.stop();
|
|
@@ -7304,7 +7326,7 @@ async function exportAllSlidesAsVideo(slideStageRef, totalSlides, setActiveSlide
|
|
|
7304
7326
|
|
|
7305
7327
|
// src/viewer/utils/export-gif.ts
|
|
7306
7328
|
function frameFromCanvas(canvas, maxSide) {
|
|
7307
|
-
const { width, height } =
|
|
7329
|
+
const { width, height } = chunk4SPZ5IZN_js.clampGifDimensions(canvas.width, canvas.height, maxSide);
|
|
7308
7330
|
let source = canvas;
|
|
7309
7331
|
if (width !== canvas.width || height !== canvas.height) {
|
|
7310
7332
|
const scaled = canvas.ownerDocument.createElement("canvas");
|
|
@@ -7327,7 +7349,7 @@ async function exportAllSlidesAsGif(slideStageRef, totalSlides, setActiveSlide,
|
|
|
7327
7349
|
const {
|
|
7328
7350
|
scale = 0.5,
|
|
7329
7351
|
slideDurationMs = 2e3,
|
|
7330
|
-
maxSide =
|
|
7352
|
+
maxSide = chunk4SPZ5IZN_js.GIF_POST_CAPTURE_MAX_SIDE,
|
|
7331
7353
|
onProgress,
|
|
7332
7354
|
signal
|
|
7333
7355
|
} = options;
|
|
@@ -7354,7 +7376,7 @@ async function exportAllSlidesAsGif(slideStageRef, totalSlides, setActiveSlide,
|
|
|
7354
7376
|
if (frames.length === 0) {
|
|
7355
7377
|
throw new Error(chunk3AJ54EAB_js.translationsEn["pptx.export.errorNoSlidesGif"]);
|
|
7356
7378
|
}
|
|
7357
|
-
const gifBytes =
|
|
7379
|
+
const gifBytes = chunk4SPZ5IZN_js.encodeGif(frames, Math.round(slideDurationMs / 10));
|
|
7358
7380
|
onProgress?.(totalSlides, totalSlides);
|
|
7359
7381
|
const buf = new ArrayBuffer(gifBytes.length);
|
|
7360
7382
|
new Uint8Array(buf).set(gifBytes);
|
|
@@ -7408,7 +7430,7 @@ function exportAllSlidesToSvg(data, options = {}) {
|
|
|
7408
7430
|
continue;
|
|
7409
7431
|
}
|
|
7410
7432
|
onProgress?.(processedCount, data.slides.length);
|
|
7411
|
-
let svg =
|
|
7433
|
+
let svg = chunk4SPZ5IZN_js.SvgExporter.exportSlide(slide, data.width, data.height, svgOptions);
|
|
7412
7434
|
if (embedFonts && fontFaces?.length) {
|
|
7413
7435
|
svg = injectFontFaces(svg, fontFaces);
|
|
7414
7436
|
}
|
|
@@ -7460,7 +7482,7 @@ function useExportMediaHandlers(input) {
|
|
|
7460
7482
|
setExportProgress(0);
|
|
7461
7483
|
setExportModalOpen(true);
|
|
7462
7484
|
try {
|
|
7463
|
-
const { scale } =
|
|
7485
|
+
const { scale } = chunk4SPZ5IZN_js.resolveExportCaptureDecision(imageResolutionScale, "video");
|
|
7464
7486
|
const blob = await exportAllSlidesAsVideo(
|
|
7465
7487
|
canvasStageRef,
|
|
7466
7488
|
slides.length,
|
|
@@ -7470,22 +7492,22 @@ function useExportMediaHandlers(input) {
|
|
|
7470
7492
|
scale,
|
|
7471
7493
|
slideDurationMs: 3e3,
|
|
7472
7494
|
onProgress: (current, total) => {
|
|
7473
|
-
setExportProgress(
|
|
7474
|
-
setExportStatusMessage(
|
|
7495
|
+
setExportProgress(chunk4SPZ5IZN_js.slideProgressPercent(current, total, 45));
|
|
7496
|
+
setExportStatusMessage(chunk4SPZ5IZN_js.slideStatusLabel("Capturing", current, total));
|
|
7475
7497
|
},
|
|
7476
7498
|
onRecordProgress: (current, total) => {
|
|
7477
|
-
setExportProgress(
|
|
7478
|
-
setExportStatusMessage(
|
|
7499
|
+
setExportProgress(chunk4SPZ5IZN_js.recordProgressPercent(current, total));
|
|
7500
|
+
setExportStatusMessage(chunk4SPZ5IZN_js.slideStatusLabel("Recording", current, total));
|
|
7479
7501
|
},
|
|
7480
7502
|
signal: abortCtrl.signal
|
|
7481
7503
|
}
|
|
7482
7504
|
);
|
|
7483
|
-
setExportProgress(
|
|
7505
|
+
setExportProgress(chunk4SPZ5IZN_js.EXPORT_ASSEMBLING_PERCENT);
|
|
7484
7506
|
setExportStatusMessage("Saving file...");
|
|
7485
|
-
|
|
7486
|
-
setExportProgress(
|
|
7507
|
+
chunk4SPZ5IZN_js.downloadBlob(blob, "presentation.webm");
|
|
7508
|
+
setExportProgress(chunk4SPZ5IZN_js.EXPORT_DONE_PERCENT);
|
|
7487
7509
|
} catch (err) {
|
|
7488
|
-
if (!
|
|
7510
|
+
if (!chunk4SPZ5IZN_js.isExportAbortError(err)) {
|
|
7489
7511
|
console.error("[PowerPointViewer] Video export failed:", err);
|
|
7490
7512
|
}
|
|
7491
7513
|
} finally {
|
|
@@ -7515,7 +7537,7 @@ function useExportMediaHandlers(input) {
|
|
|
7515
7537
|
setExportProgress(0);
|
|
7516
7538
|
setExportModalOpen(true);
|
|
7517
7539
|
try {
|
|
7518
|
-
const { scale, postCaptureMaxSide } =
|
|
7540
|
+
const { scale, postCaptureMaxSide } = chunk4SPZ5IZN_js.resolveExportCaptureDecision(
|
|
7519
7541
|
imageResolutionScale,
|
|
7520
7542
|
"gif"
|
|
7521
7543
|
);
|
|
@@ -7529,18 +7551,18 @@ function useExportMediaHandlers(input) {
|
|
|
7529
7551
|
maxSide: postCaptureMaxSide,
|
|
7530
7552
|
slideDurationMs: 2e3,
|
|
7531
7553
|
onProgress: (current, total) => {
|
|
7532
|
-
setExportProgress(
|
|
7533
|
-
setExportStatusMessage(
|
|
7554
|
+
setExportProgress(chunk4SPZ5IZN_js.slideProgressPercent(current, total));
|
|
7555
|
+
setExportStatusMessage(chunk4SPZ5IZN_js.slideStatusLabel("Encoding", current, total));
|
|
7534
7556
|
},
|
|
7535
7557
|
signal: abortCtrl.signal
|
|
7536
7558
|
}
|
|
7537
7559
|
);
|
|
7538
|
-
setExportProgress(
|
|
7560
|
+
setExportProgress(chunk4SPZ5IZN_js.EXPORT_ASSEMBLING_PERCENT);
|
|
7539
7561
|
setExportStatusMessage("Saving file...");
|
|
7540
|
-
|
|
7541
|
-
setExportProgress(
|
|
7562
|
+
chunk4SPZ5IZN_js.downloadBlob(blob, "presentation.gif");
|
|
7563
|
+
setExportProgress(chunk4SPZ5IZN_js.EXPORT_DONE_PERCENT);
|
|
7542
7564
|
} catch (err) {
|
|
7543
|
-
if (!
|
|
7565
|
+
if (!chunk4SPZ5IZN_js.isExportAbortError(err)) {
|
|
7544
7566
|
console.error("[PowerPointViewer] GIF export failed:", err);
|
|
7545
7567
|
}
|
|
7546
7568
|
} finally {
|
|
@@ -7666,21 +7688,21 @@ function useExportHandlers(input) {
|
|
|
7666
7688
|
{
|
|
7667
7689
|
scale: imageExportScale,
|
|
7668
7690
|
onProgress: (current, total) => {
|
|
7669
|
-
setExportProgress(
|
|
7670
|
-
setExportStatusMessage(
|
|
7691
|
+
setExportProgress(chunk4SPZ5IZN_js.slideProgressPercent(current, total));
|
|
7692
|
+
setExportStatusMessage(chunk4SPZ5IZN_js.slideStatusLabel("Rendering", current, total));
|
|
7671
7693
|
},
|
|
7672
7694
|
signal: abortCtrl.signal
|
|
7673
7695
|
}
|
|
7674
7696
|
);
|
|
7675
|
-
setExportProgress(
|
|
7697
|
+
setExportProgress(chunk4SPZ5IZN_js.EXPORT_ASSEMBLING_PERCENT);
|
|
7676
7698
|
setExportStatusMessage("Building PDF...");
|
|
7677
7699
|
await new Promise((r) => {
|
|
7678
7700
|
setTimeout(r, 100);
|
|
7679
7701
|
});
|
|
7680
|
-
setExportProgress(
|
|
7702
|
+
setExportProgress(chunk4SPZ5IZN_js.EXPORT_DONE_PERCENT);
|
|
7681
7703
|
setExportStatusMessage("Done!");
|
|
7682
7704
|
} catch (err) {
|
|
7683
|
-
if (!
|
|
7705
|
+
if (!chunk4SPZ5IZN_js.isExportAbortError(err)) {
|
|
7684
7706
|
console.error("[PowerPointViewer] PDF export failed:", err);
|
|
7685
7707
|
}
|
|
7686
7708
|
} finally {
|
|
@@ -7710,21 +7732,21 @@ function useExportHandlers(input) {
|
|
|
7710
7732
|
{
|
|
7711
7733
|
scale: imageExportScale,
|
|
7712
7734
|
onProgress: (current, total) => {
|
|
7713
|
-
setExportProgress(
|
|
7714
|
-
setExportStatusMessage(
|
|
7735
|
+
setExportProgress(chunk4SPZ5IZN_js.slideProgressPercent(current, total));
|
|
7736
|
+
setExportStatusMessage(chunk4SPZ5IZN_js.slideStatusLabel("Rendering", current, total));
|
|
7715
7737
|
},
|
|
7716
7738
|
signal: abortCtrl.signal
|
|
7717
7739
|
}
|
|
7718
7740
|
);
|
|
7719
|
-
setExportProgress(
|
|
7741
|
+
setExportProgress(chunk4SPZ5IZN_js.EXPORT_ASSEMBLING_PERCENT);
|
|
7720
7742
|
setExportStatusMessage("Building PDF...");
|
|
7721
7743
|
await new Promise((r) => {
|
|
7722
7744
|
setTimeout(r, 100);
|
|
7723
7745
|
});
|
|
7724
|
-
setExportProgress(
|
|
7746
|
+
setExportProgress(chunk4SPZ5IZN_js.EXPORT_DONE_PERCENT);
|
|
7725
7747
|
setExportStatusMessage("Done!");
|
|
7726
7748
|
} catch (err) {
|
|
7727
|
-
if (!
|
|
7749
|
+
if (!chunk4SPZ5IZN_js.isExportAbortError(err)) {
|
|
7728
7750
|
console.error("[PowerPointViewer] Notes PDF export failed:", err);
|
|
7729
7751
|
}
|
|
7730
7752
|
} finally {
|
|
@@ -7772,7 +7794,7 @@ function useExportHandlers(input) {
|
|
|
7772
7794
|
exportStatusMessage
|
|
7773
7795
|
};
|
|
7774
7796
|
}
|
|
7775
|
-
var ViewerOptionsContext = react.createContext(
|
|
7797
|
+
var ViewerOptionsContext = react.createContext(chunk4SPZ5IZN_js.DEFAULT_VIEWER_OPTIONS);
|
|
7776
7798
|
function useViewerOptionsContext() {
|
|
7777
7799
|
return react.useContext(ViewerOptionsContext);
|
|
7778
7800
|
}
|
|
@@ -7784,13 +7806,13 @@ function usePrintHandlers(input) {
|
|
|
7784
7806
|
const { t } = reactI18next.useTranslation();
|
|
7785
7807
|
const viewerOptions = useViewerOptionsContext();
|
|
7786
7808
|
const includeHiddenSlides = viewerOptions.advanced.printHiddenSlides;
|
|
7787
|
-
const printRasterScale = (viewerOptions.advanced.printHighQuality ? 4 : 3) *
|
|
7809
|
+
const printRasterScale = (viewerOptions.advanced.printHighQuality ? 4 : 3) * chunk4SPZ5IZN_js.resolveImageResolutionScale(viewerOptions);
|
|
7788
7810
|
const handlePrint = () => {
|
|
7789
7811
|
setIsPrintDialogOpen(true);
|
|
7790
7812
|
};
|
|
7791
7813
|
const handlePrintSvg = async (settings) => {
|
|
7792
7814
|
setIsPrintDialogOpen(false);
|
|
7793
|
-
const printWindow =
|
|
7815
|
+
const printWindow = chunk4SPZ5IZN_js.openPendingPrintWindow(t("pptx.print.preparingToPrint"));
|
|
7794
7816
|
if (!printWindow) {
|
|
7795
7817
|
console.warn(
|
|
7796
7818
|
"[PowerPointViewer] Print window was blocked by the browser. Allow popups for this site to print."
|
|
@@ -7800,9 +7822,9 @@ function usePrintHandlers(input) {
|
|
|
7800
7822
|
if (!pptxData || settings.printWhat !== "slides") {
|
|
7801
7823
|
return runRasterPrint(printWindow, settings);
|
|
7802
7824
|
}
|
|
7803
|
-
const colorFilter =
|
|
7804
|
-
const slideIndices =
|
|
7805
|
-
|
|
7825
|
+
const colorFilter = chunk4SPZ5IZN_js.computeColorFilter(settings.colorMode);
|
|
7826
|
+
const slideIndices = chunk4SPZ5IZN_js.filterHiddenSlideIndices(
|
|
7827
|
+
chunk4SPZ5IZN_js.computeSlideIndices(
|
|
7806
7828
|
settings.slideRange,
|
|
7807
7829
|
activeSlideIndex,
|
|
7808
7830
|
slides.length,
|
|
@@ -7820,22 +7842,22 @@ function usePrintHandlers(input) {
|
|
|
7820
7842
|
printWindow.close();
|
|
7821
7843
|
return;
|
|
7822
7844
|
}
|
|
7823
|
-
const printDoc =
|
|
7845
|
+
const printDoc = chunk4SPZ5IZN_js.buildPrintDocument(svgs, pptxData.width, pptxData.height, {
|
|
7824
7846
|
title: "Slides (Vector)",
|
|
7825
7847
|
orientation: settings.orientation,
|
|
7826
7848
|
colorFilter,
|
|
7827
7849
|
scaleToFit: settings.scaleToFit
|
|
7828
7850
|
});
|
|
7829
|
-
|
|
7851
|
+
chunk4SPZ5IZN_js.finishPrintWindow(printWindow, printDoc);
|
|
7830
7852
|
} catch (err) {
|
|
7831
7853
|
console.warn("[PowerPointViewer] SVG print path failed, falling back to raster:", err);
|
|
7832
7854
|
return runRasterPrint(printWindow, settings);
|
|
7833
7855
|
}
|
|
7834
7856
|
};
|
|
7835
7857
|
const runRasterPrint = async (printWindow, settings) => {
|
|
7836
|
-
const colorFilter =
|
|
7837
|
-
const slideIndices =
|
|
7838
|
-
|
|
7858
|
+
const colorFilter = chunk4SPZ5IZN_js.computeColorFilter(settings.colorMode);
|
|
7859
|
+
const slideIndices = chunk4SPZ5IZN_js.filterHiddenSlideIndices(
|
|
7860
|
+
chunk4SPZ5IZN_js.computeSlideIndices(
|
|
7839
7861
|
settings.slideRange,
|
|
7840
7862
|
activeSlideIndex,
|
|
7841
7863
|
slides.length,
|
|
@@ -7846,11 +7868,11 @@ function usePrintHandlers(input) {
|
|
|
7846
7868
|
includeHiddenSlides
|
|
7847
7869
|
);
|
|
7848
7870
|
if (settings.printWhat === "outline") {
|
|
7849
|
-
|
|
7871
|
+
chunk4SPZ5IZN_js.finishPrintWindow(
|
|
7850
7872
|
printWindow,
|
|
7851
|
-
|
|
7873
|
+
chunk4SPZ5IZN_js.buildPrintHtmlDocument({
|
|
7852
7874
|
title: "Outline",
|
|
7853
|
-
bodyHtml: `<div class="outline-page">${
|
|
7875
|
+
bodyHtml: `<div class="outline-page">${chunk4SPZ5IZN_js.buildOutlineHtml(slideIndices, slides)}</div>`,
|
|
7854
7876
|
orientation: settings.orientation,
|
|
7855
7877
|
colorFilter,
|
|
7856
7878
|
frameSlides: settings.frameSlides,
|
|
@@ -7877,11 +7899,11 @@ function usePrintHandlers(input) {
|
|
|
7877
7899
|
}
|
|
7878
7900
|
const slideImages = slideIndices.map((idx) => allImages[idx]).filter(Boolean);
|
|
7879
7901
|
if (settings.printWhat === "slides") {
|
|
7880
|
-
|
|
7902
|
+
chunk4SPZ5IZN_js.finishPrintWindow(
|
|
7881
7903
|
printWindow,
|
|
7882
|
-
|
|
7904
|
+
chunk4SPZ5IZN_js.buildPrintHtmlDocument({
|
|
7883
7905
|
title: "Slides",
|
|
7884
|
-
bodyHtml:
|
|
7906
|
+
bodyHtml: chunk4SPZ5IZN_js.buildSlidesHtml(slideImages, slideIndices),
|
|
7885
7907
|
orientation: settings.orientation,
|
|
7886
7908
|
colorFilter,
|
|
7887
7909
|
frameSlides: settings.frameSlides,
|
|
@@ -7891,11 +7913,11 @@ function usePrintHandlers(input) {
|
|
|
7891
7913
|
return;
|
|
7892
7914
|
}
|
|
7893
7915
|
if (settings.printWhat === "notes") {
|
|
7894
|
-
|
|
7916
|
+
chunk4SPZ5IZN_js.finishPrintWindow(
|
|
7895
7917
|
printWindow,
|
|
7896
|
-
|
|
7918
|
+
chunk4SPZ5IZN_js.buildPrintHtmlDocument({
|
|
7897
7919
|
title: "Notes Pages",
|
|
7898
|
-
bodyHtml:
|
|
7920
|
+
bodyHtml: chunk4SPZ5IZN_js.buildNotesHtml(slideImages, slideIndices, slides),
|
|
7899
7921
|
orientation: "portrait",
|
|
7900
7922
|
colorFilter,
|
|
7901
7923
|
frameSlides: settings.frameSlides,
|
|
@@ -7906,11 +7928,11 @@ function usePrintHandlers(input) {
|
|
|
7906
7928
|
}
|
|
7907
7929
|
if (settings.printWhat === "handouts") {
|
|
7908
7930
|
const spp = settings.slidesPerPage;
|
|
7909
|
-
|
|
7931
|
+
chunk4SPZ5IZN_js.finishPrintWindow(
|
|
7910
7932
|
printWindow,
|
|
7911
|
-
|
|
7933
|
+
chunk4SPZ5IZN_js.buildPrintHtmlDocument({
|
|
7912
7934
|
title: `Handout ${spp} per page`,
|
|
7913
|
-
bodyHtml:
|
|
7935
|
+
bodyHtml: chunk4SPZ5IZN_js.buildHandoutsHtml(slideImages, slideIndices, spp, pptxData?.handoutMaster),
|
|
7914
7936
|
orientation: "portrait",
|
|
7915
7937
|
colorFilter,
|
|
7916
7938
|
frameSlides: settings.frameSlides,
|
|
@@ -7924,7 +7946,7 @@ function usePrintHandlers(input) {
|
|
|
7924
7946
|
};
|
|
7925
7947
|
const handlePrintWithSettings = async (settings) => {
|
|
7926
7948
|
setIsPrintDialogOpen(false);
|
|
7927
|
-
const printWindow =
|
|
7949
|
+
const printWindow = chunk4SPZ5IZN_js.openPendingPrintWindow(t("pptx.print.preparingToPrint"));
|
|
7928
7950
|
if (!printWindow) {
|
|
7929
7951
|
console.warn(
|
|
7930
7952
|
"[PowerPointViewer] Print window was blocked by the browser. Allow popups for this site to print."
|
|
@@ -7989,13 +8011,13 @@ function useThemeHandlers(input) {
|
|
|
7989
8011
|
return;
|
|
7990
8012
|
}
|
|
7991
8013
|
await handler.updateThemeColorScheme(colorScheme);
|
|
7992
|
-
const previousMap = theme?.colorScheme ?
|
|
7993
|
-
setSlides((prev) =>
|
|
8014
|
+
const previousMap = theme?.colorScheme ? chunk4SPZ5IZN_js.buildThemeColorMap(theme.colorScheme) : {};
|
|
8015
|
+
setSlides((prev) => chunk4SPZ5IZN_js.reResolveSlideColors(prev, previousMap, colorScheme));
|
|
7994
8016
|
if (Object.keys(templateElementsBySlideId).length > 0) {
|
|
7995
8017
|
setTemplateElementsBySlideId((prev) => {
|
|
7996
8018
|
const next = {};
|
|
7997
8019
|
for (const [slideId, elements] of Object.entries(prev)) {
|
|
7998
|
-
next[slideId] =
|
|
8020
|
+
next[slideId] = chunk4SPZ5IZN_js.reResolveElementColors(elements, previousMap, colorScheme);
|
|
7999
8021
|
}
|
|
8000
8022
|
return next;
|
|
8001
8023
|
});
|
|
@@ -8104,7 +8126,7 @@ function useThemeSwitching(input) {
|
|
|
8104
8126
|
}
|
|
8105
8127
|
try {
|
|
8106
8128
|
await handler.applyTheme(preset.colorScheme, preset.fontScheme, preset.name);
|
|
8107
|
-
const newData =
|
|
8129
|
+
const newData = chunk4SPZ5IZN_js.applyThemeToData(data, preset.colorScheme, preset.fontScheme, preset.name);
|
|
8108
8130
|
onDataChange(newData);
|
|
8109
8131
|
onThemeChanged?.(preset);
|
|
8110
8132
|
} catch (error) {
|
|
@@ -8121,7 +8143,7 @@ function useThemeSwitching(input) {
|
|
|
8121
8143
|
}
|
|
8122
8144
|
try {
|
|
8123
8145
|
await handler.applyTheme(colorScheme, fontScheme ?? {}, themeName);
|
|
8124
|
-
const newData =
|
|
8146
|
+
const newData = chunk4SPZ5IZN_js.applyThemeToData(data, colorScheme, fontScheme, themeName);
|
|
8125
8147
|
onDataChange(newData);
|
|
8126
8148
|
} catch (error) {
|
|
8127
8149
|
console.error("Failed to switch to custom theme:", error);
|
|
@@ -8133,12 +8155,12 @@ function useThemeSwitching(input) {
|
|
|
8133
8155
|
if (!data?.theme?.colorScheme) {
|
|
8134
8156
|
return void 0;
|
|
8135
8157
|
}
|
|
8136
|
-
return
|
|
8137
|
-
(p) =>
|
|
8158
|
+
return chunk4SPZ5IZN_js.THEME_PRESETS.find(
|
|
8159
|
+
(p) => chunk4SPZ5IZN_js.themeColorSchemesEqual(data.theme?.colorScheme, p.colorScheme)
|
|
8138
8160
|
);
|
|
8139
8161
|
}, [data?.theme?.colorScheme]);
|
|
8140
8162
|
return {
|
|
8141
|
-
presets:
|
|
8163
|
+
presets: chunk4SPZ5IZN_js.THEME_PRESETS,
|
|
8142
8164
|
switchToPreset,
|
|
8143
8165
|
switchToCustom,
|
|
8144
8166
|
currentPreset
|
|
@@ -8213,7 +8235,7 @@ function usePropertyHandlers(input) {
|
|
|
8213
8235
|
}
|
|
8214
8236
|
try {
|
|
8215
8237
|
const ab = await file.arrayBuffer();
|
|
8216
|
-
const h = new
|
|
8238
|
+
const h = new chunk4SPZ5IZN_js.PptxHandler();
|
|
8217
8239
|
const other = await h.load(ab);
|
|
8218
8240
|
if (!other) {
|
|
8219
8241
|
return;
|
|
@@ -8223,7 +8245,7 @@ function usePropertyHandlers(input) {
|
|
|
8223
8245
|
width: canvasSize.width,
|
|
8224
8246
|
height: canvasSize.height
|
|
8225
8247
|
};
|
|
8226
|
-
setCompareResult(
|
|
8248
|
+
setCompareResult(chunk4SPZ5IZN_js.comparePresentation(cur, other));
|
|
8227
8249
|
setIsComparePanelOpen(true);
|
|
8228
8250
|
} catch (err) {
|
|
8229
8251
|
console.warn("Compare failed:", err);
|
|
@@ -8240,7 +8262,7 @@ function usePropertyHandlers(input) {
|
|
|
8240
8262
|
if (!diff || diff.status === "unchanged") {
|
|
8241
8263
|
return;
|
|
8242
8264
|
}
|
|
8243
|
-
setSlides((prev) =>
|
|
8265
|
+
setSlides((prev) => chunk4SPZ5IZN_js.applyAcceptSlide(prev, diff));
|
|
8244
8266
|
setIsDirty(true);
|
|
8245
8267
|
},
|
|
8246
8268
|
[compareResult, setSlides, setIsDirty]
|
|
@@ -8251,10 +8273,10 @@ function usePropertyHandlers(input) {
|
|
|
8251
8273
|
if (!compareResult) {
|
|
8252
8274
|
return;
|
|
8253
8275
|
}
|
|
8254
|
-
setSlides((prev) =>
|
|
8276
|
+
setSlides((prev) => chunk4SPZ5IZN_js.applyAcceptAllSlides(prev, compareResult));
|
|
8255
8277
|
setIsDirty(true);
|
|
8256
8278
|
}, [compareResult, setSlides, setIsDirty]);
|
|
8257
|
-
const usedFontFamilies = react.useMemo(() =>
|
|
8279
|
+
const usedFontFamilies = react.useMemo(() => chunk4SPZ5IZN_js.collectUsedFonts(slides), [slides]);
|
|
8258
8280
|
return {
|
|
8259
8281
|
handleUpdateNotes,
|
|
8260
8282
|
handleUpdateSlide,
|
|
@@ -8409,7 +8431,7 @@ function useViewerDialogs(input) {
|
|
|
8409
8431
|
);
|
|
8410
8432
|
const embeddedFontKey = (embeddedFontFamilies ?? []).join("\0");
|
|
8411
8433
|
const fontEmbedding = react.useMemo(
|
|
8412
|
-
() =>
|
|
8434
|
+
() => chunk4SPZ5IZN_js.describeFontEmbedding(embeddedFontKey ? embeddedFontKey.split("\0") : []),
|
|
8413
8435
|
[embeddedFontKey]
|
|
8414
8436
|
);
|
|
8415
8437
|
const [embedFontsEnabled, setEmbedFontsEnabled] = react.useState(fontEmbedding.initialEnabled);
|
|
@@ -8419,11 +8441,11 @@ function useViewerDialogs(input) {
|
|
|
8419
8441
|
setEmbedFontsEnabled(fontEmbedding.initialEnabled);
|
|
8420
8442
|
}
|
|
8421
8443
|
const [isNarrowViewport, setIsNarrowViewport] = react.useState(
|
|
8422
|
-
() => typeof window !== "undefined" ?
|
|
8444
|
+
() => typeof window !== "undefined" ? chunk4SPZ5IZN_js.isMobileViewport(window.innerWidth, window.innerHeight, viewportIsTouch()) : false
|
|
8423
8445
|
);
|
|
8424
8446
|
react.useEffect(() => {
|
|
8425
8447
|
const handleWindow = () => setIsNarrowViewport(
|
|
8426
|
-
|
|
8448
|
+
chunk4SPZ5IZN_js.isMobileViewport(window.innerWidth, window.innerHeight, viewportIsTouch())
|
|
8427
8449
|
);
|
|
8428
8450
|
window.addEventListener("resize", handleWindow);
|
|
8429
8451
|
return () => window.removeEventListener("resize", handleWindow);
|
|
@@ -8576,16 +8598,16 @@ function useViewerDialogs(input) {
|
|
|
8576
8598
|
};
|
|
8577
8599
|
}
|
|
8578
8600
|
function computeGridSpacingPx2(documentGridSpacing) {
|
|
8579
|
-
return
|
|
8601
|
+
return chunk4SPZ5IZN_js.computeGridSpacingPx(documentGridSpacing, chunkNJ3WCYYG_js.GRID_SIZE);
|
|
8580
8602
|
}
|
|
8581
8603
|
function computeVisibleSlideIndexes(slides, activeCustomShowId, customShows, presentationProperties) {
|
|
8582
8604
|
const activeShow = activeCustomShowId ? customShows.find((show) => show.id === activeCustomShowId) : void 0;
|
|
8583
|
-
const authoredRange =
|
|
8584
|
-
return
|
|
8605
|
+
const authoredRange = chunk4SPZ5IZN_js.resolveAuthoredSlideRange(presentationProperties, slides.length);
|
|
8606
|
+
return chunk4SPZ5IZN_js.resolveShowSlideIndexes(slides, activeShow, authoredRange);
|
|
8585
8607
|
}
|
|
8586
8608
|
function computeSlideSectionGroups(slides, sections) {
|
|
8587
|
-
return
|
|
8588
|
-
id: group.section?.id ?? (sections.length > 0 ?
|
|
8609
|
+
return chunk4SPZ5IZN_js.groupSlidesBySection(sections, slides).map((group) => ({
|
|
8610
|
+
id: group.section?.id ?? (sections.length > 0 ? chunkNJ3WCYYG_js.UNGROUPED_SECTION_ID : chunkNJ3WCYYG_js.DEFAULT_SECTION_GROUP_ID),
|
|
8589
8611
|
label: group.section?.name ?? (sections.length > 0 ? "Ungrouped Slides" : "Slides"),
|
|
8590
8612
|
slideIndexes: group.slideIndexes,
|
|
8591
8613
|
...group.section?.color !== void 0 ? { color: group.section.color } : {},
|
|
@@ -8597,7 +8619,7 @@ function computeMasterPseudoSlide(mode, activeLayout, activeMaster) {
|
|
|
8597
8619
|
return void 0;
|
|
8598
8620
|
}
|
|
8599
8621
|
const document2 = activeLayout ? { slideMasters: [{ ...activeMaster, layouts: [activeLayout] }] } : { slideMasters: [activeMaster] };
|
|
8600
|
-
return
|
|
8622
|
+
return chunk4SPZ5IZN_js.masterViewPseudoSlide(document2, {
|
|
8601
8623
|
tab: "slides",
|
|
8602
8624
|
masterIndex: 0,
|
|
8603
8625
|
layoutIndex: activeLayout ? 0 : null
|
|
@@ -8625,15 +8647,15 @@ function useDerivedSlideState(input) {
|
|
|
8625
8647
|
[slides, activeCustomShowId, customShows, presentationProperties]
|
|
8626
8648
|
);
|
|
8627
8649
|
const authoredRange = react.useMemo(
|
|
8628
|
-
() =>
|
|
8650
|
+
() => chunk4SPZ5IZN_js.resolveAuthoredSlideRange(presentationProperties, slides.length),
|
|
8629
8651
|
[presentationProperties, slides.length]
|
|
8630
8652
|
);
|
|
8631
8653
|
const slideSectionGroups = react.useMemo(
|
|
8632
8654
|
() => computeSlideSectionGroups(slides, sections).map((group) => {
|
|
8633
|
-
if (group.id ===
|
|
8655
|
+
if (group.id === chunkNJ3WCYYG_js.UNGROUPED_SECTION_ID && group.label === "Ungrouped Slides") {
|
|
8634
8656
|
return { ...group, label: t("pptx.slides.ungroupedSlides") };
|
|
8635
8657
|
}
|
|
8636
|
-
if (group.id ===
|
|
8658
|
+
if (group.id === chunkNJ3WCYYG_js.DEFAULT_SECTION_GROUP_ID && group.label === "Slides") {
|
|
8637
8659
|
return { ...group, label: t("pptx.sections.slides") };
|
|
8638
8660
|
}
|
|
8639
8661
|
return group;
|
|
@@ -8734,13 +8756,13 @@ function useAnnotationHandlers(input) {
|
|
|
8734
8756
|
}, [annotations, setMode, setSlides, history]);
|
|
8735
8757
|
const handleSetMode = react.useCallback(
|
|
8736
8758
|
(nextMode) => {
|
|
8737
|
-
if (mode === "present" && nextMode !== "present" && !
|
|
8759
|
+
if (mode === "present" && nextMode !== "present" && !chunk4SPZ5IZN_js.mayLeaveSlideShow()) {
|
|
8738
8760
|
return;
|
|
8739
8761
|
}
|
|
8740
8762
|
if (nextMode === "present") {
|
|
8741
8763
|
presentation.enterPresentMode();
|
|
8742
8764
|
} else if (mode === "present" && annotations.hasAnyAnnotations) {
|
|
8743
|
-
|
|
8765
|
+
chunk4SPZ5IZN_js.stopAllPersistentAudio();
|
|
8744
8766
|
if (promptKeepInkAnnotations) {
|
|
8745
8767
|
pendingModeAfterAnnotationsRef.current = nextMode;
|
|
8746
8768
|
setShowKeepAnnotationsDialog(true);
|
|
@@ -8750,7 +8772,7 @@ function useAnnotationHandlers(input) {
|
|
|
8750
8772
|
}
|
|
8751
8773
|
} else {
|
|
8752
8774
|
if (mode === "present") {
|
|
8753
|
-
|
|
8775
|
+
chunk4SPZ5IZN_js.stopAllPersistentAudio();
|
|
8754
8776
|
}
|
|
8755
8777
|
setMode(nextMode);
|
|
8756
8778
|
}
|
|
@@ -8819,13 +8841,13 @@ function useSerialize(input) {
|
|
|
8819
8841
|
let processedSlide = slide;
|
|
8820
8842
|
if (pendingEditId) {
|
|
8821
8843
|
const updatedElements = slide.elements.map((el) => {
|
|
8822
|
-
if (el.id !== pendingEditId || !
|
|
8844
|
+
if (el.id !== pendingEditId || !chunk4SPZ5IZN_js.hasTextProperties(el)) {
|
|
8823
8845
|
return el;
|
|
8824
8846
|
}
|
|
8825
8847
|
return {
|
|
8826
8848
|
...el,
|
|
8827
8849
|
text: pendingEditText,
|
|
8828
|
-
textSegments:
|
|
8850
|
+
textSegments: chunk4SPZ5IZN_js.remapTextToSegments(pendingEditText, el.textSegments, el.textStyle)
|
|
8829
8851
|
};
|
|
8830
8852
|
});
|
|
8831
8853
|
if (updatedElements.some((el, i) => el !== slide.elements[i])) {
|
|
@@ -8838,19 +8860,19 @@ function useSerialize(input) {
|
|
|
8838
8860
|
const pptxGuides = guides.map((g) => ({
|
|
8839
8861
|
id: g.id,
|
|
8840
8862
|
orientation: g.axis === "h" ? "horz" : "vert",
|
|
8841
|
-
positionEmu:
|
|
8863
|
+
positionEmu: chunk4SPZ5IZN_js.guidePxToEmu(g.position)
|
|
8842
8864
|
}));
|
|
8843
8865
|
return {
|
|
8844
8866
|
...processedSlide,
|
|
8845
8867
|
guides: pptxGuides.length > 0 ? pptxGuides : void 0
|
|
8846
8868
|
};
|
|
8847
8869
|
});
|
|
8848
|
-
const slidesToSave =
|
|
8849
|
-
const saveOptions =
|
|
8870
|
+
const slidesToSave = chunk4SPZ5IZN_js.buildSaveSlides(slidesWithGuides, templateElementsBySlideId);
|
|
8871
|
+
const saveOptions = chunk4SPZ5IZN_js.buildDeckSaveOptions({
|
|
8850
8872
|
// Without this the Slide Size card edited a viewer-only pixel value and
|
|
8851
8873
|
// the saved `p:sldSz` never moved: passing `slideSize` is the only way a
|
|
8852
8874
|
// slide-size edit reaches the file.
|
|
8853
|
-
slideSize:
|
|
8875
|
+
slideSize: chunk4SPZ5IZN_js.resolveSlideSizeSelection({ current: slideSizeEmu, canvas: canvasSize }).size,
|
|
8854
8876
|
headerFooter,
|
|
8855
8877
|
presentationProperties,
|
|
8856
8878
|
viewProperties,
|
|
@@ -8869,7 +8891,7 @@ function useSerialize(input) {
|
|
|
8869
8891
|
embedFonts,
|
|
8870
8892
|
outputFormat: format
|
|
8871
8893
|
});
|
|
8872
|
-
return
|
|
8894
|
+
return chunk4SPZ5IZN_js.saveDeckWithPassword(handler, slidesToSave, saveOptions, { password, purpose });
|
|
8873
8895
|
},
|
|
8874
8896
|
[
|
|
8875
8897
|
slides,
|
|
@@ -8910,7 +8932,7 @@ function useRecoveryDetection(input) {
|
|
|
8910
8932
|
const onRestore = input.onRestore;
|
|
8911
8933
|
const openVersionHistory = input.openVersionHistory;
|
|
8912
8934
|
react.useEffect(() => {
|
|
8913
|
-
if (!
|
|
8935
|
+
if (!chunk4SPZ5IZN_js.shouldProbeAutosaveRecovery({
|
|
8914
8936
|
alreadyChecked: recoveryCheckedRef.current,
|
|
8915
8937
|
filePath,
|
|
8916
8938
|
loading,
|
|
@@ -8922,7 +8944,7 @@ function useRecoveryDetection(input) {
|
|
|
8922
8944
|
}
|
|
8923
8945
|
recoveryCheckedRef.current = true;
|
|
8924
8946
|
void (async () => {
|
|
8925
|
-
const offer = await
|
|
8947
|
+
const offer = await chunk4SPZ5IZN_js.probeAutosaveRecovery(filePath);
|
|
8926
8948
|
if (!offer) {
|
|
8927
8949
|
return;
|
|
8928
8950
|
}
|
|
@@ -8935,7 +8957,7 @@ function useRecoveryDetection(input) {
|
|
|
8935
8957
|
const record = recordRef.current;
|
|
8936
8958
|
setPrompt(null);
|
|
8937
8959
|
if (record && onRestore) {
|
|
8938
|
-
onRestore(
|
|
8960
|
+
onRestore(chunk4SPZ5IZN_js.acceptAutosaveRecovery(record));
|
|
8939
8961
|
}
|
|
8940
8962
|
recordRef.current = null;
|
|
8941
8963
|
}, [onRestore]);
|
|
@@ -8944,7 +8966,7 @@ function useRecoveryDetection(input) {
|
|
|
8944
8966
|
setPrompt(null);
|
|
8945
8967
|
recordRef.current = null;
|
|
8946
8968
|
if (record) {
|
|
8947
|
-
void
|
|
8969
|
+
void chunk4SPZ5IZN_js.discardAutosaveRecovery(record);
|
|
8948
8970
|
}
|
|
8949
8971
|
}, []);
|
|
8950
8972
|
return { prompt, restore, discard };
|
|
@@ -8995,11 +9017,11 @@ function usePresentationSetup(input) {
|
|
|
8995
9017
|
containerRef,
|
|
8996
9018
|
content,
|
|
8997
9019
|
onSetMode: (nextMode) => {
|
|
8998
|
-
if (mode === "present" && nextMode !== "present" && !
|
|
9020
|
+
if (mode === "present" && nextMode !== "present" && !chunk4SPZ5IZN_js.mayLeaveSlideShow()) {
|
|
8999
9021
|
return;
|
|
9000
9022
|
}
|
|
9001
9023
|
if (mode === "present" && nextMode !== "present") {
|
|
9002
|
-
|
|
9024
|
+
chunk4SPZ5IZN_js.stopAllPersistentAudio();
|
|
9003
9025
|
stopAnimationSound();
|
|
9004
9026
|
const exitHandler = exitModeHandlerRef.current;
|
|
9005
9027
|
if (exitHandler) {
|
|
@@ -9067,10 +9089,10 @@ function usePresentationSetup(input) {
|
|
|
9067
9089
|
onToggleToolbar: () => annotations.setToolbarVisible(!annotations.toolbarVisible),
|
|
9068
9090
|
onToggleSubtitles,
|
|
9069
9091
|
onSaveRehearsalTimings: (timings) => {
|
|
9070
|
-
setSlides((prev) =>
|
|
9092
|
+
setSlides((prev) => chunk4SPZ5IZN_js.applyRehearsalTimings(prev, timings));
|
|
9071
9093
|
history.markDirty();
|
|
9072
9094
|
},
|
|
9073
|
-
loopContinuously:
|
|
9095
|
+
loopContinuously: chunk4SPZ5IZN_js.shouldLoopContinuously(presentationProperties),
|
|
9074
9096
|
showWithAnimation: presentationProperties.showWithAnimation,
|
|
9075
9097
|
useTimings: presentationProperties.advanceMode !== "manual",
|
|
9076
9098
|
endWithBlackSlide,
|
|
@@ -9277,7 +9299,7 @@ function useEditorOperations(input) {
|
|
|
9277
9299
|
const { formatPainterActive, setFormatPainterActive, elementLookup } = state;
|
|
9278
9300
|
react.useEffect(() => {
|
|
9279
9301
|
if (formatPainterActive && !prevFormatPainterRef.current && selectedElement) {
|
|
9280
|
-
copiedFormatRef.current =
|
|
9302
|
+
copiedFormatRef.current = chunk4SPZ5IZN_js.copyFormatFromElement(selectedElement);
|
|
9281
9303
|
} else if (!formatPainterActive) {
|
|
9282
9304
|
copiedFormatRef.current = null;
|
|
9283
9305
|
}
|
|
@@ -9303,12 +9325,12 @@ function useEditorOperations(input) {
|
|
|
9303
9325
|
e.stopPropagation();
|
|
9304
9326
|
const element = elementLookup.get(elementId);
|
|
9305
9327
|
if (element) {
|
|
9306
|
-
const updated =
|
|
9328
|
+
const updated = chunk4SPZ5IZN_js.applyFormatToElement(element, copiedFormatRef.current);
|
|
9307
9329
|
const updates = {};
|
|
9308
|
-
if (
|
|
9330
|
+
if (chunk4SPZ5IZN_js.hasShapeProperties(updated)) {
|
|
9309
9331
|
updates.shapeStyle = updated.shapeStyle;
|
|
9310
9332
|
}
|
|
9311
|
-
if (
|
|
9333
|
+
if (chunk4SPZ5IZN_js.hasTextProperties(updated)) {
|
|
9312
9334
|
updates.textStyle = updated.textStyle;
|
|
9313
9335
|
}
|
|
9314
9336
|
ops.updateElementById(elementId, updates);
|
|
@@ -9494,10 +9516,10 @@ function useFontInjection({ embeddedFonts, slides }) {
|
|
|
9494
9516
|
}
|
|
9495
9517
|
};
|
|
9496
9518
|
}, [embeddedFonts]);
|
|
9497
|
-
const referencedFamilies = react.useMemo(() =>
|
|
9519
|
+
const referencedFamilies = react.useMemo(() => chunk4SPZ5IZN_js.collectReferencedFontFamilies(slides), [slides]);
|
|
9498
9520
|
react.useEffect(() => {
|
|
9499
9521
|
let cancelled = false;
|
|
9500
|
-
void
|
|
9522
|
+
void chunk4SPZ5IZN_js.resolveGoogleWebfontHref(slides, embeddedFonts).then((href) => {
|
|
9501
9523
|
if (cancelled) {
|
|
9502
9524
|
return null;
|
|
9503
9525
|
}
|
|
@@ -9522,15 +9544,15 @@ function useFontInjection({ embeddedFonts, slides }) {
|
|
|
9522
9544
|
const [, setOutlineFontsTick] = react.useState(0);
|
|
9523
9545
|
react.useEffect(() => {
|
|
9524
9546
|
let cancelled = false;
|
|
9525
|
-
const referenced =
|
|
9526
|
-
const candidates =
|
|
9547
|
+
const referenced = chunk4SPZ5IZN_js.collectReferencedFontFamilies(slides);
|
|
9548
|
+
const candidates = chunk4SPZ5IZN_js.selectGoogleWebfontFamilies(
|
|
9527
9549
|
referenced,
|
|
9528
9550
|
embeddedFonts.map((font) => font.name)
|
|
9529
9551
|
);
|
|
9530
9552
|
if (candidates.length === 0) {
|
|
9531
9553
|
return;
|
|
9532
9554
|
}
|
|
9533
|
-
void
|
|
9555
|
+
void chunk4SPZ5IZN_js.resolveGoogleWebfontHref(slides, embeddedFonts).then(async (href) => {
|
|
9534
9556
|
if (cancelled || !href) {
|
|
9535
9557
|
return;
|
|
9536
9558
|
}
|
|
@@ -9544,7 +9566,7 @@ function useFontInjection({ embeddedFonts, slides }) {
|
|
|
9544
9566
|
if (cancelled) {
|
|
9545
9567
|
return;
|
|
9546
9568
|
}
|
|
9547
|
-
const bytes = await
|
|
9569
|
+
const bytes = await chunk4SPZ5IZN_js.fetchGoogleWebfontOutlineBytes(
|
|
9548
9570
|
href,
|
|
9549
9571
|
family,
|
|
9550
9572
|
variant.bold,
|
|
@@ -9733,7 +9755,7 @@ function useKeyboardShortcuts(input) {
|
|
|
9733
9755
|
inputRef.current = input;
|
|
9734
9756
|
const handleKeyDown = react.useCallback((e) => {
|
|
9735
9757
|
const current = inputRef.current;
|
|
9736
|
-
const startAction =
|
|
9758
|
+
const startAction = chunk4SPZ5IZN_js.mapSlideShowStartKey(e, { isPresenting: current.mode === "present" });
|
|
9737
9759
|
if (startAction !== null) {
|
|
9738
9760
|
e.preventDefault();
|
|
9739
9761
|
if (startAction === "fromBeginning") {
|
|
@@ -9743,8 +9765,9 @@ function useKeyboardShortcuts(input) {
|
|
|
9743
9765
|
}
|
|
9744
9766
|
return;
|
|
9745
9767
|
}
|
|
9746
|
-
const { action, dx, dy } =
|
|
9768
|
+
const { action, dx, dy } = chunk4SPZ5IZN_js.mapEditorKey(e, {
|
|
9747
9769
|
canEdit: current.canEdit,
|
|
9770
|
+
canPaste: current.canPaste,
|
|
9748
9771
|
// The Slide Master view is an editing surface, not a viewing one.
|
|
9749
9772
|
// Gating on `mode !== 'edit'` alone made `mapEditorKey` return
|
|
9750
9773
|
// NO_ACTION there, so Delete, the arrow-key nudges and the clipboard
|
|
@@ -9756,7 +9779,7 @@ function useKeyboardShortcuts(input) {
|
|
|
9756
9779
|
hasSelection: current.hasSelection,
|
|
9757
9780
|
isEditingText: Boolean(current.inlineEditingElementId || current.tableEditorState?.isEditing),
|
|
9758
9781
|
isDrawing: current.activeTool !== "select",
|
|
9759
|
-
isTextInputTarget:
|
|
9782
|
+
isTextInputTarget: chunk4SPZ5IZN_js.isEditorTextInputTarget(e.target)
|
|
9760
9783
|
});
|
|
9761
9784
|
if (action === null) {
|
|
9762
9785
|
return;
|
|
@@ -9840,6 +9863,7 @@ function useKeyboardShortcutWiring(input) {
|
|
|
9840
9863
|
mode,
|
|
9841
9864
|
canEdit,
|
|
9842
9865
|
inlineEditingElementId: state.inlineEditingElementId,
|
|
9866
|
+
canPaste: Boolean(state.clipboardPayload && activeSlide),
|
|
9843
9867
|
tableEditorState: state.tableEditorState,
|
|
9844
9868
|
activeTool: state.activeTool,
|
|
9845
9869
|
hasSelection: state.effectiveSelectedIds.length > 0,
|
|
@@ -9930,6 +9954,7 @@ function useViewerIntegration(input) {
|
|
|
9930
9954
|
setModifyVerifier,
|
|
9931
9955
|
setCompatToasts,
|
|
9932
9956
|
canEdit,
|
|
9957
|
+
canInsertElement = true,
|
|
9933
9958
|
promptKeepInkAnnotations,
|
|
9934
9959
|
imageExportScale,
|
|
9935
9960
|
imageResolutionScale,
|
|
@@ -10088,7 +10113,7 @@ function useViewerIntegration(input) {
|
|
|
10088
10113
|
return zoom.scale;
|
|
10089
10114
|
},
|
|
10090
10115
|
setZoom(level) {
|
|
10091
|
-
zoom.setScale(
|
|
10116
|
+
zoom.setScale(chunk4SPZ5IZN_js.clampZoomScale(level));
|
|
10092
10117
|
},
|
|
10093
10118
|
zoomIn() {
|
|
10094
10119
|
zoom.handleZoomIn();
|
|
@@ -10173,6 +10198,21 @@ function useViewerIntegration(input) {
|
|
|
10173
10198
|
return s?.elements.find((e) => e.id === elementId);
|
|
10174
10199
|
},
|
|
10175
10200
|
// -- Element manipulation --
|
|
10201
|
+
addElement(element) {
|
|
10202
|
+
const inserted = chunk4SPZ5IZN_js.prepareElementForInsertion(element, {
|
|
10203
|
+
canEdit: canEdit && canInsertElement,
|
|
10204
|
+
mode,
|
|
10205
|
+
hasActiveSlide: !loading && !error && Boolean(activeSlide),
|
|
10206
|
+
editTemplateMode: state.editTemplateMode
|
|
10207
|
+
});
|
|
10208
|
+
if (!inserted) {
|
|
10209
|
+
return void 0;
|
|
10210
|
+
}
|
|
10211
|
+
editorOps.canvasHandlers.handleInlineEditCommit();
|
|
10212
|
+
editorOps.insertHandlers.addElement(inserted);
|
|
10213
|
+
editorOps.ops.applySelection(inserted.id, [inserted.id]);
|
|
10214
|
+
return inserted.id;
|
|
10215
|
+
},
|
|
10176
10216
|
updateElement(elementId, updates) {
|
|
10177
10217
|
editorOps.ops.updateElementById(elementId, updates);
|
|
10178
10218
|
},
|
|
@@ -10193,6 +10233,11 @@ function useViewerIntegration(input) {
|
|
|
10193
10233
|
onContentChange,
|
|
10194
10234
|
slides,
|
|
10195
10235
|
activeSlideIndex,
|
|
10236
|
+
activeSlide,
|
|
10237
|
+
canEdit,
|
|
10238
|
+
canInsertElement,
|
|
10239
|
+
loading,
|
|
10240
|
+
error,
|
|
10196
10241
|
state,
|
|
10197
10242
|
history,
|
|
10198
10243
|
zoom,
|
|
@@ -10310,7 +10355,7 @@ function useReducedMotion() {
|
|
|
10310
10355
|
}
|
|
10311
10356
|
function useViewerOptions() {
|
|
10312
10357
|
const storeRef = react.useRef(null);
|
|
10313
|
-
storeRef.current ??=
|
|
10358
|
+
storeRef.current ??= chunk4SPZ5IZN_js.createViewerOptionsStore();
|
|
10314
10359
|
const store = storeRef.current;
|
|
10315
10360
|
const options = react.useSyncExternalStore(
|
|
10316
10361
|
(onStoreChange) => store.subscribe(onStoreChange),
|
|
@@ -10319,9 +10364,9 @@ function useViewerOptions() {
|
|
|
10319
10364
|
);
|
|
10320
10365
|
return { optionsStore: store, options };
|
|
10321
10366
|
}
|
|
10322
|
-
var KNOWN_TAB_IDS = new Set(
|
|
10367
|
+
var KNOWN_TAB_IDS = new Set(chunk4SPZ5IZN_js.TOOLBAR_TABS.map((tab) => tab.id));
|
|
10323
10368
|
function computeToolbarVisibility(hiddenActions, hiddenTabIds = []) {
|
|
10324
|
-
const isHidden = (id) =>
|
|
10369
|
+
const isHidden = (id) => chunk4SPZ5IZN_js.isActionHidden(id, hiddenActions);
|
|
10325
10370
|
const userHidden = new Set(hiddenTabIds);
|
|
10326
10371
|
userHidden.delete("file");
|
|
10327
10372
|
const isTabVisible = (id) => !KNOWN_TAB_IDS.has(id) || !isHidden(id) && !userHidden.has(id);
|
|
@@ -10414,12 +10459,12 @@ function useYjsDocumentSync({
|
|
|
10414
10459
|
return;
|
|
10415
10460
|
}
|
|
10416
10461
|
try {
|
|
10417
|
-
const handler = new
|
|
10462
|
+
const handler = new chunk4SPZ5IZN_js.PptxHandler();
|
|
10418
10463
|
await handler.load(sourceBytes.buffer);
|
|
10419
|
-
const currentSlides =
|
|
10464
|
+
const currentSlides = chunk4SPZ5IZN_js.readSlidesFromYDoc(
|
|
10420
10465
|
doc
|
|
10421
10466
|
);
|
|
10422
|
-
const slidesToSave =
|
|
10467
|
+
const slidesToSave = chunk4SPZ5IZN_js.buildSaveSlides(currentSlides, templateElementsBySlideId);
|
|
10423
10468
|
const bytes = await handler.save(slidesToSave, getSaveOptions?.());
|
|
10424
10469
|
config.onWriteBack(bytes);
|
|
10425
10470
|
} catch {
|
|
@@ -10434,10 +10479,10 @@ function useYjsDocumentSync({
|
|
|
10434
10479
|
if (!doc || !isConnected) {
|
|
10435
10480
|
return;
|
|
10436
10481
|
}
|
|
10437
|
-
const docSlides =
|
|
10482
|
+
const docSlides = chunk4SPZ5IZN_js.readSlidesFromYDoc(
|
|
10438
10483
|
doc
|
|
10439
10484
|
);
|
|
10440
|
-
if (!
|
|
10485
|
+
if (!chunk4SPZ5IZN_js.shouldRoomSlidesReplaceLoad(loadOrigin, docSlides.length)) {
|
|
10441
10486
|
return;
|
|
10442
10487
|
}
|
|
10443
10488
|
lastSyncedRef.current = JSON.stringify(docSlides);
|
|
@@ -10456,11 +10501,11 @@ function useYjsDocumentSync({
|
|
|
10456
10501
|
lastSyncedRef.current = serialized;
|
|
10457
10502
|
void (async () => {
|
|
10458
10503
|
const factories = await getFactories();
|
|
10459
|
-
|
|
10504
|
+
chunk4SPZ5IZN_js.reconcileSlidesInYDoc(
|
|
10460
10505
|
slides,
|
|
10461
10506
|
doc,
|
|
10462
10507
|
factories,
|
|
10463
|
-
|
|
10508
|
+
chunk4SPZ5IZN_js.LOCAL_SYNC_ORIGIN
|
|
10464
10509
|
);
|
|
10465
10510
|
scheduleWriteBack();
|
|
10466
10511
|
})();
|
|
@@ -10474,10 +10519,10 @@ function useYjsDocumentSync({
|
|
|
10474
10519
|
return;
|
|
10475
10520
|
}
|
|
10476
10521
|
const handleChange = (_events, transaction) => {
|
|
10477
|
-
if (transaction?.origin ===
|
|
10522
|
+
if (transaction?.origin === chunk4SPZ5IZN_js.LOCAL_SYNC_ORIGIN) {
|
|
10478
10523
|
return;
|
|
10479
10524
|
}
|
|
10480
|
-
const remoteSlides =
|
|
10525
|
+
const remoteSlides = chunk4SPZ5IZN_js.readSlidesFromYDoc(
|
|
10481
10526
|
doc
|
|
10482
10527
|
);
|
|
10483
10528
|
if (remoteSlides.length === 0) {
|
|
@@ -10493,7 +10538,7 @@ function useYjsDocumentSync({
|
|
|
10493
10538
|
isApplyingRemoteRef.current = false;
|
|
10494
10539
|
scheduleWriteBack();
|
|
10495
10540
|
};
|
|
10496
|
-
const unobserve =
|
|
10541
|
+
const unobserve = chunk4SPZ5IZN_js.observeYDocSlides(
|
|
10497
10542
|
doc,
|
|
10498
10543
|
handleChange
|
|
10499
10544
|
);
|
|
@@ -10531,7 +10576,7 @@ function useBroadcastFollower({
|
|
|
10531
10576
|
if (!broadcaster) {
|
|
10532
10577
|
return;
|
|
10533
10578
|
}
|
|
10534
|
-
if (!
|
|
10579
|
+
if (!chunk4SPZ5IZN_js.shouldAutoFollowBroadcaster({
|
|
10535
10580
|
localRole: collab.config.role,
|
|
10536
10581
|
broadcasterRole: broadcaster.role
|
|
10537
10582
|
})) {
|
|
@@ -10689,7 +10734,7 @@ function useLayoutSwitching(input) {
|
|
|
10689
10734
|
currentLayoutPath
|
|
10690
10735
|
};
|
|
10691
10736
|
}
|
|
10692
|
-
var MIN_TOUCH_TARGET =
|
|
10737
|
+
var MIN_TOUCH_TARGET = chunk4SPZ5IZN_js.MIN_TOUCH_TARGET_PX;
|
|
10693
10738
|
function subscribeTouchCapability(callback) {
|
|
10694
10739
|
if (typeof window === "undefined") {
|
|
10695
10740
|
return () => {
|
|
@@ -10702,7 +10747,7 @@ function subscribeTouchCapability(callback) {
|
|
|
10702
10747
|
function useIsMobile() {
|
|
10703
10748
|
const isTouchDevice = react.useSyncExternalStore(
|
|
10704
10749
|
subscribeTouchCapability,
|
|
10705
|
-
|
|
10750
|
+
chunk4SPZ5IZN_js.detectTouchDevice,
|
|
10706
10751
|
() => false
|
|
10707
10752
|
// server snapshot
|
|
10708
10753
|
);
|
|
@@ -10712,7 +10757,7 @@ function useIsMobile() {
|
|
|
10712
10757
|
const [viewportHeight, setViewportHeight] = react.useState(
|
|
10713
10758
|
() => typeof window === "undefined" ? 768 : window.innerHeight
|
|
10714
10759
|
);
|
|
10715
|
-
const [orientation, setOrientation] = react.useState(
|
|
10760
|
+
const [orientation, setOrientation] = react.useState(chunk4SPZ5IZN_js.detectOrientation);
|
|
10716
10761
|
const [isVirtualKeyboardOpen, setIsVirtualKeyboardOpen] = react.useState(false);
|
|
10717
10762
|
const [initialViewportHeight] = react.useState(
|
|
10718
10763
|
() => typeof window !== "undefined" ? window.innerHeight : 800
|
|
@@ -10733,7 +10778,7 @@ function useIsMobile() {
|
|
|
10733
10778
|
return;
|
|
10734
10779
|
}
|
|
10735
10780
|
const handleOrientationChange = () => {
|
|
10736
|
-
setOrientation(
|
|
10781
|
+
setOrientation(chunk4SPZ5IZN_js.detectOrientation());
|
|
10737
10782
|
};
|
|
10738
10783
|
if (screen.orientation) {
|
|
10739
10784
|
screen.orientation.addEventListener("change", handleOrientationChange);
|
|
@@ -10763,7 +10808,7 @@ function useIsMobile() {
|
|
|
10763
10808
|
window.addEventListener("resize", handleResize);
|
|
10764
10809
|
return () => window.removeEventListener("resize", handleResize);
|
|
10765
10810
|
}, [isTouchDevice, initialViewportHeight]);
|
|
10766
|
-
const { isMobile, isTablet, isDesktop } =
|
|
10811
|
+
const { isMobile, isTablet, isDesktop } = chunk4SPZ5IZN_js.deriveViewportBreakpoints(
|
|
10767
10812
|
viewportWidth,
|
|
10768
10813
|
viewportHeight,
|
|
10769
10814
|
isTouchDevice
|
|
@@ -10796,10 +10841,10 @@ function useTouchGestures(input) {
|
|
|
10796
10841
|
if (!el || !enabled) {
|
|
10797
10842
|
return;
|
|
10798
10843
|
}
|
|
10799
|
-
const recognizer =
|
|
10844
|
+
const recognizer = chunk4SPZ5IZN_js.createTouchGestureRecognizer({
|
|
10800
10845
|
getScale: () => scaleRef.current,
|
|
10801
|
-
minScale:
|
|
10802
|
-
maxScale:
|
|
10846
|
+
minScale: chunk4SPZ5IZN_js.MIN_ZOOM_SCALE,
|
|
10847
|
+
maxScale: chunk4SPZ5IZN_js.MAX_ZOOM_SCALE,
|
|
10803
10848
|
callbacks: {
|
|
10804
10849
|
onPinchZoom: (newScale) => callbacksRef.current.onPinchZoom?.(newScale),
|
|
10805
10850
|
onSwipe: (direction) => callbacksRef.current.onSwipe?.(direction),
|
|
@@ -10839,7 +10884,7 @@ function scrollFocusedIntoView(keyboardInset) {
|
|
|
10839
10884
|
return;
|
|
10840
10885
|
}
|
|
10841
10886
|
const rect = active.getBoundingClientRect();
|
|
10842
|
-
const delta =
|
|
10887
|
+
const delta = chunk4SPZ5IZN_js.computeScrollDelta(
|
|
10843
10888
|
{ top: rect.top, bottom: rect.bottom },
|
|
10844
10889
|
window.innerHeight,
|
|
10845
10890
|
keyboardInset
|
|
@@ -10859,8 +10904,8 @@ function useKeyboardInsets(enabled = true) {
|
|
|
10859
10904
|
return;
|
|
10860
10905
|
}
|
|
10861
10906
|
const update = () => {
|
|
10862
|
-
const metrics =
|
|
10863
|
-
const inset = metrics ?
|
|
10907
|
+
const metrics = chunk4SPZ5IZN_js.readViewportMetrics(window);
|
|
10908
|
+
const inset = metrics ? chunk4SPZ5IZN_js.computeKeyboardInset(metrics) : 0;
|
|
10864
10909
|
setKeyboardInset(inset);
|
|
10865
10910
|
if (inset > 0) {
|
|
10866
10911
|
window.requestAnimationFrame(() => scrollFocusedIntoView(inset));
|
|
@@ -10871,8 +10916,8 @@ function useKeyboardInsets(enabled = true) {
|
|
|
10871
10916
|
vv.addEventListener("scroll", update);
|
|
10872
10917
|
const onFocusIn = () => {
|
|
10873
10918
|
window.requestAnimationFrame(() => {
|
|
10874
|
-
const metrics =
|
|
10875
|
-
const inset = metrics ?
|
|
10919
|
+
const metrics = chunk4SPZ5IZN_js.readViewportMetrics(window);
|
|
10920
|
+
const inset = metrics ? chunk4SPZ5IZN_js.computeKeyboardInset(metrics) : 0;
|
|
10876
10921
|
if (inset > 0) {
|
|
10877
10922
|
scrollFocusedIntoView(inset);
|
|
10878
10923
|
}
|
|
@@ -10885,7 +10930,7 @@ function useKeyboardInsets(enabled = true) {
|
|
|
10885
10930
|
document.removeEventListener("focusin", onFocusIn);
|
|
10886
10931
|
};
|
|
10887
10932
|
}, [enabled]);
|
|
10888
|
-
return { keyboardInset, isKeyboardOpen:
|
|
10933
|
+
return { keyboardInset, isKeyboardOpen: chunk4SPZ5IZN_js.isKeyboardOpen(keyboardInset) };
|
|
10889
10934
|
}
|
|
10890
10935
|
|
|
10891
10936
|
// src/viewer/hooks/useViewerBuildingBlocks-canvas-props.ts
|
|
@@ -10914,21 +10959,21 @@ function buildCanvasProps(input) {
|
|
|
10914
10959
|
} = input;
|
|
10915
10960
|
const effectiveSlide = mode === "master" ? masterPseudoSlide : activeSlide;
|
|
10916
10961
|
const effectiveTemplateElements = mode === "master" ? s.activeLayout ? s.activeMaster?.elements ?? [] : [] : templateElements;
|
|
10917
|
-
const fieldContext =
|
|
10962
|
+
const fieldContext = chunk4SPZ5IZN_js.buildFieldSubstitutionContext({
|
|
10918
10963
|
headerFooter: s.headerFooter,
|
|
10919
10964
|
customProperties: s.customProperties,
|
|
10920
10965
|
slide: activeSlide
|
|
10921
10966
|
});
|
|
10922
10967
|
const tableStyleContext = s.theme || s.tableStyleMap ? { theme: s.theme, tableStyleMap: s.tableStyleMap } : void 0;
|
|
10923
10968
|
const openExternalUrl = (url, target) => {
|
|
10924
|
-
if (
|
|
10969
|
+
if (chunk4SPZ5IZN_js.shouldConfirmExternalHyperlink(viewerOptions, url) && !window.confirm(buildHyperlinkConfirmMessage(url))) {
|
|
10925
10970
|
return;
|
|
10926
10971
|
}
|
|
10927
|
-
|
|
10972
|
+
chunk4SPZ5IZN_js.safeOpenUrl(url, target);
|
|
10928
10973
|
};
|
|
10929
10974
|
const handleActionClick = (elementId, action) => {
|
|
10930
10975
|
if (mode === "present") {
|
|
10931
|
-
const resolved =
|
|
10976
|
+
const resolved = chunk4SPZ5IZN_js.resolvePresentationAction(action, { slideCount: slides.length });
|
|
10932
10977
|
if (resolved.intent.kind === "openUrl") {
|
|
10933
10978
|
openExternalUrl(resolved.intent.url);
|
|
10934
10979
|
return;
|
|
@@ -10939,9 +10984,9 @@ function buildCanvasProps(input) {
|
|
|
10939
10984
|
}
|
|
10940
10985
|
};
|
|
10941
10986
|
const handleHyperlinkClick = (url, target) => {
|
|
10942
|
-
if (
|
|
10987
|
+
if (chunk4SPZ5IZN_js.isPpactionUrl(url)) {
|
|
10943
10988
|
if (mode === "present") {
|
|
10944
|
-
const parsed =
|
|
10989
|
+
const parsed = chunk4SPZ5IZN_js.parsePpactionUrl(url);
|
|
10945
10990
|
if (parsed) {
|
|
10946
10991
|
presentation.handlePresentationAction({
|
|
10947
10992
|
action: parsed.action,
|
|
@@ -11047,7 +11092,7 @@ function buildCanvasProps(input) {
|
|
|
11047
11092
|
|
|
11048
11093
|
// src/viewer/hooks/useScopedLayoutOptions.ts
|
|
11049
11094
|
function scopeLayoutOptionsToActiveSlide(options, activeSlide) {
|
|
11050
|
-
return
|
|
11095
|
+
return chunk4SPZ5IZN_js.scopeLayoutOptionsToSlide(options, activeSlide?.layoutPath);
|
|
11051
11096
|
}
|
|
11052
11097
|
|
|
11053
11098
|
// src/viewer/hooks/useViewerBuildingBlocks-toolbar-handlers.ts
|
|
@@ -11060,7 +11105,7 @@ function buildToolbarAnimationHandlers(input) {
|
|
|
11060
11105
|
const current = activeSlide.animations ?? [];
|
|
11061
11106
|
if (group === "motionPath") {
|
|
11062
11107
|
propertyHandlers.handleUpdateSlide({
|
|
11063
|
-
animations:
|
|
11108
|
+
animations: chunk4SPZ5IZN_js.applyMotionPathPreset(current, selectedElement.id, preset)
|
|
11064
11109
|
});
|
|
11065
11110
|
return;
|
|
11066
11111
|
}
|
|
@@ -11256,7 +11301,7 @@ function buildToolbarProps(input) {
|
|
|
11256
11301
|
onOpenFile,
|
|
11257
11302
|
onOpenRecentFile,
|
|
11258
11303
|
onCreatePresentation: (templateId) => {
|
|
11259
|
-
s.setSlides(
|
|
11304
|
+
s.setSlides(chunk4SPZ5IZN_js.createBackstagePresentation(templateId));
|
|
11260
11305
|
s.setActiveSlideIndex(0);
|
|
11261
11306
|
s.setSelectedElementId(null);
|
|
11262
11307
|
s.setSelectedElementIds([]);
|
|
@@ -11286,7 +11331,7 @@ function buildToolbarProps(input) {
|
|
|
11286
11331
|
loadLayoutPreviews: input.loadLayoutPreviews,
|
|
11287
11332
|
onInsertSlideFromLayout: slideOps.handleInsertSlideFromLayout,
|
|
11288
11333
|
onInsertSlideFromTemplate: slideOps.handleInsertSlideFromTemplate,
|
|
11289
|
-
templateScheme:
|
|
11334
|
+
templateScheme: chunk4SPZ5IZN_js.templateSchemeFromTheme(s.theme?.colorScheme),
|
|
11290
11335
|
customShows: s.customShows,
|
|
11291
11336
|
activeCustomShowId: s.activeCustomShowId,
|
|
11292
11337
|
onSetActiveCustomShowId: s.setActiveCustomShowId,
|
|
@@ -11327,7 +11372,7 @@ function buildToolbarProps(input) {
|
|
|
11327
11372
|
isCommentsPanelOpen: s.isInspectorPaneOpen,
|
|
11328
11373
|
slideCommentCount: activeSlide?.comments?.length ?? 0,
|
|
11329
11374
|
formatPainterActive: s.formatPainterActive,
|
|
11330
|
-
canActivateFormatPainter:
|
|
11375
|
+
canActivateFormatPainter: chunk4SPZ5IZN_js.hasCopyableFormat(selectedElement),
|
|
11331
11376
|
onToggleFormatPainter: () => s.setFormatPainterActive((p) => !p),
|
|
11332
11377
|
isSelectionPaneOpen: s.isSelectionPaneOpen,
|
|
11333
11378
|
onToggleSelectionPane: () => s.setIsSelectionPaneOpen((p) => !p),
|
|
@@ -11390,7 +11435,12 @@ function useViewerBuildingBlocksCore(input) {
|
|
|
11390
11435
|
state.isDrawingRef
|
|
11391
11436
|
]
|
|
11392
11437
|
);
|
|
11393
|
-
const zoom = useZoomViewport({
|
|
11438
|
+
const zoom = useZoomViewport({
|
|
11439
|
+
canvasSize,
|
|
11440
|
+
selectedElements: state.selectedElements,
|
|
11441
|
+
fitPadding: input.fitPadding,
|
|
11442
|
+
maxFitScale: input.maxFitScale
|
|
11443
|
+
});
|
|
11394
11444
|
const { options: viewerOptions } = useViewerOptions();
|
|
11395
11445
|
const { setIsDirty } = state;
|
|
11396
11446
|
const markDocumentDirty = react.useCallback(() => {
|
|
@@ -11405,7 +11455,7 @@ function useViewerBuildingBlocksCore(input) {
|
|
|
11405
11455
|
headerFooter: state.headerFooter,
|
|
11406
11456
|
loading,
|
|
11407
11457
|
error,
|
|
11408
|
-
maxHistoryEntries:
|
|
11458
|
+
maxHistoryEntries: chunk4SPZ5IZN_js.resolveHistoryDepth(viewerOptions),
|
|
11409
11459
|
hasActivePointerInteraction,
|
|
11410
11460
|
pointerCommitNonce: state.pointerCommitNonce,
|
|
11411
11461
|
onDirty: markDocumentDirty,
|
|
@@ -11430,7 +11480,7 @@ function useViewerBuildingBlocksCore(input) {
|
|
|
11430
11480
|
documentGridSpacing: state.viewProperties?.gridSpacing
|
|
11431
11481
|
});
|
|
11432
11482
|
const themeColorMap = react.useMemo(
|
|
11433
|
-
() => state.theme?.colorScheme ?
|
|
11483
|
+
() => state.theme?.colorScheme ? chunk4SPZ5IZN_js.buildThemeColorMap(state.theme.colorScheme) : void 0,
|
|
11434
11484
|
[state.theme?.colorScheme]
|
|
11435
11485
|
);
|
|
11436
11486
|
const { presentation, annotations, actionSoundHandlerRef, setExitModeHandler } = usePresentationSetup({
|
|
@@ -11479,8 +11529,8 @@ function useViewerBuildingBlocksCore(input) {
|
|
|
11479
11529
|
gridSpacingPx,
|
|
11480
11530
|
// Multiplied against the pre-existing 2x baseline; see the matching
|
|
11481
11531
|
// comment in `PowerPointViewer.tsx`.
|
|
11482
|
-
imageExportScale: 2 *
|
|
11483
|
-
imageResolutionScale:
|
|
11532
|
+
imageExportScale: 2 * chunk4SPZ5IZN_js.resolveImageResolutionScale(viewerOptions),
|
|
11533
|
+
imageResolutionScale: chunk4SPZ5IZN_js.resolveImageResolutionScale(viewerOptions),
|
|
11484
11534
|
viewerOptions
|
|
11485
11535
|
};
|
|
11486
11536
|
}
|
|
@@ -11496,7 +11546,7 @@ function useCompatibilityToastsState() {
|
|
|
11496
11546
|
}
|
|
11497
11547
|
function useReadOnlyRecommendationState(content) {
|
|
11498
11548
|
const [recommendation, setRecommendation] = react.useState(
|
|
11499
|
-
() =>
|
|
11549
|
+
() => chunk4SPZ5IZN_js.readOnlyRecommendation(void 0)
|
|
11500
11550
|
);
|
|
11501
11551
|
const [modifyVerifier, setModifyVerifier] = react.useState(void 0);
|
|
11502
11552
|
const [bannerHidden, setBannerHidden] = react.useState(false);
|
|
@@ -11536,7 +11586,7 @@ function useReadOnlyRecommendationState(content) {
|
|
|
11536
11586
|
async (password) => {
|
|
11537
11587
|
setCheckingPassword(true);
|
|
11538
11588
|
try {
|
|
11539
|
-
const result = await
|
|
11589
|
+
const result = await chunk4SPZ5IZN_js.checkModifyPassword(modifyVerifier, password);
|
|
11540
11590
|
if (result.ok) {
|
|
11541
11591
|
unlock();
|
|
11542
11592
|
} else {
|
|
@@ -11581,9 +11631,9 @@ function useViewPreferencesSync(input) {
|
|
|
11581
11631
|
setShowGuides
|
|
11582
11632
|
} = input;
|
|
11583
11633
|
react.useEffect(() => {
|
|
11584
|
-
const seeded =
|
|
11634
|
+
const seeded = chunk4SPZ5IZN_js.viewerPreferencesFromViewProperties(
|
|
11585
11635
|
{ viewProperties },
|
|
11586
|
-
{ ...
|
|
11636
|
+
{ ...chunk4SPZ5IZN_js.DEFAULT_VIEWER_PREFERENCES, snapToGrid, snapToObjects: snapToShape, showGuides }
|
|
11587
11637
|
);
|
|
11588
11638
|
setSnapToGrid(seeded.snapToGrid);
|
|
11589
11639
|
setSnapToShape(seeded.snapToObjects ?? snapToShape);
|
|
@@ -11593,7 +11643,7 @@ function useViewPreferencesSync(input) {
|
|
|
11593
11643
|
(prefsOverride) => {
|
|
11594
11644
|
setViewProperties((prev) => {
|
|
11595
11645
|
const merged = {
|
|
11596
|
-
...
|
|
11646
|
+
...chunk4SPZ5IZN_js.DEFAULT_VIEWER_PREFERENCES,
|
|
11597
11647
|
snapToGrid,
|
|
11598
11648
|
snapToObjects: snapToShape,
|
|
11599
11649
|
showGuides,
|
|
@@ -11601,7 +11651,7 @@ function useViewPreferencesSync(input) {
|
|
|
11601
11651
|
gridSpacingCy: prev?.gridSpacing?.cy,
|
|
11602
11652
|
...prefsOverride
|
|
11603
11653
|
};
|
|
11604
|
-
const patch =
|
|
11654
|
+
const patch = chunk4SPZ5IZN_js.viewPropertiesPatchFromPreferences(merged);
|
|
11605
11655
|
return {
|
|
11606
11656
|
...prev,
|
|
11607
11657
|
slideViewPr: { ...prev?.slideViewPr, ...patch.slideViewPr },
|
|
@@ -11690,7 +11740,8 @@ function useViewerBuildingBlocksState(input) {
|
|
|
11690
11740
|
preMasterMode: state.preMasterMode,
|
|
11691
11741
|
hasDigitalSignatures: state.hasDigitalSignatures,
|
|
11692
11742
|
isDirty: state.isDirty,
|
|
11693
|
-
history
|
|
11743
|
+
history,
|
|
11744
|
+
embeddedFontFamilies: state.embeddedFonts.map((font) => font.name)
|
|
11694
11745
|
});
|
|
11695
11746
|
const readOnlyRec = useReadOnlyRecommendationState(content);
|
|
11696
11747
|
const compatToastsState = useCompatibilityToastsState();
|
|
@@ -11745,6 +11796,7 @@ function useViewerBuildingBlocksState(input) {
|
|
|
11745
11796
|
allowExternalImages: viewerOptions.trust.allowExternalContent,
|
|
11746
11797
|
setReadOnlyRecommendation: readOnlyRec.setRecommendation,
|
|
11747
11798
|
setModifyVerifier: readOnlyRec.setModifyVerifier,
|
|
11799
|
+
canInsertElement: !readOnlyRec.locked && !viewerOptions.trust.openInProtectedView,
|
|
11748
11800
|
setCompatToasts: compatToastsState.setToasts,
|
|
11749
11801
|
canEdit,
|
|
11750
11802
|
promptKeepInkAnnotations: viewerOptions.advanced.slideShowPromptKeepInkAnnotations,
|
|
@@ -11822,7 +11874,7 @@ function useViewerBuildingBlocks(input) {
|
|
|
11822
11874
|
}, [incomingContent]);
|
|
11823
11875
|
const onOpenFile = react.useCallback(() => {
|
|
11824
11876
|
void (async () => {
|
|
11825
|
-
const picked = await
|
|
11877
|
+
const picked = await chunk4SPZ5IZN_js.openPptxFile();
|
|
11826
11878
|
if (picked) {
|
|
11827
11879
|
setContent(picked.buffer);
|
|
11828
11880
|
}
|
|
@@ -11830,13 +11882,17 @@ function useViewerBuildingBlocks(input) {
|
|
|
11830
11882
|
}, []);
|
|
11831
11883
|
const onOpenRecentFile = react.useCallback((key) => {
|
|
11832
11884
|
void (async () => {
|
|
11833
|
-
const bytes = await
|
|
11885
|
+
const bytes = await chunk4SPZ5IZN_js.readBackstageRecentFile(key);
|
|
11834
11886
|
if (bytes) {
|
|
11835
11887
|
setContent(bytes);
|
|
11836
11888
|
}
|
|
11837
11889
|
})();
|
|
11838
11890
|
}, []);
|
|
11839
|
-
const core = useViewerBuildingBlocksCore({
|
|
11891
|
+
const core = useViewerBuildingBlocksCore({
|
|
11892
|
+
content,
|
|
11893
|
+
fitPadding: input.fitPadding,
|
|
11894
|
+
maxFitScale: input.maxFitScale
|
|
11895
|
+
});
|
|
11840
11896
|
const {
|
|
11841
11897
|
state,
|
|
11842
11898
|
mode,
|