@yudaocode/univer-slides-ui 0.0.0-stage → 1.6.218

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.
@@ -0,0 +1,4249 @@
1
+ import {
2
+ zh_CN_default
3
+ } from "./chunk-LG4ORGUD.js";
4
+ import {
5
+ en_US_default
6
+ } from "./chunk-NK6YCSA2.js";
7
+ import {
8
+ __decorateClass,
9
+ __decorateParam
10
+ } from "./chunk-BRKEJJFQ.js";
11
+
12
+ // src/icons/slides-icons.tsx
13
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
14
+ function createSvgIcon(children) {
15
+ return ({ className, style, onClick }) => /* @__PURE__ */ jsx(
16
+ "svg",
17
+ {
18
+ viewBox: "0 0 16 16",
19
+ width: "16",
20
+ height: "16",
21
+ fill: "none",
22
+ stroke: "currentColor",
23
+ className,
24
+ style: { display: "inline-block", verticalAlign: "middle", ...style },
25
+ onClick,
26
+ children
27
+ }
28
+ );
29
+ }
30
+ var SlideNewPageIcon = createSvgIcon(
31
+ /* @__PURE__ */ jsxs(Fragment, { children: [
32
+ /* @__PURE__ */ jsx("rect", { x: "2", y: "3", width: "12", height: "10", rx: "1.5", strokeWidth: "1.35" }),
33
+ /* @__PURE__ */ jsx("path", { d: "M8 5.5V10.5M5.5 8H10.5", strokeWidth: "1.4", strokeLinecap: "round" })
34
+ ] })
35
+ );
36
+ var SlideDuplicateIcon = createSvgIcon(
37
+ /* @__PURE__ */ jsxs(Fragment, { children: [
38
+ /* @__PURE__ */ jsx("rect", { x: "4.5", y: "4.5", width: "9", height: "8", rx: "1.2", strokeWidth: "1.3" }),
39
+ /* @__PURE__ */ jsx("path", { d: "M2.5 10V3.5C2.5 2.95 2.95 2.5 3.5 2.5H10.5", strokeWidth: "1.3", strokeLinecap: "round" })
40
+ ] })
41
+ );
42
+ var SlideTextIcon = createSvgIcon(
43
+ /* @__PURE__ */ jsxs(Fragment, { children: [
44
+ /* @__PURE__ */ jsx("rect", { x: "2", y: "2.5", width: "12", height: "11", rx: "1.4", strokeWidth: "1.2", strokeDasharray: "2 1.5" }),
45
+ /* @__PURE__ */ jsx("path", { d: "M5 5.2H11M8 5.2V11.2M6.5 11.2H9.5", strokeWidth: "1.4", strokeLinecap: "round" })
46
+ ] })
47
+ );
48
+ var SlideShapeIcon = createSvgIcon(
49
+ /* @__PURE__ */ jsxs(Fragment, { children: [
50
+ /* @__PURE__ */ jsx("rect", { x: "2.2", y: "2.5", width: "6.8", height: "6.8", rx: "1.2", strokeWidth: "1.35" }),
51
+ /* @__PURE__ */ jsx("circle", { cx: "10.8", cy: "10.5", r: "3.4", strokeWidth: "1.35" })
52
+ ] })
53
+ );
54
+ var SlideConnectorIcon = createSvgIcon(
55
+ /* @__PURE__ */ jsxs(Fragment, { children: [
56
+ /* @__PURE__ */ jsx("circle", { cx: "3.2", cy: "4", r: "1.4", strokeWidth: "1.3" }),
57
+ /* @__PURE__ */ jsx("circle", { cx: "12.8", cy: "12", r: "1.4", strokeWidth: "1.3" }),
58
+ /* @__PURE__ */ jsx("path", { d: "M4.6 4H8.2V12H11.4", strokeWidth: "1.35", strokeLinecap: "round", strokeLinejoin: "round" })
59
+ ] })
60
+ );
61
+ var SlideTableIcon = createSvgIcon(
62
+ /* @__PURE__ */ jsxs(Fragment, { children: [
63
+ /* @__PURE__ */ jsx("rect", { x: "2", y: "2.5", width: "12", height: "11", rx: "1.3", strokeWidth: "1.35" }),
64
+ /* @__PURE__ */ jsx("path", { d: "M2 6.2H14M2 9.8H14M6.2 2.5V13.5M10.2 2.5V13.5", strokeWidth: "1.15" })
65
+ ] })
66
+ );
67
+ var SlideChartIcon = createSvgIcon(
68
+ /* @__PURE__ */ jsxs(Fragment, { children: [
69
+ /* @__PURE__ */ jsx("path", { d: "M2.2 13.5H13.8", strokeWidth: "1.35", strokeLinecap: "round" }),
70
+ /* @__PURE__ */ jsx("rect", { x: "3.4", y: "8", width: "2.2", height: "5.5", rx: "0.5", strokeWidth: "1.25" }),
71
+ /* @__PURE__ */ jsx("rect", { x: "7", y: "4.8", width: "2.2", height: "8.7", rx: "0.5", strokeWidth: "1.25" }),
72
+ /* @__PURE__ */ jsx("rect", { x: "10.6", y: "2.8", width: "2.2", height: "10.7", rx: "0.5", strokeWidth: "1.25" })
73
+ ] })
74
+ );
75
+ var SlideSmartArtIcon = createSvgIcon(
76
+ /* @__PURE__ */ jsxs(Fragment, { children: [
77
+ /* @__PURE__ */ jsx("rect", { x: "5.2", y: "2", width: "5.6", height: "3.4", rx: "0.8", strokeWidth: "1.3" }),
78
+ /* @__PURE__ */ jsx("rect", { x: "1.8", y: "10.4", width: "5", height: "3.4", rx: "0.8", strokeWidth: "1.3" }),
79
+ /* @__PURE__ */ jsx("rect", { x: "9.2", y: "10.4", width: "5", height: "3.4", rx: "0.8", strokeWidth: "1.3" }),
80
+ /* @__PURE__ */ jsx("path", { d: "M8 5.4V8M4.3 8H11.7M4.3 8V10.4M11.7 8V10.4", strokeWidth: "1.2", strokeLinecap: "round" })
81
+ ] })
82
+ );
83
+ var SlideImageIcon = createSvgIcon(
84
+ /* @__PURE__ */ jsxs(Fragment, { children: [
85
+ /* @__PURE__ */ jsx("rect", { x: "2", y: "2.5", width: "12", height: "11", rx: "1.5", strokeWidth: "1.35" }),
86
+ /* @__PURE__ */ jsx("circle", { cx: "5.5", cy: "6", r: "1.2", strokeWidth: "1.2" }),
87
+ /* @__PURE__ */ jsx("path", { d: "M2.5 12L6.2 8.5L9.2 11.2L11.2 9.5L13.5 12", strokeWidth: "1.25", strokeLinecap: "round", strokeLinejoin: "round" })
88
+ ] })
89
+ );
90
+ var SlideLayoutIcon = createSvgIcon(
91
+ /* @__PURE__ */ jsxs(Fragment, { children: [
92
+ /* @__PURE__ */ jsx("rect", { x: "2", y: "2.5", width: "12", height: "11", rx: "1.4", strokeWidth: "1.35" }),
93
+ /* @__PURE__ */ jsx("path", { d: "M2 6H14M8 6V13.5", strokeWidth: "1.2" })
94
+ ] })
95
+ );
96
+ var SlideTransitionIcon = createSvgIcon(
97
+ /* @__PURE__ */ jsxs(Fragment, { children: [
98
+ /* @__PURE__ */ jsx("rect", { x: "5", y: "3", width: "9", height: "10", rx: "1.3", strokeWidth: "1.35" }),
99
+ /* @__PURE__ */ jsx("path", { d: "M2 5.5H3.5M1.5 8H3.8M2 10.5H3.5", strokeWidth: "1.35", strokeLinecap: "round" })
100
+ ] })
101
+ );
102
+ var SlideAnimationIcon = createSvgIcon(
103
+ /* @__PURE__ */ jsxs(Fragment, { children: [
104
+ /* @__PURE__ */ jsx("path", { d: "M8 2.2L9.4 5.5L13 5.9L10.3 8.3L11.1 11.8L8 9.9L4.9 11.8L5.7 8.3L3 5.9L6.6 5.5L8 2.2Z", strokeWidth: "1.3", strokeLinejoin: "round" }),
105
+ /* @__PURE__ */ jsx("path", { d: "M2.2 13.8H6.2", strokeWidth: "1.3", strokeLinecap: "round" })
106
+ ] })
107
+ );
108
+ var SlidePlayIcon = createSvgIcon(
109
+ /* @__PURE__ */ jsxs(Fragment, { children: [
110
+ /* @__PURE__ */ jsx("rect", { x: "1.8", y: "2.5", width: "12.4", height: "9.4", rx: "1.4", strokeWidth: "1.35" }),
111
+ /* @__PURE__ */ jsx("path", { d: "M6.8 5.2L10.4 7.2L6.8 9.2V5.2Z", fill: "currentColor", stroke: "none" }),
112
+ /* @__PURE__ */ jsx("path", { d: "M5 14H11", strokeWidth: "1.35", strokeLinecap: "round" })
113
+ ] })
114
+ );
115
+ var SlidePresenterIcon = createSvgIcon(
116
+ /* @__PURE__ */ jsxs(Fragment, { children: [
117
+ /* @__PURE__ */ jsx("rect", { x: "1.8", y: "2.5", width: "7.8", height: "6.4", rx: "1", strokeWidth: "1.3" }),
118
+ /* @__PURE__ */ jsx("rect", { x: "10.8", y: "2.5", width: "3.4", height: "3", rx: "0.6", strokeWidth: "1.2" }),
119
+ /* @__PURE__ */ jsx("path", { d: "M10.8 7.5H14.2M10.8 9.5H13.2M2.5 11.8H9.2M2.5 13.6H7.2", strokeWidth: "1.2", strokeLinecap: "round" })
120
+ ] })
121
+ );
122
+ var SlideImportIcon = createSvgIcon(
123
+ /* @__PURE__ */ jsxs(Fragment, { children: [
124
+ /* @__PURE__ */ jsx("path", { d: "M8 10.5V2.5M8 2.5L5.2 5.3M8 2.5L10.8 5.3", strokeWidth: "1.4", strokeLinecap: "round", strokeLinejoin: "round" }),
125
+ /* @__PURE__ */ jsx("path", { d: "M2.5 10.5V12.5C2.5 13.1 2.9 13.5 3.5 13.5H12.5C13.1 13.5 13.5 13.1 13.5 12.5V10.5", strokeWidth: "1.35", strokeLinecap: "round" })
126
+ ] })
127
+ );
128
+ var SlideExportIcon = createSvgIcon(
129
+ /* @__PURE__ */ jsxs(Fragment, { children: [
130
+ /* @__PURE__ */ jsx("path", { d: "M8 2.5V10.5M8 10.5L5.2 7.7M8 10.5L10.8 7.7", strokeWidth: "1.4", strokeLinecap: "round", strokeLinejoin: "round" }),
131
+ /* @__PURE__ */ jsx("path", { d: "M2.5 10.5V12.5C2.5 13.1 2.9 13.5 3.5 13.5H12.5C13.1 13.5 13.5 13.1 13.5 12.5V10.5", strokeWidth: "1.35", strokeLinecap: "round" })
132
+ ] })
133
+ );
134
+ var SlidePdfIcon = createSvgIcon(
135
+ /* @__PURE__ */ jsxs(Fragment, { children: [
136
+ /* @__PURE__ */ jsx("path", { d: "M4 2H10L13 5V13.5C13 14.05 12.55 14.5 12 14.5H4C3.45 14.5 3 14.05 3 13.5V3C3 2.45 3.45 2 4 2Z", strokeWidth: "1.3", strokeLinejoin: "round" }),
137
+ /* @__PURE__ */ jsx("path", { d: "M9.8 2V5.2H13", strokeWidth: "1.2", strokeLinejoin: "round" }),
138
+ /* @__PURE__ */ jsx("path", { d: "M5.2 9.8H10.8M5.2 12H8.8", strokeWidth: "1.25", strokeLinecap: "round" })
139
+ ] })
140
+ );
141
+ var SlideFindIcon = createSvgIcon(
142
+ /* @__PURE__ */ jsxs(Fragment, { children: [
143
+ /* @__PURE__ */ jsx("circle", { cx: "7", cy: "7", r: "4.2", strokeWidth: "1.4" }),
144
+ /* @__PURE__ */ jsx("path", { d: "M10.2 10.2L13.5 13.5", strokeWidth: "1.5", strokeLinecap: "round" })
145
+ ] })
146
+ );
147
+ var SlideInspectorIcon = createSvgIcon(
148
+ /* @__PURE__ */ jsxs(Fragment, { children: [
149
+ /* @__PURE__ */ jsx("rect", { x: "2", y: "2.5", width: "12", height: "11", rx: "1.4", strokeWidth: "1.35" }),
150
+ /* @__PURE__ */ jsx("path", { d: "M10 2.5V13.5", strokeWidth: "1.3" })
151
+ ] })
152
+ );
153
+ var SlideAlignLeftIcon = createSvgIcon(
154
+ /* @__PURE__ */ jsxs(Fragment, { children: [
155
+ /* @__PURE__ */ jsx("path", { d: "M2.5 2.5V13.5", strokeWidth: "1.4", strokeLinecap: "round" }),
156
+ /* @__PURE__ */ jsx("rect", { x: "4.8", y: "4", width: "8.2", height: "3", rx: "0.6", strokeWidth: "1.25" }),
157
+ /* @__PURE__ */ jsx("rect", { x: "4.8", y: "9", width: "5.6", height: "3", rx: "0.6", strokeWidth: "1.25" })
158
+ ] })
159
+ );
160
+ var SlideAlignCenterIcon = createSvgIcon(
161
+ /* @__PURE__ */ jsxs(Fragment, { children: [
162
+ /* @__PURE__ */ jsx("path", { d: "M8 2V14", strokeWidth: "1.3", strokeLinecap: "round", strokeDasharray: "2 1.5" }),
163
+ /* @__PURE__ */ jsx("rect", { x: "3.2", y: "4", width: "9.6", height: "3", rx: "0.6", strokeWidth: "1.25" }),
164
+ /* @__PURE__ */ jsx("rect", { x: "4.8", y: "9", width: "6.4", height: "3", rx: "0.6", strokeWidth: "1.25" })
165
+ ] })
166
+ );
167
+ var SlideAlignRightIcon = createSvgIcon(
168
+ /* @__PURE__ */ jsxs(Fragment, { children: [
169
+ /* @__PURE__ */ jsx("path", { d: "M13.5 2.5V13.5", strokeWidth: "1.4", strokeLinecap: "round" }),
170
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "4", width: "8.2", height: "3", rx: "0.6", strokeWidth: "1.25" }),
171
+ /* @__PURE__ */ jsx("rect", { x: "5.6", y: "9", width: "5.6", height: "3", rx: "0.6", strokeWidth: "1.25" })
172
+ ] })
173
+ );
174
+ var SlideDeleteIcon = createSvgIcon(
175
+ /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("path", { d: "M3 4.2H13M6.2 4.2V2.8H9.8V4.2M4.4 4.2L5 13.2H11L11.6 4.2", strokeWidth: "1.3", strokeLinecap: "round", strokeLinejoin: "round" }) })
176
+ );
177
+ var SlideGridIcon = createSvgIcon(
178
+ /* @__PURE__ */ jsxs(Fragment, { children: [
179
+ /* @__PURE__ */ jsx("rect", { x: "2.2", y: "2.2", width: "11.6", height: "11.6", rx: "1.2", strokeWidth: "1.3" }),
180
+ /* @__PURE__ */ jsx("path", { d: "M2.2 6.1H13.8M2.2 9.9H13.8M6.1 2.2V13.8M9.9 2.2V13.8", strokeWidth: "1.05" })
181
+ ] })
182
+ );
183
+ var SlideNotesIcon = createSvgIcon(
184
+ /* @__PURE__ */ jsxs(Fragment, { children: [
185
+ /* @__PURE__ */ jsx("rect", { x: "2.2", y: "2.2", width: "11.6", height: "11.6", rx: "1.4", strokeWidth: "1.3" }),
186
+ /* @__PURE__ */ jsx("path", { d: "M2.2 9.5H13.8M4.5 11.6H9.5", strokeWidth: "1.25", strokeLinecap: "round" })
187
+ ] })
188
+ );
189
+ var SlideEyeIcon = createSvgIcon(
190
+ /* @__PURE__ */ jsxs(Fragment, { children: [
191
+ /* @__PURE__ */ jsx("path", { d: "M1.6 8C2.9 5.1 5.2 3.6 8 3.6C10.8 3.6 13.1 5.1 14.4 8C13.1 10.9 10.8 12.4 8 12.4C5.2 12.4 2.9 10.9 1.6 8Z", strokeWidth: "1.3" }),
192
+ /* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "2", strokeWidth: "1.3" })
193
+ ] })
194
+ );
195
+ var SlideEyeOffIcon = createSvgIcon(
196
+ /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("path", { d: "M2.2 2.2L13.8 13.8M4.2 4.6C2.9 5.5 2 6.6 1.6 8C2.9 10.9 5.2 12.4 8 12.4C9.4 12.4 10.6 12 11.7 11.3M6.8 3.8C7.2 3.7 7.6 3.6 8 3.6C10.8 3.6 13.1 5.1 14.4 8C13.9 9 13.3 9.9 12.6 10.5", strokeWidth: "1.3", strokeLinecap: "round" }) })
197
+ );
198
+ var SlideSectionFolderIcon = createSvgIcon(
199
+ /* @__PURE__ */ jsx("path", { d: "M2 4.2C2 3.65 2.45 3.2 3 3.2H6.2L7.6 4.8H13C13.55 4.8 14 5.25 14 5.8V12.2C14 12.75 13.55 13.2 13 13.2H3C2.45 13.2 2 12.75 2 12.2V4.2Z", strokeWidth: "1.3", strokeLinejoin: "round" })
200
+ );
201
+ var SlideLaserIcon = createSvgIcon(
202
+ /* @__PURE__ */ jsxs(Fragment, { children: [
203
+ /* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "2.2", fill: "#ef4444", stroke: "#ef4444" }),
204
+ /* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "5", stroke: "#ef4444", strokeWidth: "1.2", strokeDasharray: "2 2" })
205
+ ] })
206
+ );
207
+ var SlidePenIcon = createSvgIcon(
208
+ /* @__PURE__ */ jsx("path", { d: "M11.2 2.5L13.5 4.8L5.8 12.5L2.6 13.4L3.5 10.2L11.2 2.5Z", strokeWidth: "1.35", strokeLinejoin: "round" })
209
+ );
210
+ var SLIDE_ICON_MAP = {
211
+ SlideNewPageIcon,
212
+ SlideDuplicateIcon,
213
+ SlideTextIcon,
214
+ SlideShapeIcon,
215
+ SlideConnectorIcon,
216
+ SlideTableIcon,
217
+ SlideChartIcon,
218
+ SlideSmartArtIcon,
219
+ SlideImageIcon,
220
+ SlideLayoutIcon,
221
+ SlideTransitionIcon,
222
+ SlideAnimationIcon,
223
+ SlidePlayIcon,
224
+ SlidePresenterIcon,
225
+ SlideImportIcon,
226
+ SlideExportIcon,
227
+ SlidePdfIcon,
228
+ SlideFindIcon,
229
+ SlideInspectorIcon,
230
+ SlideAlignLeftIcon,
231
+ SlideAlignCenterIcon,
232
+ SlideAlignRightIcon,
233
+ SlideDeleteIcon,
234
+ SlideGridIcon,
235
+ SlideNotesIcon,
236
+ SlideEyeIcon,
237
+ SlideEyeOffIcon,
238
+ SlideSectionFolderIcon,
239
+ SlideLaserIcon,
240
+ SlidePenIcon
241
+ };
242
+
243
+ // src/operations/slides-ui.operation.ts
244
+ import {
245
+ CommandType,
246
+ ICommandService,
247
+ IUniverInstanceService,
248
+ UniverInstanceType
249
+ } from "@univerjs/core";
250
+ import { ISidebarService } from "@univerjs/ui";
251
+ import {
252
+ ISlideIoService,
253
+ ISlideSelectionService,
254
+ ReplaceSlideSnapshotCommand
255
+ } from "@yudaocode/univer-slides";
256
+ var SLIDES_INSPECTOR_SIDEBAR_ID = "univer.slides.inspector.sidebar";
257
+ var SLIDES_INSPECTOR_COMPONENT_KEY = "univer.slides.inspector.component";
258
+ function openSlidesInspectorSidebar(sidebarService) {
259
+ sidebarService.open({
260
+ id: SLIDES_INSPECTOR_SIDEBAR_ID,
261
+ header: { title: "slides.sidebar.inspectorTitle" },
262
+ children: { label: SLIDES_INSPECTOR_COMPONENT_KEY },
263
+ width: 344
264
+ });
265
+ }
266
+ var ToggleSlidesInspectorOperation = {
267
+ id: "slides-ui.operation.toggle-inspector",
268
+ type: CommandType.OPERATION,
269
+ handler: (accessor) => {
270
+ const sidebarService = accessor.get(ISidebarService);
271
+ if (sidebarService.visible && sidebarService.options?.id === SLIDES_INSPECTOR_SIDEBAR_ID) {
272
+ sidebarService.close(SLIDES_INSPECTOR_SIDEBAR_ID);
273
+ } else {
274
+ openSlidesInspectorSidebar(sidebarService);
275
+ }
276
+ return true;
277
+ }
278
+ };
279
+ var ToggleSlidesFindReplaceOperation = {
280
+ id: "slides-ui.operation.toggle-find-replace",
281
+ type: CommandType.OPERATION,
282
+ handler: (accessor) => {
283
+ const sel = accessor.get(ISlideSelectionService);
284
+ sel.setFindReplaceOpen(!sel.getState().findReplaceOpen);
285
+ return true;
286
+ }
287
+ };
288
+ var StartSlideShowOperation = {
289
+ id: "slides-ui.operation.start-slideshow",
290
+ type: CommandType.OPERATION,
291
+ handler: (accessor, params) => {
292
+ const sel = accessor.get(ISlideSelectionService);
293
+ const instanceService = accessor.get(IUniverInstanceService);
294
+ const unit = instanceService.getCurrentUnitOfType(
295
+ UniverInstanceType.UNIVER_SLIDE
296
+ );
297
+ const visibleOrder = unit ? unit.getSlidesOrdered().filter((s) => !s.hidden).map((s) => s.id) : [];
298
+ let startIdx = 0;
299
+ if (!params?.fromStart && unit) {
300
+ const curId = sel.getActiveSlideId() ?? unit.getActiveSlideId();
301
+ const found = visibleOrder.indexOf(curId);
302
+ if (found >= 0) startIdx = found;
303
+ }
304
+ sel.openPresenter(params?.mode ?? "presenter", startIdx);
305
+ return true;
306
+ }
307
+ };
308
+ var AdjustSlidesZoomOperation = {
309
+ id: "slides-ui.operation.adjust-zoom",
310
+ type: CommandType.OPERATION,
311
+ handler: (accessor, params) => {
312
+ const sel = accessor.get(ISlideSelectionService);
313
+ if (typeof params?.zoom === "number") {
314
+ sel.setZoom(params.zoom);
315
+ } else if (typeof params?.delta === "number") {
316
+ sel.setZoom(sel.getState().zoom + params.delta);
317
+ } else {
318
+ sel.setZoom(0.85);
319
+ }
320
+ return true;
321
+ }
322
+ };
323
+ var ToggleSlidesGridOperation = {
324
+ id: "slides-ui.operation.toggle-grid",
325
+ type: CommandType.OPERATION,
326
+ handler: (accessor) => {
327
+ const sel = accessor.get(ISlideSelectionService);
328
+ sel.setShowGrid(!sel.getState().showGrid);
329
+ return true;
330
+ }
331
+ };
332
+ var ToggleSlidesSnapOperation = {
333
+ id: "slides-ui.operation.toggle-snap",
334
+ type: CommandType.OPERATION,
335
+ handler: (accessor) => {
336
+ const sel = accessor.get(ISlideSelectionService);
337
+ sel.setSnapEnabled(!sel.getState().snapEnabled);
338
+ return true;
339
+ }
340
+ };
341
+ var ToggleSlidesSpeakerNotesOperation = {
342
+ id: "slides-ui.operation.toggle-speaker-notes",
343
+ type: CommandType.OPERATION,
344
+ handler: (accessor) => {
345
+ const sel = accessor.get(ISlideSelectionService);
346
+ sel.setShowSpeakerNotes(!sel.getState().showSpeakerNotes);
347
+ return true;
348
+ }
349
+ };
350
+ function triggerBrowserDownload(bytes, fileName, mimeType) {
351
+ if (typeof document === "undefined" || typeof URL === "undefined" || typeof URL.createObjectURL !== "function") {
352
+ return;
353
+ }
354
+ const copy = new Uint8Array(bytes.byteLength);
355
+ copy.set(bytes);
356
+ const blob = new Blob([copy.buffer], { type: mimeType });
357
+ const url = URL.createObjectURL(blob);
358
+ const a = document.createElement("a");
359
+ a.href = url;
360
+ a.download = fileName;
361
+ document.body.appendChild(a);
362
+ a.click();
363
+ document.body.removeChild(a);
364
+ setTimeout(() => URL.revokeObjectURL(url), 1e3);
365
+ }
366
+ var ExportSlidesPptxOperation = {
367
+ id: "slides-ui.operation.export-pptx",
368
+ type: CommandType.OPERATION,
369
+ handler: async (accessor, params) => {
370
+ const instanceService = accessor.get(IUniverInstanceService);
371
+ const io = accessor.get(ISlideIoService);
372
+ const unit = params?.unitId ? instanceService.getUnit(params.unitId, UniverInstanceType.UNIVER_SLIDE) : instanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SLIDE);
373
+ if (!unit) return false;
374
+ const bytes = await io.exportPptx(unit.save());
375
+ const safeName = (unit.getName() || "presentation").replace(/[\\/:*?"<>|]/g, "_");
376
+ triggerBrowserDownload(
377
+ bytes,
378
+ `${safeName}.pptx`,
379
+ "application/vnd.openxmlformats-officedocument.presentationml.presentation"
380
+ );
381
+ return true;
382
+ }
383
+ };
384
+ var ExportSlidesPdfOperation = {
385
+ id: "slides-ui.operation.export-pdf",
386
+ type: CommandType.OPERATION,
387
+ handler: async (accessor, params) => {
388
+ const instanceService = accessor.get(IUniverInstanceService);
389
+ const io = accessor.get(ISlideIoService);
390
+ const unit = params?.unitId ? instanceService.getUnit(params.unitId, UniverInstanceType.UNIVER_SLIDE) : instanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SLIDE);
391
+ if (!unit) return false;
392
+ const bytes = await io.exportPdf(unit.save(), {
393
+ handoutNotesMode: params?.handoutNotesMode,
394
+ includeHiddenSlides: params?.includeHiddenSlides
395
+ });
396
+ const safeName = (unit.getName() || "presentation").replace(/[\\/:*?"<>|]/g, "_");
397
+ const suffix = params?.handoutNotesMode ? "-\u8BB2\u4E49\u5907\u6CE8\u7248" : "";
398
+ triggerBrowserDownload(bytes, `${safeName}${suffix}.pdf`, "application/pdf");
399
+ return true;
400
+ }
401
+ };
402
+ var ImportSlidesPptxOperation = {
403
+ id: "slides-ui.operation.import-pptx",
404
+ type: CommandType.OPERATION,
405
+ handler: async (accessor, params) => {
406
+ const instanceService = accessor.get(IUniverInstanceService);
407
+ const commandService = accessor.get(ICommandService);
408
+ const io = accessor.get(ISlideIoService);
409
+ const unit = params?.unitId ? instanceService.getUnit(params.unitId, UniverInstanceType.UNIVER_SLIDE) : instanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SLIDE);
410
+ if (!unit) return false;
411
+ if (params?.bytes || params?.file) {
412
+ const source = params.bytes ?? params.file;
413
+ const fileName = params.file ? params.file.name.replace(/\.pptx$/i, "") : void 0;
414
+ const imported = await io.importPptx(source, { unitId: unit.getUnitId(), name: fileName });
415
+ return Boolean(
416
+ commandService.syncExecuteCommand(ReplaceSlideSnapshotCommand.id, {
417
+ unitId: unit.getUnitId(),
418
+ snapshot: imported
419
+ })
420
+ );
421
+ }
422
+ if (typeof document !== "undefined") {
423
+ const input = document.createElement("input");
424
+ input.type = "file";
425
+ input.accept = ".pptx,application/vnd.openxmlformats-officedocument.presentationml.presentation";
426
+ input.onchange = async () => {
427
+ const picked = input.files?.[0];
428
+ if (!picked) return;
429
+ const imported = await io.importPptx(picked, {
430
+ unitId: unit.getUnitId(),
431
+ name: picked.name.replace(/\.pptx$/i, "")
432
+ });
433
+ commandService.syncExecuteCommand(ReplaceSlideSnapshotCommand.id, {
434
+ unitId: unit.getUnitId(),
435
+ snapshot: imported
436
+ });
437
+ };
438
+ input.click();
439
+ return true;
440
+ }
441
+ return false;
442
+ }
443
+ };
444
+
445
+ // src/controllers/menu.schema.ts
446
+ import {
447
+ MenuItemType,
448
+ MenuManagerPosition,
449
+ RibbonInsertGroup,
450
+ RibbonStartGroup,
451
+ RibbonViewGroup
452
+ } from "@univerjs/ui";
453
+ import {
454
+ AddSlideElementCommand,
455
+ AddSlidePageCommand,
456
+ AlignSlideElementsCommand,
457
+ DeleteSlideElementsCommand,
458
+ DuplicateSlidePageCommand,
459
+ ISlideSelectionService as ISlideSelectionService2
460
+ } from "@yudaocode/univer-slides";
461
+ import { map } from "rxjs";
462
+ var SLIDES_RIBBON_SLIDESHOW_TAB = "ribbon.slideshow";
463
+ var SLIDES_RIBBON_SLIDESHOW_GROUP = "ribbon.slideshow.play";
464
+ var slidesRootMenuExtension = {
465
+ [MenuManagerPosition.RIBBON]: {
466
+ [SLIDES_RIBBON_SLIDESHOW_TAB]: {
467
+ order: 3,
468
+ title: "slides.ribbon.slideShowTab",
469
+ [SLIDES_RIBBON_SLIDESHOW_GROUP]: {
470
+ order: 0,
471
+ title: "slides.ribbon.slideShowTab"
472
+ }
473
+ }
474
+ }
475
+ };
476
+ function makeBtn(cfg) {
477
+ return () => ({
478
+ id: cfg.id,
479
+ commandId: cfg.commandId ?? cfg.id,
480
+ type: MenuItemType.BUTTON,
481
+ title: cfg.title,
482
+ label: cfg.label,
483
+ tooltip: cfg.title,
484
+ icon: cfg.icon,
485
+ params: cfg.params
486
+ });
487
+ }
488
+ var NewSlideMenuFactory = makeBtn({
489
+ id: "slides-ui.menu.new-slide",
490
+ commandId: AddSlidePageCommand.id,
491
+ title: "slides.ribbon.newSlide",
492
+ label: "slides.ribbon.newSlide",
493
+ icon: "SlideNewPageIcon"
494
+ });
495
+ var DuplicateSlideMenuFactory = makeBtn({
496
+ id: "slides-ui.menu.duplicate-slide",
497
+ commandId: DuplicateSlidePageCommand.id,
498
+ title: "slides.ribbon.duplicateSlide",
499
+ icon: "SlideDuplicateIcon"
500
+ });
501
+ var InsertSlideTextMenuFactory = makeBtn({
502
+ id: "slides-ui.menu.insert-text",
503
+ commandId: AddSlideElementCommand.id,
504
+ title: "slides.ribbon.insertText",
505
+ label: "slides.ribbon.insertText",
506
+ icon: "SlideTextIcon",
507
+ params: { elementType: "text" }
508
+ });
509
+ var InsertSlideShapeMenuFactory = makeBtn({
510
+ id: "slides-ui.menu.insert-shape",
511
+ commandId: AddSlideElementCommand.id,
512
+ title: "slides.ribbon.insertShape",
513
+ label: "slides.ribbon.insertShape",
514
+ icon: "SlideShapeIcon",
515
+ params: { elementType: "shape" }
516
+ });
517
+ var InsertSlideConnectorMenuFactory = makeBtn({
518
+ id: "slides-ui.menu.insert-connector",
519
+ commandId: AddSlideElementCommand.id,
520
+ title: "slides.ribbon.insertConnector",
521
+ icon: "SlideConnectorIcon",
522
+ params: { elementType: "connector" }
523
+ });
524
+ var InsertSlideTableMenuFactory = makeBtn({
525
+ id: "slides-ui.menu.insert-table",
526
+ commandId: AddSlideElementCommand.id,
527
+ title: "slides.ribbon.insertTable",
528
+ label: "slides.ribbon.insertTable",
529
+ icon: "SlideTableIcon",
530
+ params: { elementType: "table" }
531
+ });
532
+ var InsertSlideChartMenuFactory = makeBtn({
533
+ id: "slides-ui.menu.insert-chart",
534
+ commandId: AddSlideElementCommand.id,
535
+ title: "slides.ribbon.insertChart",
536
+ label: "slides.ribbon.insertChart",
537
+ icon: "SlideChartIcon",
538
+ params: { elementType: "chart" }
539
+ });
540
+ var InsertSlideSmartArtMenuFactory = makeBtn({
541
+ id: "slides-ui.menu.insert-smartart",
542
+ commandId: AddSlideElementCommand.id,
543
+ title: "slides.ribbon.insertSmartArt",
544
+ label: "slides.ribbon.insertSmartArt",
545
+ icon: "SlideSmartArtIcon",
546
+ params: { elementType: "smartArt" }
547
+ });
548
+ var InsertSlideImageMenuFactory = makeBtn({
549
+ id: "slides-ui.menu.insert-image",
550
+ commandId: AddSlideElementCommand.id,
551
+ title: "slides.ribbon.insertImage",
552
+ icon: "SlideImageIcon",
553
+ params: { elementType: "image" }
554
+ });
555
+ var AlignSlideLeftMenuFactory = makeBtn({
556
+ id: "slides-ui.menu.align-left",
557
+ commandId: AlignSlideElementsCommand.id,
558
+ title: "slides.ribbon.alignLeft",
559
+ icon: "SlideAlignLeftIcon",
560
+ params: { mode: "left" }
561
+ });
562
+ var AlignSlideCenterMenuFactory = makeBtn({
563
+ id: "slides-ui.menu.align-center",
564
+ commandId: AlignSlideElementsCommand.id,
565
+ title: "slides.ribbon.alignCenter",
566
+ icon: "SlideAlignCenterIcon",
567
+ params: { mode: "center" }
568
+ });
569
+ var AlignSlideRightMenuFactory = makeBtn({
570
+ id: "slides-ui.menu.align-right",
571
+ commandId: AlignSlideElementsCommand.id,
572
+ title: "slides.ribbon.alignRight",
573
+ icon: "SlideAlignRightIcon",
574
+ params: { mode: "right" }
575
+ });
576
+ var DeleteSlideElementMenuFactory = (accessor) => {
577
+ const sel = accessor.get(ISlideSelectionService2);
578
+ return {
579
+ id: DeleteSlideElementsCommand.id,
580
+ type: MenuItemType.BUTTON,
581
+ title: "slides.ribbon.deleteElement",
582
+ tooltip: "slides.ribbon.deleteElement",
583
+ icon: "SlideDeleteIcon",
584
+ disabled$: sel.state$.pipe(map((s) => s.selectedElementIds.length === 0))
585
+ };
586
+ };
587
+ var ImportPptxMenuFactory = makeBtn({
588
+ id: ImportSlidesPptxOperation.id,
589
+ title: "slides.ribbon.importPptx",
590
+ label: "slides.ribbon.importPptx",
591
+ icon: "SlideImportIcon"
592
+ });
593
+ var ExportPptxMenuFactory = makeBtn({
594
+ id: ExportSlidesPptxOperation.id,
595
+ title: "slides.ribbon.exportPptx",
596
+ label: "slides.ribbon.exportPptx",
597
+ icon: "SlideExportIcon"
598
+ });
599
+ var ExportPdfMenuFactory = makeBtn({
600
+ id: ExportSlidesPdfOperation.id,
601
+ title: "slides.ribbon.exportPdf",
602
+ label: "slides.ribbon.exportPdf",
603
+ icon: "SlidePdfIcon"
604
+ });
605
+ var ToggleSlidesInspectorMenuFactory = makeBtn({
606
+ id: ToggleSlidesInspectorOperation.id,
607
+ title: "slides.ribbon.inspector",
608
+ label: "slides.ribbon.inspector",
609
+ icon: "SlideInspectorIcon"
610
+ });
611
+ var ToggleSlidesFindMenuFactory = (accessor) => {
612
+ const sel = accessor.get(ISlideSelectionService2);
613
+ return {
614
+ id: ToggleSlidesFindReplaceOperation.id,
615
+ type: MenuItemType.BUTTON,
616
+ title: "slides.ribbon.findReplace",
617
+ label: "slides.ribbon.findReplace",
618
+ tooltip: "slides.ribbon.findReplace",
619
+ icon: "SlideFindIcon",
620
+ activated$: sel.state$.pipe(map((s) => s.findReplaceOpen))
621
+ };
622
+ };
623
+ var PlayFromStartMenuFactory = makeBtn({
624
+ id: "slides-ui.menu.play-start",
625
+ commandId: StartSlideShowOperation.id,
626
+ title: "slides.ribbon.playFromStart",
627
+ label: "slides.ribbon.playFromStart",
628
+ icon: "SlidePlayIcon",
629
+ params: { mode: "fullscreen", fromStart: true }
630
+ });
631
+ var PlayCurrentMenuFactory = makeBtn({
632
+ id: "slides-ui.menu.play-current",
633
+ commandId: StartSlideShowOperation.id,
634
+ title: "slides.ribbon.playCurrent",
635
+ label: "slides.ribbon.playCurrent",
636
+ icon: "SlidePlayIcon",
637
+ params: { mode: "fullscreen", fromStart: false }
638
+ });
639
+ var PresenterViewMenuFactory = makeBtn({
640
+ id: "slides-ui.menu.presenter-view",
641
+ commandId: StartSlideShowOperation.id,
642
+ title: "slides.ribbon.presenterView",
643
+ label: "slides.ribbon.presenterView",
644
+ icon: "SlidePresenterIcon",
645
+ params: { mode: "presenter", fromStart: false }
646
+ });
647
+ var ToggleGridMenuFactory = (accessor) => {
648
+ const sel = accessor.get(ISlideSelectionService2);
649
+ return {
650
+ id: ToggleSlidesGridOperation.id,
651
+ type: MenuItemType.BUTTON,
652
+ title: "slides.ribbon.toggleGrid",
653
+ tooltip: "slides.ribbon.toggleGrid",
654
+ icon: "SlideGridIcon",
655
+ activated$: sel.state$.pipe(map((s) => s.showGrid))
656
+ };
657
+ };
658
+ var ToggleSnapMenuFactory = (accessor) => {
659
+ const sel = accessor.get(ISlideSelectionService2);
660
+ return {
661
+ id: ToggleSlidesSnapOperation.id,
662
+ type: MenuItemType.BUTTON,
663
+ title: "slides.ribbon.toggleSnap",
664
+ tooltip: "slides.ribbon.toggleSnap",
665
+ icon: "SlideAlignCenterIcon",
666
+ activated$: sel.state$.pipe(map((s) => s.snapEnabled))
667
+ };
668
+ };
669
+ var ToggleNotesMenuFactory = (accessor) => {
670
+ const sel = accessor.get(ISlideSelectionService2);
671
+ return {
672
+ id: ToggleSlidesSpeakerNotesOperation.id,
673
+ type: MenuItemType.BUTTON,
674
+ title: "slides.ribbon.toggleNotes",
675
+ tooltip: "slides.ribbon.toggleNotes",
676
+ icon: "SlideNotesIcon",
677
+ activated$: sel.state$.pipe(map((s) => s.showSpeakerNotes))
678
+ };
679
+ };
680
+ var ZoomResetSlidesMenuFactory = makeBtn({
681
+ id: "slides-ui.menu.zoom-reset",
682
+ commandId: AdjustSlidesZoomOperation.id,
683
+ title: "slides.ribbon.zoomReset",
684
+ icon: "SlidePlayIcon",
685
+ params: { zoom: 0.85 }
686
+ });
687
+ var slidesMenuSchema = {
688
+ [RibbonStartGroup.FORMAT]: {
689
+ ["slides-ui.menu.new-slide"]: { order: 0, menuItemFactory: NewSlideMenuFactory },
690
+ ["slides-ui.menu.duplicate-slide"]: { order: 1, menuItemFactory: DuplicateSlideMenuFactory },
691
+ ["slides-ui.menu.insert-text"]: { order: 2, menuItemFactory: InsertSlideTextMenuFactory },
692
+ ["slides-ui.menu.insert-shape"]: { order: 3, menuItemFactory: InsertSlideShapeMenuFactory },
693
+ ["slides-ui.menu.insert-chart"]: { order: 4, menuItemFactory: InsertSlideChartMenuFactory },
694
+ ["slides-ui.menu.insert-smartart"]: { order: 5, menuItemFactory: InsertSlideSmartArtMenuFactory }
695
+ },
696
+ [RibbonStartGroup.LAYOUT]: {
697
+ ["slides-ui.menu.align-left"]: { order: 1, menuItemFactory: AlignSlideLeftMenuFactory },
698
+ ["slides-ui.menu.align-center"]: { order: 2, menuItemFactory: AlignSlideCenterMenuFactory },
699
+ ["slides-ui.menu.align-right"]: { order: 3, menuItemFactory: AlignSlideRightMenuFactory },
700
+ [DeleteSlideElementsCommand.id]: { order: 4, menuItemFactory: DeleteSlideElementMenuFactory }
701
+ },
702
+ [RibbonStartGroup.OTHERS]: {
703
+ [ImportSlidesPptxOperation.id]: { order: 1, menuItemFactory: ImportPptxMenuFactory },
704
+ [ExportSlidesPptxOperation.id]: { order: 2, menuItemFactory: ExportPptxMenuFactory },
705
+ [ExportSlidesPdfOperation.id]: { order: 3, menuItemFactory: ExportPdfMenuFactory },
706
+ [ToggleSlidesFindReplaceOperation.id]: { order: 4, menuItemFactory: ToggleSlidesFindMenuFactory },
707
+ [ToggleSlidesInspectorOperation.id]: { order: 5, menuItemFactory: ToggleSlidesInspectorMenuFactory }
708
+ },
709
+ [RibbonInsertGroup.EDIT]: {
710
+ ["slides-ui.menu.insert-text-2"]: {
711
+ order: 1,
712
+ menuItemFactory: makeBtn({
713
+ id: "slides-ui.menu.insert-text-2",
714
+ commandId: AddSlideElementCommand.id,
715
+ title: "slides.ribbon.insertText",
716
+ label: "slides.ribbon.insertText",
717
+ icon: "SlideTextIcon",
718
+ params: { elementType: "text" }
719
+ })
720
+ },
721
+ ["slides-ui.menu.insert-table"]: { order: 2, menuItemFactory: InsertSlideTableMenuFactory },
722
+ ["slides-ui.menu.insert-connector"]: { order: 3, menuItemFactory: InsertSlideConnectorMenuFactory }
723
+ },
724
+ [RibbonInsertGroup.MEDIA]: {
725
+ ["slides-ui.menu.insert-image"]: { order: 1, menuItemFactory: InsertSlideImageMenuFactory }
726
+ },
727
+ [SLIDES_RIBBON_SLIDESHOW_GROUP]: {
728
+ ["slides-ui.menu.play-start"]: { order: 1, menuItemFactory: PlayFromStartMenuFactory },
729
+ ["slides-ui.menu.play-current"]: { order: 2, menuItemFactory: PlayCurrentMenuFactory },
730
+ ["slides-ui.menu.presenter-view"]: { order: 3, menuItemFactory: PresenterViewMenuFactory }
731
+ },
732
+ [RibbonViewGroup.DISPLAY]: {
733
+ [ToggleSlidesGridOperation.id]: { order: 1, menuItemFactory: ToggleGridMenuFactory },
734
+ [ToggleSlidesSnapOperation.id]: { order: 2, menuItemFactory: ToggleSnapMenuFactory },
735
+ [ToggleSlidesSpeakerNotesOperation.id]: { order: 3, menuItemFactory: ToggleNotesMenuFactory },
736
+ ["slides-ui.menu.zoom-reset"]: { order: 4, menuItemFactory: ZoomResetSlidesMenuFactory }
737
+ }
738
+ };
739
+
740
+ // src/controllers/slides-ui.controller.ts
741
+ import { Disposable, ICommandService as ICommandService6, Inject, toDisposable } from "@univerjs/core";
742
+ import {
743
+ BuiltInUIPart,
744
+ ComponentManager,
745
+ IconManager,
746
+ IMenuManagerService,
747
+ ISidebarService as ISidebarService2,
748
+ IUIPartsService
749
+ } from "@univerjs/ui";
750
+
751
+ // src/views/footer/SlidesStatusBar.tsx
752
+ import { ICommandService as ICommandService2 } from "@univerjs/core";
753
+ import { useDependency as useDependency2 } from "@univerjs/ui";
754
+ import { ISlideSelectionService as ISlideSelectionService4 } from "@yudaocode/univer-slides";
755
+
756
+ // src/views/hooks/useActiveSlideUnit.ts
757
+ import { IUniverInstanceService as IUniverInstanceService2, UniverInstanceType as UniverInstanceType2 } from "@univerjs/core";
758
+ import { useDependency } from "@univerjs/ui";
759
+ import {
760
+ ISlideSelectionService as ISlideSelectionService3
761
+ } from "@yudaocode/univer-slides";
762
+ import { useEffect, useState } from "react";
763
+ function useActiveSlideUnit() {
764
+ const instanceService = useDependency(IUniverInstanceService2);
765
+ const selectionService = useDependency(ISlideSelectionService3);
766
+ const initialUnit = instanceService.getCurrentUnitOfType(UniverInstanceType2.UNIVER_SLIDE) ?? null;
767
+ const [unit, setUnit] = useState(initialUnit);
768
+ const [, setRevTick] = useState(() => initialUnit?.getRev() ?? 0);
769
+ const [selection, setSelection] = useState(
770
+ () => selectionService.getState()
771
+ );
772
+ useEffect(() => {
773
+ const unitSub = instanceService.getCurrentTypeOfUnit$(UniverInstanceType2.UNIVER_SLIDE).subscribe((u) => {
774
+ setUnit(u ?? null);
775
+ setRevTick((t) => t + 1);
776
+ });
777
+ const selSub = selectionService.state$.subscribe((s) => setSelection(s));
778
+ return () => {
779
+ unitSub.unsubscribe();
780
+ selSub.unsubscribe();
781
+ };
782
+ }, [instanceService, selectionService]);
783
+ useEffect(() => {
784
+ if (!unit) return;
785
+ const snapSub = unit.snapshotChanged$.subscribe(() => {
786
+ setRevTick((t) => t + 1);
787
+ });
788
+ return () => snapSub.unsubscribe();
789
+ }, [unit]);
790
+ const currentUnit = unit ?? instanceService.getCurrentUnitOfType(UniverInstanceType2.UNIVER_SLIDE) ?? null;
791
+ const snapshot = currentUnit ? currentUnit.getSnapshot() : null;
792
+ const resolvedSlideId = (selection.activeSlideId && snapshot?.slides[selection.activeSlideId] ? selection.activeSlideId : snapshot?.activeSlideId) ?? snapshot?.slideOrder[0] ?? null;
793
+ const activeSlide = resolvedSlideId && snapshot ? snapshot.slides[resolvedSlideId] ?? null : null;
794
+ const activeSlideIndex = resolvedSlideId && snapshot ? Math.max(0, snapshot.slideOrder.indexOf(resolvedSlideId)) : 0;
795
+ return {
796
+ unit: currentUnit,
797
+ snapshot,
798
+ selection,
799
+ activeSlide,
800
+ activeSlideIndex
801
+ };
802
+ }
803
+
804
+ // src/views/footer/SlidesStatusBar.tsx
805
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
806
+ var SlidesStatusBar = () => {
807
+ const commandService = useDependency2(ICommandService2);
808
+ const selectionService = useDependency2(ISlideSelectionService4);
809
+ const { snapshot, selection, activeSlideIndex } = useActiveSlideUnit();
810
+ if (!snapshot) return null;
811
+ const totalSlides = snapshot.slideOrder.length;
812
+ const zoomPct = Math.round(selection.zoom * 100);
813
+ return /* @__PURE__ */ jsxs2("div", { className: "univer-slides-status-bar", children: [
814
+ /* @__PURE__ */ jsxs2("div", { className: "univer-slides-status-left", children: [
815
+ /* @__PURE__ */ jsxs2("span", { className: "univer-slides-status-item is-strong", children: [
816
+ "\u5E7B\u706F\u7247 ",
817
+ activeSlideIndex + 1,
818
+ " / ",
819
+ totalSlides
820
+ ] }),
821
+ /* @__PURE__ */ jsx2("span", { className: "univer-slides-status-divider" }),
822
+ /* @__PURE__ */ jsxs2("span", { className: "univer-slides-status-item", children: [
823
+ snapshot.slideSize.preset,
824
+ " (",
825
+ Math.round(snapshot.slideSize.widthPt),
826
+ " \xD7 ",
827
+ Math.round(snapshot.slideSize.heightPt),
828
+ " pt)"
829
+ ] }),
830
+ /* @__PURE__ */ jsx2("span", { className: "univer-slides-status-divider" }),
831
+ /* @__PURE__ */ jsx2("span", { className: "univer-slides-status-item", children: snapshot.theme.name })
832
+ ] }),
833
+ /* @__PURE__ */ jsxs2("div", { className: "univer-slides-status-right", children: [
834
+ /* @__PURE__ */ jsx2(
835
+ "button",
836
+ {
837
+ type: "button",
838
+ className: `univer-slides-status-toggle${selection.showSpeakerNotes ? " is-active" : ""}`,
839
+ onClick: () => commandService.executeCommand(ToggleSlidesSpeakerNotesOperation.id),
840
+ children: "\u6F14\u8BB2\u8005\u5907\u6CE8"
841
+ }
842
+ ),
843
+ /* @__PURE__ */ jsx2(
844
+ "button",
845
+ {
846
+ type: "button",
847
+ className: `univer-slides-status-toggle${selection.showGrid ? " is-active" : ""}`,
848
+ onClick: () => commandService.executeCommand(ToggleSlidesGridOperation.id),
849
+ children: "\u53C2\u8003\u7F51\u683C"
850
+ }
851
+ ),
852
+ /* @__PURE__ */ jsx2(
853
+ "button",
854
+ {
855
+ type: "button",
856
+ className: `univer-slides-status-toggle${selection.snapEnabled ? " is-active" : ""}`,
857
+ onClick: () => commandService.executeCommand(ToggleSlidesSnapOperation.id),
858
+ children: "\u5BF9\u9F50\u8F85\u52A9\u7EBF"
859
+ }
860
+ ),
861
+ /* @__PURE__ */ jsx2(
862
+ "button",
863
+ {
864
+ type: "button",
865
+ className: "univer-slides-status-toggle is-highlight",
866
+ onClick: () => commandService.executeCommand(StartSlideShowOperation.id, {
867
+ mode: "presenter",
868
+ fromStart: false
869
+ }),
870
+ children: "\u6F14\u8BB2\u8005\u89C6\u56FE"
871
+ }
872
+ ),
873
+ /* @__PURE__ */ jsxs2("div", { className: "univer-slides-zoom-controls", children: [
874
+ /* @__PURE__ */ jsx2(
875
+ "button",
876
+ {
877
+ type: "button",
878
+ className: "univer-slides-zoom-btn",
879
+ title: "\u7F29\u5C0F",
880
+ onClick: () => selectionService.setZoom(selection.zoom - 0.1),
881
+ children: "-"
882
+ }
883
+ ),
884
+ /* @__PURE__ */ jsx2(
885
+ "input",
886
+ {
887
+ type: "range",
888
+ min: 30,
889
+ max: 200,
890
+ step: 5,
891
+ value: zoomPct,
892
+ onChange: (e) => selectionService.setZoom(Number(e.target.value) / 100)
893
+ }
894
+ ),
895
+ /* @__PURE__ */ jsx2(
896
+ "button",
897
+ {
898
+ type: "button",
899
+ className: "univer-slides-zoom-btn",
900
+ title: "\u653E\u5927",
901
+ onClick: () => selectionService.setZoom(selection.zoom + 0.1),
902
+ children: "+"
903
+ }
904
+ ),
905
+ /* @__PURE__ */ jsxs2(
906
+ "button",
907
+ {
908
+ type: "button",
909
+ className: "univer-slides-zoom-pct",
910
+ title: "\u70B9\u51FB\u91CD\u7F6E\u7F29\u653E\u81F3 85%",
911
+ onClick: () => selectionService.setZoom(0.85),
912
+ children: [
913
+ zoomPct,
914
+ "%"
915
+ ]
916
+ }
917
+ )
918
+ ] })
919
+ ] })
920
+ ] });
921
+ };
922
+
923
+ // src/views/inspector/SlidesInspectorPanel.tsx
924
+ import { generateRandomId, ICommandService as ICommandService3, Tools } from "@univerjs/core";
925
+ import { useDependency as useDependency3 } from "@univerjs/ui";
926
+ import {
927
+ AlignSlideElementsCommand as AlignSlideElementsCommand2,
928
+ compileSlidesWithDataset,
929
+ DeleteSlideElementsCommand as DeleteSlideElementsCommand2,
930
+ extractSlideDatasetCodes,
931
+ ISlideSelectionService as ISlideSelectionService5,
932
+ ReorderSlideElementLayerCommand,
933
+ ReplaceSlideSnapshotCommand as ReplaceSlideSnapshotCommand2,
934
+ SetSlideAnimationsCommand,
935
+ SetSlideSizeCommand,
936
+ SLIDE_THEME_PRESETS,
937
+ UpdateSlideElementsCommand,
938
+ UpdateSlidePagePropsCommand,
939
+ UpdateSlideThemeCommand
940
+ } from "@yudaocode/univer-slides";
941
+ import { useState as useState2 } from "react";
942
+ import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
943
+ var SAMPLE_DATASET_JSON = JSON.stringify(
944
+ {
945
+ meta: { quarter: "2026 Q4" },
946
+ kpi: { revenue: "6.82 \u4EBF", margin: "+4.6 pct" },
947
+ quarterlyTrend: [
948
+ { quarter: "Q1", revenue: 145, profit: 58 },
949
+ { quarter: "Q2", revenue: 172, profit: 74 },
950
+ { quarter: "Q3", revenue: 206, profit: 95 },
951
+ { quarter: "Q4", revenue: 258, profit: 126 }
952
+ ],
953
+ sales: [
954
+ { region: "\u534E\u4E1C\u5927\u533A", owner: "\u6797\u8FDC\u822A", amount: "9,860" },
955
+ { region: "\u534E\u5357\u5927\u533A", owner: "\u9648\u601D\u6E90", amount: "7,420" },
956
+ { region: "\u534E\u5317\u5927\u533A", owner: "\u5468\u660E\u54F2", amount: "6,150" }
957
+ ]
958
+ },
959
+ null,
960
+ 2
961
+ );
962
+ var SlidesInspectorPanel = () => {
963
+ const commandService = useDependency3(ICommandService3);
964
+ const selectionService = useDependency3(ISlideSelectionService5);
965
+ const { unit, snapshot, selection, activeSlide } = useActiveSlideUnit();
966
+ const [datasetJson, setDatasetJson] = useState2(SAMPLE_DATASET_JSON);
967
+ const [maxRowsInput, setMaxRowsInput] = useState2(5);
968
+ const [datasetError, setDatasetError] = useState2(null);
969
+ if (!unit || !snapshot || !activeSlide) {
970
+ return /* @__PURE__ */ jsx3("div", { className: "univer-slides-inspector", children: /* @__PURE__ */ jsx3("div", { className: "univer-slides-empty", children: "\u672A\u9009\u4E2D\u6D3B\u52A8\u5E7B\u706F\u7247" }) });
971
+ }
972
+ const unitId = unit.getUnitId();
973
+ const tab = selection.inspectorTab;
974
+ const selectedEl = selection.selectedElementIds.length > 0 ? activeSlide.elements[selection.selectedElementIds[0]] ?? null : null;
975
+ const patchElement = (patch) => {
976
+ if (!selectedEl) return;
977
+ commandService.syncExecuteCommand(UpdateSlideElementsCommand.id, {
978
+ unitId,
979
+ slideId: activeSlide.id,
980
+ updates: [{ id: selectedEl.id, patch }]
981
+ });
982
+ };
983
+ const extractedCodes = extractSlideDatasetCodes(snapshot);
984
+ const handleRunTemplateCompile = () => {
985
+ try {
986
+ const parsed = JSON.parse(datasetJson);
987
+ setDatasetError(null);
988
+ const compiled = compileSlidesWithDataset(snapshot, parsed, {
989
+ maxRowsPerSlide: maxRowsInput > 0 ? maxRowsInput : void 0
990
+ });
991
+ commandService.syncExecuteCommand(ReplaceSlideSnapshotCommand2.id, {
992
+ unitId,
993
+ snapshot: compiled
994
+ });
995
+ } catch (err) {
996
+ setDatasetError(err?.message || "JSON \u683C\u5F0F\u89E3\u6790\u5931\u8D25");
997
+ }
998
+ };
999
+ const handleAddAnimation = (category = "entrance", effect = "fadeIn") => {
1000
+ const targetId = selectedEl?.id ?? activeSlide.elementOrder[0];
1001
+ if (!targetId) return;
1002
+ const nextAnims = [
1003
+ ...activeSlide.animations ?? [],
1004
+ {
1005
+ id: `anim-${generateRandomId(6)}`,
1006
+ elementId: targetId,
1007
+ category,
1008
+ effect,
1009
+ trigger: "onClick",
1010
+ durationMs: 500,
1011
+ delayMs: 0
1012
+ }
1013
+ ];
1014
+ commandService.syncExecuteCommand(SetSlideAnimationsCommand.id, {
1015
+ unitId,
1016
+ slideId: activeSlide.id,
1017
+ animations: nextAnims
1018
+ });
1019
+ };
1020
+ const updateAnimationItem = (animId, patch) => {
1021
+ const nextAnims = (activeSlide.animations ?? []).map(
1022
+ (a) => a.id === animId ? { ...a, ...patch } : a
1023
+ );
1024
+ commandService.syncExecuteCommand(SetSlideAnimationsCommand.id, {
1025
+ unitId,
1026
+ slideId: activeSlide.id,
1027
+ animations: nextAnims
1028
+ });
1029
+ };
1030
+ const removeAnimationItem = (animId) => {
1031
+ const nextAnims = (activeSlide.animations ?? []).filter((a) => a.id !== animId);
1032
+ commandService.syncExecuteCommand(SetSlideAnimationsCommand.id, {
1033
+ unitId,
1034
+ slideId: activeSlide.id,
1035
+ animations: nextAnims
1036
+ });
1037
+ };
1038
+ return /* @__PURE__ */ jsxs3("div", { className: "univer-slides-inspector", children: [
1039
+ /* @__PURE__ */ jsx3("div", { className: "univer-slides-inspector-tabs", children: [
1040
+ { key: "page", label: "\u9875\u9762\u4E0E\u6BCD\u7248" },
1041
+ { key: "element", label: "\u5143\u7D20\u6837\u5F0F\u4E0E\u6570\u636E" },
1042
+ { key: "animation", label: "\u52A8\u753B\u65F6\u95F4\u8F74" }
1043
+ ].map((item) => /* @__PURE__ */ jsx3(
1044
+ "button",
1045
+ {
1046
+ type: "button",
1047
+ className: `univer-slides-inspector-tab${tab === item.key ? " is-active" : ""}`,
1048
+ onClick: () => selectionService.setInspectorTab(item.key),
1049
+ children: item.label
1050
+ },
1051
+ item.key
1052
+ )) }),
1053
+ /* @__PURE__ */ jsxs3("div", { className: "univer-slides-inspector-body", children: [
1054
+ tab === "page" && /* @__PURE__ */ jsxs3(Fragment2, { children: [
1055
+ /* @__PURE__ */ jsxs3("div", { className: "univer-slides-field-section", children: [
1056
+ /* @__PURE__ */ jsx3("div", { className: "univer-slides-section-heading", children: "\u5E7B\u706F\u7247\u6807\u9898\u4E0E\u5C3A\u5BF8" }),
1057
+ /* @__PURE__ */ jsxs3("label", { className: "univer-slides-field-row", children: [
1058
+ /* @__PURE__ */ jsx3("span", { children: "\u672C\u9875\u6807\u9898" }),
1059
+ /* @__PURE__ */ jsx3(
1060
+ "input",
1061
+ {
1062
+ className: "univer-slides-input",
1063
+ value: activeSlide.title,
1064
+ onChange: (e) => commandService.syncExecuteCommand(UpdateSlidePagePropsCommand.id, {
1065
+ unitId,
1066
+ slideId: activeSlide.id,
1067
+ patch: { title: e.target.value }
1068
+ })
1069
+ }
1070
+ )
1071
+ ] }),
1072
+ /* @__PURE__ */ jsx3("div", { className: "univer-slides-size-pills", children: [
1073
+ { preset: "16:9", label: "\u5BBD\u5C4F 16:9 (960\xD7540)" },
1074
+ { preset: "4:3", label: "\u6807\u51C6 4:3 (960\xD7720)" },
1075
+ { preset: "A4", label: "A4 \u6A2A\u5411\u8BB2\u4E49" }
1076
+ ].map((sp) => /* @__PURE__ */ jsx3(
1077
+ "button",
1078
+ {
1079
+ type: "button",
1080
+ className: `univer-slides-pill-btn${snapshot.slideSize.preset === sp.preset ? " is-active" : ""}`,
1081
+ onClick: () => commandService.syncExecuteCommand(SetSlideSizeCommand.id, {
1082
+ unitId,
1083
+ preset: sp.preset
1084
+ }),
1085
+ children: sp.label
1086
+ },
1087
+ sp.preset
1088
+ )) })
1089
+ ] }),
1090
+ /* @__PURE__ */ jsxs3("div", { className: "univer-slides-field-section", children: [
1091
+ /* @__PURE__ */ jsx3("div", { className: "univer-slides-section-heading", children: "\u4E3B\u9898\u914D\u8272\u65B9\u6848" }),
1092
+ /* @__PURE__ */ jsx3("div", { className: "univer-slides-theme-list", children: SLIDE_THEME_PRESETS.map((preset) => {
1093
+ const active = snapshot.theme.name === preset.name;
1094
+ return /* @__PURE__ */ jsxs3(
1095
+ "button",
1096
+ {
1097
+ type: "button",
1098
+ className: `univer-slides-theme-card${active ? " is-active" : ""}`,
1099
+ onClick: () => commandService.syncExecuteCommand(UpdateSlideThemeCommand.id, {
1100
+ unitId,
1101
+ theme: preset
1102
+ }),
1103
+ children: [
1104
+ /* @__PURE__ */ jsx3("span", { className: "univer-slides-theme-name", children: preset.name }),
1105
+ /* @__PURE__ */ jsx3("span", { className: "univer-slides-theme-swatches", children: [
1106
+ preset.colors.primary,
1107
+ preset.colors.accent1,
1108
+ preset.colors.accent2,
1109
+ preset.colors.accent3,
1110
+ preset.colors.accent4
1111
+ ].map((c, idx) => /* @__PURE__ */ jsx3("i", { style: { backgroundColor: c } }, idx)) })
1112
+ ]
1113
+ },
1114
+ preset.name
1115
+ );
1116
+ }) })
1117
+ ] }),
1118
+ /* @__PURE__ */ jsxs3("div", { className: "univer-slides-field-section", children: [
1119
+ /* @__PURE__ */ jsx3("div", { className: "univer-slides-section-heading", children: "\u9875\u9762\u80CC\u666F" }),
1120
+ /* @__PURE__ */ jsxs3("label", { className: "univer-slides-field-row", children: [
1121
+ /* @__PURE__ */ jsx3("span", { children: "\u80CC\u666F\u7C7B\u578B" }),
1122
+ /* @__PURE__ */ jsxs3(
1123
+ "select",
1124
+ {
1125
+ className: "univer-slides-select",
1126
+ value: activeSlide.background?.type ?? "solid",
1127
+ onChange: (e) => {
1128
+ const nextType = e.target.value;
1129
+ commandService.syncExecuteCommand(UpdateSlidePagePropsCommand.id, {
1130
+ unitId,
1131
+ slideId: activeSlide.id,
1132
+ patch: {
1133
+ background: nextType === "gradient" ? {
1134
+ type: "gradient",
1135
+ gradientFrom: "#0f172a",
1136
+ gradientTo: "#1d4ed8",
1137
+ gradientAngleDeg: 135
1138
+ } : nextType === "image" ? { type: "image", imageSrc: activeSlide.background?.imageSrc ?? "" } : { type: "solid", color: snapshot.theme.colors.background }
1139
+ }
1140
+ });
1141
+ },
1142
+ children: [
1143
+ /* @__PURE__ */ jsx3("option", { value: "solid", children: "\u7EAF\u8272\u80CC\u666F" }),
1144
+ /* @__PURE__ */ jsx3("option", { value: "gradient", children: "\u53CC\u8272\u7EBF\u6027\u6E10\u53D8" }),
1145
+ /* @__PURE__ */ jsx3("option", { value: "image", children: "\u80CC\u666F\u56FE\u7247" })
1146
+ ]
1147
+ }
1148
+ )
1149
+ ] }),
1150
+ (activeSlide.background?.type ?? "solid") === "solid" && /* @__PURE__ */ jsxs3("label", { className: "univer-slides-field-row", children: [
1151
+ /* @__PURE__ */ jsx3("span", { children: "\u80CC\u666F\u989C\u8272" }),
1152
+ /* @__PURE__ */ jsx3(
1153
+ "input",
1154
+ {
1155
+ type: "color",
1156
+ value: activeSlide.background?.color ?? snapshot.theme.colors.background,
1157
+ onChange: (e) => commandService.syncExecuteCommand(UpdateSlidePagePropsCommand.id, {
1158
+ unitId,
1159
+ slideId: activeSlide.id,
1160
+ patch: { background: { type: "solid", color: e.target.value } }
1161
+ })
1162
+ }
1163
+ )
1164
+ ] }),
1165
+ activeSlide.background?.type === "gradient" && /* @__PURE__ */ jsxs3("div", { className: "univer-slides-grid-2", children: [
1166
+ /* @__PURE__ */ jsxs3("label", { className: "univer-slides-field-row", children: [
1167
+ /* @__PURE__ */ jsx3("span", { children: "\u8D77\u59CB\u8272" }),
1168
+ /* @__PURE__ */ jsx3(
1169
+ "input",
1170
+ {
1171
+ type: "color",
1172
+ value: activeSlide.background.gradientFrom ?? "#0f172a",
1173
+ onChange: (e) => commandService.syncExecuteCommand(UpdateSlidePagePropsCommand.id, {
1174
+ unitId,
1175
+ slideId: activeSlide.id,
1176
+ patch: {
1177
+ background: {
1178
+ ...activeSlide.background,
1179
+ gradientFrom: e.target.value
1180
+ }
1181
+ }
1182
+ })
1183
+ }
1184
+ )
1185
+ ] }),
1186
+ /* @__PURE__ */ jsxs3("label", { className: "univer-slides-field-row", children: [
1187
+ /* @__PURE__ */ jsx3("span", { children: "\u7ED3\u675F\u8272" }),
1188
+ /* @__PURE__ */ jsx3(
1189
+ "input",
1190
+ {
1191
+ type: "color",
1192
+ value: activeSlide.background.gradientTo ?? "#1d4ed8",
1193
+ onChange: (e) => commandService.syncExecuteCommand(UpdateSlidePagePropsCommand.id, {
1194
+ unitId,
1195
+ slideId: activeSlide.id,
1196
+ patch: {
1197
+ background: {
1198
+ ...activeSlide.background,
1199
+ gradientTo: e.target.value
1200
+ }
1201
+ }
1202
+ })
1203
+ }
1204
+ )
1205
+ ] })
1206
+ ] })
1207
+ ] }),
1208
+ /* @__PURE__ */ jsxs3("div", { className: "univer-slides-field-section", children: [
1209
+ /* @__PURE__ */ jsx3("div", { className: "univer-slides-section-heading", children: "\u9875\u9762\u5207\u6362\u52A8\u753B\u4E0E\u81EA\u52A8\u6362\u7247" }),
1210
+ /* @__PURE__ */ jsxs3("label", { className: "univer-slides-field-row", children: [
1211
+ /* @__PURE__ */ jsx3("span", { children: "\u5207\u6362\u6548\u679C" }),
1212
+ /* @__PURE__ */ jsxs3(
1213
+ "select",
1214
+ {
1215
+ className: "univer-slides-select",
1216
+ value: activeSlide.transition?.type ?? "none",
1217
+ onChange: (e) => commandService.syncExecuteCommand(UpdateSlidePagePropsCommand.id, {
1218
+ unitId,
1219
+ slideId: activeSlide.id,
1220
+ patch: {
1221
+ transition: {
1222
+ ...activeSlide.transition ?? { durationMs: 500 },
1223
+ type: e.target.value
1224
+ }
1225
+ }
1226
+ }),
1227
+ children: [
1228
+ /* @__PURE__ */ jsx3("option", { value: "none", children: "\u65E0\u5207\u6362" }),
1229
+ /* @__PURE__ */ jsx3("option", { value: "fade", children: "\u5E73\u6ED1\u6DE1\u5165 (Fade)" }),
1230
+ /* @__PURE__ */ jsx3("option", { value: "push", children: "\u63A8\u5165 (Push)" }),
1231
+ /* @__PURE__ */ jsx3("option", { value: "wipe", children: "\u64E6\u9664 (Wipe)" }),
1232
+ /* @__PURE__ */ jsx3("option", { value: "split", children: "\u5206\u5272 (Split)" }),
1233
+ /* @__PURE__ */ jsx3("option", { value: "zoom", children: "\u7F29\u653E (Zoom)" }),
1234
+ /* @__PURE__ */ jsx3("option", { value: "morph", children: "\u53D8\u5F62 (Morph)" })
1235
+ ]
1236
+ }
1237
+ )
1238
+ ] }),
1239
+ /* @__PURE__ */ jsxs3("div", { className: "univer-slides-grid-2", children: [
1240
+ /* @__PURE__ */ jsxs3("label", { className: "univer-slides-field-row", children: [
1241
+ /* @__PURE__ */ jsx3("span", { children: "\u65F6\u957F (ms)" }),
1242
+ /* @__PURE__ */ jsx3(
1243
+ "input",
1244
+ {
1245
+ type: "number",
1246
+ className: "univer-slides-input",
1247
+ min: 100,
1248
+ max: 3e3,
1249
+ step: 50,
1250
+ value: activeSlide.transition?.durationMs ?? 500,
1251
+ onChange: (e) => commandService.syncExecuteCommand(UpdateSlidePagePropsCommand.id, {
1252
+ unitId,
1253
+ slideId: activeSlide.id,
1254
+ patch: {
1255
+ transition: {
1256
+ type: activeSlide.transition?.type ?? "fade",
1257
+ ...activeSlide.transition,
1258
+ durationMs: Number(e.target.value) || 500
1259
+ }
1260
+ }
1261
+ })
1262
+ }
1263
+ )
1264
+ ] }),
1265
+ /* @__PURE__ */ jsxs3("label", { className: "univer-slides-field-row", children: [
1266
+ /* @__PURE__ */ jsx3("span", { children: "\u81EA\u52A8\u6362\u7247(ms)" }),
1267
+ /* @__PURE__ */ jsx3(
1268
+ "input",
1269
+ {
1270
+ type: "number",
1271
+ className: "univer-slides-input",
1272
+ min: 0,
1273
+ step: 500,
1274
+ placeholder: "0 \u4E3A\u624B\u52A8",
1275
+ value: activeSlide.transition?.advanceAfterMs ?? 0,
1276
+ onChange: (e) => commandService.syncExecuteCommand(UpdateSlidePagePropsCommand.id, {
1277
+ unitId,
1278
+ slideId: activeSlide.id,
1279
+ patch: {
1280
+ transition: {
1281
+ type: activeSlide.transition?.type ?? "fade",
1282
+ ...activeSlide.transition,
1283
+ advanceAfterMs: Number(e.target.value) || void 0
1284
+ }
1285
+ }
1286
+ })
1287
+ }
1288
+ )
1289
+ ] })
1290
+ ] }),
1291
+ /* @__PURE__ */ jsx3(
1292
+ "button",
1293
+ {
1294
+ type: "button",
1295
+ className: "univer-slides-secondary-btn",
1296
+ onClick: () => commandService.syncExecuteCommand(UpdateSlidePagePropsCommand.id, {
1297
+ unitId,
1298
+ slideId: activeSlide.id,
1299
+ applyToAllSlides: true,
1300
+ patch: {
1301
+ transition: activeSlide.transition ?? { type: "fade", durationMs: 500 }
1302
+ }
1303
+ }),
1304
+ children: "\u5C06\u5F53\u524D\u5207\u6362\u6548\u679C\u5E94\u7528\u5230\u5168\u90E8\u5E7B\u706F\u7247"
1305
+ }
1306
+ )
1307
+ ] })
1308
+ ] }),
1309
+ tab === "element" && /* @__PURE__ */ jsxs3(Fragment2, { children: [
1310
+ !selectedEl ? /* @__PURE__ */ jsx3("div", { className: "univer-slides-field-section", children: /* @__PURE__ */ jsx3("div", { className: "univer-slides-hint", children: "\u5728\u753B\u5E03\u4E2D\u70B9\u51FB\u4EFB\u610F\u5143\u7D20\u53EF\u7F16\u8F91\u5176\u51E0\u4F55\u5C3A\u5BF8\u3001\u586B\u5145\u63CF\u8FB9\u3001\u827A\u672F\u5B57\u3001\u56FE\u8868\u6216\u8868\u683C\u6570\u636E\uFF1B\u4E0B\u65B9\u53EF\u6267\u884C\u52A8\u6001\u6570\u636E\u96C6\u6A21\u677F\u7F16\u8BD1\u3002" }) }) : /* @__PURE__ */ jsxs3(Fragment2, { children: [
1311
+ /* @__PURE__ */ jsxs3("div", { className: "univer-slides-field-section", children: [
1312
+ /* @__PURE__ */ jsx3("div", { className: "univer-slides-section-heading", children: "\u5BF9\u9F50\u4E0E\u56FE\u5C42\u987A\u5E8F" }),
1313
+ /* @__PURE__ */ jsx3("div", { className: "univer-slides-align-row", children: [
1314
+ { mode: "left", label: "\u5DE6" },
1315
+ { mode: "center", label: "\u6C34\u5E73\u4E2D" },
1316
+ { mode: "right", label: "\u53F3" },
1317
+ { mode: "top", label: "\u9876" },
1318
+ { mode: "middle", label: "\u5782\u76F4\u4E2D" },
1319
+ { mode: "bottom", label: "\u5E95" }
1320
+ ].map((al) => /* @__PURE__ */ jsx3(
1321
+ "button",
1322
+ {
1323
+ type: "button",
1324
+ className: "univer-slides-mini-btn",
1325
+ onClick: () => commandService.syncExecuteCommand(AlignSlideElementsCommand2.id, {
1326
+ unitId,
1327
+ slideId: activeSlide.id,
1328
+ mode: al.mode
1329
+ }),
1330
+ children: al.label
1331
+ },
1332
+ al.mode
1333
+ )) }),
1334
+ /* @__PURE__ */ jsxs3("div", { className: "univer-slides-align-row", children: [
1335
+ [
1336
+ { action: "front", label: "\u7F6E\u4E8E\u9876\u5C42" },
1337
+ { action: "forward", label: "\u4E0A\u79FB\u4E00\u5C42" },
1338
+ { action: "backward", label: "\u4E0B\u79FB\u4E00\u5C42" },
1339
+ { action: "back", label: "\u7F6E\u4E8E\u5E95\u5C42" }
1340
+ ].map((ly) => /* @__PURE__ */ jsx3(
1341
+ "button",
1342
+ {
1343
+ type: "button",
1344
+ className: "univer-slides-mini-btn",
1345
+ onClick: () => commandService.syncExecuteCommand(ReorderSlideElementLayerCommand.id, {
1346
+ unitId,
1347
+ slideId: activeSlide.id,
1348
+ elementId: selectedEl.id,
1349
+ action: ly.action
1350
+ }),
1351
+ children: ly.label
1352
+ },
1353
+ ly.action
1354
+ )),
1355
+ /* @__PURE__ */ jsx3(
1356
+ "button",
1357
+ {
1358
+ type: "button",
1359
+ className: "univer-slides-mini-btn is-danger",
1360
+ onClick: () => commandService.syncExecuteCommand(DeleteSlideElementsCommand2.id, {
1361
+ unitId,
1362
+ slideId: activeSlide.id,
1363
+ elementIds: [selectedEl.id]
1364
+ }),
1365
+ children: "\u5220\u9664"
1366
+ }
1367
+ )
1368
+ ] })
1369
+ ] }),
1370
+ /* @__PURE__ */ jsxs3("div", { className: "univer-slides-field-section", children: [
1371
+ /* @__PURE__ */ jsx3("div", { className: "univer-slides-section-heading", children: "\u4F4D\u7F6E\u4E0E\u5C3A\u5BF8 (pt)" }),
1372
+ /* @__PURE__ */ jsxs3("div", { className: "univer-slides-grid-2", children: [
1373
+ /* @__PURE__ */ jsxs3("label", { className: "univer-slides-field-row", children: [
1374
+ /* @__PURE__ */ jsx3("span", { children: "X" }),
1375
+ /* @__PURE__ */ jsx3(
1376
+ "input",
1377
+ {
1378
+ type: "number",
1379
+ className: "univer-slides-input",
1380
+ value: Math.round(selectedEl.x),
1381
+ onChange: (e) => patchElement({ x: Number(e.target.value) || 0 })
1382
+ }
1383
+ )
1384
+ ] }),
1385
+ /* @__PURE__ */ jsxs3("label", { className: "univer-slides-field-row", children: [
1386
+ /* @__PURE__ */ jsx3("span", { children: "Y" }),
1387
+ /* @__PURE__ */ jsx3(
1388
+ "input",
1389
+ {
1390
+ type: "number",
1391
+ className: "univer-slides-input",
1392
+ value: Math.round(selectedEl.y),
1393
+ onChange: (e) => patchElement({ y: Number(e.target.value) || 0 })
1394
+ }
1395
+ )
1396
+ ] }),
1397
+ /* @__PURE__ */ jsxs3("label", { className: "univer-slides-field-row", children: [
1398
+ /* @__PURE__ */ jsx3("span", { children: "\u5BBD" }),
1399
+ /* @__PURE__ */ jsx3(
1400
+ "input",
1401
+ {
1402
+ type: "number",
1403
+ className: "univer-slides-input",
1404
+ value: Math.round(selectedEl.width),
1405
+ onChange: (e) => patchElement({ width: Math.max(16, Number(e.target.value) || 16) })
1406
+ }
1407
+ )
1408
+ ] }),
1409
+ /* @__PURE__ */ jsxs3("label", { className: "univer-slides-field-row", children: [
1410
+ /* @__PURE__ */ jsx3("span", { children: "\u9AD8" }),
1411
+ /* @__PURE__ */ jsx3(
1412
+ "input",
1413
+ {
1414
+ type: "number",
1415
+ className: "univer-slides-input",
1416
+ value: Math.round(selectedEl.height),
1417
+ onChange: (e) => patchElement({ height: Math.max(16, Number(e.target.value) || 16) })
1418
+ }
1419
+ )
1420
+ ] }),
1421
+ /* @__PURE__ */ jsxs3("label", { className: "univer-slides-field-row", children: [
1422
+ /* @__PURE__ */ jsx3("span", { children: "\u65CB\u8F6C\xB0" }),
1423
+ /* @__PURE__ */ jsx3(
1424
+ "input",
1425
+ {
1426
+ type: "number",
1427
+ className: "univer-slides-input",
1428
+ value: selectedEl.rotation ?? 0,
1429
+ onChange: (e) => patchElement({ rotation: Number(e.target.value) || 0 })
1430
+ }
1431
+ )
1432
+ ] }),
1433
+ /* @__PURE__ */ jsxs3("label", { className: "univer-slides-field-row", children: [
1434
+ /* @__PURE__ */ jsx3("span", { children: "\u900F\u660E\u5EA6" }),
1435
+ /* @__PURE__ */ jsx3(
1436
+ "input",
1437
+ {
1438
+ type: "number",
1439
+ step: 0.1,
1440
+ min: 0.1,
1441
+ max: 1,
1442
+ className: "univer-slides-input",
1443
+ value: selectedEl.opacity ?? 1,
1444
+ onChange: (e) => patchElement({ opacity: Math.min(1, Math.max(0.1, Number(e.target.value) || 1)) })
1445
+ }
1446
+ )
1447
+ ] })
1448
+ ] })
1449
+ ] }),
1450
+ selectedEl.type === "text" && /* @__PURE__ */ jsxs3("div", { className: "univer-slides-field-section", children: [
1451
+ /* @__PURE__ */ jsx3("div", { className: "univer-slides-section-heading", children: "\u6587\u672C\u6392\u7248\u4E0E\u827A\u672F\u5B57 (WordArt)" }),
1452
+ /* @__PURE__ */ jsxs3("div", { className: "univer-slides-grid-2", children: [
1453
+ /* @__PURE__ */ jsxs3("label", { className: "univer-slides-field-row", children: [
1454
+ /* @__PURE__ */ jsx3("span", { children: "\u5B57\u53F7" }),
1455
+ /* @__PURE__ */ jsx3(
1456
+ "input",
1457
+ {
1458
+ type: "number",
1459
+ className: "univer-slides-input",
1460
+ value: selectedEl.fontSize ?? 18,
1461
+ onChange: (e) => patchElement({ fontSize: Number(e.target.value) || 18 })
1462
+ }
1463
+ )
1464
+ ] }),
1465
+ /* @__PURE__ */ jsxs3("label", { className: "univer-slides-field-row", children: [
1466
+ /* @__PURE__ */ jsx3("span", { children: "\u989C\u8272" }),
1467
+ /* @__PURE__ */ jsx3(
1468
+ "input",
1469
+ {
1470
+ type: "color",
1471
+ value: selectedEl.color ?? snapshot.theme.colors.text,
1472
+ onChange: (e) => patchElement({ color: e.target.value })
1473
+ }
1474
+ )
1475
+ ] })
1476
+ ] }),
1477
+ /* @__PURE__ */ jsxs3("div", { className: "univer-slides-align-row", children: [
1478
+ /* @__PURE__ */ jsx3(
1479
+ "button",
1480
+ {
1481
+ type: "button",
1482
+ className: `univer-slides-mini-btn${selectedEl.fontWeight === "bold" ? " is-active" : ""}`,
1483
+ onClick: () => patchElement({
1484
+ fontWeight: selectedEl.fontWeight === "bold" ? "normal" : "bold"
1485
+ }),
1486
+ children: "\u52A0\u7C97 B"
1487
+ }
1488
+ ),
1489
+ /* @__PURE__ */ jsx3(
1490
+ "button",
1491
+ {
1492
+ type: "button",
1493
+ className: `univer-slides-mini-btn${selectedEl.italic ? " is-active" : ""}`,
1494
+ onClick: () => patchElement({ italic: !selectedEl.italic }),
1495
+ children: "\u659C\u4F53 I"
1496
+ }
1497
+ ),
1498
+ /* @__PURE__ */ jsx3(
1499
+ "button",
1500
+ {
1501
+ type: "button",
1502
+ className: `univer-slides-mini-btn${selectedEl.bullet ? " is-active" : ""}`,
1503
+ onClick: () => patchElement({
1504
+ bullet: selectedEl.bullet ? false : "disc"
1505
+ }),
1506
+ children: "\u9879\u76EE\u7B26\u53F7"
1507
+ }
1508
+ )
1509
+ ] }),
1510
+ /* @__PURE__ */ jsxs3("label", { className: "univer-slides-checkbox-label", children: [
1511
+ /* @__PURE__ */ jsx3(
1512
+ "input",
1513
+ {
1514
+ type: "checkbox",
1515
+ checked: Boolean(selectedEl.wordArt?.enabled),
1516
+ onChange: (e) => patchElement({
1517
+ wordArt: {
1518
+ enabled: e.target.checked,
1519
+ gradientFrom: selectedEl.wordArt?.gradientFrom ?? "#2563eb",
1520
+ gradientTo: selectedEl.wordArt?.gradientTo ?? "#10b981",
1521
+ shadowColor: "rgba(15,23,42,0.35)",
1522
+ shadowBlur: 5,
1523
+ shadowOffsetY: 3
1524
+ }
1525
+ })
1526
+ }
1527
+ ),
1528
+ /* @__PURE__ */ jsx3("span", { children: "\u542F\u7528\u827A\u672F\u5B57\u6E10\u53D8\u4E0E\u6295\u5F71 (WordArt)" })
1529
+ ] })
1530
+ ] }),
1531
+ selectedEl.type === "shape" && /* @__PURE__ */ jsxs3("div", { className: "univer-slides-field-section", children: [
1532
+ /* @__PURE__ */ jsx3("div", { className: "univer-slides-section-heading", children: "\u51E0\u4F55\u5F62\u72B6\u6837\u5F0F" }),
1533
+ /* @__PURE__ */ jsxs3("label", { className: "univer-slides-field-row", children: [
1534
+ /* @__PURE__ */ jsx3("span", { children: "\u51E0\u4F55\u7C7B\u578B" }),
1535
+ /* @__PURE__ */ jsxs3(
1536
+ "select",
1537
+ {
1538
+ className: "univer-slides-select",
1539
+ value: selectedEl.shapeType,
1540
+ onChange: (e) => patchElement({ shapeType: e.target.value }),
1541
+ children: [
1542
+ /* @__PURE__ */ jsx3("option", { value: "rect", children: "\u77E9\u5F62" }),
1543
+ /* @__PURE__ */ jsx3("option", { value: "roundRect", children: "\u5706\u89D2\u77E9\u5F62" }),
1544
+ /* @__PURE__ */ jsx3("option", { value: "ellipse", children: "\u692D\u5706" }),
1545
+ /* @__PURE__ */ jsx3("option", { value: "triangle", children: "\u4E09\u89D2\u5F62" }),
1546
+ /* @__PURE__ */ jsx3("option", { value: "diamond", children: "\u83F1\u5F62" }),
1547
+ /* @__PURE__ */ jsx3("option", { value: "pentagon", children: "\u4E94\u8FB9\u5F62" }),
1548
+ /* @__PURE__ */ jsx3("option", { value: "hexagon", children: "\u516D\u8FB9\u5F62" }),
1549
+ /* @__PURE__ */ jsx3("option", { value: "octagon", children: "\u516B\u8FB9\u5F62" }),
1550
+ /* @__PURE__ */ jsx3("option", { value: "star5", children: "\u4E94\u89D2\u661F" }),
1551
+ /* @__PURE__ */ jsx3("option", { value: "rightArrow", children: "\u53F3\u7BAD\u5934" }),
1552
+ /* @__PURE__ */ jsx3("option", { value: "leftArrow", children: "\u5DE6\u7BAD\u5934" }),
1553
+ /* @__PURE__ */ jsx3("option", { value: "chevron", children: "\u71D5\u5C3E\u5757" }),
1554
+ /* @__PURE__ */ jsx3("option", { value: "callout", children: "\u6C14\u6CE1\u6846" }),
1555
+ /* @__PURE__ */ jsx3("option", { value: "cloud", children: "\u4E91\u6735\u6846" }),
1556
+ /* @__PURE__ */ jsx3("option", { value: "plus", children: "\u52A0\u53F7" })
1557
+ ]
1558
+ }
1559
+ )
1560
+ ] }),
1561
+ /* @__PURE__ */ jsxs3("div", { className: "univer-slides-grid-2", children: [
1562
+ /* @__PURE__ */ jsxs3("label", { className: "univer-slides-field-row", children: [
1563
+ /* @__PURE__ */ jsx3("span", { children: "\u586B\u5145\u8272" }),
1564
+ /* @__PURE__ */ jsx3(
1565
+ "input",
1566
+ {
1567
+ type: "color",
1568
+ value: selectedEl.fillColor || "#2563eb",
1569
+ onChange: (e) => patchElement({ fillColor: e.target.value })
1570
+ }
1571
+ )
1572
+ ] }),
1573
+ /* @__PURE__ */ jsxs3("label", { className: "univer-slides-field-row", children: [
1574
+ /* @__PURE__ */ jsx3("span", { children: "\u63CF\u8FB9\u8272" }),
1575
+ /* @__PURE__ */ jsx3(
1576
+ "input",
1577
+ {
1578
+ type: "color",
1579
+ value: selectedEl.strokeColor || "#1d4ed8",
1580
+ onChange: (e) => patchElement({ strokeColor: e.target.value })
1581
+ }
1582
+ )
1583
+ ] })
1584
+ ] })
1585
+ ] }),
1586
+ selectedEl.type === "connector" && /* @__PURE__ */ jsxs3("div", { className: "univer-slides-field-section", children: [
1587
+ /* @__PURE__ */ jsx3("div", { className: "univer-slides-section-heading", children: "\u8FDE\u63A5\u7EBF\u5C5E\u6027" }),
1588
+ /* @__PURE__ */ jsxs3("label", { className: "univer-slides-field-row", children: [
1589
+ /* @__PURE__ */ jsx3("span", { children: "\u8FDE\u63A5\u6587\u672C" }),
1590
+ /* @__PURE__ */ jsx3(
1591
+ "input",
1592
+ {
1593
+ className: "univer-slides-input",
1594
+ value: selectedEl.label ?? "",
1595
+ onChange: (e) => patchElement({ label: e.target.value })
1596
+ }
1597
+ )
1598
+ ] })
1599
+ ] }),
1600
+ selectedEl.type === "chart" && /* @__PURE__ */ jsxs3("div", { className: "univer-slides-field-section", children: [
1601
+ /* @__PURE__ */ jsx3("div", { className: "univer-slides-section-heading", children: "\u56FE\u8868\u7C7B\u578B\u4E0E\u6570\u636E\u96C6\u7ED1\u5B9A" }),
1602
+ /* @__PURE__ */ jsxs3("label", { className: "univer-slides-field-row", children: [
1603
+ /* @__PURE__ */ jsx3("span", { children: "\u56FE\u8868\u7C7B\u578B" }),
1604
+ /* @__PURE__ */ jsxs3(
1605
+ "select",
1606
+ {
1607
+ className: "univer-slides-select",
1608
+ value: selectedEl.chartType,
1609
+ onChange: (e) => patchElement({ chartType: e.target.value }),
1610
+ children: [
1611
+ /* @__PURE__ */ jsx3("option", { value: "column", children: "\u7C07\u72B6\u67F1\u5F62\u56FE" }),
1612
+ /* @__PURE__ */ jsx3("option", { value: "bar", children: "\u6C34\u5E73\u6761\u5F62\u56FE" }),
1613
+ /* @__PURE__ */ jsx3("option", { value: "line", children: "\u6298\u7EBF\u56FE" }),
1614
+ /* @__PURE__ */ jsx3("option", { value: "combo", children: "\u67F1\u7EBF\u7EC4\u5408\u56FE" }),
1615
+ /* @__PURE__ */ jsx3("option", { value: "pie", children: "\u997C\u56FE" }),
1616
+ /* @__PURE__ */ jsx3("option", { value: "doughnut", children: "\u73AF\u5F62\u56FE" }),
1617
+ /* @__PURE__ */ jsx3("option", { value: "area", children: "\u9762\u79EF\u56FE" }),
1618
+ /* @__PURE__ */ jsx3("option", { value: "radar", children: "\u96F7\u8FBE\u56FE" }),
1619
+ /* @__PURE__ */ jsx3("option", { value: "scatter", children: "\u6563\u70B9\u56FE" })
1620
+ ]
1621
+ }
1622
+ )
1623
+ ] }),
1624
+ /* @__PURE__ */ jsxs3("label", { className: "univer-slides-field-row", children: [
1625
+ /* @__PURE__ */ jsx3("span", { children: "\u56FE\u8868\u6807\u9898" }),
1626
+ /* @__PURE__ */ jsx3(
1627
+ "input",
1628
+ {
1629
+ className: "univer-slides-input",
1630
+ value: selectedEl.title ?? "",
1631
+ onChange: (e) => patchElement({ title: e.target.value })
1632
+ }
1633
+ )
1634
+ ] }),
1635
+ /* @__PURE__ */ jsxs3("label", { className: "univer-slides-field-row", children: [
1636
+ /* @__PURE__ */ jsx3("span", { children: "\u5206\u7C7B\u8F74(\u9017\u53F7)" }),
1637
+ /* @__PURE__ */ jsx3(
1638
+ "input",
1639
+ {
1640
+ className: "univer-slides-input",
1641
+ value: selectedEl.categories.join(", "),
1642
+ onChange: (e) => patchElement({
1643
+ categories: e.target.value.split(",").map((s) => s.trim())
1644
+ })
1645
+ }
1646
+ )
1647
+ ] }),
1648
+ /* @__PURE__ */ jsxs3("label", { className: "univer-slides-field-row", children: [
1649
+ /* @__PURE__ */ jsx3("span", { children: "\u6570\u636E\u96C6\u7F16\u7801" }),
1650
+ /* @__PURE__ */ jsx3(
1651
+ "input",
1652
+ {
1653
+ className: "univer-slides-input",
1654
+ placeholder: "\u5982 quarterlyTrend",
1655
+ value: selectedEl.datasetCode ?? "",
1656
+ onChange: (e) => patchElement({ datasetCode: e.target.value })
1657
+ }
1658
+ )
1659
+ ] })
1660
+ ] }),
1661
+ selectedEl.type === "smartArt" && /* @__PURE__ */ jsxs3("div", { className: "univer-slides-field-section", children: [
1662
+ /* @__PURE__ */ jsx3("div", { className: "univer-slides-section-heading", children: "\u667A\u80FD\u56FE\u793A SmartArt \u8282\u70B9" }),
1663
+ /* @__PURE__ */ jsxs3("label", { className: "univer-slides-field-row", children: [
1664
+ /* @__PURE__ */ jsx3("span", { children: "\u56FE\u793A\u5E03\u5C40" }),
1665
+ /* @__PURE__ */ jsxs3(
1666
+ "select",
1667
+ {
1668
+ className: "univer-slides-select",
1669
+ value: selectedEl.layout,
1670
+ onChange: (e) => patchElement({
1671
+ layout: e.target.value
1672
+ }),
1673
+ children: [
1674
+ /* @__PURE__ */ jsx3("option", { value: "process", children: "\u9012\u8FDB\u6D41\u7A0B (Process)" }),
1675
+ /* @__PURE__ */ jsx3("option", { value: "cycle", children: "\u95ED\u73AF\u5FAA\u73AF (Cycle)" }),
1676
+ /* @__PURE__ */ jsx3("option", { value: "hierarchy", children: "\u7EC4\u7EC7\u67B6\u6784 (Hierarchy)" }),
1677
+ /* @__PURE__ */ jsx3("option", { value: "list", children: "\u5206\u7EC4\u5217\u8868 (List)" }),
1678
+ /* @__PURE__ */ jsx3("option", { value: "pyramid", children: "\u6218\u7565\u91D1\u5B57\u5854 (Pyramid)" })
1679
+ ]
1680
+ }
1681
+ )
1682
+ ] }),
1683
+ selectedEl.items.map((item, idx) => /* @__PURE__ */ jsxs3("div", { className: "univer-slides-smartart-row", children: [
1684
+ /* @__PURE__ */ jsx3(
1685
+ "input",
1686
+ {
1687
+ className: "univer-slides-input",
1688
+ value: item.title,
1689
+ onChange: (e) => {
1690
+ const nextItems = Tools.deepClone(selectedEl.items);
1691
+ nextItems[idx].title = e.target.value;
1692
+ patchElement({ items: nextItems });
1693
+ }
1694
+ }
1695
+ ),
1696
+ /* @__PURE__ */ jsx3(
1697
+ "input",
1698
+ {
1699
+ className: "univer-slides-input",
1700
+ placeholder: "\u526F\u6807\u9898",
1701
+ value: item.subtitle ?? "",
1702
+ onChange: (e) => {
1703
+ const nextItems = Tools.deepClone(selectedEl.items);
1704
+ nextItems[idx].subtitle = e.target.value;
1705
+ patchElement({ items: nextItems });
1706
+ }
1707
+ }
1708
+ )
1709
+ ] }, item.id)),
1710
+ /* @__PURE__ */ jsx3(
1711
+ "button",
1712
+ {
1713
+ type: "button",
1714
+ className: "univer-slides-secondary-btn",
1715
+ onClick: () => {
1716
+ const nextItems = [
1717
+ ...Tools.deepClone(selectedEl.items),
1718
+ { id: `sa-${generateRandomId(4)}`, title: "\u65B0\u9636\u6BB5\u8282\u70B9", subtitle: "\u5173\u952E\u52A8\u4F5C" }
1719
+ ];
1720
+ patchElement({ items: nextItems });
1721
+ },
1722
+ children: "+ \u6DFB\u52A0\u56FE\u793A\u8282\u70B9"
1723
+ }
1724
+ )
1725
+ ] }),
1726
+ selectedEl.type === "table" && /* @__PURE__ */ jsxs3("div", { className: "univer-slides-field-section", children: [
1727
+ /* @__PURE__ */ jsxs3("div", { className: "univer-slides-section-heading", children: [
1728
+ "\u8868\u683C\u7ED3\u6784\u4E0E #",
1729
+ " \u5FAA\u73AF\u7ED1\u5B9A"
1730
+ ] }),
1731
+ /* @__PURE__ */ jsxs3("label", { className: "univer-slides-field-row", children: [
1732
+ /* @__PURE__ */ jsx3("span", { children: "\u5FAA\u73AF\u6570\u636E\u96C6" }),
1733
+ /* @__PURE__ */ jsx3(
1734
+ "input",
1735
+ {
1736
+ className: "univer-slides-input",
1737
+ placeholder: "\u5982 sales\uFF08\u914D\u5408 #{sales.field}\uFF09",
1738
+ value: selectedEl.datasetLoopCode ?? "",
1739
+ onChange: (e) => patchElement({ datasetLoopCode: e.target.value })
1740
+ }
1741
+ )
1742
+ ] }),
1743
+ /* @__PURE__ */ jsxs3("div", { className: "univer-slides-align-row", children: [
1744
+ /* @__PURE__ */ jsx3(
1745
+ "button",
1746
+ {
1747
+ type: "button",
1748
+ className: "univer-slides-mini-btn",
1749
+ onClick: () => {
1750
+ const tbl = selectedEl;
1751
+ const newCells = [
1752
+ ...Tools.deepClone(tbl.cells),
1753
+ Array.from({ length: tbl.cols }, () => ({ text: "" }))
1754
+ ];
1755
+ patchElement({
1756
+ rows: tbl.rows + 1,
1757
+ rowHeights: [...tbl.rowHeights, 40],
1758
+ height: tbl.height + 40,
1759
+ cells: newCells
1760
+ });
1761
+ },
1762
+ children: "+ \u6DFB\u52A0\u884C"
1763
+ }
1764
+ ),
1765
+ /* @__PURE__ */ jsx3(
1766
+ "button",
1767
+ {
1768
+ type: "button",
1769
+ className: "univer-slides-mini-btn",
1770
+ onClick: () => {
1771
+ const tbl = selectedEl;
1772
+ const newCells = Tools.deepClone(tbl.cells).map((r, rIdx) => [
1773
+ ...r,
1774
+ { text: rIdx === 0 ? "\u65B0\u5217" : "", bold: rIdx === 0 }
1775
+ ]);
1776
+ patchElement({
1777
+ cols: tbl.cols + 1,
1778
+ colWidths: [...tbl.colWidths, 120],
1779
+ width: tbl.width + 120,
1780
+ cells: newCells
1781
+ });
1782
+ },
1783
+ children: "+ \u6DFB\u52A0\u5217"
1784
+ }
1785
+ )
1786
+ ] })
1787
+ ] })
1788
+ ] }),
1789
+ /* @__PURE__ */ jsxs3("div", { className: "univer-slides-field-section", children: [
1790
+ /* @__PURE__ */ jsxs3("div", { className: "univer-slides-section-heading", children: [
1791
+ "\u52A8\u6001\u62A5\u544A\u5F15\u64CE ($",
1792
+ "{}",
1793
+ " / #",
1794
+ "{}",
1795
+ " \u6570\u636E\u96C6\u7ED1\u5B9A)"
1796
+ ] }),
1797
+ /* @__PURE__ */ jsxs3("div", { className: "univer-slides-hint", children: [
1798
+ "\u5DF2\u8BC6\u522B\u6570\u636E\u96C6\u7F16\u7801\uFF1A",
1799
+ extractedCodes.codes.length > 0 ? extractedCodes.codes.join(", ") : "\u6682\u65E0"
1800
+ ] }),
1801
+ /* @__PURE__ */ jsxs3("label", { className: "univer-slides-field-row", children: [
1802
+ /* @__PURE__ */ jsx3("span", { children: "\u5355\u9875\u6700\u5927\u884C\u6570" }),
1803
+ /* @__PURE__ */ jsx3(
1804
+ "input",
1805
+ {
1806
+ type: "number",
1807
+ min: 1,
1808
+ max: 50,
1809
+ className: "univer-slides-input",
1810
+ value: maxRowsInput,
1811
+ onChange: (e) => setMaxRowsInput(Number(e.target.value) || 5)
1812
+ }
1813
+ )
1814
+ ] }),
1815
+ /* @__PURE__ */ jsx3(
1816
+ "textarea",
1817
+ {
1818
+ className: "univer-slides-code-textarea",
1819
+ rows: 6,
1820
+ value: datasetJson,
1821
+ onChange: (e) => setDatasetJson(e.target.value)
1822
+ }
1823
+ ),
1824
+ datasetError && /* @__PURE__ */ jsx3("div", { className: "univer-slides-error-msg", children: datasetError }),
1825
+ /* @__PURE__ */ jsx3(
1826
+ "button",
1827
+ {
1828
+ type: "button",
1829
+ className: "univer-slides-primary-btn is-block",
1830
+ onClick: handleRunTemplateCompile,
1831
+ children: "\u6CE8\u5165\u6570\u636E\u96C6\u5E76\u81EA\u52A8\u5206\u9875\u6E32\u67D3"
1832
+ }
1833
+ )
1834
+ ] })
1835
+ ] }),
1836
+ tab === "animation" && /* @__PURE__ */ jsxs3("div", { className: "univer-slides-field-section", children: [
1837
+ /* @__PURE__ */ jsx3("div", { className: "univer-slides-section-heading", children: "\u5143\u7D20\u52A8\u753B\u65F6\u95F4\u8F74" }),
1838
+ /* @__PURE__ */ jsxs3("div", { className: "univer-slides-align-row", children: [
1839
+ /* @__PURE__ */ jsx3(
1840
+ "button",
1841
+ {
1842
+ type: "button",
1843
+ className: "univer-slides-mini-btn",
1844
+ onClick: () => handleAddAnimation("entrance", "fadeIn"),
1845
+ children: "+ \u8FDB\u5165\u52A8\u753B"
1846
+ }
1847
+ ),
1848
+ /* @__PURE__ */ jsx3(
1849
+ "button",
1850
+ {
1851
+ type: "button",
1852
+ className: "univer-slides-mini-btn",
1853
+ onClick: () => handleAddAnimation("emphasis", "pulse"),
1854
+ children: "+ \u5F3A\u8C03\u52A8\u753B"
1855
+ }
1856
+ ),
1857
+ /* @__PURE__ */ jsx3(
1858
+ "button",
1859
+ {
1860
+ type: "button",
1861
+ className: "univer-slides-mini-btn",
1862
+ onClick: () => handleAddAnimation("exit", "fadeOut"),
1863
+ children: "+ \u9000\u51FA\u52A8\u753B"
1864
+ }
1865
+ )
1866
+ ] }),
1867
+ (activeSlide.animations ?? []).length === 0 ? /* @__PURE__ */ jsx3("div", { className: "univer-slides-hint", children: "\u5F53\u524D\u9875\u6682\u65E0\u5143\u7D20\u52A8\u753B\u3002\u9009\u4E2D\u753B\u5E03\u5143\u7D20\u540E\u70B9\u51FB\u4E0A\u65B9\u6309\u94AE\u5373\u53EF\u6DFB\u52A0\u8FDB\u5165\u3001\u5F3A\u8C03\u6216\u9000\u51FA\u65F6\u95F4\u8F74\u6548\u679C\u3002" }) : /* @__PURE__ */ jsx3("div", { className: "univer-slides-anim-list", children: activeSlide.animations.map((anim, idx) => {
1868
+ const target = activeSlide.elements[anim.elementId];
1869
+ return /* @__PURE__ */ jsxs3("div", { className: "univer-slides-anim-card", children: [
1870
+ /* @__PURE__ */ jsxs3("div", { className: "univer-slides-anim-card-top", children: [
1871
+ /* @__PURE__ */ jsx3("span", { className: "univer-slides-thumb-index", children: idx + 1 }),
1872
+ /* @__PURE__ */ jsx3("span", { className: "univer-slides-anim-target", children: target?.name || target?.type || anim.elementId }),
1873
+ /* @__PURE__ */ jsx3(
1874
+ "button",
1875
+ {
1876
+ type: "button",
1877
+ className: "univer-slides-icon-btn is-danger",
1878
+ onClick: () => removeAnimationItem(anim.id),
1879
+ children: "\xD7"
1880
+ }
1881
+ )
1882
+ ] }),
1883
+ /* @__PURE__ */ jsxs3("div", { className: "univer-slides-grid-2", children: [
1884
+ /* @__PURE__ */ jsxs3(
1885
+ "select",
1886
+ {
1887
+ className: "univer-slides-select",
1888
+ value: anim.effect,
1889
+ onChange: (e) => updateAnimationItem(anim.id, {
1890
+ effect: e.target.value
1891
+ }),
1892
+ children: [
1893
+ /* @__PURE__ */ jsx3("option", { value: "appear", children: "\u76F4\u63A5\u51FA\u73B0 (Appear)" }),
1894
+ /* @__PURE__ */ jsx3("option", { value: "fadeIn", children: "\u5E73\u6ED1\u6DE1\u5165 (Fade In)" }),
1895
+ /* @__PURE__ */ jsx3("option", { value: "flyIn", children: "\u98DE\u5165 (Fly In)" }),
1896
+ /* @__PURE__ */ jsx3("option", { value: "zoomIn", children: "\u7F29\u653E\u8FDB\u5165 (Zoom In)" }),
1897
+ /* @__PURE__ */ jsx3("option", { value: "wipe", children: "\u64E6\u9664\u8FDB\u5165 (Wipe)" }),
1898
+ /* @__PURE__ */ jsx3("option", { value: "pulse", children: "\u8109\u51B2\u5F3A\u8C03 (Pulse)" }),
1899
+ /* @__PURE__ */ jsx3("option", { value: "fadeOut", children: "\u6DE1\u51FA\u6D88\u5931 (Fade Out)" })
1900
+ ]
1901
+ }
1902
+ ),
1903
+ /* @__PURE__ */ jsxs3(
1904
+ "select",
1905
+ {
1906
+ className: "univer-slides-select",
1907
+ value: anim.trigger,
1908
+ onChange: (e) => updateAnimationItem(anim.id, {
1909
+ trigger: e.target.value
1910
+ }),
1911
+ children: [
1912
+ /* @__PURE__ */ jsx3("option", { value: "onClick", children: "\u5355\u51FB\u65F6" }),
1913
+ /* @__PURE__ */ jsx3("option", { value: "withPrevious", children: "\u4E0E\u4E0A\u4E00\u52A8\u753B\u540C\u65F6" }),
1914
+ /* @__PURE__ */ jsx3("option", { value: "afterPrevious", children: "\u4E0A\u4E00\u52A8\u753B\u4E4B\u540E" })
1915
+ ]
1916
+ }
1917
+ )
1918
+ ] }),
1919
+ /* @__PURE__ */ jsxs3("div", { className: "univer-slides-grid-2", children: [
1920
+ /* @__PURE__ */ jsxs3("label", { className: "univer-slides-field-row", children: [
1921
+ /* @__PURE__ */ jsx3("span", { children: "\u65F6\u957F(ms)" }),
1922
+ /* @__PURE__ */ jsx3(
1923
+ "input",
1924
+ {
1925
+ type: "number",
1926
+ className: "univer-slides-input",
1927
+ value: anim.durationMs,
1928
+ onChange: (e) => updateAnimationItem(anim.id, {
1929
+ durationMs: Number(e.target.value) || 500
1930
+ })
1931
+ }
1932
+ )
1933
+ ] }),
1934
+ /* @__PURE__ */ jsxs3("label", { className: "univer-slides-field-row", children: [
1935
+ /* @__PURE__ */ jsx3("span", { children: "\u5EF6\u8FDF(ms)" }),
1936
+ /* @__PURE__ */ jsx3(
1937
+ "input",
1938
+ {
1939
+ type: "number",
1940
+ className: "univer-slides-input",
1941
+ value: anim.delayMs,
1942
+ onChange: (e) => updateAnimationItem(anim.id, {
1943
+ delayMs: Number(e.target.value) || 0
1944
+ })
1945
+ }
1946
+ )
1947
+ ] })
1948
+ ] }),
1949
+ anim.effect === "flyIn" && /* @__PURE__ */ jsxs3("label", { className: "univer-slides-field-row", children: [
1950
+ /* @__PURE__ */ jsx3("span", { children: "\u98DE\u5165\u65B9\u5411" }),
1951
+ /* @__PURE__ */ jsxs3(
1952
+ "select",
1953
+ {
1954
+ className: "univer-slides-select",
1955
+ value: anim.direction ?? "up",
1956
+ onChange: (e) => updateAnimationItem(anim.id, {
1957
+ direction: e.target.value
1958
+ }),
1959
+ children: [
1960
+ /* @__PURE__ */ jsx3("option", { value: "up", children: "\u81EA\u5E95\u90E8\u5411\u4E0A" }),
1961
+ /* @__PURE__ */ jsx3("option", { value: "down", children: "\u81EA\u9876\u90E8\u5411\u4E0B" }),
1962
+ /* @__PURE__ */ jsx3("option", { value: "left", children: "\u81EA\u53F3\u4FA7\u5411\u5DE6" }),
1963
+ /* @__PURE__ */ jsx3("option", { value: "right", children: "\u81EA\u5DE6\u4FA7\u5411\u53F3" })
1964
+ ]
1965
+ }
1966
+ )
1967
+ ] })
1968
+ ] }, anim.id);
1969
+ }) })
1970
+ ] })
1971
+ ] })
1972
+ ] });
1973
+ };
1974
+
1975
+ // src/views/left-sidebar/SlidesLeftSidebar.tsx
1976
+ import { ICommandService as ICommandService4 } from "@univerjs/core";
1977
+ import { useDependency as useDependency4 } from "@univerjs/ui";
1978
+ import {
1979
+ AddSlidePageCommand as AddSlidePageCommand2,
1980
+ AddSlideSectionCommand,
1981
+ DeleteSlidePageCommand,
1982
+ DeleteSlideSectionCommand,
1983
+ DuplicateSlidePageCommand as DuplicateSlidePageCommand2,
1984
+ ReorderSlidePagesCommand,
1985
+ renderSlidePageToSvg,
1986
+ SetActiveSlidePageCommand,
1987
+ UpdateSlidePagePropsCommand as UpdateSlidePagePropsCommand2,
1988
+ UpdateSlideSectionCommand
1989
+ } from "@yudaocode/univer-slides";
1990
+ import { useState as useState3 } from "react";
1991
+ import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
1992
+ var LAYOUT_OPTIONS = [
1993
+ { type: "titleAndContent", label: "\u6807\u9898\u548C\u5185\u5BB9", desc: "\u9876\u90E8\u6807\u9898 + \u6B63\u6587\u6838\u5FC3\u533A" },
1994
+ { type: "title", label: "\u6807\u9898\u5E7B\u706F\u7247", desc: "\u5C45\u4E2D\u4E3B\u526F\u6807\u9898\u5C01\u9762" },
1995
+ { type: "sectionHeader", label: "\u8282\u6807\u9898", desc: "\u7AE0\u8282\u8FC7\u6E21\u5BFC\u8BFB\u9875" },
1996
+ { type: "twoColumn", label: "\u4E24\u680F\u5185\u5BB9", desc: "\u5DE6\u53F3\u53CC\u680F\u5E76\u5217\u8981\u70B9" },
1997
+ { type: "comparison", label: "\u5BF9\u6BD4\u7248\u5F0F", desc: "\u5E26\u5B50\u6807\u9898\u7684\u65B9\u6848\u5BF9\u6BD4" },
1998
+ { type: "blank", label: "\u7A7A\u767D\u7248\u5F0F", desc: "\u81EA\u7531\u6392\u5E03\u753B\u5E03" }
1999
+ ];
2000
+ var SlidesLeftSidebar = () => {
2001
+ const commandService = useDependency4(ICommandService4);
2002
+ const { unit, snapshot, activeSlide } = useActiveSlideUnit();
2003
+ const [layoutMenuOpen, setLayoutMenuOpen] = useState3(false);
2004
+ const [editingSecId, setEditingSecId] = useState3(null);
2005
+ const [editingSecTitle, setEditingSecTitle] = useState3("");
2006
+ if (!unit || !snapshot) {
2007
+ return /* @__PURE__ */ jsx4("div", { className: "univer-slides-left-sidebar univer-slides-empty", children: /* @__PURE__ */ jsx4("span", { children: "\u6682\u65E0\u6D3B\u52A8\u7684\u5E7B\u706F\u7247\u6587\u7A3F" }) });
2008
+ }
2009
+ const unitId = unit.getUnitId();
2010
+ const totalSlides = snapshot.slideOrder.length;
2011
+ const handleAddSlide = (layoutType = "titleAndContent") => {
2012
+ commandService.syncExecuteCommand(AddSlidePageCommand2.id, {
2013
+ unitId,
2014
+ layoutId: layoutType
2015
+ });
2016
+ setLayoutMenuOpen(false);
2017
+ };
2018
+ const handleAddSection = () => {
2019
+ commandService.syncExecuteCommand(AddSlideSectionCommand.id, {
2020
+ unitId,
2021
+ title: `\u7AE0\u8282 ${snapshot.sections.length + 1}`,
2022
+ slideIds: activeSlide ? [activeSlide.id] : []
2023
+ });
2024
+ };
2025
+ const handleToggleSection = (sec) => {
2026
+ commandService.syncExecuteCommand(UpdateSlideSectionCommand.id, {
2027
+ unitId,
2028
+ sectionId: sec.id,
2029
+ patch: { collapsed: !sec.collapsed }
2030
+ });
2031
+ };
2032
+ const commitSectionTitle = (sectionId) => {
2033
+ if (editingSecTitle.trim()) {
2034
+ commandService.syncExecuteCommand(UpdateSlideSectionCommand.id, {
2035
+ unitId,
2036
+ sectionId,
2037
+ patch: { title: editingSecTitle.trim() }
2038
+ });
2039
+ }
2040
+ setEditingSecId(null);
2041
+ };
2042
+ const assignedSet = /* @__PURE__ */ new Set();
2043
+ for (const sec of snapshot.sections) {
2044
+ for (const sid of sec.slideIds) assignedSet.add(sid);
2045
+ }
2046
+ const unassignedIds = snapshot.slideOrder.filter((id) => !assignedSet.has(id));
2047
+ const effectiveSections = snapshot.sections.length > 0 ? snapshot.sections.map(
2048
+ (sec, idx) => idx === snapshot.sections.length - 1 && unassignedIds.length > 0 ? { ...sec, slideIds: [...sec.slideIds, ...unassignedIds] } : sec
2049
+ ) : [{ id: "sec-virtual", title: "\u5168\u90E8\u5E7B\u706F\u7247", slideIds: snapshot.slideOrder, collapsed: false }];
2050
+ const renderSlideCard = (slide) => {
2051
+ const globalIndex = snapshot.slideOrder.indexOf(slide.id);
2052
+ const slideNum = globalIndex + 1;
2053
+ const isActive = activeSlide?.id === slide.id;
2054
+ const svgMarkup = renderSlidePageToSvg(slide, snapshot, slideNum);
2055
+ const hasTransition = Boolean(slide.transition?.type && slide.transition.type !== "none");
2056
+ const hasNotes = Boolean(slide.speakerNotes && slide.speakerNotes.trim().length > 0);
2057
+ const animCount = slide.animations?.length ?? 0;
2058
+ return /* @__PURE__ */ jsxs4(
2059
+ "div",
2060
+ {
2061
+ className: `univer-slides-thumb-card${isActive ? " is-active" : ""}${slide.hidden ? " is-hidden" : ""}`,
2062
+ onClick: () => commandService.syncExecuteCommand(SetActiveSlidePageCommand.id, {
2063
+ unitId,
2064
+ slideId: slide.id
2065
+ }),
2066
+ children: [
2067
+ /* @__PURE__ */ jsxs4("div", { className: "univer-slides-thumb-top", children: [
2068
+ /* @__PURE__ */ jsx4("span", { className: "univer-slides-thumb-index", children: slideNum }),
2069
+ /* @__PURE__ */ jsx4("span", { className: "univer-slides-thumb-title", title: slide.title, children: slide.title || `\u5E7B\u706F\u7247 ${slideNum}` }),
2070
+ /* @__PURE__ */ jsxs4("div", { className: "univer-slides-thumb-badges", children: [
2071
+ slide.hidden && /* @__PURE__ */ jsx4("span", { className: "univer-slides-badge is-muted", title: "\u653E\u6620\u65F6\u9690\u85CF", children: "\u9690\u85CF" }),
2072
+ hasTransition && /* @__PURE__ */ jsx4("span", { className: "univer-slides-badge is-accent", title: `\u5207\u6362\u52A8\u753B: ${slide.transition?.type}`, children: "\u5207\u6362" }),
2073
+ animCount > 0 && /* @__PURE__ */ jsxs4("span", { className: "univer-slides-badge is-violet", title: `\u5143\u7D20\u52A8\u753B: ${animCount} \u9879`, children: [
2074
+ "\u52A8\u753B ",
2075
+ animCount
2076
+ ] }),
2077
+ hasNotes && /* @__PURE__ */ jsx4("span", { className: "univer-slides-badge is-emerald", title: "\u542B\u6F14\u8BB2\u8005\u5907\u6CE8", children: "\u5907\u6CE8" })
2078
+ ] })
2079
+ ] }),
2080
+ /* @__PURE__ */ jsx4(
2081
+ "div",
2082
+ {
2083
+ className: "univer-slides-thumb-preview",
2084
+ dangerouslySetInnerHTML: { __html: svgMarkup }
2085
+ }
2086
+ ),
2087
+ /* @__PURE__ */ jsxs4(
2088
+ "div",
2089
+ {
2090
+ className: "univer-slides-thumb-actions",
2091
+ onClick: (e) => e.stopPropagation(),
2092
+ children: [
2093
+ /* @__PURE__ */ jsx4(
2094
+ "button",
2095
+ {
2096
+ type: "button",
2097
+ className: "univer-slides-icon-btn",
2098
+ title: "\u590D\u5236\u5E7B\u706F\u7247",
2099
+ onClick: () => commandService.syncExecuteCommand(DuplicateSlidePageCommand2.id, {
2100
+ unitId,
2101
+ slideId: slide.id
2102
+ }),
2103
+ children: /* @__PURE__ */ jsxs4("svg", { viewBox: "0 0 16 16", width: "13", height: "13", fill: "none", stroke: "currentColor", children: [
2104
+ /* @__PURE__ */ jsx4("rect", { x: "4.5", y: "4.5", width: "9", height: "8", rx: "1.2", strokeWidth: "1.3" }),
2105
+ /* @__PURE__ */ jsx4("path", { d: "M2.5 10V3.5C2.5 2.9 2.9 2.5 3.5 2.5H10", strokeWidth: "1.3", strokeLinecap: "round" })
2106
+ ] })
2107
+ }
2108
+ ),
2109
+ /* @__PURE__ */ jsx4(
2110
+ "button",
2111
+ {
2112
+ type: "button",
2113
+ className: "univer-slides-icon-btn",
2114
+ title: slide.hidden ? "\u53D6\u6D88\u9690\u85CF" : "\u9690\u85CF\u6B64\u9875",
2115
+ onClick: () => commandService.syncExecuteCommand(UpdateSlidePagePropsCommand2.id, {
2116
+ unitId,
2117
+ slideId: slide.id,
2118
+ patch: { hidden: !slide.hidden }
2119
+ }),
2120
+ children: /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 16 16", width: "13", height: "13", fill: "none", stroke: "currentColor", children: slide.hidden ? /* @__PURE__ */ jsx4("path", { d: "M2.5 2.5L13.5 13.5M3 8C4.5 5 6.3 4 8 4C10.5 4 12.5 5.5 13.5 8", strokeWidth: "1.3", strokeLinecap: "round" }) : /* @__PURE__ */ jsxs4(Fragment3, { children: [
2121
+ /* @__PURE__ */ jsx4("path", { d: "M1.8 8C3 5.2 5.3 3.8 8 3.8C10.7 3.8 13 5.2 14.2 8C13 10.8 10.7 12.2 8 12.2C5.3 12.2 3 10.8 1.8 8Z", strokeWidth: "1.3" }),
2122
+ /* @__PURE__ */ jsx4("circle", { cx: "8", cy: "8", r: "1.8", strokeWidth: "1.3" })
2123
+ ] }) })
2124
+ }
2125
+ ),
2126
+ /* @__PURE__ */ jsx4(
2127
+ "button",
2128
+ {
2129
+ type: "button",
2130
+ className: "univer-slides-icon-btn",
2131
+ title: "\u4E0A\u79FB",
2132
+ disabled: globalIndex <= 0,
2133
+ onClick: () => commandService.syncExecuteCommand(ReorderSlidePagesCommand.id, {
2134
+ unitId,
2135
+ slideId: slide.id,
2136
+ direction: "up"
2137
+ }),
2138
+ children: /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 16 16", width: "13", height: "13", fill: "none", stroke: "currentColor", children: /* @__PURE__ */ jsx4("path", { d: "M8 12.5V3.5M8 3.5L4.5 7M8 3.5L11.5 7", strokeWidth: "1.4", strokeLinecap: "round", strokeLinejoin: "round" }) })
2139
+ }
2140
+ ),
2141
+ /* @__PURE__ */ jsx4(
2142
+ "button",
2143
+ {
2144
+ type: "button",
2145
+ className: "univer-slides-icon-btn",
2146
+ title: "\u4E0B\u79FB",
2147
+ disabled: globalIndex >= totalSlides - 1,
2148
+ onClick: () => commandService.syncExecuteCommand(ReorderSlidePagesCommand.id, {
2149
+ unitId,
2150
+ slideId: slide.id,
2151
+ direction: "down"
2152
+ }),
2153
+ children: /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 16 16", width: "13", height: "13", fill: "none", stroke: "currentColor", children: /* @__PURE__ */ jsx4("path", { d: "M8 3.5V12.5M8 12.5L4.5 9M8 12.5L11.5 9", strokeWidth: "1.4", strokeLinecap: "round", strokeLinejoin: "round" }) })
2154
+ }
2155
+ ),
2156
+ /* @__PURE__ */ jsx4(
2157
+ "button",
2158
+ {
2159
+ type: "button",
2160
+ className: "univer-slides-icon-btn is-danger",
2161
+ title: "\u5220\u9664\u5E7B\u706F\u7247",
2162
+ disabled: totalSlides <= 1,
2163
+ onClick: () => commandService.syncExecuteCommand(DeleteSlidePageCommand.id, {
2164
+ unitId,
2165
+ slideId: slide.id
2166
+ }),
2167
+ children: /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 16 16", width: "13", height: "13", fill: "none", stroke: "currentColor", children: /* @__PURE__ */ jsx4("path", { d: "M3.2 4.5H12.8M6.2 4.5V3H9.8V4.5M4.6 4.5L5.2 13H10.8L11.4 4.5", strokeWidth: "1.3", strokeLinecap: "round" }) })
2168
+ }
2169
+ )
2170
+ ]
2171
+ }
2172
+ )
2173
+ ]
2174
+ },
2175
+ slide.id
2176
+ );
2177
+ };
2178
+ return /* @__PURE__ */ jsxs4("div", { className: "univer-slides-left-sidebar", children: [
2179
+ /* @__PURE__ */ jsxs4("div", { className: "univer-slides-sorter-header", children: [
2180
+ /* @__PURE__ */ jsxs4("div", { className: "univer-slides-new-btn-group", children: [
2181
+ /* @__PURE__ */ jsxs4(
2182
+ "button",
2183
+ {
2184
+ type: "button",
2185
+ className: "univer-slides-primary-btn",
2186
+ onClick: () => handleAddSlide("titleAndContent"),
2187
+ children: [
2188
+ /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 16 16", width: "14", height: "14", fill: "none", stroke: "currentColor", children: /* @__PURE__ */ jsx4("path", { d: "M8 3V13M3 8H13", strokeWidth: "1.6", strokeLinecap: "round" }) }),
2189
+ /* @__PURE__ */ jsx4("span", { children: "\u65B0\u5EFA\u5E7B\u706F\u7247" })
2190
+ ]
2191
+ }
2192
+ ),
2193
+ /* @__PURE__ */ jsx4(
2194
+ "button",
2195
+ {
2196
+ type: "button",
2197
+ className: "univer-slides-split-caret",
2198
+ title: "\u9009\u62E9\u7248\u5F0F\u65B0\u5EFA\u5E7B\u706F\u7247",
2199
+ onClick: () => setLayoutMenuOpen((v) => !v),
2200
+ children: /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 16 16", width: "12", height: "12", fill: "none", stroke: "currentColor", children: /* @__PURE__ */ jsx4("path", { d: "M4 6L8 10L12 6", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
2201
+ }
2202
+ )
2203
+ ] }),
2204
+ /* @__PURE__ */ jsxs4(
2205
+ "button",
2206
+ {
2207
+ type: "button",
2208
+ className: "univer-slides-sec-add-btn",
2209
+ title: "\u65B0\u5EFA\u7AE0\u8282\u5206\u7EC4",
2210
+ onClick: handleAddSection,
2211
+ children: [
2212
+ /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 16 16", width: "14", height: "14", fill: "none", stroke: "currentColor", children: /* @__PURE__ */ jsx4("path", { d: "M2 4.2H6L7.4 5.6H14V12.5H2V4.2Z", strokeWidth: "1.3", strokeLinejoin: "round" }) }),
2213
+ /* @__PURE__ */ jsx4("span", { children: "\u7AE0\u8282\u5206\u7EC4" })
2214
+ ]
2215
+ }
2216
+ )
2217
+ ] }),
2218
+ layoutMenuOpen && /* @__PURE__ */ jsx4("div", { className: "univer-slides-layout-chooser", children: LAYOUT_OPTIONS.map((opt) => /* @__PURE__ */ jsxs4(
2219
+ "button",
2220
+ {
2221
+ type: "button",
2222
+ className: "univer-slides-layout-option",
2223
+ onClick: () => handleAddSlide(opt.type),
2224
+ children: [
2225
+ /* @__PURE__ */ jsx4("span", { className: "univer-slides-layout-option-title", children: opt.label }),
2226
+ /* @__PURE__ */ jsx4("span", { className: "univer-slides-layout-option-desc", children: opt.desc })
2227
+ ]
2228
+ },
2229
+ opt.type
2230
+ )) }),
2231
+ /* @__PURE__ */ jsx4("div", { className: "univer-slides-sorter-scroll", children: effectiveSections.map((sec) => {
2232
+ const secSlides = sec.slideIds.map((id) => snapshot.slides[id]).filter((s) => Boolean(s));
2233
+ return /* @__PURE__ */ jsxs4("div", { className: "univer-slides-section-group", children: [
2234
+ /* @__PURE__ */ jsxs4("div", { className: "univer-slides-section-bar", children: [
2235
+ /* @__PURE__ */ jsx4(
2236
+ "button",
2237
+ {
2238
+ type: "button",
2239
+ className: "univer-slides-section-toggle",
2240
+ onClick: () => handleToggleSection(sec),
2241
+ children: /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 16 16", width: "12", height: "12", fill: "none", stroke: "currentColor", children: sec.collapsed ? /* @__PURE__ */ jsx4("path", { d: "M6 4L10 8L6 12", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) : /* @__PURE__ */ jsx4("path", { d: "M4 6L8 10L12 6", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
2242
+ }
2243
+ ),
2244
+ editingSecId === sec.id ? /* @__PURE__ */ jsx4(
2245
+ "input",
2246
+ {
2247
+ className: "univer-slides-sec-input",
2248
+ value: editingSecTitle,
2249
+ autoFocus: true,
2250
+ onChange: (e) => setEditingSecTitle(e.target.value),
2251
+ onBlur: () => commitSectionTitle(sec.id),
2252
+ onKeyDown: (e) => {
2253
+ if (e.key === "Enter") commitSectionTitle(sec.id);
2254
+ }
2255
+ }
2256
+ ) : /* @__PURE__ */ jsx4(
2257
+ "span",
2258
+ {
2259
+ className: "univer-slides-section-title",
2260
+ onDoubleClick: () => {
2261
+ setEditingSecId(sec.id);
2262
+ setEditingSecTitle(sec.title);
2263
+ },
2264
+ title: "\u53CC\u51FB\u91CD\u547D\u540D\u7AE0\u8282",
2265
+ children: sec.title
2266
+ }
2267
+ ),
2268
+ /* @__PURE__ */ jsx4("span", { className: "univer-slides-section-count", children: secSlides.length }),
2269
+ snapshot.sections.length > 1 && sec.id !== "sec-virtual" && /* @__PURE__ */ jsx4(
2270
+ "button",
2271
+ {
2272
+ type: "button",
2273
+ className: "univer-slides-icon-btn",
2274
+ title: "\u5220\u9664\u7AE0\u8282\uFF08\u4FDD\u7559\u5E7B\u706F\u7247\uFF09",
2275
+ onClick: () => commandService.syncExecuteCommand(DeleteSlideSectionCommand.id, {
2276
+ unitId,
2277
+ sectionId: sec.id
2278
+ }),
2279
+ children: /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 16 16", width: "11", height: "11", fill: "none", stroke: "currentColor", children: /* @__PURE__ */ jsx4("path", { d: "M4 4L12 12M12 4L4 12", strokeWidth: "1.4", strokeLinecap: "round" }) })
2280
+ }
2281
+ )
2282
+ ] }),
2283
+ !sec.collapsed && /* @__PURE__ */ jsx4("div", { className: "univer-slides-section-cards", children: secSlides.map((slide) => renderSlideCard(slide)) })
2284
+ ] }, sec.id);
2285
+ }) })
2286
+ ] });
2287
+ };
2288
+
2289
+ // src/views/presenter/SlidesPresenterModal.tsx
2290
+ import { useDependency as useDependency5 } from "@univerjs/ui";
2291
+ import {
2292
+ ISlideSelectionService as ISlideSelectionService6,
2293
+ renderSlidePageToSvg as renderSlidePageToSvg2
2294
+ } from "@yudaocode/univer-slides";
2295
+ import { useCallback, useEffect as useEffect2, useRef, useState as useState4 } from "react";
2296
+ import { Fragment as Fragment4, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
2297
+ function formatElapsed(seconds) {
2298
+ const hrs = Math.floor(seconds / 3600);
2299
+ const mins = Math.floor(seconds % 3600 / 60);
2300
+ const secs = seconds % 60;
2301
+ return [hrs, mins, secs].map((n) => String(n).padStart(2, "0")).join(":");
2302
+ }
2303
+ var SlidesPresenterModal = (props) => {
2304
+ const selectionService = useDependency5(ISlideSelectionService6);
2305
+ const ctx = useActiveSlideUnit();
2306
+ const snapshot = props.snapshot ?? ctx.snapshot;
2307
+ const isOpen = Boolean(props.snapshot || ctx.selection.presenterOpen);
2308
+ const mode = props.initialMode ?? ctx.selection.presenterMode;
2309
+ const [slideIdx, setSlideIdx] = useState4(
2310
+ props.initialIndex ?? ctx.selection.presenterSlideIndex ?? 0
2311
+ );
2312
+ const [animStep, setAnimStep] = useState4(999);
2313
+ const [notesFontSize, setNotesFontSize] = useState4(16);
2314
+ const [elapsedSec, setElapsedSec] = useState4(0);
2315
+ const [timerPaused, setTimerPaused] = useState4(false);
2316
+ const [toolMode, setToolMode] = useState4("pointer");
2317
+ const [penColor, setPenColor] = useState4("#ef4444");
2318
+ const [laserTrail, setLaserTrail] = useState4([]);
2319
+ const [inkBySlide, setInkBySlide] = useState4({});
2320
+ const [jumpGridOpen, setJumpGridOpen] = useState4(false);
2321
+ const drawingStrokeRef = useRef(null);
2322
+ const stageBoxRef = useRef(null);
2323
+ useEffect2(() => {
2324
+ setSlideIdx(props.initialIndex ?? ctx.selection.presenterSlideIndex ?? 0);
2325
+ }, [props.initialIndex, ctx.selection.presenterSlideIndex]);
2326
+ const visibleSlides = snapshot ? snapshot.slideOrder.map((id) => snapshot.slides[id]).filter((s) => Boolean(s && !s.hidden)) : [];
2327
+ const effectiveSlides = visibleSlides.length > 0 ? visibleSlides : snapshot && snapshot.slideOrder[0] && snapshot.slides[snapshot.slideOrder[0]] ? [snapshot.slides[snapshot.slideOrder[0]]] : [];
2328
+ const clampedIdx = Math.max(0, Math.min(effectiveSlides.length - 1, slideIdx));
2329
+ const currentSlide = effectiveSlides[clampedIdx] ?? null;
2330
+ const nextSlide = effectiveSlides[clampedIdx + 1] ?? null;
2331
+ const clickAnimations = (currentSlide?.animations ?? []).filter((a) => a.trigger === "onClick");
2332
+ const handleClose = useCallback(() => {
2333
+ if (props.onExit) props.onExit();
2334
+ else selectionService.closePresenter();
2335
+ }, [props, selectionService]);
2336
+ const goNext = useCallback(() => {
2337
+ if (animStep < clickAnimations.length) {
2338
+ setAnimStep((s) => s + 1);
2339
+ return;
2340
+ }
2341
+ if (clampedIdx < effectiveSlides.length - 1) {
2342
+ const nextIndex = clampedIdx + 1;
2343
+ const nextTarget = effectiveSlides[nextIndex];
2344
+ const nextClickCount = (nextTarget?.animations ?? []).filter(
2345
+ (a) => a.trigger === "onClick"
2346
+ ).length;
2347
+ setSlideIdx(nextIndex);
2348
+ selectionService.setPresenterSlideIndex(nextIndex);
2349
+ setAnimStep(nextClickCount > 0 ? 0 : 999);
2350
+ }
2351
+ }, [animStep, clickAnimations.length, clampedIdx, effectiveSlides, selectionService]);
2352
+ const goPrev = useCallback(() => {
2353
+ if (clampedIdx > 0) {
2354
+ const prevIndex = clampedIdx - 1;
2355
+ setSlideIdx(prevIndex);
2356
+ selectionService.setPresenterSlideIndex(prevIndex);
2357
+ setAnimStep(999);
2358
+ }
2359
+ }, [clampedIdx, selectionService]);
2360
+ useEffect2(() => {
2361
+ if (!isOpen || timerPaused) return;
2362
+ const timer = setInterval(() => {
2363
+ setElapsedSec((s) => s + 1);
2364
+ }, 1e3);
2365
+ return () => clearInterval(timer);
2366
+ }, [isOpen, timerPaused]);
2367
+ useEffect2(() => {
2368
+ const advMs = currentSlide?.transition?.advanceAfterMs;
2369
+ if (!isOpen || timerPaused || !advMs || advMs <= 0) return;
2370
+ const t = setTimeout(() => {
2371
+ goNext();
2372
+ }, advMs);
2373
+ return () => clearTimeout(t);
2374
+ }, [isOpen, timerPaused, currentSlide?.id, currentSlide?.transition?.advanceAfterMs, goNext]);
2375
+ useEffect2(() => {
2376
+ if (!isOpen || typeof window === "undefined") return;
2377
+ const onKeyDown = (e) => {
2378
+ if (e.key === "Escape") {
2379
+ e.preventDefault();
2380
+ handleClose();
2381
+ } else if (e.key === "ArrowRight" || e.key === "ArrowDown" || e.key === " " || e.key === "PageDown") {
2382
+ e.preventDefault();
2383
+ goNext();
2384
+ } else if (e.key === "ArrowLeft" || e.key === "ArrowUp" || e.key === "PageUp") {
2385
+ e.preventDefault();
2386
+ goPrev();
2387
+ }
2388
+ };
2389
+ window.addEventListener("keydown", onKeyDown);
2390
+ return () => window.removeEventListener("keydown", onKeyDown);
2391
+ }, [isOpen, handleClose, goNext, goPrev]);
2392
+ if (!isOpen || !snapshot || !currentSlide) return null;
2393
+ const hiddenByAnimIds = new Set(
2394
+ clickAnimations.slice(animStep).filter((a) => a.category === "entrance").map((a) => a.elementId)
2395
+ );
2396
+ const filteredSlide = hiddenByAnimIds.size > 0 ? {
2397
+ ...currentSlide,
2398
+ elementOrder: currentSlide.elementOrder.filter((id) => !hiddenByAnimIds.has(id))
2399
+ } : currentSlide;
2400
+ const currentSvg = renderSlidePageToSvg2(filteredSlide, snapshot, clampedIdx + 1);
2401
+ const nextSvg = nextSlide ? renderSlidePageToSvg2(nextSlide, snapshot, clampedIdx + 2) : null;
2402
+ const transitionType = currentSlide.transition?.type ?? "fade";
2403
+ const currentStrokes = inkBySlide[currentSlide.id] ?? [];
2404
+ const getNormalizedCoords = (e) => {
2405
+ if (!stageBoxRef.current) return null;
2406
+ const r = stageBoxRef.current.getBoundingClientRect();
2407
+ if (r.width <= 0 || r.height <= 0) return null;
2408
+ return {
2409
+ x: (e.clientX - r.left) / r.width * 1e3,
2410
+ y: (e.clientY - r.top) / r.height * 562.5
2411
+ };
2412
+ };
2413
+ const handleStageMouseMove = (e) => {
2414
+ const pt = getNormalizedCoords(e);
2415
+ if (!pt) return;
2416
+ if (toolMode === "laser") {
2417
+ setLaserTrail((prev) => [...prev.slice(-10), pt]);
2418
+ } else if (toolMode === "pen" && drawingStrokeRef.current) {
2419
+ drawingStrokeRef.current.points.push(pt);
2420
+ setInkBySlide((prev) => ({
2421
+ ...prev,
2422
+ [currentSlide.id]: [...(prev[currentSlide.id] ?? []).slice(0, -1), { ...drawingStrokeRef.current }]
2423
+ }));
2424
+ }
2425
+ };
2426
+ const handleStageMouseDown = (e) => {
2427
+ if (toolMode === "pen") {
2428
+ const pt = getNormalizedCoords(e);
2429
+ if (!pt) return;
2430
+ const stroke = { color: penColor, points: [pt] };
2431
+ drawingStrokeRef.current = stroke;
2432
+ setInkBySlide((prev) => ({
2433
+ ...prev,
2434
+ [currentSlide.id]: [...prev[currentSlide.id] ?? [], stroke]
2435
+ }));
2436
+ } else if (toolMode === "pointer") {
2437
+ goNext();
2438
+ }
2439
+ };
2440
+ const handleStageMouseUp = () => {
2441
+ drawingStrokeRef.current = null;
2442
+ };
2443
+ return /* @__PURE__ */ jsxs5("div", { className: "univer-slides-presenter-overlay", role: "dialog", "aria-label": "\u5E7B\u706F\u7247\u6F14\u793A\u89C6\u56FE", children: [
2444
+ /* @__PURE__ */ jsxs5("div", { className: "univer-slides-presenter-topbar", children: [
2445
+ /* @__PURE__ */ jsxs5("div", { className: "univer-slides-presenter-left", children: [
2446
+ /* @__PURE__ */ jsx5("span", { className: "univer-slides-presenter-title", children: snapshot.name }),
2447
+ /* @__PURE__ */ jsxs5("span", { className: "univer-slides-presenter-counter", children: [
2448
+ "\u7B2C ",
2449
+ clampedIdx + 1,
2450
+ " / ",
2451
+ effectiveSlides.length,
2452
+ " \u9875"
2453
+ ] }),
2454
+ /* @__PURE__ */ jsxs5("div", { className: "univer-slides-timer-pill", children: [
2455
+ /* @__PURE__ */ jsxs5("svg", { viewBox: "0 0 16 16", width: "14", height: "14", fill: "none", stroke: "currentColor", children: [
2456
+ /* @__PURE__ */ jsx5("circle", { cx: "8", cy: "8.5", r: "5.5", strokeWidth: "1.35" }),
2457
+ /* @__PURE__ */ jsx5("path", { d: "M8 5.5V8.5L10 10M6 1.8H10", strokeWidth: "1.35", strokeLinecap: "round" })
2458
+ ] }),
2459
+ /* @__PURE__ */ jsx5("span", { className: "univer-slides-timer-digits", children: formatElapsed(elapsedSec) }),
2460
+ /* @__PURE__ */ jsx5(
2461
+ "button",
2462
+ {
2463
+ type: "button",
2464
+ className: "univer-slides-presenter-btn",
2465
+ onClick: () => setTimerPaused((p) => !p),
2466
+ children: timerPaused ? "\u7EE7\u7EED" : "\u6682\u505C"
2467
+ }
2468
+ ),
2469
+ /* @__PURE__ */ jsx5(
2470
+ "button",
2471
+ {
2472
+ type: "button",
2473
+ className: "univer-slides-presenter-btn",
2474
+ onClick: () => setElapsedSec(0),
2475
+ children: "\u91CD\u7F6E"
2476
+ }
2477
+ )
2478
+ ] })
2479
+ ] }),
2480
+ /* @__PURE__ */ jsxs5("div", { className: "univer-slides-presenter-tools", children: [
2481
+ /* @__PURE__ */ jsx5(
2482
+ "button",
2483
+ {
2484
+ type: "button",
2485
+ className: `univer-slides-presenter-btn${mode === "presenter" ? " is-active" : ""}`,
2486
+ onClick: () => selectionService.openPresenter(
2487
+ mode === "presenter" ? "fullscreen" : "presenter",
2488
+ clampedIdx
2489
+ ),
2490
+ children: mode === "presenter" ? "\u5207\u6362\u7EAF\u5168\u5C4F\u653E\u6620" : "\u5207\u6362\u6F14\u8BB2\u8005\u53CC\u5C4F\u89C6\u56FE"
2491
+ }
2492
+ ),
2493
+ /* @__PURE__ */ jsxs5(
2494
+ "button",
2495
+ {
2496
+ type: "button",
2497
+ className: `univer-slides-presenter-btn${toolMode === "laser" ? " is-laser" : ""}`,
2498
+ onClick: () => {
2499
+ setToolMode(toolMode === "laser" ? "pointer" : "laser");
2500
+ setLaserTrail([]);
2501
+ },
2502
+ children: [
2503
+ /* @__PURE__ */ jsxs5("svg", { viewBox: "0 0 16 16", width: "13", height: "13", fill: "none", stroke: "currentColor", children: [
2504
+ /* @__PURE__ */ jsx5("circle", { cx: "8", cy: "8", r: "2.5", fill: "#ef4444", stroke: "none" }),
2505
+ /* @__PURE__ */ jsx5("circle", { cx: "8", cy: "8", r: "5.5", stroke: "#ef4444", strokeWidth: "1.2", strokeDasharray: "2 2" })
2506
+ ] }),
2507
+ /* @__PURE__ */ jsx5("span", { children: "\u6FC0\u5149\u7B14" })
2508
+ ]
2509
+ }
2510
+ ),
2511
+ /* @__PURE__ */ jsxs5(
2512
+ "button",
2513
+ {
2514
+ type: "button",
2515
+ className: `univer-slides-presenter-btn${toolMode === "pen" ? " is-active" : ""}`,
2516
+ onClick: () => setToolMode(toolMode === "pen" ? "pointer" : "pen"),
2517
+ children: [
2518
+ /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 16 16", width: "13", height: "13", fill: "none", stroke: "currentColor", children: /* @__PURE__ */ jsx5("path", { d: "M11 2.5L13.5 5L5.5 13L2.5 13.8L3.3 10.8L11 2.5Z", strokeWidth: "1.3" }) }),
2519
+ /* @__PURE__ */ jsx5("span", { children: "\u753B\u7B14\u6279\u6CE8" })
2520
+ ]
2521
+ }
2522
+ ),
2523
+ toolMode === "pen" && /* @__PURE__ */ jsxs5("div", { className: "univer-slides-pen-colors", children: [
2524
+ ["#ef4444", "#facc15", "#38bdf8", "#34d399"].map((c) => /* @__PURE__ */ jsx5(
2525
+ "button",
2526
+ {
2527
+ type: "button",
2528
+ className: `univer-slides-color-dot${penColor === c ? " is-active" : ""}`,
2529
+ style: { backgroundColor: c },
2530
+ onClick: () => setPenColor(c)
2531
+ },
2532
+ c
2533
+ )),
2534
+ /* @__PURE__ */ jsx5(
2535
+ "button",
2536
+ {
2537
+ type: "button",
2538
+ className: "univer-slides-presenter-btn",
2539
+ onClick: () => setInkBySlide((prev) => ({
2540
+ ...prev,
2541
+ [currentSlide.id]: []
2542
+ })),
2543
+ children: "\u6E05\u5C4F"
2544
+ }
2545
+ )
2546
+ ] }),
2547
+ /* @__PURE__ */ jsx5(
2548
+ "button",
2549
+ {
2550
+ type: "button",
2551
+ className: "univer-slides-presenter-btn",
2552
+ onClick: () => setJumpGridOpen((v) => !v),
2553
+ children: "\u9875\u9762\u603B\u89C8"
2554
+ }
2555
+ ),
2556
+ /* @__PURE__ */ jsx5("button", { type: "button", className: "univer-slides-presenter-exit", onClick: handleClose, children: "\u7ED3\u675F\u653E\u6620 (Esc)" })
2557
+ ] })
2558
+ ] }),
2559
+ /* @__PURE__ */ jsxs5("div", { className: `univer-slides-presenter-main is-${mode}`, children: [
2560
+ /* @__PURE__ */ jsxs5("div", { className: "univer-slides-presenter-stage-col", children: [
2561
+ /* @__PURE__ */ jsxs5(
2562
+ "div",
2563
+ {
2564
+ ref: stageBoxRef,
2565
+ className: `univer-slides-presenter-stage anim-transition-${transitionType}`,
2566
+ style: {
2567
+ aspectRatio: `${snapshot.slideSize.widthPt} / ${snapshot.slideSize.heightPt}`,
2568
+ cursor: toolMode === "laser" ? "none" : toolMode === "pen" ? "crosshair" : "pointer"
2569
+ },
2570
+ onMouseMove: handleStageMouseMove,
2571
+ onMouseDown: handleStageMouseDown,
2572
+ onMouseUp: handleStageMouseUp,
2573
+ onMouseLeave: () => {
2574
+ setLaserTrail([]);
2575
+ handleStageMouseUp();
2576
+ },
2577
+ children: [
2578
+ /* @__PURE__ */ jsx5(
2579
+ "div",
2580
+ {
2581
+ className: "univer-slides-presenter-svg-wrap",
2582
+ dangerouslySetInnerHTML: { __html: currentSvg }
2583
+ }
2584
+ ),
2585
+ /* @__PURE__ */ jsxs5(
2586
+ "svg",
2587
+ {
2588
+ className: "univer-slides-ink-overlay",
2589
+ viewBox: "0 0 1000 562.5",
2590
+ preserveAspectRatio: "none",
2591
+ children: [
2592
+ currentStrokes.map((st, idx) => /* @__PURE__ */ jsx5(
2593
+ "polyline",
2594
+ {
2595
+ fill: "none",
2596
+ stroke: st.color,
2597
+ strokeWidth: 4,
2598
+ strokeLinecap: "round",
2599
+ strokeLinejoin: "round",
2600
+ points: st.points.map((p) => `${p.x.toFixed(1)},${p.y.toFixed(1)}`).join(" ")
2601
+ },
2602
+ idx
2603
+ )),
2604
+ toolMode === "laser" && laserTrail.length > 0 && /* @__PURE__ */ jsxs5(Fragment4, { children: [
2605
+ laserTrail.length > 1 && /* @__PURE__ */ jsx5(
2606
+ "polyline",
2607
+ {
2608
+ fill: "none",
2609
+ stroke: "rgba(239, 68, 68, 0.55)",
2610
+ strokeWidth: 3.5,
2611
+ strokeLinecap: "round",
2612
+ points: laserTrail.map((p) => `${p.x.toFixed(1)},${p.y.toFixed(1)}`).join(" ")
2613
+ }
2614
+ ),
2615
+ /* @__PURE__ */ jsx5(
2616
+ "circle",
2617
+ {
2618
+ cx: laserTrail[laserTrail.length - 1].x,
2619
+ cy: laserTrail[laserTrail.length - 1].y,
2620
+ r: 9,
2621
+ fill: "rgba(239, 68, 68, 0.32)"
2622
+ }
2623
+ ),
2624
+ /* @__PURE__ */ jsx5(
2625
+ "circle",
2626
+ {
2627
+ cx: laserTrail[laserTrail.length - 1].x,
2628
+ cy: laserTrail[laserTrail.length - 1].y,
2629
+ r: 4.5,
2630
+ fill: "#ef4444"
2631
+ }
2632
+ )
2633
+ ] })
2634
+ ]
2635
+ }
2636
+ )
2637
+ ]
2638
+ },
2639
+ `${currentSlide.id}-${transitionType}`
2640
+ ),
2641
+ /* @__PURE__ */ jsxs5("div", { className: "univer-slides-presenter-nav", children: [
2642
+ /* @__PURE__ */ jsx5(
2643
+ "button",
2644
+ {
2645
+ type: "button",
2646
+ className: "univer-slides-presenter-btn",
2647
+ disabled: clampedIdx <= 0,
2648
+ onClick: goPrev,
2649
+ children: "\u4E0A\u4E00\u9875"
2650
+ }
2651
+ ),
2652
+ /* @__PURE__ */ jsxs5("span", { className: "univer-slides-presenter-progress", children: [
2653
+ currentSlide.title,
2654
+ clickAnimations.length > 0 && animStep < clickAnimations.length ? ` \xB7 \u5F85\u89E6\u53D1\u52A8\u753B (${animStep}/${clickAnimations.length})` : ""
2655
+ ] }),
2656
+ /* @__PURE__ */ jsx5(
2657
+ "button",
2658
+ {
2659
+ type: "button",
2660
+ className: "univer-slides-presenter-btn",
2661
+ disabled: clampedIdx >= effectiveSlides.length - 1 && animStep >= clickAnimations.length,
2662
+ onClick: goNext,
2663
+ children: "\u4E0B\u4E00\u9875"
2664
+ }
2665
+ )
2666
+ ] })
2667
+ ] }),
2668
+ mode === "presenter" && /* @__PURE__ */ jsxs5("div", { className: "univer-slides-presenter-side-col", children: [
2669
+ /* @__PURE__ */ jsxs5("div", { className: "univer-slides-next-card", children: [
2670
+ /* @__PURE__ */ jsxs5("div", { className: "univer-slides-next-label", children: [
2671
+ "\u4E0B\u4E00\u9875\u9884\u89C8 ",
2672
+ nextSlide ? `\u2014 ${nextSlide.title}` : "\uFF08\u5DF2\u662F\u6700\u540E\u4E00\u9875\uFF09"
2673
+ ] }),
2674
+ nextSvg ? /* @__PURE__ */ jsx5(
2675
+ "div",
2676
+ {
2677
+ className: "univer-slides-next-preview",
2678
+ dangerouslySetInnerHTML: { __html: nextSvg }
2679
+ }
2680
+ ) : /* @__PURE__ */ jsx5("div", { className: "univer-slides-next-end", children: "\u6F14\u793A\u6587\u7A3F\u653E\u6620\u5373\u5C06\u7ED3\u675F" })
2681
+ ] }),
2682
+ /* @__PURE__ */ jsxs5("div", { className: "univer-slides-teleprompter-card", children: [
2683
+ /* @__PURE__ */ jsxs5("div", { className: "univer-slides-teleprompter-header", children: [
2684
+ /* @__PURE__ */ jsx5("span", { children: "\u6F14\u8BB2\u8005\u5907\u6CE8\u63D0\u8BCD\u5668" }),
2685
+ /* @__PURE__ */ jsxs5("div", { className: "univer-slides-font-btns", children: [
2686
+ /* @__PURE__ */ jsx5(
2687
+ "button",
2688
+ {
2689
+ type: "button",
2690
+ className: "univer-slides-presenter-btn",
2691
+ onClick: () => setNotesFontSize((s) => Math.max(12, s - 2)),
2692
+ children: "A-"
2693
+ }
2694
+ ),
2695
+ /* @__PURE__ */ jsx5(
2696
+ "button",
2697
+ {
2698
+ type: "button",
2699
+ className: "univer-slides-presenter-btn",
2700
+ onClick: () => setNotesFontSize((s) => Math.min(28, s + 2)),
2701
+ children: "A+"
2702
+ }
2703
+ )
2704
+ ] })
2705
+ ] }),
2706
+ /* @__PURE__ */ jsx5(
2707
+ "div",
2708
+ {
2709
+ className: "univer-slides-teleprompter-body",
2710
+ style: { fontSize: `${notesFontSize}px` },
2711
+ children: currentSlide.speakerNotes?.trim() || "\uFF08\u672C\u9875\u6682\u65E0\u6F14\u8BB2\u8005\u5907\u6CE8\uFF09"
2712
+ }
2713
+ )
2714
+ ] })
2715
+ ] })
2716
+ ] }),
2717
+ jumpGridOpen && /* @__PURE__ */ jsx5("div", { className: "univer-slides-jump-modal", onClick: () => setJumpGridOpen(false), children: /* @__PURE__ */ jsx5("div", { className: "univer-slides-jump-grid", onClick: (e) => e.stopPropagation(), children: effectiveSlides.map((s, idx) => /* @__PURE__ */ jsxs5(
2718
+ "button",
2719
+ {
2720
+ type: "button",
2721
+ className: `univer-slides-jump-item${idx === clampedIdx ? " is-active" : ""}`,
2722
+ onClick: () => {
2723
+ setSlideIdx(idx);
2724
+ selectionService.setPresenterSlideIndex(idx);
2725
+ setAnimStep(999);
2726
+ setJumpGridOpen(false);
2727
+ },
2728
+ children: [
2729
+ /* @__PURE__ */ jsx5(
2730
+ "div",
2731
+ {
2732
+ className: "univer-slides-jump-thumb",
2733
+ dangerouslySetInnerHTML: {
2734
+ __html: renderSlidePageToSvg2(s, snapshot, idx + 1)
2735
+ }
2736
+ }
2737
+ ),
2738
+ /* @__PURE__ */ jsxs5("span", { children: [
2739
+ idx + 1,
2740
+ ". ",
2741
+ s.title
2742
+ ] })
2743
+ ]
2744
+ },
2745
+ s.id
2746
+ )) }) })
2747
+ ] });
2748
+ };
2749
+ var SlidesPresenterAndModalsHost = () => {
2750
+ return /* @__PURE__ */ jsx5(SlidesPresenterModal, {});
2751
+ };
2752
+
2753
+ // src/views/stage/SlidesCanvasStage.tsx
2754
+ import { ICommandService as ICommandService5, Tools as Tools2 } from "@univerjs/core";
2755
+ import { useDependency as useDependency6 } from "@univerjs/ui";
2756
+ import {
2757
+ AddSlideElementCommand as AddSlideElementCommand2,
2758
+ countSlideTextMatches,
2759
+ DeleteSlideElementsCommand as DeleteSlideElementsCommand3,
2760
+ FindAndReplaceSlideTextCommand,
2761
+ getShapeSvgPath,
2762
+ ISlideSelectionService as ISlideSelectionService7,
2763
+ renderSlideChartToSvg,
2764
+ renderSlideSmartArtToSvg,
2765
+ resolveConnectorEndpoints,
2766
+ UpdateSlideElementsCommand as UpdateSlideElementsCommand2,
2767
+ UpdateSlidePagePropsCommand as UpdateSlidePagePropsCommand3
2768
+ } from "@yudaocode/univer-slides";
2769
+ import { useRef as useRef2, useState as useState5 } from "react";
2770
+ import { Fragment as Fragment5, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
2771
+ var SHAPE_CHOICES = [
2772
+ { kind: "rect", label: "\u77E9\u5F62" },
2773
+ { kind: "roundRect", label: "\u5706\u89D2\u77E9\u5F62" },
2774
+ { kind: "ellipse", label: "\u692D\u5706 / \u5706\u5F62" },
2775
+ { kind: "triangle", label: "\u4E09\u89D2\u5F62" },
2776
+ { kind: "diamond", label: "\u83F1\u5F62" },
2777
+ { kind: "parallelogram", label: "\u5E73\u884C\u56DB\u8FB9\u5F62" },
2778
+ { kind: "pentagon", label: "\u4E94\u8FB9\u5F62" },
2779
+ { kind: "hexagon", label: "\u516D\u8FB9\u5F62" },
2780
+ { kind: "octagon", label: "\u516B\u8FB9\u5F62" },
2781
+ { kind: "star5", label: "\u4E94\u89D2\u661F" },
2782
+ { kind: "rightArrow", label: "\u5411\u53F3\u7BAD\u5934" },
2783
+ { kind: "leftArrow", label: "\u5411\u5DE6\u7BAD\u5934" },
2784
+ { kind: "chevron", label: "\u71D5\u5C3E\u6D41\u7A0B\u5757" },
2785
+ { kind: "callout", label: "\u6C14\u6CE1\u6807\u6CE8\u6846" },
2786
+ { kind: "cloud", label: "\u4E91\u6735\u6846" },
2787
+ { kind: "plus", label: "\u5341\u5B57\u52A0\u53F7" }
2788
+ ];
2789
+ var CHART_CHOICES = [
2790
+ { kind: "column", label: "\u7C07\u72B6\u67F1\u5F62\u56FE" },
2791
+ { kind: "bar", label: "\u6C34\u5E73\u6761\u5F62\u56FE" },
2792
+ { kind: "line", label: "\u8D8B\u52BF\u6298\u7EBF\u56FE" },
2793
+ { kind: "combo", label: "\u67F1\u7EBF\u7EC4\u5408\u56FE" },
2794
+ { kind: "pie", label: "\u5360\u6BD4\u997C\u56FE" },
2795
+ { kind: "doughnut", label: "\u73AF\u5F62\u6307\u6807\u56FE" },
2796
+ { kind: "area", label: "\u9762\u79EF\u8D8B\u52BF\u56FE" },
2797
+ { kind: "radar", label: "\u591A\u7EF4\u96F7\u8FBE\u56FE" },
2798
+ { kind: "scatter", label: "\u6563\u70B9\u5206\u5E03\u56FE" }
2799
+ ];
2800
+ var SMARTART_CHOICES = [
2801
+ { kind: "process", label: "\u9012\u8FDB\u6D41\u7A0B\u56FE (Process)" },
2802
+ { kind: "cycle", label: "\u95ED\u73AF\u5FAA\u73AF\u56FE (Cycle)" },
2803
+ { kind: "hierarchy", label: "\u7EC4\u7EC7\u67B6\u6784\u56FE (Hierarchy)" },
2804
+ { kind: "list", label: "\u5206\u7EC4\u5217\u8868\u56FE (List)" },
2805
+ { kind: "pyramid", label: "\u6218\u7565\u91D1\u5B57\u5854 (Pyramid)" }
2806
+ ];
2807
+ var LAYOUT_CHOICES = [
2808
+ { kind: "title", label: "\u6807\u9898\u5E7B\u706F\u7247" },
2809
+ { kind: "titleAndContent", label: "\u6807\u9898\u548C\u5185\u5BB9" },
2810
+ { kind: "sectionHeader", label: "\u8282\u6807\u9898" },
2811
+ { kind: "twoColumn", label: "\u4E24\u680F\u5185\u5BB9" },
2812
+ { kind: "comparison", label: "\u5BF9\u6BD4\u7248\u5F0F" },
2813
+ { kind: "blank", label: "\u7A7A\u767D\u7248\u5F0F" }
2814
+ ];
2815
+ var TRANSITION_CHOICES = [
2816
+ { kind: "none", label: "\u65E0\u5207\u6362" },
2817
+ { kind: "fade", label: "\u5E73\u6ED1\u6DE1\u5165 (Fade)" },
2818
+ { kind: "push", label: "\u63A8\u5165\u5207\u6362 (Push)" },
2819
+ { kind: "wipe", label: "\u64E6\u9664\u5207\u6362 (Wipe)" },
2820
+ { kind: "split", label: "\u5206\u5272\u5C55\u5F00 (Split)" },
2821
+ { kind: "zoom", label: "\u7F29\u653E\u805A\u7126 (Zoom)" },
2822
+ { kind: "morph", label: "\u5E73\u6ED1\u53D8\u5F62 (Morph)" }
2823
+ ];
2824
+ var SlidesCanvasStage = () => {
2825
+ const commandService = useDependency6(ICommandService5);
2826
+ const selectionService = useDependency6(ISlideSelectionService7);
2827
+ const { unit, snapshot, selection, activeSlide, activeSlideIndex } = useActiveSlideUnit();
2828
+ const [openMenu, setOpenMenu] = useState5(null);
2829
+ const [snapGuides, setSnapGuides] = useState5([]);
2830
+ const [findQuery, setFindQuery] = useState5("");
2831
+ const [replaceQuery, setReplaceQuery] = useState5("");
2832
+ const [matchCase, setMatchCase] = useState5(false);
2833
+ const canvasRef = useRef2(null);
2834
+ if (!unit || !snapshot || !activeSlide) {
2835
+ return /* @__PURE__ */ jsx6("div", { className: "univer-slides-stage-empty", children: /* @__PURE__ */ jsx6("span", { children: "\u8BF7\u65B0\u5EFA\u6216\u6253\u5F00\u5E7B\u706F\u7247\u6587\u7A3F" }) });
2836
+ }
2837
+ const unitId = unit.getUnitId();
2838
+ const slideW = snapshot.slideSize.widthPt || 960;
2839
+ const slideH = snapshot.slideSize.heightPt || 540;
2840
+ const zoom = selection.zoom || 0.85;
2841
+ const selectedSet = new Set(selection.selectedElementIds);
2842
+ const insertElement = (elementType, extra) => {
2843
+ commandService.syncExecuteCommand(AddSlideElementCommand2.id, {
2844
+ unitId,
2845
+ slideId: activeSlide.id,
2846
+ elementType,
2847
+ element: extra
2848
+ });
2849
+ setOpenMenu(null);
2850
+ };
2851
+ const handleUploadImage = () => {
2852
+ if (typeof document === "undefined") {
2853
+ insertElement("image");
2854
+ return;
2855
+ }
2856
+ const input = document.createElement("input");
2857
+ input.type = "file";
2858
+ input.accept = "image/*";
2859
+ input.onchange = () => {
2860
+ const file = input.files?.[0];
2861
+ if (!file) return;
2862
+ const reader = new FileReader();
2863
+ reader.onload = () => {
2864
+ if (typeof reader.result === "string") {
2865
+ insertElement("image", {
2866
+ name: file.name,
2867
+ src: reader.result
2868
+ });
2869
+ }
2870
+ };
2871
+ reader.readAsDataURL(file);
2872
+ };
2873
+ input.click();
2874
+ };
2875
+ const startDragMove = (e, targetEl) => {
2876
+ if (targetEl.locked || selection.editingElementId === targetEl.id || selection.editingTableCell?.elementId === targetEl.id) {
2877
+ return;
2878
+ }
2879
+ e.stopPropagation();
2880
+ let nextSelected = selection.selectedElementIds;
2881
+ if (e.shiftKey) {
2882
+ nextSelected = selectedSet.has(targetEl.id) ? nextSelected.filter((id) => id !== targetEl.id) : [...nextSelected, targetEl.id];
2883
+ selectionService.selectElements(nextSelected);
2884
+ } else if (!selectedSet.has(targetEl.id)) {
2885
+ nextSelected = [targetEl.id];
2886
+ selectionService.selectElements(nextSelected);
2887
+ }
2888
+ const startClientX = e.clientX;
2889
+ const startClientY = e.clientY;
2890
+ const movingIds = nextSelected.filter((id) => activeSlide.elements[id] && !activeSlide.elements[id].locked);
2891
+ const initialBoxes = /* @__PURE__ */ new Map();
2892
+ for (const id of movingIds) {
2893
+ const el = activeSlide.elements[id];
2894
+ initialBoxes.set(id, { x: el.x, y: el.y, w: el.width, h: el.height });
2895
+ }
2896
+ const otherElements = Object.values(activeSlide.elements).filter(
2897
+ (el) => !movingIds.includes(el.id) && !el.hidden
2898
+ );
2899
+ const onMove = (ev) => {
2900
+ let dx = (ev.clientX - startClientX) / zoom;
2901
+ let dy = (ev.clientY - startClientY) / zoom;
2902
+ const guides = [];
2903
+ if (selection.snapEnabled && movingIds.length === 1) {
2904
+ const box = initialBoxes.get(movingIds[0]);
2905
+ const candX = box.x + dx;
2906
+ const candY = box.y + dy;
2907
+ const candCx = candX + box.w / 2;
2908
+ const candCy = candY + box.h / 2;
2909
+ const threshold = 6;
2910
+ if (Math.abs(candCx - slideW / 2) <= threshold) {
2911
+ dx = slideW / 2 - box.w / 2 - box.x;
2912
+ guides.push({ axis: "x", posPt: slideW / 2 });
2913
+ }
2914
+ if (Math.abs(candCy - slideH / 2) <= threshold) {
2915
+ dy = slideH / 2 - box.h / 2 - box.y;
2916
+ guides.push({ axis: "y", posPt: slideH / 2 });
2917
+ }
2918
+ for (const other of otherElements) {
2919
+ if (Math.abs(candX - other.x) <= threshold) {
2920
+ dx = other.x - box.x;
2921
+ guides.push({ axis: "x", posPt: other.x });
2922
+ } else if (Math.abs(candCx - (other.x + other.width / 2)) <= threshold) {
2923
+ dx = other.x + other.width / 2 - box.w / 2 - box.x;
2924
+ guides.push({ axis: "x", posPt: other.x + other.width / 2 });
2925
+ }
2926
+ if (Math.abs(candY - other.y) <= threshold) {
2927
+ dy = other.y - box.y;
2928
+ guides.push({ axis: "y", posPt: other.y });
2929
+ } else if (Math.abs(candCy - (other.y + other.height / 2)) <= threshold) {
2930
+ dy = other.y + other.height / 2 - box.h / 2 - box.y;
2931
+ guides.push({ axis: "y", posPt: other.y + other.height / 2 });
2932
+ }
2933
+ }
2934
+ }
2935
+ setSnapGuides(guides);
2936
+ if (Math.abs(dx) < 0.5 && Math.abs(dy) < 0.5) return;
2937
+ commandService.syncExecuteCommand(UpdateSlideElementsCommand2.id, {
2938
+ unitId,
2939
+ slideId: activeSlide.id,
2940
+ updates: movingIds.map((id) => {
2941
+ const init = initialBoxes.get(id);
2942
+ return {
2943
+ id,
2944
+ patch: {
2945
+ x: Math.round(init.x + dx),
2946
+ y: Math.round(init.y + dy)
2947
+ }
2948
+ };
2949
+ })
2950
+ });
2951
+ };
2952
+ const onUp = () => {
2953
+ setSnapGuides([]);
2954
+ window.removeEventListener("mousemove", onMove);
2955
+ window.removeEventListener("mouseup", onUp);
2956
+ };
2957
+ window.addEventListener("mousemove", onMove);
2958
+ window.addEventListener("mouseup", onUp);
2959
+ };
2960
+ const startResize = (e, el, dir) => {
2961
+ e.stopPropagation();
2962
+ e.preventDefault();
2963
+ const startX = e.clientX;
2964
+ const startY = e.clientY;
2965
+ const orig = { x: el.x, y: el.y, w: el.width, h: el.height };
2966
+ const onMove = (ev) => {
2967
+ const dx = (ev.clientX - startX) / zoom;
2968
+ const dy = (ev.clientY - startY) / zoom;
2969
+ let nx = orig.x;
2970
+ let ny = orig.y;
2971
+ let nw = orig.w;
2972
+ let nh = orig.h;
2973
+ if (dir.includes("e")) nw = Math.max(24, orig.w + dx);
2974
+ if (dir.includes("s")) nh = Math.max(24, orig.h + dy);
2975
+ if (dir.includes("w")) {
2976
+ nw = Math.max(24, orig.w - dx);
2977
+ nx = orig.x + (orig.w - nw);
2978
+ }
2979
+ if (dir.includes("n")) {
2980
+ nh = Math.max(24, orig.h - dy);
2981
+ ny = orig.y + (orig.h - nh);
2982
+ }
2983
+ commandService.syncExecuteCommand(UpdateSlideElementsCommand2.id, {
2984
+ unitId,
2985
+ slideId: activeSlide.id,
2986
+ updates: [
2987
+ {
2988
+ id: el.id,
2989
+ patch: {
2990
+ x: Math.round(nx),
2991
+ y: Math.round(ny),
2992
+ width: Math.round(nw),
2993
+ height: Math.round(nh)
2994
+ }
2995
+ }
2996
+ ]
2997
+ });
2998
+ };
2999
+ const onUp = () => {
3000
+ window.removeEventListener("mousemove", onMove);
3001
+ window.removeEventListener("mouseup", onUp);
3002
+ };
3003
+ window.addEventListener("mousemove", onMove);
3004
+ window.addEventListener("mouseup", onUp);
3005
+ };
3006
+ const startRotate = (e, el) => {
3007
+ e.stopPropagation();
3008
+ e.preventDefault();
3009
+ if (!canvasRef.current) return;
3010
+ const rect = canvasRef.current.getBoundingClientRect();
3011
+ const centerX = rect.left + (el.x + el.width / 2) * zoom;
3012
+ const centerY = rect.top + (el.y + el.height / 2) * zoom;
3013
+ const onMove = (ev) => {
3014
+ const angleRad = Math.atan2(ev.clientY - centerY, ev.clientX - centerX);
3015
+ const deg = Math.round((angleRad * 180 / Math.PI + 90 + 360) % 360);
3016
+ commandService.syncExecuteCommand(UpdateSlideElementsCommand2.id, {
3017
+ unitId,
3018
+ slideId: activeSlide.id,
3019
+ updates: [{ id: el.id, patch: { rotation: deg } }]
3020
+ });
3021
+ };
3022
+ const onUp = () => {
3023
+ window.removeEventListener("mousemove", onMove);
3024
+ window.removeEventListener("mouseup", onUp);
3025
+ };
3026
+ window.addEventListener("mousemove", onMove);
3027
+ window.addEventListener("mouseup", onUp);
3028
+ };
3029
+ const startNotesResize = (e) => {
3030
+ e.preventDefault();
3031
+ const startY = e.clientY;
3032
+ const origH = selection.speakerNotesHeight;
3033
+ const onMove = (ev) => {
3034
+ selectionService.setSpeakerNotesHeight(origH - (ev.clientY - startY));
3035
+ };
3036
+ const onUp = () => {
3037
+ window.removeEventListener("mousemove", onMove);
3038
+ window.removeEventListener("mouseup", onUp);
3039
+ };
3040
+ window.addEventListener("mousemove", onMove);
3041
+ window.addEventListener("mouseup", onUp);
3042
+ };
3043
+ const bg = activeSlide.background ?? snapshot.masters[0]?.background ?? {
3044
+ type: "solid",
3045
+ color: snapshot.theme.colors.background
3046
+ };
3047
+ const slideBgStyle = bg.type === "gradient" && bg.gradientFrom && bg.gradientTo ? {
3048
+ backgroundImage: `linear-gradient(${bg.gradientAngleDeg ?? 135}deg, ${bg.gradientFrom}, ${bg.gradientTo})`
3049
+ } : bg.type === "image" && bg.imageSrc ? {
3050
+ backgroundColor: bg.color || "#ffffff",
3051
+ backgroundImage: `url(${bg.imageSrc})`,
3052
+ backgroundSize: "cover",
3053
+ backgroundPosition: "center"
3054
+ } : {
3055
+ backgroundColor: bg.color || snapshot.theme.colors.background || "#ffffff"
3056
+ };
3057
+ const matchCount = findQuery ? countSlideTextMatches(snapshot, findQuery, { matchCase }) : 0;
3058
+ const renderElementNode = (el) => {
3059
+ if (el.hidden) return null;
3060
+ const isSelected = selectedSet.has(el.id);
3061
+ const isEditing = selection.editingElementId === el.id;
3062
+ if (el.type === "connector") {
3063
+ const geom = resolveConnectorEndpoints(el, activeSlide.elements);
3064
+ const markerId = `stage-conn-arrow-${el.id}`;
3065
+ return /* @__PURE__ */ jsxs6(
3066
+ "svg",
3067
+ {
3068
+ className: `univer-slides-connector-layer${isSelected ? " is-selected" : ""}`,
3069
+ viewBox: `0 0 ${slideW} ${slideH}`,
3070
+ style: {
3071
+ position: "absolute",
3072
+ inset: 0,
3073
+ width: "100%",
3074
+ height: "100%",
3075
+ pointerEvents: "none"
3076
+ },
3077
+ children: [
3078
+ /* @__PURE__ */ jsx6("defs", { children: /* @__PURE__ */ jsx6("marker", { id: markerId, markerWidth: "8", markerHeight: "8", refX: "7", refY: "4", orient: "auto", children: /* @__PURE__ */ jsx6("path", { d: "M0,0 L8,4 L0,8 Z", fill: el.strokeColor }) }) }),
3079
+ /* @__PURE__ */ jsx6(
3080
+ "path",
3081
+ {
3082
+ d: geom.pathD,
3083
+ fill: "none",
3084
+ stroke: "transparent",
3085
+ strokeWidth: 14,
3086
+ style: { pointerEvents: "stroke", cursor: "pointer" },
3087
+ onClick: (ev) => {
3088
+ ev.stopPropagation();
3089
+ selectionService.selectElements([el.id]);
3090
+ }
3091
+ }
3092
+ ),
3093
+ /* @__PURE__ */ jsx6(
3094
+ "path",
3095
+ {
3096
+ d: geom.pathD,
3097
+ fill: "none",
3098
+ stroke: el.strokeColor,
3099
+ strokeWidth: el.strokeWidth || 2,
3100
+ strokeDasharray: el.strokeDash === "dashed" ? "7 4" : el.strokeDash === "dotted" ? "2 3" : void 0,
3101
+ markerEnd: el.endArrow ? `url(#${markerId})` : void 0
3102
+ }
3103
+ ),
3104
+ el.label && /* @__PURE__ */ jsx6(
3105
+ "text",
3106
+ {
3107
+ x: geom.midX,
3108
+ y: geom.midY - 6,
3109
+ textAnchor: "middle",
3110
+ fontSize: 12,
3111
+ fontWeight: 600,
3112
+ fill: el.labelColor || el.strokeColor,
3113
+ children: el.label
3114
+ }
3115
+ ),
3116
+ isSelected && /* @__PURE__ */ jsxs6(Fragment5, { children: [
3117
+ /* @__PURE__ */ jsx6("circle", { cx: geom.x1, cy: geom.y1, r: 4.5, fill: "#ffffff", stroke: "#2563eb", strokeWidth: 2 }),
3118
+ /* @__PURE__ */ jsx6("circle", { cx: geom.x2, cy: geom.y2, r: 4.5, fill: "#ffffff", stroke: "#2563eb", strokeWidth: 2 })
3119
+ ] })
3120
+ ]
3121
+ },
3122
+ el.id
3123
+ );
3124
+ }
3125
+ const wrapperStyle = {
3126
+ position: "absolute",
3127
+ left: `${el.x}px`,
3128
+ top: `${el.y}px`,
3129
+ width: `${el.width}px`,
3130
+ height: `${el.height}px`,
3131
+ transform: el.rotation ? `rotate(${el.rotation}deg)` : void 0,
3132
+ opacity: el.opacity ?? 1,
3133
+ cursor: isEditing ? "text" : el.locked ? "default" : "move",
3134
+ boxSizing: "border-box"
3135
+ };
3136
+ let content = null;
3137
+ if (el.type === "text") {
3138
+ const textEl = el;
3139
+ const isWordArt = Boolean(textEl.wordArt?.enabled);
3140
+ const lines = (textEl.text || "").split("\n");
3141
+ const vJustify = textEl.verticalAlign === "middle" ? "center" : textEl.verticalAlign === "bottom" ? "flex-end" : "flex-start";
3142
+ if (isEditing) {
3143
+ content = /* @__PURE__ */ jsx6(
3144
+ "textarea",
3145
+ {
3146
+ className: "univer-slides-inline-textarea",
3147
+ autoFocus: true,
3148
+ value: textEl.text,
3149
+ style: {
3150
+ fontSize: `${textEl.fontSize ?? 18}px`,
3151
+ fontWeight: textEl.fontWeight ?? "normal",
3152
+ fontStyle: textEl.italic ? "italic" : "normal",
3153
+ textAlign: textEl.align ?? "left",
3154
+ color: textEl.color || snapshot.theme.colors.text
3155
+ },
3156
+ onChange: (ev) => commandService.syncExecuteCommand(UpdateSlideElementsCommand2.id, {
3157
+ unitId,
3158
+ slideId: activeSlide.id,
3159
+ updates: [{ id: textEl.id, patch: { text: ev.target.value } }]
3160
+ }),
3161
+ onBlur: () => selectionService.setEditingElement(null),
3162
+ onKeyDown: (ev) => {
3163
+ if (ev.key === "Escape") selectionService.setEditingElement(null);
3164
+ }
3165
+ }
3166
+ );
3167
+ } else {
3168
+ content = /* @__PURE__ */ jsx6(
3169
+ "div",
3170
+ {
3171
+ className: "univer-slides-text-box",
3172
+ style: {
3173
+ width: "100%",
3174
+ height: "100%",
3175
+ display: "flex",
3176
+ flexDirection: "column",
3177
+ justifyContent: vJustify,
3178
+ padding: `${textEl.paddingPt ?? 6}px`,
3179
+ backgroundColor: textEl.fillColor || "transparent",
3180
+ border: textEl.strokeColor && (textEl.strokeWidth ?? 0) > 0 ? `${textEl.strokeWidth}px solid ${textEl.strokeColor}` : "none",
3181
+ borderRadius: `${textEl.borderRadius ?? 4}px`,
3182
+ fontFamily: textEl.fontFamily || snapshot.theme.minorFont,
3183
+ fontSize: `${textEl.fontSize ?? 18}px`,
3184
+ fontWeight: textEl.fontWeight ?? "normal",
3185
+ fontStyle: textEl.italic ? "italic" : "normal",
3186
+ textDecoration: textEl.underline ? "underline" : "none",
3187
+ textAlign: textEl.align ?? "left",
3188
+ lineHeight: textEl.lineHeight ?? 1.4,
3189
+ color: textEl.color || snapshot.theme.colors.text,
3190
+ boxSizing: "border-box",
3191
+ overflow: "hidden"
3192
+ },
3193
+ children: lines.map((line, lIdx) => {
3194
+ const prefix = textEl.bullet ? textEl.bullet === "number" ? `${lIdx + 1}. ` : textEl.bullet === "square" ? "\u25AA " : "\u2022 " : "";
3195
+ return /* @__PURE__ */ jsxs6(
3196
+ "div",
3197
+ {
3198
+ style: isWordArt && textEl.wordArt ? {
3199
+ backgroundImage: `linear-gradient(${textEl.wordArt.gradientAngleDeg ?? 0}deg, ${textEl.wordArt.gradientFrom}, ${textEl.wordArt.gradientTo})`,
3200
+ WebkitBackgroundClip: "text",
3201
+ WebkitTextFillColor: "transparent",
3202
+ filter: textEl.wordArt.shadowColor ? `drop-shadow(${textEl.wordArt.shadowOffsetX ?? 0}px ${textEl.wordArt.shadowOffsetY ?? 3}px ${textEl.wordArt.shadowBlur ?? 5}px ${textEl.wordArt.shadowColor})` : void 0
3203
+ } : void 0,
3204
+ children: [
3205
+ prefix,
3206
+ line || "\xA0"
3207
+ ]
3208
+ },
3209
+ lIdx
3210
+ );
3211
+ })
3212
+ }
3213
+ );
3214
+ }
3215
+ } else if (el.type === "shape") {
3216
+ const shapeEl = el;
3217
+ const pathD = getShapeSvgPath(
3218
+ shapeEl.shapeType,
3219
+ shapeEl.width,
3220
+ shapeEl.height,
3221
+ shapeEl.cornerRadius ?? 8
3222
+ );
3223
+ const gradId = `shape-grad-${shapeEl.id}`;
3224
+ content = /* @__PURE__ */ jsxs6("div", { className: "univer-slides-shape-box", style: { width: "100%", height: "100%", position: "relative" }, children: [
3225
+ /* @__PURE__ */ jsxs6(
3226
+ "svg",
3227
+ {
3228
+ viewBox: `0 0 ${shapeEl.width} ${shapeEl.height}`,
3229
+ width: "100%",
3230
+ height: "100%",
3231
+ style: { position: "absolute", inset: 0, overflow: "visible" },
3232
+ children: [
3233
+ shapeEl.gradientFrom && shapeEl.gradientTo && /* @__PURE__ */ jsx6("defs", { children: /* @__PURE__ */ jsxs6("linearGradient", { id: gradId, x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [
3234
+ /* @__PURE__ */ jsx6("stop", { offset: "0%", stopColor: shapeEl.gradientFrom }),
3235
+ /* @__PURE__ */ jsx6("stop", { offset: "100%", stopColor: shapeEl.gradientTo })
3236
+ ] }) }),
3237
+ /* @__PURE__ */ jsx6(
3238
+ "path",
3239
+ {
3240
+ d: pathD,
3241
+ fill: shapeEl.gradientFrom && shapeEl.gradientTo ? `url(#${gradId})` : shapeEl.fillColor || snapshot.theme.colors.accent1,
3242
+ stroke: shapeEl.strokeWidth > 0 ? shapeEl.strokeColor : "none",
3243
+ strokeWidth: shapeEl.strokeWidth,
3244
+ strokeDasharray: shapeEl.strokeDash === "dashed" ? "6 4" : shapeEl.strokeDash === "dotted" ? "2 3" : void 0
3245
+ }
3246
+ )
3247
+ ]
3248
+ }
3249
+ ),
3250
+ isEditing ? /* @__PURE__ */ jsx6(
3251
+ "textarea",
3252
+ {
3253
+ className: "univer-slides-inline-textarea",
3254
+ autoFocus: true,
3255
+ value: shapeEl.text ?? "",
3256
+ style: {
3257
+ position: "relative",
3258
+ zIndex: 2,
3259
+ color: shapeEl.textColor || "#ffffff",
3260
+ fontSize: `${shapeEl.fontSize ?? 15}px`,
3261
+ fontWeight: shapeEl.fontWeight ?? "bold",
3262
+ textAlign: shapeEl.textAlign ?? "center"
3263
+ },
3264
+ onChange: (ev) => commandService.syncExecuteCommand(UpdateSlideElementsCommand2.id, {
3265
+ unitId,
3266
+ slideId: activeSlide.id,
3267
+ updates: [{ id: shapeEl.id, patch: { text: ev.target.value } }]
3268
+ }),
3269
+ onBlur: () => selectionService.setEditingElement(null)
3270
+ }
3271
+ ) : shapeEl.text && /* @__PURE__ */ jsx6(
3272
+ "div",
3273
+ {
3274
+ style: {
3275
+ position: "relative",
3276
+ zIndex: 1,
3277
+ width: "100%",
3278
+ height: "100%",
3279
+ display: "flex",
3280
+ alignItems: "center",
3281
+ justifyContent: "center",
3282
+ padding: "8px",
3283
+ boxSizing: "border-box",
3284
+ textAlign: shapeEl.textAlign ?? "center",
3285
+ color: shapeEl.textColor || "#ffffff",
3286
+ fontSize: `${shapeEl.fontSize ?? 15}px`,
3287
+ fontWeight: shapeEl.fontWeight ?? "bold",
3288
+ whiteSpace: "pre-line"
3289
+ },
3290
+ children: shapeEl.text
3291
+ }
3292
+ )
3293
+ ] });
3294
+ } else if (el.type === "table") {
3295
+ const tbl = el;
3296
+ content = /* @__PURE__ */ jsxs6(
3297
+ "table",
3298
+ {
3299
+ className: "univer-slides-stage-table",
3300
+ style: {
3301
+ width: "100%",
3302
+ height: "100%",
3303
+ borderCollapse: "collapse",
3304
+ tableLayout: "fixed"
3305
+ },
3306
+ children: [
3307
+ /* @__PURE__ */ jsx6("colgroup", { children: Array.from({ length: tbl.cols }, (_, c) => /* @__PURE__ */ jsx6("col", { style: { width: `${tbl.colWidths[c] ?? tbl.width / tbl.cols}px` } }, c)) }),
3308
+ /* @__PURE__ */ jsx6("tbody", { children: Array.from({ length: tbl.rows }, (_, r) => {
3309
+ const isHeader = tbl.headerRow !== false && r === 0;
3310
+ return /* @__PURE__ */ jsx6("tr", { style: { height: `${tbl.rowHeights[r] ?? tbl.height / tbl.rows}px` }, children: Array.from({ length: tbl.cols }, (__, c) => {
3311
+ const cell = tbl.cells[r]?.[c];
3312
+ if (cell?.mergedInto) return null;
3313
+ const isCellEditing = selection.editingTableCell?.elementId === tbl.id && selection.editingTableCell.row === r && selection.editingTableCell.col === c;
3314
+ const bg2 = cell?.bg || (isHeader ? tbl.headerBg || snapshot.theme.colors.primary : r % 2 === 1 ? tbl.zebraBg || "#f8fafc" : "#ffffff");
3315
+ const fg = cell?.color || (isHeader ? tbl.headerColor || "#ffffff" : snapshot.theme.colors.text);
3316
+ return /* @__PURE__ */ jsx6(
3317
+ "td",
3318
+ {
3319
+ rowSpan: cell?.rowSpan,
3320
+ colSpan: cell?.colSpan,
3321
+ onDoubleClick: (ev) => {
3322
+ ev.stopPropagation();
3323
+ selectionService.selectElements([tbl.id]);
3324
+ selectionService.setEditingTableCell({ elementId: tbl.id, row: r, col: c });
3325
+ },
3326
+ style: {
3327
+ backgroundColor: bg2,
3328
+ color: fg,
3329
+ border: `1px solid ${tbl.borderColor || "#cbd5e1"}`,
3330
+ padding: "4px 8px",
3331
+ fontSize: `${cell?.fontSize ?? 12}px`,
3332
+ fontWeight: cell?.bold || isHeader ? 700 : 400,
3333
+ fontStyle: cell?.italic ? "italic" : "normal",
3334
+ textAlign: cell?.align ?? "left",
3335
+ verticalAlign: "middle"
3336
+ },
3337
+ children: isCellEditing ? /* @__PURE__ */ jsx6(
3338
+ "input",
3339
+ {
3340
+ className: "univer-slides-cell-input",
3341
+ autoFocus: true,
3342
+ value: cell?.text ?? "",
3343
+ onChange: (ev) => {
3344
+ const clonedCells = Tools2.deepClone(tbl.cells);
3345
+ if (!clonedCells[r]) clonedCells[r] = [];
3346
+ clonedCells[r][c] = {
3347
+ ...clonedCells[r][c] ?? {},
3348
+ text: ev.target.value
3349
+ };
3350
+ commandService.syncExecuteCommand(UpdateSlideElementsCommand2.id, {
3351
+ unitId,
3352
+ slideId: activeSlide.id,
3353
+ updates: [{ id: tbl.id, patch: { cells: clonedCells } }]
3354
+ });
3355
+ },
3356
+ onBlur: () => selectionService.setEditingTableCell(null),
3357
+ onKeyDown: (ev) => {
3358
+ if (ev.key === "Enter" || ev.key === "Escape") {
3359
+ selectionService.setEditingTableCell(null);
3360
+ }
3361
+ }
3362
+ }
3363
+ ) : cell?.text ?? ""
3364
+ },
3365
+ c
3366
+ );
3367
+ }) }, r);
3368
+ }) })
3369
+ ]
3370
+ }
3371
+ );
3372
+ } else if (el.type === "chart") {
3373
+ const svgMarkup = renderSlideChartToSvg(el, snapshot.theme);
3374
+ content = /* @__PURE__ */ jsx6(
3375
+ "div",
3376
+ {
3377
+ className: "univer-slides-vector-host",
3378
+ style: { width: "100%", height: "100%" },
3379
+ dangerouslySetInnerHTML: { __html: svgMarkup }
3380
+ }
3381
+ );
3382
+ } else if (el.type === "smartArt") {
3383
+ const svgMarkup = renderSlideSmartArtToSvg(el, snapshot.theme);
3384
+ content = /* @__PURE__ */ jsx6(
3385
+ "div",
3386
+ {
3387
+ className: "univer-slides-vector-host",
3388
+ style: { width: "100%", height: "100%" },
3389
+ dangerouslySetInnerHTML: { __html: svgMarkup }
3390
+ }
3391
+ );
3392
+ } else if (el.type === "image" || el.type === "svg") {
3393
+ content = /* @__PURE__ */ jsx6(
3394
+ "img",
3395
+ {
3396
+ src: el.src,
3397
+ alt: el.altText || el.name || "slide-media",
3398
+ draggable: false,
3399
+ style: {
3400
+ width: "100%",
3401
+ height: "100%",
3402
+ objectFit: el.fit ?? "contain",
3403
+ borderRadius: `${el.borderRadius ?? 0}px`,
3404
+ pointerEvents: "none"
3405
+ }
3406
+ }
3407
+ );
3408
+ } else if (el.type === "codeBlock") {
3409
+ const dark = el.codeTheme !== "light";
3410
+ content = /* @__PURE__ */ jsxs6(
3411
+ "div",
3412
+ {
3413
+ style: {
3414
+ width: "100%",
3415
+ height: "100%",
3416
+ backgroundColor: dark ? "#0f172a" : "#f8fafc",
3417
+ color: dark ? "#e2e8f0" : "#0f172a",
3418
+ borderRadius: "8px",
3419
+ border: "1px solid #334155",
3420
+ padding: "10px 12px",
3421
+ boxSizing: "border-box",
3422
+ fontFamily: "Menlo, Monaco, Consolas, monospace",
3423
+ fontSize: `${el.fontSize ?? 12}px`,
3424
+ overflow: "hidden"
3425
+ },
3426
+ children: [
3427
+ /* @__PURE__ */ jsx6("div", { style: { fontSize: "10px", fontWeight: 700, color: "#38bdf8", marginBottom: "6px" }, children: el.language.toUpperCase() }),
3428
+ /* @__PURE__ */ jsx6("pre", { style: { margin: 0, whiteSpace: "pre-wrap" }, children: el.code })
3429
+ ]
3430
+ }
3431
+ );
3432
+ } else if (el.type === "sheetEmbed") {
3433
+ content = /* @__PURE__ */ jsxs6(
3434
+ "div",
3435
+ {
3436
+ style: {
3437
+ width: "100%",
3438
+ height: "100%",
3439
+ backgroundColor: "#ffffff",
3440
+ border: `1.5px solid ${el.accentColor || "#059669"}`,
3441
+ borderRadius: "6px",
3442
+ overflow: "hidden",
3443
+ display: "flex",
3444
+ flexDirection: "column"
3445
+ },
3446
+ children: [
3447
+ /* @__PURE__ */ jsx6(
3448
+ "div",
3449
+ {
3450
+ style: {
3451
+ backgroundColor: el.accentColor || "#059669",
3452
+ color: "#ffffff",
3453
+ padding: "4px 10px",
3454
+ fontSize: "11px",
3455
+ fontWeight: 700
3456
+ },
3457
+ children: el.title || "\u7535\u5B50\u8868\u683C\u5F15\u7528\u5FEB\u7167"
3458
+ }
3459
+ ),
3460
+ /* @__PURE__ */ jsxs6("table", { style: { width: "100%", borderCollapse: "collapse", fontSize: "11px", flex: 1 }, children: [
3461
+ /* @__PURE__ */ jsx6("thead", { children: /* @__PURE__ */ jsx6("tr", { style: { backgroundColor: "#ecfdf5" }, children: el.headers.map((h, i) => /* @__PURE__ */ jsx6("th", { style: { border: "1px solid #d1fae5", padding: "3px 6px" }, children: h }, i)) }) }),
3462
+ /* @__PURE__ */ jsx6("tbody", { children: el.rows.map((r, ri) => /* @__PURE__ */ jsx6("tr", { children: r.map((cell, ci) => /* @__PURE__ */ jsx6("td", { style: { border: "1px solid #e2e8f0", padding: "3px 6px", textAlign: ci === 0 ? "left" : "right" }, children: cell }, ci)) }, ri)) })
3463
+ ] })
3464
+ ]
3465
+ }
3466
+ );
3467
+ }
3468
+ return /* @__PURE__ */ jsxs6(
3469
+ "div",
3470
+ {
3471
+ className: `univer-slides-element-box${isSelected ? " is-selected" : ""}`,
3472
+ style: wrapperStyle,
3473
+ onMouseDown: (ev) => startDragMove(ev, el),
3474
+ onDoubleClick: (ev) => {
3475
+ ev.stopPropagation();
3476
+ if (el.type === "text" || el.type === "shape") {
3477
+ selectionService.selectElements([el.id]);
3478
+ selectionService.setEditingElement(el.id);
3479
+ }
3480
+ },
3481
+ children: [
3482
+ content,
3483
+ isSelected && !isEditing && !el.locked && /* @__PURE__ */ jsxs6(Fragment5, { children: [
3484
+ /* @__PURE__ */ jsx6(
3485
+ "div",
3486
+ {
3487
+ className: "univer-slides-rotate-handle",
3488
+ title: "\u62D6\u62FD\u65CB\u8F6C\u89D2\u5EA6",
3489
+ onMouseDown: (ev) => startRotate(ev, el)
3490
+ }
3491
+ ),
3492
+ ["nw", "n", "ne", "e", "se", "s", "sw", "w"].map((dir) => /* @__PURE__ */ jsx6(
3493
+ "div",
3494
+ {
3495
+ className: `univer-slides-resize-handle is-${dir}`,
3496
+ onMouseDown: (ev) => startResize(ev, el, dir)
3497
+ },
3498
+ dir
3499
+ ))
3500
+ ] })
3501
+ ]
3502
+ },
3503
+ el.id
3504
+ );
3505
+ };
3506
+ return /* @__PURE__ */ jsxs6(
3507
+ "div",
3508
+ {
3509
+ className: "univer-slides-workbench-center",
3510
+ tabIndex: 0,
3511
+ onKeyDown: (e) => {
3512
+ if ((e.key === "Delete" || e.key === "Backspace") && !selection.editingElementId && !selection.editingTableCell && selection.selectedElementIds.length > 0 && e.target?.tagName !== "INPUT" && e.target?.tagName !== "TEXTAREA") {
3513
+ commandService.syncExecuteCommand(DeleteSlideElementsCommand3.id, {
3514
+ unitId,
3515
+ slideId: activeSlide.id
3516
+ });
3517
+ }
3518
+ },
3519
+ children: [
3520
+ /* @__PURE__ */ jsxs6("div", { className: "univer-slides-quick-toolbar", children: [
3521
+ /* @__PURE__ */ jsxs6("div", { className: "univer-slides-toolbar-group", children: [
3522
+ /* @__PURE__ */ jsxs6(
3523
+ "button",
3524
+ {
3525
+ type: "button",
3526
+ className: "univer-slides-tool-btn",
3527
+ onClick: () => insertElement("text"),
3528
+ children: [
3529
+ /* @__PURE__ */ jsxs6("svg", { viewBox: "0 0 16 16", width: "14", height: "14", fill: "none", stroke: "currentColor", children: [
3530
+ /* @__PURE__ */ jsx6("rect", { x: "2", y: "2.5", width: "12", height: "11", rx: "1.4", strokeWidth: "1.2", strokeDasharray: "2 1.5" }),
3531
+ /* @__PURE__ */ jsx6("path", { d: "M5 5.2H11M8 5.2V11.2", strokeWidth: "1.4", strokeLinecap: "round" })
3532
+ ] }),
3533
+ /* @__PURE__ */ jsx6("span", { children: "\u6587\u672C\u6846" })
3534
+ ]
3535
+ }
3536
+ ),
3537
+ /* @__PURE__ */ jsxs6("div", { className: "univer-slides-dropdown-anchor", children: [
3538
+ /* @__PURE__ */ jsxs6(
3539
+ "button",
3540
+ {
3541
+ type: "button",
3542
+ className: "univer-slides-tool-btn",
3543
+ onClick: () => setOpenMenu(openMenu === "shape" ? null : "shape"),
3544
+ children: [
3545
+ /* @__PURE__ */ jsxs6("svg", { viewBox: "0 0 16 16", width: "14", height: "14", fill: "none", stroke: "currentColor", children: [
3546
+ /* @__PURE__ */ jsx6("rect", { x: "2.2", y: "2.5", width: "6.5", height: "6.5", rx: "1", strokeWidth: "1.3" }),
3547
+ /* @__PURE__ */ jsx6("circle", { cx: "10.8", cy: "10.5", r: "3.3", strokeWidth: "1.3" })
3548
+ ] }),
3549
+ /* @__PURE__ */ jsx6("span", { children: "\u5F62\u72B6" })
3550
+ ]
3551
+ }
3552
+ ),
3553
+ openMenu === "shape" && /* @__PURE__ */ jsx6("div", { className: "univer-slides-popover is-grid", children: SHAPE_CHOICES.map((sc) => /* @__PURE__ */ jsx6(
3554
+ "button",
3555
+ {
3556
+ type: "button",
3557
+ className: "univer-slides-popover-item",
3558
+ onClick: () => insertElement("shape", { shapeType: sc.kind, name: sc.label }),
3559
+ children: sc.label
3560
+ },
3561
+ sc.kind
3562
+ )) })
3563
+ ] }),
3564
+ /* @__PURE__ */ jsxs6("div", { className: "univer-slides-dropdown-anchor", children: [
3565
+ /* @__PURE__ */ jsxs6(
3566
+ "button",
3567
+ {
3568
+ type: "button",
3569
+ className: "univer-slides-tool-btn",
3570
+ onClick: () => setOpenMenu(openMenu === "connector" ? null : "connector"),
3571
+ children: [
3572
+ /* @__PURE__ */ jsxs6("svg", { viewBox: "0 0 16 16", width: "14", height: "14", fill: "none", stroke: "currentColor", children: [
3573
+ /* @__PURE__ */ jsx6("circle", { cx: "3.2", cy: "4", r: "1.4", strokeWidth: "1.3" }),
3574
+ /* @__PURE__ */ jsx6("circle", { cx: "12.8", cy: "12", r: "1.4", strokeWidth: "1.3" }),
3575
+ /* @__PURE__ */ jsx6("path", { d: "M4.6 4H8.2V12H11.4", strokeWidth: "1.3", strokeLinecap: "round" })
3576
+ ] }),
3577
+ /* @__PURE__ */ jsx6("span", { children: "\u8FDE\u63A5\u7EBF" })
3578
+ ]
3579
+ }
3580
+ ),
3581
+ openMenu === "connector" && /* @__PURE__ */ jsx6("div", { className: "univer-slides-popover", children: [
3582
+ { kind: "straight", label: "\u76F4\u7EBF\u7BAD\u5934\u8FDE\u63A5\u7EBF" },
3583
+ { kind: "elbow", label: "\u76F4\u89D2\u6298\u7EBF\u8FDE\u63A5\u7EBF" },
3584
+ { kind: "curved", label: "\u5E73\u6ED1\u8D1D\u585E\u5C14\u8FDE\u63A5\u7EBF" }
3585
+ ].map((cc) => /* @__PURE__ */ jsx6(
3586
+ "button",
3587
+ {
3588
+ type: "button",
3589
+ className: "univer-slides-popover-item",
3590
+ onClick: () => insertElement("connector", { connectorType: cc.kind, name: cc.label }),
3591
+ children: cc.label
3592
+ },
3593
+ cc.kind
3594
+ )) })
3595
+ ] }),
3596
+ /* @__PURE__ */ jsxs6(
3597
+ "button",
3598
+ {
3599
+ type: "button",
3600
+ className: "univer-slides-tool-btn",
3601
+ onClick: () => insertElement("table"),
3602
+ children: [
3603
+ /* @__PURE__ */ jsxs6("svg", { viewBox: "0 0 16 16", width: "14", height: "14", fill: "none", stroke: "currentColor", children: [
3604
+ /* @__PURE__ */ jsx6("rect", { x: "2", y: "2.5", width: "12", height: "11", rx: "1.2", strokeWidth: "1.3" }),
3605
+ /* @__PURE__ */ jsx6("path", { d: "M2 6.2H14M2 9.8H14M6.2 2.5V13.5M10.2 2.5V13.5", strokeWidth: "1.1" })
3606
+ ] }),
3607
+ /* @__PURE__ */ jsx6("span", { children: "\u8868\u683C" })
3608
+ ]
3609
+ }
3610
+ ),
3611
+ /* @__PURE__ */ jsxs6("div", { className: "univer-slides-dropdown-anchor", children: [
3612
+ /* @__PURE__ */ jsxs6(
3613
+ "button",
3614
+ {
3615
+ type: "button",
3616
+ className: "univer-slides-tool-btn",
3617
+ onClick: () => setOpenMenu(openMenu === "chart" ? null : "chart"),
3618
+ children: [
3619
+ /* @__PURE__ */ jsxs6("svg", { viewBox: "0 0 16 16", width: "14", height: "14", fill: "none", stroke: "currentColor", children: [
3620
+ /* @__PURE__ */ jsx6("path", { d: "M2.2 13.5H13.8", strokeWidth: "1.3", strokeLinecap: "round" }),
3621
+ /* @__PURE__ */ jsx6("rect", { x: "3.5", y: "8", width: "2.2", height: "5.5", strokeWidth: "1.2" }),
3622
+ /* @__PURE__ */ jsx6("rect", { x: "7", y: "4.8", width: "2.2", height: "8.7", strokeWidth: "1.2" }),
3623
+ /* @__PURE__ */ jsx6("rect", { x: "10.5", y: "2.8", width: "2.2", height: "10.7", strokeWidth: "1.2" })
3624
+ ] }),
3625
+ /* @__PURE__ */ jsx6("span", { children: "\u56FE\u8868" })
3626
+ ]
3627
+ }
3628
+ ),
3629
+ openMenu === "chart" && /* @__PURE__ */ jsx6("div", { className: "univer-slides-popover", children: CHART_CHOICES.map((ch) => /* @__PURE__ */ jsx6(
3630
+ "button",
3631
+ {
3632
+ type: "button",
3633
+ className: "univer-slides-popover-item",
3634
+ onClick: () => insertElement("chart", { chartType: ch.kind, title: ch.label }),
3635
+ children: ch.label
3636
+ },
3637
+ ch.kind
3638
+ )) })
3639
+ ] }),
3640
+ /* @__PURE__ */ jsxs6("div", { className: "univer-slides-dropdown-anchor", children: [
3641
+ /* @__PURE__ */ jsxs6(
3642
+ "button",
3643
+ {
3644
+ type: "button",
3645
+ className: "univer-slides-tool-btn",
3646
+ onClick: () => setOpenMenu(openMenu === "smartArt" ? null : "smartArt"),
3647
+ children: [
3648
+ /* @__PURE__ */ jsxs6("svg", { viewBox: "0 0 16 16", width: "14", height: "14", fill: "none", stroke: "currentColor", children: [
3649
+ /* @__PURE__ */ jsx6("rect", { x: "5.2", y: "2", width: "5.6", height: "3.2", rx: "0.7", strokeWidth: "1.25" }),
3650
+ /* @__PURE__ */ jsx6("rect", { x: "1.8", y: "10.4", width: "5", height: "3.2", rx: "0.7", strokeWidth: "1.25" }),
3651
+ /* @__PURE__ */ jsx6("rect", { x: "9.2", y: "10.4", width: "5", height: "3.2", rx: "0.7", strokeWidth: "1.25" }),
3652
+ /* @__PURE__ */ jsx6("path", { d: "M8 5.2V8M4.3 8H11.7M4.3 8V10.4M11.7 8V10.4", strokeWidth: "1.2" })
3653
+ ] }),
3654
+ /* @__PURE__ */ jsx6("span", { children: "\u667A\u80FD\u56FE\u793A SmartArt" })
3655
+ ]
3656
+ }
3657
+ ),
3658
+ openMenu === "smartArt" && /* @__PURE__ */ jsx6("div", { className: "univer-slides-popover", children: SMARTART_CHOICES.map((sa) => /* @__PURE__ */ jsx6(
3659
+ "button",
3660
+ {
3661
+ type: "button",
3662
+ className: "univer-slides-popover-item",
3663
+ onClick: () => insertElement("smartArt", { layout: sa.kind, title: sa.label }),
3664
+ children: sa.label
3665
+ },
3666
+ sa.kind
3667
+ )) })
3668
+ ] }),
3669
+ /* @__PURE__ */ jsxs6(
3670
+ "button",
3671
+ {
3672
+ type: "button",
3673
+ className: "univer-slides-tool-btn",
3674
+ onClick: handleUploadImage,
3675
+ children: [
3676
+ /* @__PURE__ */ jsxs6("svg", { viewBox: "0 0 16 16", width: "14", height: "14", fill: "none", stroke: "currentColor", children: [
3677
+ /* @__PURE__ */ jsx6("rect", { x: "2", y: "2.5", width: "12", height: "11", rx: "1.4", strokeWidth: "1.3" }),
3678
+ /* @__PURE__ */ jsx6("circle", { cx: "5.5", cy: "6", r: "1.1", strokeWidth: "1.2" }),
3679
+ /* @__PURE__ */ jsx6("path", { d: "M2.5 12L6.2 8.5L9.2 11.2L11.2 9.5L13.5 12", strokeWidth: "1.2", strokeLinecap: "round" })
3680
+ ] }),
3681
+ /* @__PURE__ */ jsx6("span", { children: "\u56FE\u7247" })
3682
+ ]
3683
+ }
3684
+ )
3685
+ ] }),
3686
+ /* @__PURE__ */ jsx6("span", { className: "univer-slides-toolbar-sep" }),
3687
+ /* @__PURE__ */ jsxs6("div", { className: "univer-slides-toolbar-group", children: [
3688
+ /* @__PURE__ */ jsxs6("div", { className: "univer-slides-dropdown-anchor", children: [
3689
+ /* @__PURE__ */ jsx6(
3690
+ "button",
3691
+ {
3692
+ type: "button",
3693
+ className: "univer-slides-tool-btn",
3694
+ onClick: () => setOpenMenu(openMenu === "layout" ? null : "layout"),
3695
+ children: /* @__PURE__ */ jsx6("span", { children: "\u6BCD\u7248\u7248\u5F0F" })
3696
+ }
3697
+ ),
3698
+ openMenu === "layout" && /* @__PURE__ */ jsx6("div", { className: "univer-slides-popover", children: LAYOUT_CHOICES.map((lc) => /* @__PURE__ */ jsx6(
3699
+ "button",
3700
+ {
3701
+ type: "button",
3702
+ className: "univer-slides-popover-item",
3703
+ onClick: () => {
3704
+ commandService.syncExecuteCommand(UpdateSlidePagePropsCommand3.id, {
3705
+ unitId,
3706
+ slideId: activeSlide.id,
3707
+ applyLayoutPlaceholders: true,
3708
+ patch: { layoutId: lc.kind }
3709
+ });
3710
+ setOpenMenu(null);
3711
+ },
3712
+ children: lc.label
3713
+ },
3714
+ lc.kind
3715
+ )) })
3716
+ ] }),
3717
+ /* @__PURE__ */ jsxs6("div", { className: "univer-slides-dropdown-anchor", children: [
3718
+ /* @__PURE__ */ jsx6(
3719
+ "button",
3720
+ {
3721
+ type: "button",
3722
+ className: "univer-slides-tool-btn",
3723
+ onClick: () => setOpenMenu(openMenu === "transition" ? null : "transition"),
3724
+ children: /* @__PURE__ */ jsx6("span", { children: "\u5207\u6362\u52A8\u753B" })
3725
+ }
3726
+ ),
3727
+ openMenu === "transition" && /* @__PURE__ */ jsx6("div", { className: "univer-slides-popover", children: TRANSITION_CHOICES.map((tc) => /* @__PURE__ */ jsx6(
3728
+ "button",
3729
+ {
3730
+ type: "button",
3731
+ className: "univer-slides-popover-item",
3732
+ onClick: () => {
3733
+ commandService.syncExecuteCommand(UpdateSlidePagePropsCommand3.id, {
3734
+ unitId,
3735
+ slideId: activeSlide.id,
3736
+ patch: {
3737
+ transition: {
3738
+ type: tc.kind,
3739
+ durationMs: activeSlide.transition?.durationMs ?? 500
3740
+ }
3741
+ }
3742
+ });
3743
+ setOpenMenu(null);
3744
+ },
3745
+ children: tc.label
3746
+ },
3747
+ tc.kind
3748
+ )) })
3749
+ ] }),
3750
+ /* @__PURE__ */ jsx6(
3751
+ "button",
3752
+ {
3753
+ type: "button",
3754
+ className: `univer-slides-tool-btn${selection.findReplaceOpen ? " is-active" : ""}`,
3755
+ onClick: () => selectionService.setFindReplaceOpen(!selection.findReplaceOpen),
3756
+ children: /* @__PURE__ */ jsx6("span", { children: "\u67E5\u627E\u66FF\u6362" })
3757
+ }
3758
+ ),
3759
+ /* @__PURE__ */ jsx6(
3760
+ "button",
3761
+ {
3762
+ type: "button",
3763
+ className: "univer-slides-tool-btn",
3764
+ onClick: () => commandService.executeCommand(ToggleSlidesInspectorOperation.id),
3765
+ children: /* @__PURE__ */ jsx6("span", { children: "\u5C5E\u6027\u9762\u677F" })
3766
+ }
3767
+ )
3768
+ ] }),
3769
+ /* @__PURE__ */ jsx6("span", { className: "univer-slides-toolbar-sep" }),
3770
+ /* @__PURE__ */ jsxs6("div", { className: "univer-slides-toolbar-group", children: [
3771
+ /* @__PURE__ */ jsx6(
3772
+ "button",
3773
+ {
3774
+ type: "button",
3775
+ className: "univer-slides-tool-btn",
3776
+ onClick: () => commandService.executeCommand(ImportSlidesPptxOperation.id, { unitId }),
3777
+ children: /* @__PURE__ */ jsx6("span", { children: "\u5BFC\u5165 PPTX" })
3778
+ }
3779
+ ),
3780
+ /* @__PURE__ */ jsx6(
3781
+ "button",
3782
+ {
3783
+ type: "button",
3784
+ className: "univer-slides-tool-btn",
3785
+ onClick: () => commandService.executeCommand(ExportSlidesPptxOperation.id, { unitId }),
3786
+ children: /* @__PURE__ */ jsx6("span", { children: "\u5BFC\u51FA PPTX" })
3787
+ }
3788
+ ),
3789
+ /* @__PURE__ */ jsxs6("div", { className: "univer-slides-dropdown-anchor", children: [
3790
+ /* @__PURE__ */ jsx6(
3791
+ "button",
3792
+ {
3793
+ type: "button",
3794
+ className: "univer-slides-tool-btn",
3795
+ onClick: () => setOpenMenu(openMenu === "pdf" ? null : "pdf"),
3796
+ children: /* @__PURE__ */ jsx6("span", { children: "\u5BFC\u51FA PDF" })
3797
+ }
3798
+ ),
3799
+ openMenu === "pdf" && /* @__PURE__ */ jsxs6("div", { className: "univer-slides-popover", children: [
3800
+ /* @__PURE__ */ jsx6(
3801
+ "button",
3802
+ {
3803
+ type: "button",
3804
+ className: "univer-slides-popover-item",
3805
+ onClick: () => {
3806
+ commandService.executeCommand(ExportSlidesPdfOperation.id, {
3807
+ unitId,
3808
+ handoutNotesMode: false
3809
+ });
3810
+ setOpenMenu(null);
3811
+ },
3812
+ children: "\u6807\u51C6\u5BBD\u5C4F\u77E2\u91CF PDF"
3813
+ }
3814
+ ),
3815
+ /* @__PURE__ */ jsx6(
3816
+ "button",
3817
+ {
3818
+ type: "button",
3819
+ className: "univer-slides-popover-item",
3820
+ onClick: () => {
3821
+ commandService.executeCommand(ExportSlidesPdfOperation.id, {
3822
+ unitId,
3823
+ handoutNotesMode: true
3824
+ });
3825
+ setOpenMenu(null);
3826
+ },
3827
+ children: "A4 \u6F14\u8BB2\u8005\u5907\u6CE8\u8BB2\u4E49 PDF"
3828
+ }
3829
+ )
3830
+ ] })
3831
+ ] }),
3832
+ /* @__PURE__ */ jsx6(
3833
+ "button",
3834
+ {
3835
+ type: "button",
3836
+ className: "univer-slides-tool-btn is-accent",
3837
+ onClick: () => commandService.executeCommand(StartSlideShowOperation.id, {
3838
+ mode: "fullscreen",
3839
+ fromStart: true
3840
+ }),
3841
+ children: /* @__PURE__ */ jsx6("span", { children: "\u4ECE\u5934\u653E\u6620" })
3842
+ }
3843
+ ),
3844
+ /* @__PURE__ */ jsx6(
3845
+ "button",
3846
+ {
3847
+ type: "button",
3848
+ className: "univer-slides-tool-btn is-primary",
3849
+ onClick: () => commandService.executeCommand(StartSlideShowOperation.id, {
3850
+ mode: "presenter",
3851
+ fromStart: false
3852
+ }),
3853
+ children: /* @__PURE__ */ jsx6("span", { children: "\u5F53\u524D\u9875\u653E\u6620" })
3854
+ }
3855
+ )
3856
+ ] })
3857
+ ] }),
3858
+ selection.findReplaceOpen && /* @__PURE__ */ jsxs6("div", { className: "univer-slides-find-bar", children: [
3859
+ /* @__PURE__ */ jsx6(
3860
+ "input",
3861
+ {
3862
+ className: "univer-slides-input",
3863
+ placeholder: "\u67E5\u627E\u5E7B\u706F\u7247\u4E0E\u5907\u6CE8\u4E2D\u7684\u6587\u672C...",
3864
+ value: findQuery,
3865
+ onChange: (e) => setFindQuery(e.target.value)
3866
+ }
3867
+ ),
3868
+ /* @__PURE__ */ jsx6(
3869
+ "input",
3870
+ {
3871
+ className: "univer-slides-input",
3872
+ placeholder: "\u66FF\u6362\u4E3A...",
3873
+ value: replaceQuery,
3874
+ onChange: (e) => setReplaceQuery(e.target.value)
3875
+ }
3876
+ ),
3877
+ /* @__PURE__ */ jsxs6("label", { className: "univer-slides-checkbox-label", children: [
3878
+ /* @__PURE__ */ jsx6(
3879
+ "input",
3880
+ {
3881
+ type: "checkbox",
3882
+ checked: matchCase,
3883
+ onChange: (e) => setMatchCase(e.target.checked)
3884
+ }
3885
+ ),
3886
+ /* @__PURE__ */ jsx6("span", { children: "\u533A\u5206\u5927\u5C0F\u5199" })
3887
+ ] }),
3888
+ /* @__PURE__ */ jsxs6("span", { className: "univer-slides-find-count", children: [
3889
+ "\u5339\u914D ",
3890
+ matchCount,
3891
+ " \u5904"
3892
+ ] }),
3893
+ /* @__PURE__ */ jsx6(
3894
+ "button",
3895
+ {
3896
+ type: "button",
3897
+ className: "univer-slides-primary-btn",
3898
+ disabled: !findQuery || matchCount === 0,
3899
+ onClick: () => commandService.syncExecuteCommand(FindAndReplaceSlideTextCommand.id, {
3900
+ unitId,
3901
+ findText: findQuery,
3902
+ replaceText: replaceQuery,
3903
+ matchCase
3904
+ }),
3905
+ children: "\u5168\u90E8\u66FF\u6362"
3906
+ }
3907
+ ),
3908
+ /* @__PURE__ */ jsx6(
3909
+ "button",
3910
+ {
3911
+ type: "button",
3912
+ className: "univer-slides-icon-btn",
3913
+ onClick: () => selectionService.setFindReplaceOpen(false),
3914
+ children: "\xD7"
3915
+ }
3916
+ )
3917
+ ] }),
3918
+ /* @__PURE__ */ jsx6(
3919
+ "div",
3920
+ {
3921
+ className: "univer-slides-canvas-viewport",
3922
+ onMouseDown: () => {
3923
+ selectionService.selectElements([]);
3924
+ setOpenMenu(null);
3925
+ },
3926
+ children: /* @__PURE__ */ jsx6(
3927
+ "div",
3928
+ {
3929
+ className: "univer-slides-canvas-scaler",
3930
+ style: {
3931
+ width: `${Math.round(slideW * zoom)}px`,
3932
+ height: `${Math.round(slideH * zoom)}px`
3933
+ },
3934
+ children: /* @__PURE__ */ jsxs6(
3935
+ "div",
3936
+ {
3937
+ ref: canvasRef,
3938
+ className: `univer-slides-canvas-surface${selection.showGrid ? " has-grid" : ""}`,
3939
+ style: {
3940
+ width: `${slideW}px`,
3941
+ height: `${slideH}px`,
3942
+ transform: `scale(${zoom})`,
3943
+ transformOrigin: "top left",
3944
+ ...slideBgStyle
3945
+ },
3946
+ children: [
3947
+ snapshot.masters[0]?.accentBar && /* @__PURE__ */ jsx6(
3948
+ "div",
3949
+ {
3950
+ className: "univer-slides-master-bar",
3951
+ style: { backgroundColor: snapshot.theme.colors.primary }
3952
+ }
3953
+ ),
3954
+ activeSlide.elementOrder.map((elId) => {
3955
+ const el = activeSlide.elements[elId];
3956
+ return el ? renderElementNode(el) : null;
3957
+ }),
3958
+ snapGuides.map(
3959
+ (g, idx) => g.axis === "x" ? /* @__PURE__ */ jsx6(
3960
+ "div",
3961
+ {
3962
+ className: "univer-slides-snap-guide is-vertical",
3963
+ style: { left: `${g.posPt}px` }
3964
+ },
3965
+ idx
3966
+ ) : /* @__PURE__ */ jsx6(
3967
+ "div",
3968
+ {
3969
+ className: "univer-slides-snap-guide is-horizontal",
3970
+ style: { top: `${g.posPt}px` }
3971
+ },
3972
+ idx
3973
+ )
3974
+ ),
3975
+ activeSlide.showSlideNumber !== false && /* @__PURE__ */ jsx6("div", { className: "univer-slides-page-number", children: activeSlideIndex + 1 })
3976
+ ]
3977
+ }
3978
+ )
3979
+ }
3980
+ )
3981
+ }
3982
+ ),
3983
+ /* @__PURE__ */ jsxs6("div", { className: "univer-slides-notes-pane", children: [
3984
+ selection.showSpeakerNotes && /* @__PURE__ */ jsx6(
3985
+ "div",
3986
+ {
3987
+ className: "univer-slides-notes-resizer",
3988
+ onMouseDown: startNotesResize,
3989
+ title: "\u4E0A\u4E0B\u62D6\u62FD\u8C03\u6574\u5907\u6CE8\u680F\u9AD8\u5EA6"
3990
+ }
3991
+ ),
3992
+ /* @__PURE__ */ jsxs6("div", { className: "univer-slides-notes-header", children: [
3993
+ /* @__PURE__ */ jsxs6("span", { className: "univer-slides-notes-label", children: [
3994
+ "\u6F14\u8BB2\u8005\u5907\u6CE8 (Speaker Notes) \u2014 ",
3995
+ activeSlide.title
3996
+ ] }),
3997
+ /* @__PURE__ */ jsx6(
3998
+ "button",
3999
+ {
4000
+ type: "button",
4001
+ className: "univer-slides-notes-toggle",
4002
+ onClick: () => selectionService.setShowSpeakerNotes(!selection.showSpeakerNotes),
4003
+ children: selection.showSpeakerNotes ? "\u6536\u8D77\u5907\u6CE8" : "\u5C55\u5F00\u5907\u6CE8"
4004
+ }
4005
+ )
4006
+ ] }),
4007
+ selection.showSpeakerNotes && /* @__PURE__ */ jsx6(
4008
+ "textarea",
4009
+ {
4010
+ className: "univer-slides-notes-textarea",
4011
+ style: { height: `${selection.speakerNotesHeight}px` },
4012
+ placeholder: "\u5728\u6B64\u8F93\u5165\u672C\u9875\u6F14\u8BB2\u8005\u5907\u6CE8\u4E0E\u63D0\u8BCD\u8981\u70B9\uFF08\u53CC\u5411\u540C\u6B65\u81F3 .pptx notesSlide \u4E0E\u6F14\u8BB2\u8005\u89C6\u56FE\u63D0\u8BCD\u5668\uFF09...",
4013
+ value: activeSlide.speakerNotes ?? "",
4014
+ onChange: (e) => commandService.syncExecuteCommand(UpdateSlidePagePropsCommand3.id, {
4015
+ unitId,
4016
+ slideId: activeSlide.id,
4017
+ patch: { speakerNotes: e.target.value }
4018
+ })
4019
+ }
4020
+ )
4021
+ ] })
4022
+ ]
4023
+ }
4024
+ );
4025
+ };
4026
+
4027
+ // src/controllers/slides-ui.controller.ts
4028
+ var SlidesUIController = class extends Disposable {
4029
+ constructor(_config, _commandService, _menuManagerService, _uiPartsService, _sidebarService, _componentManager, _iconManager) {
4030
+ super();
4031
+ this._config = _config;
4032
+ this._commandService = _commandService;
4033
+ this._menuManagerService = _menuManagerService;
4034
+ this._uiPartsService = _uiPartsService;
4035
+ this._sidebarService = _sidebarService;
4036
+ this._componentManager = _componentManager;
4037
+ this._iconManager = _iconManager;
4038
+ this._openInspectorTimer = null;
4039
+ this._initIcons();
4040
+ this._initComponents();
4041
+ this._initOperations();
4042
+ this._initMenus();
4043
+ this._initWorkbenchParts();
4044
+ if (this._config.defaultOpenInspector) {
4045
+ this._openInspectorTimer = setTimeout(() => {
4046
+ this._openInspectorTimer = null;
4047
+ if (!this._disposed) {
4048
+ openSlidesInspectorSidebar(this._sidebarService);
4049
+ }
4050
+ }, 100);
4051
+ this.disposeWithMe(
4052
+ toDisposable(() => {
4053
+ if (this._openInspectorTimer !== null) {
4054
+ clearTimeout(this._openInspectorTimer);
4055
+ this._openInspectorTimer = null;
4056
+ }
4057
+ })
4058
+ );
4059
+ }
4060
+ }
4061
+ _initIcons() {
4062
+ this.disposeWithMe(this._iconManager.register(SLIDE_ICON_MAP));
4063
+ }
4064
+ _initComponents() {
4065
+ this.disposeWithMe(
4066
+ this._componentManager.register(SLIDES_INSPECTOR_COMPONENT_KEY, SlidesInspectorPanel)
4067
+ );
4068
+ }
4069
+ _initOperations() {
4070
+ const operations = [
4071
+ ToggleSlidesInspectorOperation,
4072
+ ToggleSlidesFindReplaceOperation,
4073
+ StartSlideShowOperation,
4074
+ AdjustSlidesZoomOperation,
4075
+ ToggleSlidesGridOperation,
4076
+ ToggleSlidesSnapOperation,
4077
+ ToggleSlidesSpeakerNotesOperation,
4078
+ ExportSlidesPptxOperation,
4079
+ ExportSlidesPdfOperation,
4080
+ ImportSlidesPptxOperation
4081
+ ];
4082
+ for (const op of operations) {
4083
+ this.disposeWithMe(this._commandService.registerCommand(op));
4084
+ }
4085
+ }
4086
+ _initMenus() {
4087
+ this._menuManagerService.appendRootMenu(slidesRootMenuExtension);
4088
+ this._menuManagerService.mergeMenu(slidesMenuSchema);
4089
+ }
4090
+ _initWorkbenchParts() {
4091
+ this.disposeWithMe(
4092
+ this._uiPartsService.registerComponent(BuiltInUIPart.LEFT_SIDEBAR, () => SlidesLeftSidebar)
4093
+ );
4094
+ this.disposeWithMe(
4095
+ this._uiPartsService.registerComponent(BuiltInUIPart.CONTENT, () => SlidesCanvasStage)
4096
+ );
4097
+ this.disposeWithMe(
4098
+ this._uiPartsService.registerComponent(BuiltInUIPart.FOOTER, () => SlidesStatusBar)
4099
+ );
4100
+ this.disposeWithMe(
4101
+ this._uiPartsService.registerComponent(
4102
+ BuiltInUIPart.GLOBAL,
4103
+ () => SlidesPresenterAndModalsHost
4104
+ )
4105
+ );
4106
+ }
4107
+ };
4108
+ SlidesUIController = __decorateClass([
4109
+ __decorateParam(1, ICommandService6),
4110
+ __decorateParam(2, IMenuManagerService),
4111
+ __decorateParam(3, IUIPartsService),
4112
+ __decorateParam(4, ISidebarService2),
4113
+ __decorateParam(5, Inject(ComponentManager)),
4114
+ __decorateParam(6, Inject(IconManager))
4115
+ ], SlidesUIController);
4116
+
4117
+ // src/plugin.ts
4118
+ import {
4119
+ DependentOn,
4120
+ Inject as Inject2,
4121
+ Injector,
4122
+ LocaleService,
4123
+ LocaleType,
4124
+ Plugin,
4125
+ UniverInstanceType as UniverInstanceType3
4126
+ } from "@univerjs/core";
4127
+ import { UniverRenderEnginePlugin } from "@univerjs/engine-render";
4128
+ import { UniverSlidesPlugin } from "@yudaocode/univer-slides";
4129
+ var UNIVER_SLIDES_UI_PLUGIN_NAME = "UNIVER_SLIDES_UI_PLUGIN";
4130
+ var UniverSlidesUIPlugin = class extends Plugin {
4131
+ constructor(_config = {}, _injector) {
4132
+ super();
4133
+ this._config = _config;
4134
+ this._injector = _injector;
4135
+ }
4136
+ onStarting() {
4137
+ if (this._injector.has(LocaleService)) {
4138
+ this._injector.get(LocaleService).load({
4139
+ [LocaleType.ZH_CN]: zh_CN_default,
4140
+ [LocaleType.EN_US]: en_US_default
4141
+ });
4142
+ }
4143
+ this._injector.add([
4144
+ SlidesUIController,
4145
+ {
4146
+ useFactory: () => this._injector.createInstance(SlidesUIController, this._config)
4147
+ }
4148
+ ]);
4149
+ this._injector.get(SlidesUIController);
4150
+ }
4151
+ };
4152
+ UniverSlidesUIPlugin.pluginName = UNIVER_SLIDES_UI_PLUGIN_NAME;
4153
+ UniverSlidesUIPlugin.packageName = "@yudaocode/univer-slides-ui";
4154
+ UniverSlidesUIPlugin.type = UniverInstanceType3.UNIVER_SLIDE;
4155
+ UniverSlidesUIPlugin = __decorateClass([
4156
+ DependentOn(UniverRenderEnginePlugin, UniverSlidesPlugin),
4157
+ __decorateParam(1, Inject2(Injector))
4158
+ ], UniverSlidesUIPlugin);
4159
+
4160
+ // src/index.ts
4161
+ var VERSION = "1.6.218";
4162
+ export {
4163
+ AdjustSlidesZoomOperation,
4164
+ AlignSlideCenterMenuFactory,
4165
+ AlignSlideLeftMenuFactory,
4166
+ AlignSlideRightMenuFactory,
4167
+ DeleteSlideElementMenuFactory,
4168
+ DuplicateSlideMenuFactory,
4169
+ ExportPdfMenuFactory,
4170
+ ExportPptxMenuFactory,
4171
+ ExportSlidesPdfOperation,
4172
+ ExportSlidesPptxOperation,
4173
+ ImportPptxMenuFactory,
4174
+ ImportSlidesPptxOperation,
4175
+ InsertSlideChartMenuFactory,
4176
+ InsertSlideConnectorMenuFactory,
4177
+ InsertSlideImageMenuFactory,
4178
+ InsertSlideShapeMenuFactory,
4179
+ InsertSlideSmartArtMenuFactory,
4180
+ InsertSlideTableMenuFactory,
4181
+ InsertSlideTextMenuFactory,
4182
+ NewSlideMenuFactory,
4183
+ PlayCurrentMenuFactory,
4184
+ PlayFromStartMenuFactory,
4185
+ PresenterViewMenuFactory,
4186
+ SLIDES_INSPECTOR_COMPONENT_KEY,
4187
+ SLIDES_INSPECTOR_SIDEBAR_ID,
4188
+ SLIDES_RIBBON_SLIDESHOW_GROUP,
4189
+ SLIDES_RIBBON_SLIDESHOW_TAB,
4190
+ SLIDE_ICON_MAP,
4191
+ SlideAlignCenterIcon,
4192
+ SlideAlignLeftIcon,
4193
+ SlideAlignRightIcon,
4194
+ SlideAnimationIcon,
4195
+ SlideChartIcon,
4196
+ SlideConnectorIcon,
4197
+ SlideDeleteIcon,
4198
+ SlideDuplicateIcon,
4199
+ SlideExportIcon,
4200
+ SlideEyeIcon,
4201
+ SlideEyeOffIcon,
4202
+ SlideFindIcon,
4203
+ SlideGridIcon,
4204
+ SlideImageIcon,
4205
+ SlideImportIcon,
4206
+ SlideInspectorIcon,
4207
+ SlideLaserIcon,
4208
+ SlideLayoutIcon,
4209
+ SlideNewPageIcon,
4210
+ SlideNotesIcon,
4211
+ SlidePdfIcon,
4212
+ SlidePenIcon,
4213
+ SlidePlayIcon,
4214
+ SlidePresenterIcon,
4215
+ SlideSectionFolderIcon,
4216
+ SlideShapeIcon,
4217
+ SlideSmartArtIcon,
4218
+ SlideTableIcon,
4219
+ SlideTextIcon,
4220
+ SlideTransitionIcon,
4221
+ SlidesCanvasStage,
4222
+ SlidesInspectorPanel,
4223
+ SlidesLeftSidebar,
4224
+ SlidesPresenterAndModalsHost,
4225
+ SlidesPresenterModal,
4226
+ SlidesStatusBar,
4227
+ SlidesUIController,
4228
+ StartSlideShowOperation,
4229
+ ToggleGridMenuFactory,
4230
+ ToggleNotesMenuFactory,
4231
+ ToggleSlidesFindMenuFactory,
4232
+ ToggleSlidesFindReplaceOperation,
4233
+ ToggleSlidesGridOperation,
4234
+ ToggleSlidesInspectorMenuFactory,
4235
+ ToggleSlidesInspectorOperation,
4236
+ ToggleSlidesSnapOperation,
4237
+ ToggleSlidesSpeakerNotesOperation,
4238
+ ToggleSnapMenuFactory,
4239
+ UNIVER_SLIDES_UI_PLUGIN_NAME,
4240
+ UniverSlidesUIPlugin,
4241
+ VERSION,
4242
+ ZoomResetSlidesMenuFactory,
4243
+ openSlidesInspectorSidebar,
4244
+ slidesMenuSchema,
4245
+ slidesRootMenuExtension,
4246
+ triggerBrowserDownload,
4247
+ useActiveSlideUnit
4248
+ };
4249
+ //# sourceMappingURL=index.js.map