@univer-cli/content-inspection 1.0.0-beta.2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -3
- package/README.zh-CN.md +9 -6
- package/dist/index.d.ts +227 -4
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ English | [简体中文](./README.zh-CN.md)
|
|
|
4
4
|
|
|
5
5
|
Read stable, structured content information from loaded Univer Units, suitable for CLI, Agent, testing or other automation tools.
|
|
6
6
|
|
|
7
|
-
It supports Sheet, Doc, and
|
|
7
|
+
It supports Sheet, Doc, Slide, Base, and Board. Supply a read-only runtime and a typed query to receive a JSON-compatible result.
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
@@ -49,13 +49,15 @@ Each Unit has an overview query, which is used to first discover the structure a
|
|
|
49
49
|
|
|
50
50
|
- Sheet: `workbook` overview, select worksheet by ID/name/index, or read worksheet range;
|
|
51
51
|
- Doc: `document` overview, or select paragraph by ID/index;
|
|
52
|
-
- Slide: `presentation` overview, or select a slide by ID/index
|
|
52
|
+
- Slide: `presentation` overview, or select a slide by ID/index;
|
|
53
|
+
- Base: `base` overview of ordered tables, fields, record counts, and views. Field config is included, but record values and view projections are not.
|
|
54
|
+
- Board: `board` overview for ordered element summaries, type counts, background, and theme; or `board-element` details selected by exact element ID.
|
|
53
55
|
|
|
54
56
|
The query is a discriminated union, so TypeScript infers the fields available for each query kind. Results contain only JSON-compatible values for straightforward serialization and cross-process transfer.
|
|
55
57
|
|
|
56
58
|
## Error model
|
|
57
59
|
|
|
58
|
-
|
|
60
|
+
Failures use `ContentInspectionError` with stable codes for invalid selectors, missing content, Unit type mismatches, runtime failures, and invalid results.
|
|
59
61
|
|
|
60
62
|
For the preset command, see
|
|
61
63
|
[`@univer-cli/content-inspection-command`](../content-inspection-command/README.md).
|
package/README.zh-CN.md
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
从已经加载的 Univer Unit 中读取稳定、结构化的内容信息,适合 CLI、Agent、测试或其他自动化工具。
|
|
6
6
|
|
|
7
|
-
支持 Sheet、Doc 和
|
|
8
|
-
|
|
7
|
+
支持 Sheet、Doc、Slide、Base 和 Board。调用方提供只读 runtime 和 typed query,即可得到 JSON-compatible
|
|
8
|
+
result。
|
|
9
9
|
|
|
10
10
|
## 安装
|
|
11
11
|
|
|
@@ -50,16 +50,19 @@ Collaboration Runtime lease 可以直接适配这个接口。
|
|
|
50
50
|
|
|
51
51
|
- Sheet:`workbook` overview、按 ID/name/index 选择 worksheet,或读取 worksheet range;
|
|
52
52
|
- Doc:`document` overview,或按 ID/index 选择 paragraph;
|
|
53
|
-
- Slide:`presentation` overview,或按 ID/index 选择 slide
|
|
53
|
+
- Slide:`presentation` overview,或按 ID/index 选择 slide;
|
|
54
|
+
- Base:通过 `base` overview 读取有序的 Table、Field、Record 数量和 View。结果包含字段 config,
|
|
55
|
+
但不包含记录值和 View projection。
|
|
56
|
+
- Board:通过 `board` overview 读取按 z-order 排列的 element summary、类型计数、背景和主题;再通过精确
|
|
57
|
+
element ID 查询 `board-element` details。
|
|
54
58
|
|
|
55
59
|
Query 是 discriminated union,具体字段由 TypeScript 自动提示。结果只包含 JSON-compatible value,便于序列化
|
|
56
60
|
和跨进程传递。
|
|
57
61
|
|
|
58
62
|
## 错误模型
|
|
59
63
|
|
|
60
|
-
|
|
61
|
-
`ContentInspectionError
|
|
62
|
-
inspection result。
|
|
64
|
+
输入非法、内容不存在、Unit 类型不匹配、runtime 失败或结果无效时,package 会抛出带稳定 error code 的
|
|
65
|
+
`ContentInspectionError`。
|
|
63
66
|
|
|
64
67
|
预设 command 见
|
|
65
68
|
[`@univer-cli/content-inspection-command`](../content-inspection-command/README.zh-CN.md)。
|
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ declare class ContentInspectionError extends Error {
|
|
|
13
13
|
}
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/types.d.ts
|
|
16
|
-
type ContentInspectionTarget = "workbook" | "worksheet" | "worksheet-range" | "presentation" | "slide" | "
|
|
16
|
+
type ContentInspectionTarget = "workbook" | "worksheet" | "worksheet-range" | "document" | "paragraph" | "presentation" | "slide" | "base" | "board" | "board-element";
|
|
17
17
|
type WorksheetSelector = {
|
|
18
18
|
readonly id: string;
|
|
19
19
|
} | {
|
|
@@ -31,9 +31,22 @@ type ParagraphSelector = {
|
|
|
31
31
|
} | {
|
|
32
32
|
readonly index: number;
|
|
33
33
|
};
|
|
34
|
+
interface BoardElementSelector {
|
|
35
|
+
readonly id: string;
|
|
36
|
+
}
|
|
34
37
|
interface WorkbookInspectionQuery {
|
|
35
38
|
readonly kind: "workbook";
|
|
36
39
|
}
|
|
40
|
+
interface BaseInspectionQuery {
|
|
41
|
+
readonly kind: "base";
|
|
42
|
+
}
|
|
43
|
+
interface BoardInspectionQuery {
|
|
44
|
+
readonly kind: "board";
|
|
45
|
+
}
|
|
46
|
+
interface BoardElementInspectionQuery {
|
|
47
|
+
readonly elements: readonly [BoardElementSelector, ...BoardElementSelector[]];
|
|
48
|
+
readonly kind: "board-element";
|
|
49
|
+
}
|
|
37
50
|
interface WorksheetInspectionQuery {
|
|
38
51
|
readonly kind: "worksheet";
|
|
39
52
|
readonly worksheets: readonly [WorksheetSelector, ...WorksheetSelector[]];
|
|
@@ -62,7 +75,184 @@ interface ParagraphInspectionQuery {
|
|
|
62
75
|
readonly kind: "paragraph";
|
|
63
76
|
readonly paragraphs: readonly [ParagraphSelector, ...ParagraphSelector[]];
|
|
64
77
|
}
|
|
65
|
-
type ContentInspectionQuery = WorkbookInspectionQuery | WorksheetInspectionQuery | WorksheetRangeInspectionQuery | PresentationInspectionQuery | SlideInspectionQuery |
|
|
78
|
+
type ContentInspectionQuery = WorkbookInspectionQuery | WorksheetInspectionQuery | WorksheetRangeInspectionQuery | DocumentInspectionQuery | ParagraphInspectionQuery | PresentationInspectionQuery | SlideInspectionQuery | BaseInspectionQuery | BoardInspectionQuery | BoardElementInspectionQuery;
|
|
79
|
+
interface BoardRect {
|
|
80
|
+
readonly height: number;
|
|
81
|
+
readonly left: number;
|
|
82
|
+
readonly top: number;
|
|
83
|
+
readonly width: number;
|
|
84
|
+
}
|
|
85
|
+
interface BoardElementTransform {
|
|
86
|
+
readonly flipX?: boolean;
|
|
87
|
+
readonly flipY?: boolean;
|
|
88
|
+
readonly height?: number;
|
|
89
|
+
readonly left?: number;
|
|
90
|
+
readonly rotation?: number;
|
|
91
|
+
readonly scaleX?: number;
|
|
92
|
+
readonly scaleY?: number;
|
|
93
|
+
readonly skewX?: number;
|
|
94
|
+
readonly skewY?: number;
|
|
95
|
+
readonly top?: number;
|
|
96
|
+
readonly width?: number;
|
|
97
|
+
}
|
|
98
|
+
interface BoardElementSummary {
|
|
99
|
+
readonly bounds: BoardRect | null;
|
|
100
|
+
readonly description?: string;
|
|
101
|
+
readonly endElementId?: string;
|
|
102
|
+
readonly id: string;
|
|
103
|
+
readonly laneId?: string;
|
|
104
|
+
readonly locked: boolean;
|
|
105
|
+
readonly name?: string;
|
|
106
|
+
readonly orderIndex: number;
|
|
107
|
+
readonly parentId?: string;
|
|
108
|
+
readonly selectable: boolean;
|
|
109
|
+
readonly startElementId?: string;
|
|
110
|
+
readonly subtype?: string;
|
|
111
|
+
readonly text?: string;
|
|
112
|
+
readonly transform: BoardElementTransform;
|
|
113
|
+
readonly type: string;
|
|
114
|
+
readonly visible: boolean;
|
|
115
|
+
}
|
|
116
|
+
interface BoardElementCounts {
|
|
117
|
+
readonly byType: Readonly<Record<string, number>>;
|
|
118
|
+
readonly total: number;
|
|
119
|
+
}
|
|
120
|
+
interface BoardConnectorPoint {
|
|
121
|
+
readonly x: number;
|
|
122
|
+
readonly y: number;
|
|
123
|
+
}
|
|
124
|
+
type BoardConnectorEndpoint = ({
|
|
125
|
+
readonly kind: "free";
|
|
126
|
+
} & BoardConnectorPoint) | {
|
|
127
|
+
readonly fallbackPoint?: BoardConnectorPoint;
|
|
128
|
+
readonly kind: "lifeline";
|
|
129
|
+
readonly offsetY: number;
|
|
130
|
+
readonly shapeId: string;
|
|
131
|
+
} | {
|
|
132
|
+
readonly boundaryRatio?: number;
|
|
133
|
+
readonly fallbackPoint?: BoardConnectorPoint;
|
|
134
|
+
readonly kind: "shapeBoundary";
|
|
135
|
+
readonly localUV?: {
|
|
136
|
+
readonly u: number;
|
|
137
|
+
readonly v: number;
|
|
138
|
+
};
|
|
139
|
+
readonly outlineIndex: number;
|
|
140
|
+
readonly segmentIndex: number;
|
|
141
|
+
readonly segmentT: number;
|
|
142
|
+
readonly shapeId: string;
|
|
143
|
+
} | {
|
|
144
|
+
readonly connectionPosition?: number;
|
|
145
|
+
readonly connectionSiteId: number;
|
|
146
|
+
readonly fallbackPoint?: BoardConnectorPoint;
|
|
147
|
+
readonly kind: "shapeSite";
|
|
148
|
+
readonly shapeId: string;
|
|
149
|
+
};
|
|
150
|
+
interface BoardConnectorWaypoint extends BoardConnectorPoint {
|
|
151
|
+
readonly id: string;
|
|
152
|
+
readonly kind: "auto" | "manual";
|
|
153
|
+
readonly locked?: boolean;
|
|
154
|
+
}
|
|
155
|
+
interface BoardConnectorConnection {
|
|
156
|
+
readonly end: BoardConnectorEndpoint;
|
|
157
|
+
readonly routing: "curve" | "freePolyline" | "orthogonal" | "straight";
|
|
158
|
+
readonly routingMode: "auto" | "manual" | "mixed";
|
|
159
|
+
readonly start: BoardConnectorEndpoint;
|
|
160
|
+
readonly waypoints: readonly BoardConnectorWaypoint[];
|
|
161
|
+
}
|
|
162
|
+
interface BoardInspectionResult {
|
|
163
|
+
readonly background?: JsonValue;
|
|
164
|
+
readonly elementCounts: BoardElementCounts;
|
|
165
|
+
readonly elements: readonly BoardElementSummary[];
|
|
166
|
+
readonly kind: "board";
|
|
167
|
+
readonly name: string;
|
|
168
|
+
readonly themeData: JsonValue;
|
|
169
|
+
readonly unitId: string;
|
|
170
|
+
}
|
|
171
|
+
interface BoardElementInspectionBase {
|
|
172
|
+
readonly bounds: BoardRect | null;
|
|
173
|
+
readonly description?: string;
|
|
174
|
+
readonly id: string;
|
|
175
|
+
readonly laneId?: string;
|
|
176
|
+
readonly locked: boolean;
|
|
177
|
+
readonly name?: string;
|
|
178
|
+
readonly orderIndex: number;
|
|
179
|
+
readonly parentId?: string;
|
|
180
|
+
readonly selectable: boolean;
|
|
181
|
+
readonly transform: BoardElementTransform;
|
|
182
|
+
readonly type: string;
|
|
183
|
+
readonly visible: boolean;
|
|
184
|
+
}
|
|
185
|
+
interface BoardShapeElementInspection extends BoardElementInspectionBase {
|
|
186
|
+
readonly shapeData: JsonValue;
|
|
187
|
+
readonly type: "shape";
|
|
188
|
+
}
|
|
189
|
+
interface BoardConnectorElementInspection extends BoardElementInspectionBase {
|
|
190
|
+
readonly connection: BoardConnectorConnection;
|
|
191
|
+
readonly labels: readonly JsonValue[];
|
|
192
|
+
readonly labelStyle: JsonValue | null;
|
|
193
|
+
readonly labelText: JsonValue | null;
|
|
194
|
+
readonly style: JsonValue | null;
|
|
195
|
+
readonly type: "connector";
|
|
196
|
+
}
|
|
197
|
+
interface BoardTextElementInspection extends BoardElementInspectionBase {
|
|
198
|
+
readonly textContent: JsonValue | null;
|
|
199
|
+
readonly textStyle: JsonValue | null;
|
|
200
|
+
readonly type: "text";
|
|
201
|
+
}
|
|
202
|
+
interface BoardImageElementInspection extends BoardElementInspectionBase {
|
|
203
|
+
readonly adjustValues?: Readonly<Record<string, number>>;
|
|
204
|
+
readonly crop?: JsonValue;
|
|
205
|
+
readonly imageSourceType?: string;
|
|
206
|
+
readonly prstGeom?: string;
|
|
207
|
+
readonly source: string;
|
|
208
|
+
readonly type: "image";
|
|
209
|
+
}
|
|
210
|
+
interface BoardChartElementInspection extends BoardElementInspectionBase {
|
|
211
|
+
readonly chartId: string;
|
|
212
|
+
readonly placeholder?: JsonValue;
|
|
213
|
+
readonly stroke?: JsonValue;
|
|
214
|
+
readonly type: "chart";
|
|
215
|
+
}
|
|
216
|
+
interface BoardContainerElementInspection extends BoardElementInspectionBase {
|
|
217
|
+
readonly containerData: JsonValue;
|
|
218
|
+
readonly type: "container";
|
|
219
|
+
}
|
|
220
|
+
interface BoardDiagramElementInspection extends BoardElementInspectionBase {
|
|
221
|
+
readonly data: JsonValue;
|
|
222
|
+
readonly type: "diagram";
|
|
223
|
+
}
|
|
224
|
+
interface BoardTableElementInspection extends BoardElementInspectionBase {
|
|
225
|
+
readonly placeholder?: JsonValue;
|
|
226
|
+
readonly tableId: string;
|
|
227
|
+
readonly type: "table";
|
|
228
|
+
}
|
|
229
|
+
interface BoardGroupElementInspection extends BoardElementInspectionBase {
|
|
230
|
+
readonly children: readonly string[];
|
|
231
|
+
readonly type: "group";
|
|
232
|
+
}
|
|
233
|
+
interface BoardMediaElementInspection extends BoardElementInspectionBase {
|
|
234
|
+
readonly mediaType: string;
|
|
235
|
+
readonly poster?: string;
|
|
236
|
+
readonly source: string;
|
|
237
|
+
readonly type: "media";
|
|
238
|
+
}
|
|
239
|
+
interface BoardPlaceholderElementInspection extends BoardElementInspectionBase {
|
|
240
|
+
readonly placeholder: JsonValue;
|
|
241
|
+
readonly style?: JsonValue;
|
|
242
|
+
readonly text?: string;
|
|
243
|
+
readonly type: "placeholder";
|
|
244
|
+
}
|
|
245
|
+
interface BoardOtherElementInspection extends BoardElementInspectionBase {
|
|
246
|
+
readonly data: JsonValue;
|
|
247
|
+
readonly originalType: string;
|
|
248
|
+
readonly type: "unknown";
|
|
249
|
+
}
|
|
250
|
+
type BoardElementInspection = BoardShapeElementInspection | BoardConnectorElementInspection | BoardTextElementInspection | BoardImageElementInspection | BoardChartElementInspection | BoardContainerElementInspection | BoardDiagramElementInspection | BoardTableElementInspection | BoardGroupElementInspection | BoardMediaElementInspection | BoardPlaceholderElementInspection | BoardOtherElementInspection;
|
|
251
|
+
interface BoardElementInspectionResult {
|
|
252
|
+
readonly elements: readonly BoardElementInspection[];
|
|
253
|
+
readonly kind: "board-element";
|
|
254
|
+
readonly unitId: string;
|
|
255
|
+
}
|
|
66
256
|
interface WorksheetIdentity {
|
|
67
257
|
readonly id: string;
|
|
68
258
|
readonly index: number;
|
|
@@ -101,6 +291,36 @@ interface WorkbookInspectionResult {
|
|
|
101
291
|
readonly unitId: string;
|
|
102
292
|
readonly worksheets: readonly WorksheetOverview[];
|
|
103
293
|
}
|
|
294
|
+
interface BaseFieldOverview {
|
|
295
|
+
readonly config: JsonValue;
|
|
296
|
+
readonly id: string;
|
|
297
|
+
readonly index: number;
|
|
298
|
+
readonly isReadonly: boolean;
|
|
299
|
+
readonly name: string;
|
|
300
|
+
readonly type: string;
|
|
301
|
+
}
|
|
302
|
+
interface BaseViewOverview {
|
|
303
|
+
readonly id: string;
|
|
304
|
+
readonly index: number;
|
|
305
|
+
readonly name: string;
|
|
306
|
+
readonly type: string;
|
|
307
|
+
}
|
|
308
|
+
interface BaseTableOverview {
|
|
309
|
+
readonly fields: readonly BaseFieldOverview[];
|
|
310
|
+
readonly formulaName: string;
|
|
311
|
+
readonly id: string;
|
|
312
|
+
readonly index: number;
|
|
313
|
+
readonly name: string;
|
|
314
|
+
readonly primaryFieldId: string;
|
|
315
|
+
readonly recordCount: number;
|
|
316
|
+
readonly views: readonly BaseViewOverview[];
|
|
317
|
+
}
|
|
318
|
+
interface BaseInspectionResult {
|
|
319
|
+
readonly kind: "base";
|
|
320
|
+
readonly name: string;
|
|
321
|
+
readonly tables: readonly BaseTableOverview[];
|
|
322
|
+
readonly unitId: string;
|
|
323
|
+
}
|
|
104
324
|
interface WorksheetInspectionResult {
|
|
105
325
|
readonly kind: "worksheet";
|
|
106
326
|
readonly unitId: string;
|
|
@@ -221,7 +441,7 @@ interface ParagraphInspectionResult {
|
|
|
221
441
|
readonly paragraphs: readonly ParagraphInspectionDetails[];
|
|
222
442
|
readonly unitId: string;
|
|
223
443
|
}
|
|
224
|
-
type ContentInspectionResult = WorkbookInspectionResult | WorksheetInspectionResult | WorksheetRangeInspectionResult | PresentationInspectionResult | SlideInspectionResult |
|
|
444
|
+
type ContentInspectionResult = WorkbookInspectionResult | WorksheetInspectionResult | WorksheetRangeInspectionResult | DocumentInspectionResult | ParagraphInspectionResult | PresentationInspectionResult | SlideInspectionResult | BaseInspectionResult | BoardInspectionResult | BoardElementInspectionResult;
|
|
225
445
|
//#endregion
|
|
226
446
|
//#region src/inspect-content.d.ts
|
|
227
447
|
type ContentInspectionUnitType = "sheet" | "doc" | "slide" | "base" | "board";
|
|
@@ -242,6 +462,9 @@ declare function inspectContent(runtime: ContentInspectionRuntime, query: Presen
|
|
|
242
462
|
declare function inspectContent(runtime: ContentInspectionRuntime, query: SlideInspectionQuery): Promise<SlideInspectionResult>;
|
|
243
463
|
declare function inspectContent(runtime: ContentInspectionRuntime, query: DocumentInspectionQuery): Promise<DocumentInspectionResult>;
|
|
244
464
|
declare function inspectContent(runtime: ContentInspectionRuntime, query: ParagraphInspectionQuery): Promise<ParagraphInspectionResult>;
|
|
465
|
+
declare function inspectContent(runtime: ContentInspectionRuntime, query: BaseInspectionQuery): Promise<BaseInspectionResult>;
|
|
466
|
+
declare function inspectContent(runtime: ContentInspectionRuntime, query: BoardInspectionQuery): Promise<BoardInspectionResult>;
|
|
467
|
+
declare function inspectContent(runtime: ContentInspectionRuntime, query: BoardElementInspectionQuery): Promise<BoardElementInspectionResult>;
|
|
245
468
|
declare function inspectContent(runtime: ContentInspectionRuntime, query: ContentInspectionQuery): Promise<ContentInspectionResult>;
|
|
246
469
|
//#endregion
|
|
247
|
-
export { ContentInspectionError, type ContentInspectionErrorCode, type ContentInspectionQuery, type ContentInspectionResult, type ContentInspectionRuntime, type ContentInspectionTarget, type ContentInspectionUnitType, type DocumentFeatureCounts, type DocumentInspectionQuery, type DocumentInspectionResult, type ParagraphInspectionDetails, type ParagraphInspectionQuery, type ParagraphInspectionResult, type ParagraphSelector, type ParagraphSummary, type PresentationInspectionQuery, type PresentationInspectionResult, type PresentationSize, type SlideElementCounts, type SlideElementInspection, type SlideElementTransform, type SlideInspectionDetails, type SlideInspectionQuery, type SlideInspectionResult, type SlideSelector, type SlideSummary, type SlideTextDetails, type WorkbookInspectionQuery, type WorkbookInspectionResult, type WorksheetDrawingSummary, type WorksheetIdentity, type WorksheetInspectionQuery, type WorksheetInspectionResult, type WorksheetOverview, type WorksheetRangeInspectionQuery, type WorksheetRangeInspectionResult, type WorksheetRangeResult, type WorksheetRuleSummary, type WorksheetSelector, type WorksheetTableSummary, inspectContent };
|
|
470
|
+
export { type BaseFieldOverview, type BaseInspectionQuery, type BaseInspectionResult, type BaseTableOverview, type BaseViewOverview, type BoardChartElementInspection, type BoardConnectorConnection, type BoardConnectorElementInspection, type BoardConnectorEndpoint, type BoardConnectorPoint, type BoardConnectorWaypoint, type BoardContainerElementInspection, type BoardDiagramElementInspection, type BoardElementCounts, type BoardElementInspection, type BoardElementInspectionBase, type BoardElementInspectionQuery, type BoardElementInspectionResult, type BoardElementSelector, type BoardElementSummary, type BoardElementTransform, type BoardGroupElementInspection, type BoardImageElementInspection, type BoardInspectionQuery, type BoardInspectionResult, type BoardMediaElementInspection, type BoardOtherElementInspection, type BoardPlaceholderElementInspection, type BoardRect, type BoardShapeElementInspection, type BoardTableElementInspection, type BoardTextElementInspection, ContentInspectionError, type ContentInspectionErrorCode, type ContentInspectionQuery, type ContentInspectionResult, type ContentInspectionRuntime, type ContentInspectionTarget, type ContentInspectionUnitType, type DocumentFeatureCounts, type DocumentInspectionQuery, type DocumentInspectionResult, type ParagraphInspectionDetails, type ParagraphInspectionQuery, type ParagraphInspectionResult, type ParagraphSelector, type ParagraphSummary, type PresentationInspectionQuery, type PresentationInspectionResult, type PresentationSize, type SlideElementCounts, type SlideElementInspection, type SlideElementTransform, type SlideInspectionDetails, type SlideInspectionQuery, type SlideInspectionResult, type SlideSelector, type SlideSummary, type SlideTextDetails, type WorkbookInspectionQuery, type WorkbookInspectionResult, type WorksheetDrawingSummary, type WorksheetIdentity, type WorksheetInspectionQuery, type WorksheetInspectionResult, type WorksheetOverview, type WorksheetRangeInspectionQuery, type WorksheetRangeInspectionResult, type WorksheetRangeResult, type WorksheetRuleSummary, type WorksheetSelector, type WorksheetTableSummary, inspectContent };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x4bd1fa=_0x75d7;(function(_0x4abf20,_0x3926ed){const _0x39556d=_0x75d7,_0x255a0c=_0x4abf20();while(!![]){try{const _0x203503=parseInt(_0x39556d(0x177))/0x1*(parseInt(_0x39556d(0x174))/0x2)+-parseInt(_0x39556d(0x18c))/0x3*(-parseInt(_0x39556d(0x176))/0x4)+parseInt(_0x39556d(0x192))/0x5+-parseInt(_0x39556d(0x181))/0x6+parseInt(_0x39556d(0x17e))/0x7+-parseInt(_0x39556d(0x1a2))/0x8*(parseInt(_0x39556d(0x188))/0x9)+parseInt(_0x39556d(0x18b))/0xa*(-parseInt(_0x39556d(0x1a4))/0xb);if(_0x203503===_0x3926ed)break;else _0x255a0c['push'](_0x255a0c['shift']());}catch(_0x146db2){_0x255a0c['push'](_0x255a0c['shift']());}}}(_0x28c3,0x31220));var e=class extends Error{[_0x4bd1fa(0x194)];['details'];constructor(_0x2517c6,_0x337bd2,_0xe5209c){const _0x5ea319=_0x4bd1fa;super(_0x337bd2),this[_0x5ea319(0x194)]=_0x2517c6,this[_0x5ea319(0x198)]=_0xe5209c,this['name']=_0x5ea319(0x189);}};function t(_0x43739a){const _0x3fc592=_0x4bd1fa;if(!i(_0x43739a)||typeof _0x43739a['ok']!=_0x3fc592(0x19c))throw r('Inspection\x20runtime\x20returned\x20an\x20invalid\x20envelope');if(_0x43739a['ok']===!0x0&&_0x3fc592(0x196)in _0x43739a)return _0x43739a[_0x3fc592(0x196)];let _0x238e1c=_0x43739a['error'];if(_0x43739a['ok']===!0x1&&i(_0x238e1c)){let _0x104b14=_0x238e1c[_0x3fc592(0x194)],_0x2fb2a7=_0x238e1c[_0x3fc592(0x17a)];if(a(_0x104b14)&&typeof _0x2fb2a7==_0x3fc592(0x18d))throw new e(_0x104b14,_0x2fb2a7,_0x238e1c[_0x3fc592(0x198)]);}throw r(_0x3fc592(0x180));}function n(_0x2ed17d,_0x545996){const _0x134d0e=_0x4bd1fa;if(!i(_0x2ed17d)||_0x2ed17d[_0x134d0e(0x18e)]!==_0x545996||typeof _0x2ed17d['unitId']!=_0x134d0e(0x18d)||!(_0x545996===_0x134d0e(0x185)?typeof _0x2ed17d[_0x134d0e(0x19a)]==_0x134d0e(0x18d)&&Array[_0x134d0e(0x182)](_0x2ed17d[_0x134d0e(0x197)]):_0x545996===_0x134d0e(0x187)?Array[_0x134d0e(0x182)](_0x2ed17d[_0x134d0e(0x197)]):_0x545996===_0x134d0e(0x184)?Array['isArray'](_0x2ed17d[_0x134d0e(0x183)]):_0x545996===_0x134d0e(0x19b)?typeof _0x2ed17d[_0x134d0e(0x19a)]==_0x134d0e(0x18d)&&Array[_0x134d0e(0x182)](_0x2ed17d[_0x134d0e(0x172)]):_0x545996===_0x134d0e(0x1a3)?Array[_0x134d0e(0x182)](_0x2ed17d['slides']):_0x545996===_0x134d0e(0x19d)?typeof _0x2ed17d['title']==_0x134d0e(0x18d)&&Array[_0x134d0e(0x182)](_0x2ed17d[_0x134d0e(0x19f)]):_0x545996===_0x134d0e(0x17f)&&Array[_0x134d0e(0x182)](_0x2ed17d[_0x134d0e(0x19f)])))throw r('Inspection\x20runtime\x20returned\x20an\x20invalid\x20'+_0x545996+_0x134d0e(0x190));}function r(_0x40577d){const _0x350e83=_0x4bd1fa;return new e(_0x350e83(0x179),_0x40577d);}function i(_0x843842){const _0x4a31a8=_0x4bd1fa;return typeof _0x843842==_0x4a31a8(0x19e)&&!!_0x843842&&!Array['isArray'](_0x843842);}function a(_0x22a22f){const _0x5b23ac=_0x4bd1fa;return _0x22a22f===_0x5b23ac(0x199)||_0x22a22f===_0x5b23ac(0x179)||_0x22a22f===_0x5b23ac(0x18f)||_0x22a22f==='INSPECTION_SELECTOR_INVALID'||_0x22a22f===_0x5b23ac(0x18a)||_0x22a22f===_0x5b23ac(0x178);}function o(_0x1642eb,_0x81098a){const _0x5e0828=_0x4bd1fa;return _0x5e0828(0x17b)+JSON[_0x5e0828(0x17c)]({'query':_0x81098a,'unitId':_0x1642eb})+_0x5e0828(0x17d);}function s(_0x39ba09,_0x44e7c1){return'\x0aconst\x20input\x20=\x20'+JSON['stringify']({'query':_0x44e7c1,'unitId':_0x39ba09})+';\x0aconst\x20fail\x20=\x20(code,\x20message,\x20details)\x20=>\x20({\x20ok:\x20false,\x20error:\x20{\x20code,\x20message,\x20...(details\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20details\x20})\x20}\x20});\x0aconst\x20success\x20=\x20(value)\x20=>\x20({\x20ok:\x20true,\x20value\x20});\x0aconst\x20workbook\x20=\x20univerAPI.getWorkbook(input.unitId);\x0aif\x20(!workbook)\x20return\x20fail(\x22INSPECTION_RESULT_INVALID\x22,\x20\x22Workbook\x20\x22\x20+\x20input.unitId\x20+\x20\x22\x20is\x20not\x20available\x20in\x20the\x20runtime\x22);\x0aconst\x20sheets\x20=\x20workbook.getSheets();\x0aconst\x20snapshot\x20=\x20workbook.save();\x0a\x0afunction\x20columnName(column)\x20{\x0a\x20\x20let\x20value\x20=\x20column\x20+\x201;\x0a\x20\x20let\x20name\x20=\x20\x22\x22;\x0a\x20\x20while\x20(value\x20>\x200)\x20{\x0a\x20\x20\x20\x20const\x20remainder\x20=\x20(value\x20-\x201)\x20%\x2026;\x0a\x20\x20\x20\x20name\x20=\x20String.fromCharCode(65\x20+\x20remainder)\x20+\x20name;\x0a\x20\x20\x20\x20value\x20=\x20Math.floor((value\x20-\x201)\x20/\x2026);\x0a\x20\x20}\x0a\x20\x20return\x20name;\x0a}\x0a\x0afunction\x20rangeNotation(range)\x20{\x0a\x20\x20const\x20start\x20=\x20columnName(range.startColumn)\x20+\x20String(range.startRow\x20+\x201);\x0a\x20\x20const\x20end\x20=\x20columnName(range.endColumn)\x20+\x20String(range.endRow\x20+\x201);\x0a\x20\x20return\x20start\x20===\x20end\x20?\x20start\x20:\x20start\x20+\x20\x22:\x22\x20+\x20end;\x0a}\x0a\x0afunction\x20parseA1Range(notation)\x20{\x0a\x20\x20const\x20match\x20=\x20/^\x5c$?([A-Za-z]+)\x5c$?(\x5cd+)(?::\x5c$?([A-Za-z]+)\x5c$?(\x5cd+))?$/.exec(notation);\x0a\x20\x20if\x20(!match)\x20return\x20null;\x0a\x20\x20const\x20columnIndex\x20=\x20(name)\x20=>\x20{\x0a\x20\x20\x20\x20let\x20column\x20=\x200;\x0a\x20\x20\x20\x20for\x20(const\x20character\x20of\x20name.toUpperCase())\x20column\x20=\x20column\x20*\x2026\x20+\x20character.charCodeAt(0)\x20-\x2064;\x0a\x20\x20\x20\x20return\x20column\x20-\x201;\x0a\x20\x20};\x0a\x20\x20const\x20startColumn\x20=\x20columnIndex(match[1]);\x0a\x20\x20const\x20startRow\x20=\x20Number(match[2])\x20-\x201;\x0a\x20\x20const\x20endColumn\x20=\x20columnIndex(match[3]\x20||\x20match[1]);\x0a\x20\x20const\x20endRow\x20=\x20Number(match[4]\x20||\x20match[2])\x20-\x201;\x0a\x20\x20if\x20(!Number.isSafeInteger(startRow)\x20||\x20!Number.isSafeInteger(endRow)\x20||\x20startRow\x20<\x200\x20||\x20endRow\x20<\x20startRow\x20||\x20endColumn\x20<\x20startColumn)\x20return\x20null;\x0a\x20\x20return\x20{\x20startRow,\x20endRow,\x20startColumn,\x20endColumn\x20};\x0a}\x0a\x0afunction\x20normalizeCellData(cellData)\x20{\x0a\x20\x20const\x20cells\x20=\x20[];\x0a\x20\x20for\x20(const\x20[rowKey,\x20columns]\x20of\x20Object.entries(cellData\x20||\x20{}))\x20{\x0a\x20\x20\x20\x20const\x20row\x20=\x20Number(rowKey);\x0a\x20\x20\x20\x20if\x20(!Number.isInteger(row)\x20||\x20!columns\x20||\x20typeof\x20columns\x20!==\x20\x22object\x22)\x20continue;\x0a\x20\x20\x20\x20for\x20(const\x20[columnKey,\x20cell]\x20of\x20Object.entries(columns))\x20{\x0a\x20\x20\x20\x20\x20\x20const\x20column\x20=\x20Number(columnKey);\x0a\x20\x20\x20\x20\x20\x20if\x20(Number.isInteger(column)\x20&&\x20cell\x20&&\x20typeof\x20cell\x20===\x20\x22object\x22)\x20cells.push({\x20row,\x20column,\x20cell\x20});\x0a\x20\x20\x20\x20}\x0a\x20\x20}\x0a\x20\x20cells.sort((left,\x20right)\x20=>\x20left.row\x20-\x20right.row\x20||\x20left.column\x20-\x20right.column);\x0a\x20\x20return\x20cells;\x0a}\x0a\x0a//\x20TODO:\x20profile\x20large\x20sparse\x20worksheets\x20and\x20move\x20this\x20scan\x20behind\x20an\x20incremental\x20index\x20if\x20needed.\x0afunction\x20compactUsedRanges(cells,\x20predicate)\x20{\x0a\x20\x20const\x20horizontal\x20=\x20[];\x0a\x20\x20let\x20active\x20=\x20null;\x0a\x20\x20for\x20(const\x20entry\x20of\x20cells)\x20{\x0a\x20\x20\x20\x20if\x20(!predicate(entry.cell))\x20continue;\x0a\x20\x20\x20\x20if\x20(active\x20&&\x20active.startRow\x20===\x20entry.row\x20&&\x20active.endColumn\x20+\x201\x20===\x20entry.column)\x20{\x0a\x20\x20\x20\x20\x20\x20active.endColumn\x20=\x20entry.column;\x0a\x20\x20\x20\x20}\x20else\x20{\x0a\x20\x20\x20\x20\x20\x20active\x20=\x20{\x20startRow:\x20entry.row,\x20endRow:\x20entry.row,\x20startColumn:\x20entry.column,\x20endColumn:\x20entry.column\x20};\x0a\x20\x20\x20\x20\x20\x20horizontal.push(active);\x0a\x20\x20\x20\x20}\x0a\x20\x20}\x0a\x20\x20const\x20rectangles\x20=\x20[];\x0a\x20\x20const\x20previousRow\x20=\x20new\x20Map();\x0a\x20\x20let\x20currentRow\x20=\x20-1;\x0a\x20\x20let\x20current\x20=\x20new\x20Map();\x0a\x20\x20for\x20(const\x20span\x20of\x20horizontal)\x20{\x0a\x20\x20\x20\x20if\x20(span.startRow\x20!==\x20currentRow)\x20{\x0a\x20\x20\x20\x20\x20\x20previousRow.clear();\x0a\x20\x20\x20\x20\x20\x20for\x20(const\x20[key,\x20value]\x20of\x20current)\x20previousRow.set(key,\x20value);\x0a\x20\x20\x20\x20\x20\x20current\x20=\x20new\x20Map();\x0a\x20\x20\x20\x20\x20\x20currentRow\x20=\x20span.startRow;\x0a\x20\x20\x20\x20}\x0a\x20\x20\x20\x20const\x20key\x20=\x20span.startColumn\x20+\x20\x22:\x22\x20+\x20span.endColumn;\x0a\x20\x20\x20\x20const\x20prior\x20=\x20previousRow.get(key);\x0a\x20\x20\x20\x20if\x20(prior\x20&&\x20prior.endRow\x20+\x201\x20===\x20span.startRow)\x20{\x0a\x20\x20\x20\x20\x20\x20prior.endRow\x20=\x20span.startRow;\x0a\x20\x20\x20\x20\x20\x20current.set(key,\x20prior);\x0a\x20\x20\x20\x20}\x20else\x20{\x0a\x20\x20\x20\x20\x20\x20const\x20rectangle\x20=\x20{\x20...span\x20};\x0a\x20\x20\x20\x20\x20\x20rectangles.push(rectangle);\x0a\x20\x20\x20\x20\x20\x20current.set(key,\x20rectangle);\x0a\x20\x20\x20\x20}\x0a\x20\x20}\x0a\x20\x20return\x20rectangles.map(rangeNotation);\x0a}\x0a\x0afunction\x20hasValue(cell)\x20{\x0a\x20\x20return\x20Object.entries(cell).some(([key,\x20value])\x20=>\x20key\x20!==\x20\x22s\x22\x20&&\x20key\x20!==\x20\x22t\x22\x20&&\x20value\x20!==\x20null\x20&&\x20value\x20!==\x20undefined\x20&&\x20value\x20!==\x20\x22\x22);\x0a}\x0a\x0afunction\x20hasFormula(cell)\x20{\x0a\x20\x20return\x20(typeof\x20cell.f\x20===\x20\x22string\x22\x20&&\x20cell.f.length\x20>\x200)\x20||\x20cell.si\x20!==\x20null\x20&&\x20cell.si\x20!==\x20undefined\x20&&\x20cell.si\x20!==\x20\x22\x22;\x0a}\x0a\x0afunction\x20hasStyle(cell)\x20{\x0a\x20\x20return\x20cell.s\x20!==\x20null\x20&&\x20cell.s\x20!==\x20undefined;\x0a}\x0a\x0afunction\x20uniqueRanges(ranges)\x20{\x0a\x20\x20return\x20[...new\x20Set(ranges.map(rangeNotation))].sort();\x0a}\x0a\x0afunction\x20worksheetIdentity(sheet,\x20index)\x20{\x0a\x20\x20return\x20{\x20id:\x20sheet.getSheetId(),\x20index,\x20name:\x20sheet.getSheetName()\x20};\x0a}\x0a\x0afunction\x20worksheetOverview(sheet,\x20index)\x20{\x0a\x20\x20const\x20identity\x20=\x20worksheetIdentity(sheet,\x20index);\x0a\x20\x20const\x20sheetData\x20=\x20snapshot.sheets\x20&&\x20snapshot.sheets[identity.id]\x20||\x20{};\x0a\x20\x20const\x20cells\x20=\x20normalizeCellData(sheetData.cellData);\x0a\x20\x20const\x20conditionalRules\x20=\x20typeof\x20sheet.getConditionalFormattingRules\x20===\x20\x22function\x22\x20?\x20sheet.getConditionalFormattingRules()\x20:\x20[];\x0a\x20\x20const\x20validationRules\x20=\x20typeof\x20sheet.getDataValidations\x20===\x20\x22function\x22\x20?\x20sheet.getDataValidations()\x20:\x20[];\x0a\x20\x20const\x20tables\x20=\x20typeof\x20sheet.getSubTableInfos\x20===\x20\x22function\x22\x20?\x20sheet.getSubTableInfos()\x20:\x20[];\x0a\x20\x20const\x20images\x20=\x20typeof\x20sheet.getImages\x20===\x20\x22function\x22\x20?\x20sheet.getImages().length\x20:\x200;\x0a\x20\x20const\x20shapes\x20=\x20typeof\x20sheet.getShapes\x20===\x20\x22function\x22\x20?\x20sheet.getShapes().length\x20:\x200;\x0a\x20\x20const\x20charts\x20=\x20sheet.charts\x20&&\x20typeof\x20sheet.charts.list\x20===\x20\x22function\x22\x20?\x20sheet.charts.list().length\x20:\x200;\x0a\x20\x20return\x20{\x0a\x20\x20\x20\x20...identity,\x0a\x20\x20\x20\x20rowCount:\x20sheet.getMaxRows(),\x0a\x20\x20\x20\x20columnCount:\x20sheet.getMaxColumns(),\x0a\x20\x20\x20\x20valueUsedRanges:\x20compactUsedRanges(cells,\x20hasValue),\x0a\x20\x20\x20\x20formulaUsedRanges:\x20compactUsedRanges(cells,\x20hasFormula),\x0a\x20\x20\x20\x20styleUsedRanges:\x20compactUsedRanges(cells,\x20hasStyle),\x0a\x20\x20\x20\x20mergedRanges:\x20sheet.getMergedRanges().map((range)\x20=>\x20range.getA1Notation()),\x0a\x20\x20\x20\x20tables:\x20tables.map((table)\x20=>\x20({\x20id:\x20table.id,\x20name:\x20table.name,\x20range:\x20rangeNotation(table.range)\x20})),\x0a\x20\x20\x20\x20conditionalFormatting:\x20{\x0a\x20\x20\x20\x20\x20\x20count:\x20conditionalRules.length,\x0a\x20\x20\x20\x20\x20\x20ranges:\x20uniqueRanges(conditionalRules.flatMap((rule)\x20=>\x20Array.isArray(rule.ranges)\x20?\x20rule.ranges\x20:\x20[])),\x0a\x20\x20\x20\x20},\x0a\x20\x20\x20\x20dataValidation:\x20{\x0a\x20\x20\x20\x20\x20\x20count:\x20validationRules.length,\x0a\x20\x20\x20\x20\x20\x20ranges:\x20uniqueRanges(validationRules.flatMap((validation)\x20=>\x20Array.isArray(validation.rule\x20&&\x20validation.rule.ranges)\x20?\x20validation.rule.ranges\x20:\x20[])),\x0a\x20\x20\x20\x20},\x0a\x20\x20\x20\x20drawings:\x20{\x20total:\x20charts\x20+\x20images\x20+\x20shapes,\x20charts,\x20images,\x20shapes\x20},\x0a\x20\x20};\x0a}\x0a\x0afunction\x20resolveWorksheet(selector)\x20{\x0a\x20\x20if\x20(!selector\x20||\x20typeof\x20selector\x20!==\x20\x22object\x22)\x20return\x20{\x20error:\x20fail(\x22INSPECTION_SELECTOR_INVALID\x22,\x20\x22Worksheet\x20selector\x20must\x20be\x20an\x20object\x22)\x20};\x0a\x20\x20const\x20keys\x20=\x20[\x22id\x22,\x20\x22index\x22,\x20\x22name\x22].filter((key)\x20=>\x20Object.hasOwn(selector,\x20key));\x0a\x20\x20if\x20(keys.length\x20!==\x201)\x20return\x20{\x20error:\x20fail(\x22INSPECTION_SELECTOR_INVALID\x22,\x20\x22Worksheet\x20selector\x20must\x20contain\x20exactly\x20one\x20of\x20id,\x20index,\x20or\x20name\x22,\x20selector)\x20};\x0a\x20\x20let\x20matches\x20=\x20[];\x0a\x20\x20if\x20(keys[0]\x20===\x20\x22id\x22\x20&&\x20typeof\x20selector.id\x20===\x20\x22string\x22\x20&&\x20selector.id.length\x20>\x200)\x20matches\x20=\x20sheets.filter((sheet)\x20=>\x20sheet.getSheetId()\x20===\x20selector.id);\x0a\x20\x20else\x20if\x20(keys[0]\x20===\x20\x22name\x22\x20&&\x20typeof\x20selector.name\x20===\x20\x22string\x22\x20&&\x20selector.name.length\x20>\x200)\x20matches\x20=\x20sheets.filter((sheet)\x20=>\x20sheet.getSheetName()\x20===\x20selector.name);\x0a\x20\x20else\x20if\x20(keys[0]\x20===\x20\x22index\x22\x20&&\x20Number.isInteger(selector.index)\x20&&\x20selector.index\x20>=\x200)\x20matches\x20=\x20sheets[selector.index]\x20?\x20[sheets[selector.index]]\x20:\x20[];\x0a\x20\x20else\x20return\x20{\x20error:\x20fail(\x22INSPECTION_SELECTOR_INVALID\x22,\x20\x22Worksheet\x20selector\x20value\x20is\x20invalid\x22,\x20selector)\x20};\x0a\x20\x20if\x20(matches.length\x20===\x200)\x20return\x20{\x20error:\x20fail(\x22INSPECTION_SELECTOR_NOT_FOUND\x22,\x20\x22Worksheet\x20selector\x20did\x20not\x20match\x20a\x20worksheet\x22,\x20selector)\x20};\x0a\x20\x20if\x20(matches.length\x20>\x201)\x20return\x20{\x20error:\x20fail(\x22INSPECTION_SELECTOR_AMBIGUOUS\x22,\x20\x22Worksheet\x20selector\x20matched\x20more\x20than\x20one\x20worksheet\x22,\x20selector)\x20};\x0a\x20\x20const\x20sheet\x20=\x20matches[0];\x0a\x20\x20return\x20{\x20sheet,\x20index:\x20sheets.indexOf(sheet)\x20};\x0a}\x0a\x0aif\x20(input.query.kind\x20===\x20\x22workbook\x22)\x20{\x0a\x20\x20return\x20success({\x20kind:\x20\x22workbook\x22,\x20unitId:\x20input.unitId,\x20name:\x20workbook.getName(),\x20worksheets:\x20sheets.map(worksheetOverview)\x20});\x0a}\x0a\x0aif\x20(input.query.kind\x20===\x20\x22worksheet\x22)\x20{\x0a\x20\x20const\x20resolved\x20=\x20[];\x0a\x20\x20for\x20(const\x20selector\x20of\x20input.query.worksheets\x20||\x20[])\x20{\x0a\x20\x20\x20\x20const\x20item\x20=\x20resolveWorksheet(selector);\x0a\x20\x20\x20\x20if\x20(item.error)\x20return\x20item.error;\x0a\x20\x20\x20\x20resolved.push(worksheetOverview(item.sheet,\x20item.index));\x0a\x20\x20}\x0a\x20\x20return\x20success({\x20kind:\x20\x22worksheet\x22,\x20unitId:\x20input.unitId,\x20worksheets:\x20resolved\x20});\x0a}\x0a\x0aif\x20(input.query.kind\x20===\x20\x22worksheet-range\x22)\x20{\x0a\x20\x20const\x20resolved\x20=\x20[];\x0a\x20\x20for\x20(const\x20request\x20of\x20input.query.ranges\x20||\x20[])\x20{\x0a\x20\x20\x20\x20const\x20item\x20=\x20resolveWorksheet(request.worksheet);\x0a\x20\x20\x20\x20if\x20(item.error)\x20return\x20item.error;\x0a\x20\x20\x20\x20if\x20(typeof\x20request.range\x20!==\x20\x22string\x22\x20||\x20request.range.length\x20===\x200)\x20return\x20fail(\x22INSPECTION_SELECTOR_INVALID\x22,\x20\x22Worksheet\x20range\x20must\x20be\x20a\x20non-empty\x20A1\x20notation\x22,\x20request);\x0a\x20\x20\x20\x20const\x20parsed\x20=\x20parseA1Range(request.range);\x0a\x20\x20\x20\x20if\x20(!parsed)\x20{\x0a\x20\x20\x20\x20\x20\x20return\x20fail(\x22INSPECTION_SELECTOR_INVALID\x22,\x20\x22Invalid\x20worksheet\x20A1\x20range:\x20\x22\x20+\x20request.range,\x20request);\x0a\x20\x20\x20\x20}\x0a\x20\x20\x20\x20const\x20maxRow\x20=\x20item.sheet.getMaxRows()\x20-\x201;\x0a\x20\x20\x20\x20const\x20maxColumn\x20=\x20item.sheet.getMaxColumns()\x20-\x201;\x0a\x20\x20\x20\x20if\x20(parsed.endRow\x20<\x200\x20||\x20parsed.endColumn\x20<\x200\x20||\x20parsed.startRow\x20>\x20maxRow\x20||\x20parsed.startColumn\x20>\x20maxColumn)\x20{\x0a\x20\x20\x20\x20\x20\x20return\x20fail(\x22INSPECTION_RANGE_OUT_OF_BOUNDS\x22,\x20\x22Worksheet\x20range\x20is\x20outside\x20the\x20worksheet\x20bounds:\x20\x22\x20+\x20request.range,\x20request);\x0a\x20\x20\x20\x20}\x0a\x20\x20\x20\x20const\x20clippedRange\x20=\x20{\x0a\x20\x20\x20\x20\x20\x20startRow:\x20Math.max(0,\x20parsed.startRow),\x0a\x20\x20\x20\x20\x20\x20endRow:\x20Math.min(maxRow,\x20parsed.endRow),\x0a\x20\x20\x20\x20\x20\x20startColumn:\x20Math.max(0,\x20parsed.startColumn),\x0a\x20\x20\x20\x20\x20\x20endColumn:\x20Math.min(maxColumn,\x20parsed.endColumn),\x0a\x20\x20\x20\x20};\x0a\x20\x20\x20\x20const\x20facadeRange\x20=\x20item.sheet.getRange(clippedRange.startRow,\x20clippedRange.startColumn,\x20clippedRange.endRow\x20-\x20clippedRange.startRow\x20+\x201,\x20clippedRange.endColumn\x20-\x20clippedRange.startColumn\x20+\x201);\x0a\x20\x20\x20\x20const\x20rawCells\x20=\x20facadeRange.getCellDatas();\x0a\x20\x20\x20\x20const\x20displayValues\x20=\x20facadeRange.getDisplayValues();\x0a\x20\x20\x20\x20const\x20cellData\x20=\x20rawCells.map((row)\x20=>\x20row.map((cell)\x20=>\x20cell\x20===\x20undefined\x20?\x20null\x20:\x20cell));\x0a\x20\x20\x20\x20const\x20clipped\x20=\x20clippedRange.startRow\x20!==\x20parsed.startRow\x20||\x20clippedRange.endRow\x20!==\x20parsed.endRow\x20||\x20clippedRange.startColumn\x20!==\x20parsed.startColumn\x20||\x20clippedRange.endColumn\x20!==\x20parsed.endColumn;\x0a\x20\x20\x20\x20resolved.push({\x0a\x20\x20\x20\x20\x20\x20worksheet:\x20worksheetIdentity(item.sheet,\x20item.index),\x0a\x20\x20\x20\x20\x20\x20requestedRange:\x20request.range,\x0a\x20\x20\x20\x20\x20\x20resolvedRange:\x20rangeNotation(clippedRange),\x0a\x20\x20\x20\x20\x20\x20clipped,\x0a\x20\x20\x20\x20\x20\x20cellData,\x0a\x20\x20\x20\x20\x20\x20displayValues,\x0a\x20\x20\x20\x20});\x0a\x20\x20}\x0a\x20\x20return\x20success({\x20kind:\x20\x22worksheet-range\x22,\x20unitId:\x20input.unitId,\x20ranges:\x20resolved\x20});\x0a}\x0a\x0areturn\x20fail(\x22INSPECTION_RESULT_INVALID\x22,\x20\x22Unsupported\x20sheet\x20inspection\x20target\x22);\x0a';}function _0x75d7(_0xba3f3c,_0x33e9f9){_0xba3f3c=_0xba3f3c-0x172;const _0x28c3d7=_0x28c3();let _0x75d776=_0x28c3d7[_0xba3f3c];return _0x75d776;}function _0x28c3(){const _0x589434=['workbook','sheet','worksheet','63wtnRcW','ContentInspectionError','INSPECTION_SELECTOR_NOT_FOUND','10vAOsak','21ERVnvv','string','kind','INSPECTION_SELECTOR_AMBIGUOUS','\x20result','length','166690RjnlHc','execute','code','INSPECTION_SELECTOR_INVALID','value','worksheets','details','INSPECTION_RANGE_OUT_OF_BOUNDS','name','presentation','boolean','document','object','paragraphs','doc','\x20inspection\x20requires\x20at\x20least\x20one\x20selector','50216fRPOck','slide','287771CIdvde','slides','\x20runtime,\x20received\x20','880iaDqpW','unitType','197452ysubfD','167vtdsbs','INSPECTION_UNIT_TYPE_MISMATCH','INSPECTION_RESULT_INVALID','message','\x0aconst\x20input\x20=\x20','stringify',';\x0aconst\x20fail\x20=\x20(code,\x20message,\x20details)\x20=>\x20({\x20ok:\x20false,\x20error:\x20{\x20code,\x20message,\x20...(details\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20details\x20})\x20}\x20});\x0aconst\x20success\x20=\x20(value)\x20=>\x20({\x20ok:\x20true,\x20value\x20});\x0aconst\x20document\x20=\x20univerAPI.getDocument(input.unitId);\x0aif\x20(!document)\x20return\x20fail(\x22INSPECTION_RESULT_INVALID\x22,\x20\x22Document\x20\x22\x20+\x20input.unitId\x20+\x20\x22\x20is\x20not\x20available\x20in\x20the\x20runtime\x22);\x0aconst\x20snapshot\x20=\x20document.save();\x0aconst\x20body\x20=\x20snapshot.body\x20||\x20{};\x0aconst\x20stream\x20=\x20typeof\x20body.dataStream\x20===\x20\x22string\x22\x20?\x20body.dataStream\x20:\x20\x22\x22;\x0aconst\x20rawParagraphs\x20=\x20Array.isArray(body.paragraphs)\x20?\x20body.paragraphs\x20:\x20[];\x0a\x0afunction\x20cleanPreview(text)\x20{\x0a\x20\x20const\x20normalized\x20=\x20text.replace(/[\x5cu0000-\x5cu001f]+/g,\x20\x22\x20\x22).replace(/\x5cs+/g,\x20\x22\x20\x22).trim();\x0a\x20\x20return\x20normalized.length\x20<=\x20120\x20?\x20normalized\x20:\x20normalized.slice(0,\x20117)\x20+\x20\x22...\x22;\x0a}\x0a\x0afunction\x20resolveParagraphs()\x20{\x0a\x20\x20let\x20start\x20=\x200;\x0a\x20\x20return\x20rawParagraphs.map((paragraph,\x20index)\x20=>\x20{\x0a\x20\x20\x20\x20const\x20end\x20=\x20Number.isInteger(paragraph.startIndex)\x20?\x20paragraph.startIndex\x20:\x20start;\x0a\x20\x20\x20\x20const\x20result\x20=\x20{\x0a\x20\x20\x20\x20\x20\x20id:\x20typeof\x20paragraph.paragraphId\x20===\x20\x22string\x22\x20?\x20paragraph.paragraphId\x20:\x20String(index),\x0a\x20\x20\x20\x20\x20\x20index,\x0a\x20\x20\x20\x20\x20\x20text:\x20stream.slice(start,\x20end),\x0a\x20\x20\x20\x20\x20\x20start,\x0a\x20\x20\x20\x20\x20\x20end,\x0a\x20\x20\x20\x20\x20\x20raw:\x20paragraph,\x0a\x20\x20\x20\x20};\x0a\x20\x20\x20\x20start\x20=\x20end\x20+\x201;\x0a\x20\x20\x20\x20return\x20result;\x0a\x20\x20});\x0a}\x0a\x0aconst\x20paragraphs\x20=\x20resolveParagraphs();\x0a\x0afunction\x20resolveParagraph(selector)\x20{\x0a\x20\x20if\x20(!selector\x20||\x20typeof\x20selector\x20!==\x20\x22object\x22)\x20return\x20{\x20error:\x20fail(\x22INSPECTION_SELECTOR_INVALID\x22,\x20\x22Paragraph\x20selector\x20must\x20be\x20an\x20object\x22)\x20};\x0a\x20\x20const\x20keys\x20=\x20[\x22id\x22,\x20\x22index\x22].filter((key)\x20=>\x20Object.hasOwn(selector,\x20key));\x0a\x20\x20if\x20(keys.length\x20!==\x201)\x20return\x20{\x20error:\x20fail(\x22INSPECTION_SELECTOR_INVALID\x22,\x20\x22Paragraph\x20selector\x20must\x20contain\x20exactly\x20one\x20of\x20id\x20or\x20index\x22,\x20selector)\x20};\x0a\x20\x20let\x20matches\x20=\x20[];\x0a\x20\x20if\x20(keys[0]\x20===\x20\x22id\x22\x20&&\x20typeof\x20selector.id\x20===\x20\x22string\x22\x20&&\x20selector.id.length\x20>\x200)\x20matches\x20=\x20paragraphs.filter((paragraph)\x20=>\x20paragraph.id\x20===\x20selector.id);\x0a\x20\x20else\x20if\x20(keys[0]\x20===\x20\x22index\x22\x20&&\x20Number.isInteger(selector.index)\x20&&\x20selector.index\x20>=\x200)\x20matches\x20=\x20paragraphs[selector.index]\x20?\x20[paragraphs[selector.index]]\x20:\x20[];\x0a\x20\x20else\x20return\x20{\x20error:\x20fail(\x22INSPECTION_SELECTOR_INVALID\x22,\x20\x22Paragraph\x20selector\x20value\x20is\x20invalid\x22,\x20selector)\x20};\x0a\x20\x20if\x20(matches.length\x20===\x200)\x20return\x20{\x20error:\x20fail(\x22INSPECTION_SELECTOR_NOT_FOUND\x22,\x20\x22Paragraph\x20selector\x20did\x20not\x20match\x20a\x20paragraph\x22,\x20selector)\x20};\x0a\x20\x20if\x20(matches.length\x20>\x201)\x20return\x20{\x20error:\x20fail(\x22INSPECTION_SELECTOR_AMBIGUOUS\x22,\x20\x22Paragraph\x20selector\x20matched\x20more\x20than\x20one\x20paragraph\x22,\x20selector)\x20};\x0a\x20\x20return\x20{\x20paragraph:\x20matches[0]\x20};\x0a}\x0a\x0aif\x20(input.query.kind\x20===\x20\x22document\x22)\x20{\x0a\x20\x20const\x20mode\x20=\x20typeof\x20document.isModern\x20===\x20\x22function\x22\x20&&\x20document.isModern()\x0a\x20\x20\x20\x20?\x20\x22modern\x22\x0a\x20\x20\x20\x20:\x20typeof\x20document.isTraditional\x20===\x20\x22function\x22\x20&&\x20document.isTraditional()\x0a\x20\x20\x20\x20\x20\x20?\x20\x22paginated\x22\x0a\x20\x20\x20\x20\x20\x20:\x20\x22unspecified\x22;\x0a\x20\x20return\x20success({\x0a\x20\x20\x20\x20kind:\x20\x22document\x22,\x0a\x20\x20\x20\x20unitId:\x20input.unitId,\x0a\x20\x20\x20\x20title:\x20document.getName(),\x0a\x20\x20\x20\x20mode,\x0a\x20\x20\x20\x20paragraphCount:\x20paragraphs.length,\x0a\x20\x20\x20\x20characterCount:\x20paragraphs.reduce((total,\x20paragraph)\x20=>\x20total\x20+\x20paragraph.text.length,\x200),\x0a\x20\x20\x20\x20features:\x20{\x0a\x20\x20\x20\x20\x20\x20tables:\x20Array.isArray(body.tables)\x20?\x20body.tables.length\x20:\x200,\x0a\x20\x20\x20\x20\x20\x20lists:\x20paragraphs.filter((paragraph)\x20=>\x20paragraph.raw.bullet\x20!==\x20undefined).length,\x0a\x20\x20\x20\x20\x20\x20drawings:\x20snapshot.drawings\x20&&\x20typeof\x20snapshot.drawings\x20===\x20\x22object\x22\x20?\x20Object.keys(snapshot.drawings).length\x20:\x200,\x0a\x20\x20\x20\x20\x20\x20customBlocks:\x20Array.isArray(body.customBlocks)\x20?\x20body.customBlocks.length\x20:\x200,\x0a\x20\x20\x20\x20\x20\x20blockRanges:\x20Array.isArray(body.blockRanges)\x20?\x20body.blockRanges.length\x20:\x200,\x0a\x20\x20\x20\x20},\x0a\x20\x20\x20\x20paragraphs:\x20paragraphs.map((paragraph)\x20=>\x20({\x20id:\x20paragraph.id,\x20index:\x20paragraph.index,\x20textPreview:\x20cleanPreview(paragraph.text)\x20})),\x0a\x20\x20});\x0a}\x0a\x0aif\x20(input.query.kind\x20===\x20\x22paragraph\x22)\x20{\x0a\x20\x20const\x20selected\x20=\x20[];\x0a\x20\x20for\x20(const\x20selector\x20of\x20input.query.paragraphs\x20||\x20[])\x20{\x0a\x20\x20\x20\x20const\x20item\x20=\x20resolveParagraph(selector);\x0a\x20\x20\x20\x20if\x20(item.error)\x20return\x20item.error;\x0a\x20\x20\x20\x20const\x20paragraph\x20=\x20item.paragraph;\x0a\x20\x20\x20\x20const\x20runs\x20=\x20(Array.isArray(body.textRuns)\x20?\x20body.textRuns\x20:\x20[]).filter((run)\x20=>\x20(run.ed\x20||\x200)\x20>\x20paragraph.start\x20&&\x20(run.st\x20||\x200)\x20<\x20paragraph.end);\x0a\x20\x20\x20\x20const\x20bullet\x20=\x20paragraph.raw.bullet;\x0a\x20\x20\x20\x20const\x20listId\x20=\x20bullet\x20&&\x20bullet.listId;\x0a\x20\x20\x20\x20const\x20list\x20=\x20typeof\x20listId\x20===\x20\x22string\x22\x20&&\x20snapshot.lists\x20&&\x20snapshot.lists[listId];\x0a\x20\x20\x20\x20selected.push({\x0a\x20\x20\x20\x20\x20\x20id:\x20paragraph.id,\x0a\x20\x20\x20\x20\x20\x20index:\x20paragraph.index,\x0a\x20\x20\x20\x20\x20\x20text:\x20paragraph.text,\x0a\x20\x20\x20\x20\x20\x20...(paragraph.raw.paragraphStyle\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20style:\x20paragraph.raw.paragraphStyle\x20}),\x0a\x20\x20\x20\x20\x20\x20...(bullet\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20bullet\x20}),\x0a\x20\x20\x20\x20\x20\x20...(list\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20list\x20}),\x0a\x20\x20\x20\x20\x20\x20textRuns:\x20runs,\x0a\x20\x20\x20\x20});\x0a\x20\x20}\x0a\x20\x20return\x20success({\x20kind:\x20\x22paragraph\x22,\x20unitId:\x20input.unitId,\x20paragraphs:\x20selected\x20});\x0a}\x0a\x0areturn\x20fail(\x22INSPECTION_RESULT_INVALID\x22,\x20\x22Unsupported\x20document\x20inspection\x20target\x22);\x0a','554400tmYcKE','paragraph','Inspection\x20runtime\x20returned\x20an\x20invalid\x20error\x20envelope','1561266MFxuZT','isArray','ranges','worksheet-range'];_0x28c3=function(){return _0x589434;};return _0x28c3();}function c(_0x12ce2c,_0x19ad20){const _0xc2f6e1=_0x4bd1fa;return'\x0aconst\x20input\x20=\x20'+JSON[_0xc2f6e1(0x17c)]({'query':_0x19ad20,'unitId':_0x12ce2c})+';\x0aconst\x20fail\x20=\x20(code,\x20message,\x20details)\x20=>\x20({\x20ok:\x20false,\x20error:\x20{\x20code,\x20message,\x20...(details\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20details\x20})\x20}\x20});\x0aconst\x20success\x20=\x20(value)\x20=>\x20({\x20ok:\x20true,\x20value\x20});\x0aconst\x20presentation\x20=\x20univerAPI.getPresentation(input.unitId);\x0aif\x20(!presentation)\x20return\x20fail(\x22INSPECTION_RESULT_INVALID\x22,\x20\x22Presentation\x20\x22\x20+\x20input.unitId\x20+\x20\x22\x20is\x20not\x20available\x20in\x20the\x20runtime\x22);\x0aconst\x20snapshot\x20=\x20presentation.save();\x0aconst\x20slideIds\x20=\x20Array.isArray(snapshot.slideOrder)\x20?\x20snapshot.slideOrder\x20:\x20Object.keys(snapshot.slides\x20||\x20{});\x0aconst\x20slides\x20=\x20slideIds.map((id)\x20=>\x20snapshot.slides\x20&&\x20snapshot.slides[id]).filter(Boolean);\x0a\x0afunction\x20documentText(documentData)\x20{\x0a\x20\x20const\x20stream\x20=\x20documentData\x20&&\x20documentData.body\x20&&\x20documentData.body.dataStream;\x0a\x20\x20return\x20typeof\x20stream\x20===\x20\x22string\x22\x20?\x20stream.replace(/\x5cr/g,\x20\x22\x5cn\x22).replace(/[\x5cu0000-\x5cu0009\x5cu000b-\x5cu001f]+/g,\x20\x22\x22).replace(/\x5cn+$/g,\x20\x22\x22)\x20:\x20\x22\x22;\x0a}\x0a\x0afunction\x20elementText(element)\x20{\x0a\x20\x20if\x20(typeof\x20element.text\x20===\x20\x22string\x22)\x20return\x20element.text;\x0a\x20\x20if\x20(element.textData)\x20return\x20documentText(element.textData);\x0a\x20\x20const\x20shapeData\x20=\x20element.shapeData\x20||\x20element.connectorData;\x0a\x20\x20const\x20shapeText\x20=\x20shapeData\x20&&\x20shapeData.shapeText;\x0a\x20\x20if\x20(shapeText\x20&&\x20typeof\x20shapeText.text\x20===\x20\x22string\x22)\x20return\x20shapeText.text;\x0a\x20\x20if\x20(shapeText\x20&&\x20shapeText.dataModel\x20&&\x20shapeText.dataModel.doc)\x20return\x20documentText(shapeText.dataModel.doc);\x0a\x20\x20return\x20\x22\x22;\x0a}\x0a\x0afunction\x20elementCountType(type)\x20{\x0a\x20\x20if\x20(type\x20===\x20\x22chart\x22)\x20return\x20\x22charts\x22;\x0a\x20\x20if\x20(type\x20===\x20\x22image\x22)\x20return\x20\x22images\x22;\x0a\x20\x20if\x20(type\x20===\x20\x22table\x22)\x20return\x20\x22tables\x22;\x0a\x20\x20if\x20(type\x20===\x20\x22group\x22)\x20return\x20\x22groups\x22;\x0a\x20\x20if\x20(type\x20===\x20\x22text\x22\x20||\x20type\x20===\x20\x22placeholder\x22)\x20return\x20\x22text\x22;\x0a\x20\x20return\x20\x22shapes\x22;\x0a}\x0a\x0afunction\x20collectElements(slide)\x20{\x0a\x20\x20const\x20elements\x20=\x20slide.elements\x20||\x20{};\x0a\x20\x20const\x20visited\x20=\x20new\x20Set();\x0a\x20\x20const\x20output\x20=\x20[];\x0a\x20\x20function\x20visit(id)\x20{\x0a\x20\x20\x20\x20if\x20(visited.has(id))\x20return;\x0a\x20\x20\x20\x20visited.add(id);\x0a\x20\x20\x20\x20const\x20element\x20=\x20elements[id];\x0a\x20\x20\x20\x20if\x20(!element)\x20return;\x0a\x20\x20\x20\x20output.push(element);\x0a\x20\x20\x20\x20if\x20(element.type\x20===\x20\x22group\x22\x20&&\x20Array.isArray(element.children))\x20element.children.forEach(visit);\x0a\x20\x20}\x0a\x20\x20(Array.isArray(slide.elementOrder)\x20?\x20slide.elementOrder\x20:\x20Object.keys(elements)).forEach(visit);\x0a\x20\x20Object.keys(elements).forEach(visit);\x0a\x20\x20return\x20output;\x0a}\x0a\x0afunction\x20elementCounts(slide)\x20{\x0a\x20\x20const\x20counts\x20=\x20{\x20total:\x200,\x20text:\x200,\x20shapes:\x200,\x20images:\x200,\x20charts:\x200,\x20tables:\x200,\x20groups:\x200\x20};\x0a\x20\x20for\x20(const\x20element\x20of\x20collectElements(slide))\x20{\x0a\x20\x20\x20\x20counts.total\x20+=\x201;\x0a\x20\x20\x20\x20counts[elementCountType(element.type)]\x20+=\x201;\x0a\x20\x20}\x0a\x20\x20return\x20counts;\x0a}\x0a\x0afunction\x20slideSummary(slide,\x20index)\x20{\x0a\x20\x20const\x20text\x20=\x20collectElements(slide).map(elementText).filter(Boolean).join(\x22\x20|\x20\x22).replace(/\x5cs+/g,\x20\x22\x20\x22).trim();\x0a\x20\x20const\x20preview\x20=\x20text.length\x20<=\x20160\x20?\x20text\x20:\x20text.slice(0,\x20157)\x20+\x20\x22...\x22;\x0a\x20\x20return\x20{\x0a\x20\x20\x20\x20id:\x20slide.id,\x0a\x20\x20\x20\x20index,\x0a\x20\x20\x20\x20name:\x20slide.name\x20||\x20\x22\x22,\x0a\x20\x20\x20\x20elementCounts:\x20elementCounts(slide),\x0a\x20\x20\x20\x20...(preview\x20===\x20\x22\x22\x20?\x20{}\x20:\x20{\x20textPreview:\x20preview\x20}),\x0a\x20\x20\x20\x20hasSpeakerNotes:\x20typeof\x20slide.speakerNotes\x20===\x20\x22string\x22\x20&&\x20slide.speakerNotes.length\x20>\x200,\x0a\x20\x20};\x0a}\x0a\x0afunction\x20parseTableResources()\x20{\x0a\x20\x20const\x20resource\x20=\x20(Array.isArray(snapshot.resources)\x20?\x20snapshot.resources\x20:\x20[]).find((item)\x20=>\x20item\x20&&\x20item.name\x20===\x20\x22SLIDE_TABLE_PLUGIN\x22);\x0a\x20\x20if\x20(!resource\x20||\x20typeof\x20resource.data\x20!==\x20\x22string\x22)\x20return\x20{};\x0a\x20\x20try\x20{\x0a\x20\x20\x20\x20const\x20parsed\x20=\x20JSON.parse(resource.data);\x0a\x20\x20\x20\x20return\x20parsed\x20&&\x20typeof\x20parsed.tables\x20===\x20\x22object\x22\x20?\x20parsed.tables\x20:\x20{};\x0a\x20\x20}\x20catch\x20{\x0a\x20\x20\x20\x20return\x20{};\x0a\x20\x20}\x0a}\x0a\x0aconst\x20tableResources\x20=\x20parseTableResources();\x0a\x0afunction\x20tableText(tableId)\x20{\x0a\x20\x20const\x20table\x20=\x20tableResources[tableId];\x0a\x20\x20if\x20(!table\x20||\x20!Array.isArray(table.rows))\x20return\x20undefined;\x0a\x20\x20return\x20table.rows.map((row)\x20=>\x20(Array.isArray(row.cells)\x20?\x20row.cells\x20:\x20[]).map((cell)\x20=>\x20documentText(cell\x20&&\x20cell.textData)));\x0a}\x0a\x0afunction\x20finite(value)\x20{\x0a\x20\x20return\x20typeof\x20value\x20===\x20\x22number\x22\x20&&\x20Number.isFinite(value)\x20?\x20value\x20:\x20undefined;\x0a}\x0a\x0afunction\x20transformOf(element)\x20{\x0a\x20\x20const\x20transform\x20=\x20element.transform\x20||\x20{};\x0a\x20\x20const\x20result\x20=\x20{};\x0a\x20\x20const\x20left\x20=\x20finite(transform.left\x20??\x20transform.x);\x0a\x20\x20const\x20top\x20=\x20finite(transform.top\x20??\x20transform.y);\x0a\x20\x20const\x20width\x20=\x20finite(transform.width);\x0a\x20\x20const\x20height\x20=\x20finite(transform.height);\x0a\x20\x20const\x20angle\x20=\x20finite(transform.angle\x20??\x20transform.rotation);\x0a\x20\x20if\x20(left\x20!==\x20undefined)\x20result.left\x20=\x20left;\x0a\x20\x20if\x20(top\x20!==\x20undefined)\x20result.top\x20=\x20top;\x0a\x20\x20if\x20(width\x20!==\x20undefined)\x20result.width\x20=\x20width;\x0a\x20\x20if\x20(height\x20!==\x20undefined)\x20result.height\x20=\x20height;\x0a\x20\x20if\x20(angle\x20!==\x20undefined)\x20result.angle\x20=\x20angle;\x0a\x20\x20return\x20Object.keys(result).length\x20===\x200\x20?\x20undefined\x20:\x20result;\x0a}\x0a\x0afunction\x20inspectElement(element,\x20elements,\x20ancestors)\x20{\x0a\x20\x20const\x20shapeData\x20=\x20element.shapeData\x20||\x20element.connectorData\x20||\x20{};\x0a\x20\x20const\x20shapeText\x20=\x20shapeData.shapeText\x20||\x20{};\x0a\x20\x20const\x20text\x20=\x20elementText(element);\x0a\x20\x20const\x20output\x20=\x20{\x0a\x20\x20\x20\x20id:\x20element.id,\x0a\x20\x20\x20\x20type:\x20String(element.type\x20||\x20\x22unknown\x22),\x0a\x20\x20\x20\x20name:\x20typeof\x20element.name\x20===\x20\x22string\x22\x20?\x20element.name\x20:\x20\x22\x22,\x0a\x20\x20\x20\x20visible:\x20element.visible\x20!==\x20false,\x0a\x20\x20};\x0a\x20\x20const\x20transform\x20=\x20transformOf(element);\x0a\x20\x20if\x20(transform)\x20output.transform\x20=\x20transform;\x0a\x20\x20if\x20(shapeData.fill\x20!==\x20undefined)\x20output.fill\x20=\x20shapeData.fill;\x0a\x20\x20if\x20((shapeData.stroke\x20??\x20element.stroke)\x20!==\x20undefined)\x20output.stroke\x20=\x20shapeData.stroke\x20??\x20element.stroke;\x0a\x20\x20if\x20(text\x20!==\x20\x22\x22)\x20{\x0a\x20\x20\x20\x20const\x20textDetails\x20=\x20{\x20text\x20};\x0a\x20\x20\x20\x20const\x20horizontal\x20=\x20shapeText.dataModel\x20&&\x20shapeText.dataModel.ha;\x0a\x20\x20\x20\x20const\x20vertical\x20=\x20shapeText.dataModel\x20&&\x20shapeText.dataModel.va;\x0a\x20\x20\x20\x20if\x20(horizontal\x20!==\x20undefined\x20||\x20vertical\x20!==\x20undefined)\x20textDetails.alignment\x20=\x20{\x0a\x20\x20\x20\x20\x20\x20...(horizontal\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20horizontal\x20}),\x0a\x20\x20\x20\x20\x20\x20...(vertical\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20vertical\x20}),\x0a\x20\x20\x20\x20};\x0a\x20\x20\x20\x20if\x20(shapeText.padding\x20!==\x20undefined\x20||\x20shapeText.insets\x20!==\x20undefined)\x20textDetails.insets\x20=\x20shapeText.padding\x20??\x20shapeText.insets;\x0a\x20\x20\x20\x20output.text\x20=\x20textDetails;\x0a\x20\x20}\x0a\x20\x20if\x20(typeof\x20element.chartId\x20===\x20\x22string\x22)\x20output.chartId\x20=\x20element.chartId;\x0a\x20\x20if\x20(typeof\x20element.tableId\x20===\x20\x22string\x22)\x20{\x0a\x20\x20\x20\x20output.tableId\x20=\x20element.tableId;\x0a\x20\x20\x20\x20const\x20grid\x20=\x20tableText(element.tableId);\x0a\x20\x20\x20\x20if\x20(grid)\x20output.tableText\x20=\x20grid;\x0a\x20\x20}\x0a\x20\x20if\x20(typeof\x20element.mediaType\x20===\x20\x22string\x22)\x20output.mediaType\x20=\x20element.mediaType;\x0a\x20\x20if\x20(element.type\x20===\x20\x22group\x22\x20&&\x20Array.isArray(element.children))\x20{\x0a\x20\x20\x20\x20output.children\x20=\x20element.children.filter((id)\x20=>\x20!ancestors.has(id)\x20&&\x20elements[id]).map((id)\x20=>\x20{\x0a\x20\x20\x20\x20\x20\x20const\x20next\x20=\x20new\x20Set(ancestors);\x0a\x20\x20\x20\x20\x20\x20next.add(id);\x0a\x20\x20\x20\x20\x20\x20return\x20inspectElement(elements[id],\x20elements,\x20next);\x0a\x20\x20\x20\x20});\x0a\x20\x20}\x0a\x20\x20return\x20output;\x0a}\x0a\x0afunction\x20slideDetails(slide,\x20index)\x20{\x0a\x20\x20const\x20summary\x20=\x20slideSummary(slide,\x20index);\x0a\x20\x20const\x20elements\x20=\x20slide.elements\x20||\x20{};\x0a\x20\x20const\x20ordered\x20=\x20Array.isArray(slide.elementOrder)\x20?\x20slide.elementOrder\x20:\x20Object.keys(elements);\x0a\x20\x20return\x20{\x0a\x20\x20\x20\x20...summary,\x0a\x20\x20\x20\x20speakerNotes:\x20typeof\x20slide.speakerNotes\x20===\x20\x22string\x22\x20?\x20slide.speakerNotes\x20:\x20\x22\x22,\x0a\x20\x20\x20\x20elements:\x20ordered.filter((id)\x20=>\x20elements[id]).map((id)\x20=>\x20inspectElement(elements[id],\x20elements,\x20new\x20Set([id]))),\x0a\x20\x20};\x0a}\x0a\x0afunction\x20resolveSlide(selector)\x20{\x0a\x20\x20if\x20(!selector\x20||\x20typeof\x20selector\x20!==\x20\x22object\x22)\x20return\x20{\x20error:\x20fail(\x22INSPECTION_SELECTOR_INVALID\x22,\x20\x22Slide\x20selector\x20must\x20be\x20an\x20object\x22)\x20};\x0a\x20\x20const\x20keys\x20=\x20[\x22id\x22,\x20\x22index\x22].filter((key)\x20=>\x20Object.hasOwn(selector,\x20key));\x0a\x20\x20if\x20(keys.length\x20!==\x201)\x20return\x20{\x20error:\x20fail(\x22INSPECTION_SELECTOR_INVALID\x22,\x20\x22Slide\x20selector\x20must\x20contain\x20exactly\x20one\x20of\x20id\x20or\x20index\x22,\x20selector)\x20};\x0a\x20\x20let\x20matches\x20=\x20[];\x0a\x20\x20if\x20(keys[0]\x20===\x20\x22id\x22\x20&&\x20typeof\x20selector.id\x20===\x20\x22string\x22\x20&&\x20selector.id.length\x20>\x200)\x20matches\x20=\x20slides.filter((slide)\x20=>\x20slide.id\x20===\x20selector.id);\x0a\x20\x20else\x20if\x20(keys[0]\x20===\x20\x22index\x22\x20&&\x20Number.isInteger(selector.index)\x20&&\x20selector.index\x20>=\x200)\x20matches\x20=\x20slides[selector.index]\x20?\x20[slides[selector.index]]\x20:\x20[];\x0a\x20\x20else\x20return\x20{\x20error:\x20fail(\x22INSPECTION_SELECTOR_INVALID\x22,\x20\x22Slide\x20selector\x20value\x20is\x20invalid\x22,\x20selector)\x20};\x0a\x20\x20if\x20(matches.length\x20===\x200)\x20return\x20{\x20error:\x20fail(\x22INSPECTION_SELECTOR_NOT_FOUND\x22,\x20\x22Slide\x20selector\x20did\x20not\x20match\x20a\x20slide\x22,\x20selector)\x20};\x0a\x20\x20if\x20(matches.length\x20>\x201)\x20return\x20{\x20error:\x20fail(\x22INSPECTION_SELECTOR_AMBIGUOUS\x22,\x20\x22Slide\x20selector\x20matched\x20more\x20than\x20one\x20slide\x22,\x20selector)\x20};\x0a\x20\x20return\x20{\x20slide:\x20matches[0],\x20index:\x20slides.indexOf(matches[0])\x20};\x0a}\x0a\x0aif\x20(input.query.kind\x20===\x20\x22presentation\x22)\x20{\x0a\x20\x20const\x20size\x20=\x20presentation.getPageSize();\x0a\x20\x20return\x20success({\x0a\x20\x20\x20\x20kind:\x20\x22presentation\x22,\x0a\x20\x20\x20\x20unitId:\x20input.unitId,\x0a\x20\x20\x20\x20name:\x20presentation.getName(),\x0a\x20\x20\x20\x20size:\x20{\x20width:\x20size.width,\x20height:\x20size.height\x20},\x0a\x20\x20\x20\x20masterSlideCount:\x20Array.isArray(snapshot.masterPageOrder)\x20?\x20snapshot.masterPageOrder.length\x20:\x20Object.keys(snapshot.masterPages\x20||\x20{}).length,\x0a\x20\x20\x20\x20layoutSlideCount:\x20Array.isArray(snapshot.layoutPageOrder)\x20?\x20snapshot.layoutPageOrder.length\x20:\x20Object.keys(snapshot.layoutPages\x20||\x20{}).length,\x0a\x20\x20\x20\x20slides:\x20slides.map(slideSummary),\x0a\x20\x20});\x0a}\x0a\x0aif\x20(input.query.kind\x20===\x20\x22slide\x22)\x20{\x0a\x20\x20const\x20selected\x20=\x20[];\x0a\x20\x20for\x20(const\x20selector\x20of\x20input.query.slides\x20||\x20[])\x20{\x0a\x20\x20\x20\x20const\x20item\x20=\x20resolveSlide(selector);\x0a\x20\x20\x20\x20if\x20(item.error)\x20return\x20item.error;\x0a\x20\x20\x20\x20selected.push(slideDetails(item.slide,\x20item.index));\x0a\x20\x20}\x0a\x20\x20return\x20success({\x20kind:\x20\x22slide\x22,\x20unitId:\x20input.unitId,\x20slides:\x20selected\x20});\x0a}\x0a\x0areturn\x20fail(\x22INSPECTION_RESULT_INVALID\x22,\x20\x22Unsupported\x20slide\x20inspection\x20target\x22);\x0a';}async function l(_0x5a8624,_0x207872){const _0x135890=_0x4bd1fa;d(_0x207872),f(_0x5a8624[_0x135890(0x175)],_0x207872[_0x135890(0x18e)]);let _0x1a2027=u(_0x5a8624['unitId'],_0x207872),_0x4bcd6a=t((await _0x5a8624[_0x135890(0x193)]({'code':_0x1a2027,'mode':'read'}))[_0x135890(0x196)]);return n(_0x4bcd6a,_0x207872['kind']),_0x4bcd6a;}function u(_0x2a928a,_0xbdca84){const _0x10944=_0x4bd1fa;switch(_0xbdca84[_0x10944(0x18e)]){case _0x10944(0x185):case _0x10944(0x187):case'worksheet-range':return s(_0x2a928a,_0xbdca84);case _0x10944(0x19b):case'slide':return c(_0x2a928a,_0xbdca84);case _0x10944(0x19d):case _0x10944(0x17f):return o(_0x2a928a,_0xbdca84);}}function d(_0x10d2da){const _0x2dea70=_0x4bd1fa;let _0xa6670e=_0x10d2da[_0x2dea70(0x18e)]===_0x2dea70(0x187)?_0x10d2da['worksheets']:_0x10d2da[_0x2dea70(0x18e)]===_0x2dea70(0x184)?_0x10d2da[_0x2dea70(0x183)]:_0x10d2da[_0x2dea70(0x18e)]===_0x2dea70(0x1a3)?_0x10d2da[_0x2dea70(0x172)]:_0x10d2da[_0x2dea70(0x18e)]===_0x2dea70(0x17f)?_0x10d2da[_0x2dea70(0x19f)]:null;if(_0xa6670e!==null&&_0xa6670e[_0x2dea70(0x191)]===0x0)throw new e(_0x2dea70(0x195),_0x10d2da[_0x2dea70(0x18e)]+_0x2dea70(0x1a1));}function f(_0x206903,_0xaf8aa2){const _0x15f178=_0x4bd1fa;let _0x335657=_0xaf8aa2===_0x15f178(0x185)||_0xaf8aa2===_0x15f178(0x187)||_0xaf8aa2==='worksheet-range'?_0x15f178(0x186):_0xaf8aa2==='presentation'||_0xaf8aa2===_0x15f178(0x1a3)?'slide':_0x15f178(0x1a0);if(_0x206903!==_0x335657)throw new e('INSPECTION_UNIT_TYPE_MISMATCH',_0xaf8aa2+'\x20inspection\x20requires\x20a\x20'+_0x335657+_0x15f178(0x173)+_0x206903,{'actual':_0x206903,'expected':_0x335657,'kind':_0xaf8aa2});}export{e as ContentInspectionError,l as inspectContent};
|
|
1
|
+
const _0x3141af=_0x53a1;(function(_0xd22bc9,_0x2b3051){const _0x342bdb=_0x53a1,_0x4a4cbd=_0xd22bc9();while(!![]){try{const _0x3b7d1f=parseInt(_0x342bdb(0x152))/0x1+parseInt(_0x342bdb(0x1c1))/0x2+-parseInt(_0x342bdb(0x1bb))/0x3*(-parseInt(_0x342bdb(0x1a7))/0x4)+-parseInt(_0x342bdb(0x158))/0x5*(-parseInt(_0x342bdb(0x16f))/0x6)+-parseInt(_0x342bdb(0x157))/0x7*(-parseInt(_0x342bdb(0x172))/0x8)+-parseInt(_0x342bdb(0x1b3))/0x9*(parseInt(_0x342bdb(0x155))/0xa)+-parseInt(_0x342bdb(0x1ac))/0xb;if(_0x3b7d1f===_0x2b3051)break;else _0x4a4cbd['push'](_0x4a4cbd['shift']());}catch(_0x2d3521){_0x4a4cbd['push'](_0x4a4cbd['shift']());}}}(_0x9729,0x219b8));var e=class extends Error{['code'];[_0x3141af(0x1b1)];constructor(_0xd9090b,_0x2762dc,_0xd4f9bc){const _0x456685=_0x3141af;super(_0x2762dc),this[_0x456685(0x16b)]=_0xd9090b,this['details']=_0xd4f9bc,this[_0x456685(0x182)]=_0x456685(0x180);}};function t(_0xeb78ea){const _0x366188=_0x3141af;if(!_(_0xeb78ea)||typeof _0xeb78ea['ok']!=_0x366188(0x193))throw g('Inspection\x20runtime\x20returned\x20an\x20invalid\x20envelope');if(_0xeb78ea['ok']===!0x0&&_0x366188(0x189)in _0xeb78ea)return _0xeb78ea[_0x366188(0x189)];let _0x2ac952=_0xeb78ea[_0x366188(0x164)];if(_0xeb78ea['ok']===!0x1&&_(_0x2ac952)){let _0x5bc109=_0x2ac952[_0x366188(0x16b)],_0x59e024=_0x2ac952[_0x366188(0x198)];if(v(_0x5bc109)&&typeof _0x59e024==_0x366188(0x1c3))throw new e(_0x5bc109,_0x59e024,_0x2ac952[_0x366188(0x1b1)]);}throw g(_0x366188(0x195));}function n(_0x230e67,_0x9b5c02){const _0x1d469a=_0x3141af;if(!_(_0x230e67)||_0x230e67[_0x1d469a(0x174)]!==_0x9b5c02||typeof _0x230e67[_0x1d469a(0x19b)]!=_0x1d469a(0x1c3)||!(_0x9b5c02===_0x1d469a(0x1b4)?p(_0x230e67):_0x9b5c02===_0x1d469a(0x171)?typeof _0x230e67['name']==_0x1d469a(0x1c3)&&Array['isArray'](_0x230e67[_0x1d469a(0x17b)]):_0x9b5c02===_0x1d469a(0x178)?Array[_0x1d469a(0x1ca)](_0x230e67[_0x1d469a(0x17b)]):_0x9b5c02===_0x1d469a(0x18e)?Array['isArray'](_0x230e67[_0x1d469a(0x1bf)]):_0x9b5c02===_0x1d469a(0x17f)?typeof _0x230e67[_0x1d469a(0x182)]==_0x1d469a(0x1c3)&&Array[_0x1d469a(0x1ca)](_0x230e67['slides']):_0x9b5c02===_0x1d469a(0x167)?Array[_0x1d469a(0x1ca)](_0x230e67['slides']):_0x9b5c02===_0x1d469a(0x168)?typeof _0x230e67[_0x1d469a(0x188)]=='string'&&Array['isArray'](_0x230e67[_0x1d469a(0x1c0)]):_0x9b5c02===_0x1d469a(0x1c6)?Array[_0x1d469a(0x1ca)](_0x230e67[_0x1d469a(0x1c0)]):_0x9b5c02===_0x1d469a(0x1c7)?r(_0x230e67):_0x9b5c02==='board-element'&&i(_0x230e67)))throw g(_0x1d469a(0x175)+_0x9b5c02+_0x1d469a(0x1c2));}function r(_0x4299f9){const _0x1274f2=_0x3141af;let _0x583d3e=_0x4299f9[_0x1274f2(0x15d)];return typeof _0x4299f9[_0x1274f2(0x182)]==_0x1274f2(0x1c3)&&'themeData'in _0x4299f9&&_(_0x583d3e)&&m(_0x583d3e[_0x1274f2(0x150)])&&_(_0x583d3e[_0x1274f2(0x17d)])&&Object[_0x1274f2(0x15b)](_0x583d3e['byType'])['every'](m)&&Array[_0x1274f2(0x1ca)](_0x4299f9[_0x1274f2(0x186)])&&_0x583d3e[_0x1274f2(0x150)]===_0x4299f9[_0x1274f2(0x186)][_0x1274f2(0x179)]&&Object[_0x1274f2(0x15b)](_0x583d3e[_0x1274f2(0x17d)])[_0x1274f2(0x14f)]((_0x182118,_0x2c1ec7)=>_0x182118+Number(_0x2c1ec7),0x0)===_0x583d3e[_0x1274f2(0x150)]&&_0x4299f9['elements'][_0x1274f2(0x19c)](a);}function i(_0x1a3f9e){const _0x2c374b=_0x3141af;return Array[_0x2c374b(0x1ca)](_0x1a3f9e[_0x2c374b(0x186)])&&_0x1a3f9e[_0x2c374b(0x186)][_0x2c374b(0x19c)](o);}function _0x53a1(_0x2873b7,_0x18e115){_0x2873b7=_0x2873b7-0x14f;const _0x9729a2=_0x9729();let _0x53a1b5=_0x9729a2[_0x2873b7];return _0x53a1b5;}function _0x9729(){const _0x538b31=['read','left','worksheet-range','data','mixed','endElementId','group','boolean','manual','Inspection\x20runtime\x20returned\x20an\x20invalid\x20error\x20envelope','table','container','message','connector','\x20inspection\x20requires\x20a\x20','unitId','every','locked','parentId','\x0aconst\x20input\x20=\x20','connectionPosition','connectorData','textStyle','auto','bounds','outlineIndex','startElementId','157492rvlBnf','descriptor','top','chart','image','3245957tyuehO','freePolyline','board-element','shapeId','subtype','details','source','254601DApXnf','base',';\x0aconst\x20fail\x20=\x20(code,\x20message,\x20details)\x20=>\x20({\x20ok:\x20false,\x20error:\x20{\x20code,\x20message,\x20...(details\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20details\x20})\x20}\x20});\x0aconst\x20success\x20=\x20(value)\x20=>\x20({\x20ok:\x20true,\x20value\x20});\x0aconst\x20base\x20=\x20univerAPI.getBase(input.unitId);\x0aif\x20(!base)\x20return\x20fail(\x22INSPECTION_RESULT_INVALID\x22,\x20\x22Base\x20\x22\x20+\x20input.unitId\x20+\x20\x22\x20is\x20not\x20available\x20in\x20the\x20runtime\x22);\x0aconst\x20schema\x20=\x20base.getSchema();\x0areturn\x20success({\x0a\x20\x20kind:\x20\x22base\x22,\x0a\x20\x20unitId:\x20input.unitId,\x0a\x20\x20name:\x20schema.name,\x0a\x20\x20tables:\x20schema.tables.map((table,\x20index)\x20=>\x20({\x0a\x20\x20\x20\x20id:\x20table.id,\x0a\x20\x20\x20\x20index,\x0a\x20\x20\x20\x20name:\x20table.name,\x0a\x20\x20\x20\x20formulaName:\x20table.formulaName,\x0a\x20\x20\x20\x20primaryFieldId:\x20table.primaryFieldId,\x0a\x20\x20\x20\x20recordCount:\x20table.recordCount,\x0a\x20\x20\x20\x20fields:\x20table.fields.map((field,\x20fieldIndex)\x20=>\x20({\x0a\x20\x20\x20\x20\x20\x20id:\x20field.id,\x0a\x20\x20\x20\x20\x20\x20index:\x20fieldIndex,\x0a\x20\x20\x20\x20\x20\x20name:\x20field.name,\x0a\x20\x20\x20\x20\x20\x20type:\x20field.type,\x0a\x20\x20\x20\x20\x20\x20config:\x20field.config\x20??\x20{},\x0a\x20\x20\x20\x20\x20\x20isReadonly:\x20field.readonly\x20===\x20true,\x0a\x20\x20\x20\x20})),\x0a\x20\x20\x20\x20views:\x20table.views.map((view,\x20viewIndex)\x20=>\x20({\x0a\x20\x20\x20\x20\x20\x20id:\x20view.id,\x0a\x20\x20\x20\x20\x20\x20index:\x20viewIndex,\x0a\x20\x20\x20\x20\x20\x20name:\x20view.name,\x0a\x20\x20\x20\x20\x20\x20type:\x20view.type,\x0a\x20\x20\x20\x20})),\x0a\x20\x20})),\x0a});\x0a','INSPECTION_SELECTOR_INVALID','type','laneId','routing','selectable','9gHMpIN','containerData','segmentIndex','connection','ranges','paragraphs','121302RAHsXU','\x20result','string','slides','height','paragraph','board','unitType','shapeSite','isArray','straight','shapeBoundary','style','routingMode','fields','text','views','chartId','reduce','total','labels','126121QpIugl','sheet','children','50UaIFgW','visible','42QTjywX','5dGirfO','free','tables','values',';\x0aconst\x20fail\x20=\x20(code,\x20message,\x20details)\x20=>\x20({\x20ok:\x20false,\x20error:\x20{\x20code,\x20message,\x20...(details\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20details\x20})\x20}\x20});\x0aconst\x20success\x20=\x20(value)\x20=>\x20({\x20ok:\x20true,\x20value\x20});\x0aconst\x20document\x20=\x20univerAPI.getDocument(input.unitId);\x0aif\x20(!document)\x20return\x20fail(\x22INSPECTION_RESULT_INVALID\x22,\x20\x22Document\x20\x22\x20+\x20input.unitId\x20+\x20\x22\x20is\x20not\x20available\x20in\x20the\x20runtime\x22);\x0aconst\x20snapshot\x20=\x20document.save();\x0aconst\x20body\x20=\x20snapshot.body\x20||\x20{};\x0aconst\x20stream\x20=\x20typeof\x20body.dataStream\x20===\x20\x22string\x22\x20?\x20body.dataStream\x20:\x20\x22\x22;\x0aconst\x20rawParagraphs\x20=\x20Array.isArray(body.paragraphs)\x20?\x20body.paragraphs\x20:\x20[];\x0a\x0afunction\x20cleanPreview(text)\x20{\x0a\x20\x20const\x20normalized\x20=\x20text.replace(/[\x5cu0000-\x5cu001f]+/g,\x20\x22\x20\x22).replace(/\x5cs+/g,\x20\x22\x20\x22).trim();\x0a\x20\x20return\x20normalized.length\x20<=\x20120\x20?\x20normalized\x20:\x20normalized.slice(0,\x20117)\x20+\x20\x22...\x22;\x0a}\x0a\x0afunction\x20resolveParagraphs()\x20{\x0a\x20\x20let\x20start\x20=\x200;\x0a\x20\x20return\x20rawParagraphs.map((paragraph,\x20index)\x20=>\x20{\x0a\x20\x20\x20\x20const\x20end\x20=\x20Number.isInteger(paragraph.startIndex)\x20?\x20paragraph.startIndex\x20:\x20start;\x0a\x20\x20\x20\x20const\x20result\x20=\x20{\x0a\x20\x20\x20\x20\x20\x20id:\x20typeof\x20paragraph.paragraphId\x20===\x20\x22string\x22\x20?\x20paragraph.paragraphId\x20:\x20String(index),\x0a\x20\x20\x20\x20\x20\x20index,\x0a\x20\x20\x20\x20\x20\x20text:\x20stream.slice(start,\x20end),\x0a\x20\x20\x20\x20\x20\x20start,\x0a\x20\x20\x20\x20\x20\x20end,\x0a\x20\x20\x20\x20\x20\x20raw:\x20paragraph,\x0a\x20\x20\x20\x20};\x0a\x20\x20\x20\x20start\x20=\x20end\x20+\x201;\x0a\x20\x20\x20\x20return\x20result;\x0a\x20\x20});\x0a}\x0a\x0aconst\x20paragraphs\x20=\x20resolveParagraphs();\x0a\x0afunction\x20resolveParagraph(selector)\x20{\x0a\x20\x20if\x20(!selector\x20||\x20typeof\x20selector\x20!==\x20\x22object\x22)\x20return\x20{\x20error:\x20fail(\x22INSPECTION_SELECTOR_INVALID\x22,\x20\x22Paragraph\x20selector\x20must\x20be\x20an\x20object\x22)\x20};\x0a\x20\x20const\x20keys\x20=\x20[\x22id\x22,\x20\x22index\x22].filter((key)\x20=>\x20Object.hasOwn(selector,\x20key));\x0a\x20\x20if\x20(keys.length\x20!==\x201)\x20return\x20{\x20error:\x20fail(\x22INSPECTION_SELECTOR_INVALID\x22,\x20\x22Paragraph\x20selector\x20must\x20contain\x20exactly\x20one\x20of\x20id\x20or\x20index\x22,\x20selector)\x20};\x0a\x20\x20let\x20matches\x20=\x20[];\x0a\x20\x20if\x20(keys[0]\x20===\x20\x22id\x22\x20&&\x20typeof\x20selector.id\x20===\x20\x22string\x22\x20&&\x20selector.id.length\x20>\x200)\x20matches\x20=\x20paragraphs.filter((paragraph)\x20=>\x20paragraph.id\x20===\x20selector.id);\x0a\x20\x20else\x20if\x20(keys[0]\x20===\x20\x22index\x22\x20&&\x20Number.isInteger(selector.index)\x20&&\x20selector.index\x20>=\x200)\x20matches\x20=\x20paragraphs[selector.index]\x20?\x20[paragraphs[selector.index]]\x20:\x20[];\x0a\x20\x20else\x20return\x20{\x20error:\x20fail(\x22INSPECTION_SELECTOR_INVALID\x22,\x20\x22Paragraph\x20selector\x20value\x20is\x20invalid\x22,\x20selector)\x20};\x0a\x20\x20if\x20(matches.length\x20===\x200)\x20return\x20{\x20error:\x20fail(\x22INSPECTION_SELECTOR_NOT_FOUND\x22,\x20\x22Paragraph\x20selector\x20did\x20not\x20match\x20a\x20paragraph\x22,\x20selector)\x20};\x0a\x20\x20if\x20(matches.length\x20>\x201)\x20return\x20{\x20error:\x20fail(\x22INSPECTION_SELECTOR_AMBIGUOUS\x22,\x20\x22Paragraph\x20selector\x20matched\x20more\x20than\x20one\x20paragraph\x22,\x20selector)\x20};\x0a\x20\x20return\x20{\x20paragraph:\x20matches[0]\x20};\x0a}\x0a\x0aif\x20(input.query.kind\x20===\x20\x22document\x22)\x20{\x0a\x20\x20const\x20mode\x20=\x20typeof\x20document.isModern\x20===\x20\x22function\x22\x20&&\x20document.isModern()\x0a\x20\x20\x20\x20?\x20\x22modern\x22\x0a\x20\x20\x20\x20:\x20typeof\x20document.isTraditional\x20===\x20\x22function\x22\x20&&\x20document.isTraditional()\x0a\x20\x20\x20\x20\x20\x20?\x20\x22paginated\x22\x0a\x20\x20\x20\x20\x20\x20:\x20\x22unspecified\x22;\x0a\x20\x20return\x20success({\x0a\x20\x20\x20\x20kind:\x20\x22document\x22,\x0a\x20\x20\x20\x20unitId:\x20input.unitId,\x0a\x20\x20\x20\x20title:\x20document.getName(),\x0a\x20\x20\x20\x20mode,\x0a\x20\x20\x20\x20paragraphCount:\x20paragraphs.length,\x0a\x20\x20\x20\x20characterCount:\x20paragraphs.reduce((total,\x20paragraph)\x20=>\x20total\x20+\x20paragraph.text.length,\x200),\x0a\x20\x20\x20\x20features:\x20{\x0a\x20\x20\x20\x20\x20\x20tables:\x20Array.isArray(body.tables)\x20?\x20body.tables.length\x20:\x200,\x0a\x20\x20\x20\x20\x20\x20lists:\x20paragraphs.filter((paragraph)\x20=>\x20paragraph.raw.bullet\x20!==\x20undefined).length,\x0a\x20\x20\x20\x20\x20\x20drawings:\x20snapshot.drawings\x20&&\x20typeof\x20snapshot.drawings\x20===\x20\x22object\x22\x20?\x20Object.keys(snapshot.drawings).length\x20:\x200,\x0a\x20\x20\x20\x20\x20\x20customBlocks:\x20Array.isArray(body.customBlocks)\x20?\x20body.customBlocks.length\x20:\x200,\x0a\x20\x20\x20\x20\x20\x20blockRanges:\x20Array.isArray(body.blockRanges)\x20?\x20body.blockRanges.length\x20:\x200,\x0a\x20\x20\x20\x20},\x0a\x20\x20\x20\x20paragraphs:\x20paragraphs.map((paragraph)\x20=>\x20({\x20id:\x20paragraph.id,\x20index:\x20paragraph.index,\x20textPreview:\x20cleanPreview(paragraph.text)\x20})),\x0a\x20\x20});\x0a}\x0a\x0aif\x20(input.query.kind\x20===\x20\x22paragraph\x22)\x20{\x0a\x20\x20const\x20selected\x20=\x20[];\x0a\x20\x20for\x20(const\x20selector\x20of\x20input.query.paragraphs\x20||\x20[])\x20{\x0a\x20\x20\x20\x20const\x20item\x20=\x20resolveParagraph(selector);\x0a\x20\x20\x20\x20if\x20(item.error)\x20return\x20item.error;\x0a\x20\x20\x20\x20const\x20paragraph\x20=\x20item.paragraph;\x0a\x20\x20\x20\x20const\x20runs\x20=\x20(Array.isArray(body.textRuns)\x20?\x20body.textRuns\x20:\x20[]).filter((run)\x20=>\x20(run.ed\x20||\x200)\x20>\x20paragraph.start\x20&&\x20(run.st\x20||\x200)\x20<\x20paragraph.end);\x0a\x20\x20\x20\x20const\x20bullet\x20=\x20paragraph.raw.bullet;\x0a\x20\x20\x20\x20const\x20listId\x20=\x20bullet\x20&&\x20bullet.listId;\x0a\x20\x20\x20\x20const\x20list\x20=\x20typeof\x20listId\x20===\x20\x22string\x22\x20&&\x20snapshot.lists\x20&&\x20snapshot.lists[listId];\x0a\x20\x20\x20\x20selected.push({\x0a\x20\x20\x20\x20\x20\x20id:\x20paragraph.id,\x0a\x20\x20\x20\x20\x20\x20index:\x20paragraph.index,\x0a\x20\x20\x20\x20\x20\x20text:\x20paragraph.text,\x0a\x20\x20\x20\x20\x20\x20...(paragraph.raw.paragraphStyle\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20style:\x20paragraph.raw.paragraphStyle\x20}),\x0a\x20\x20\x20\x20\x20\x20...(bullet\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20bullet\x20}),\x0a\x20\x20\x20\x20\x20\x20...(list\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20list\x20}),\x0a\x20\x20\x20\x20\x20\x20textRuns:\x20runs,\x0a\x20\x20\x20\x20});\x0a\x20\x20}\x0a\x20\x20return\x20success({\x20kind:\x20\x22paragraph\x22,\x20unitId:\x20input.unitId,\x20paragraphs:\x20selected\x20});\x0a}\x0a\x0areturn\x20fail(\x22INSPECTION_RESULT_INVALID\x22,\x20\x22Unsupported\x20document\x20inspection\x20target\x22);\x0a','elementCounts','\x20inspection\x20requires\x20at\x20least\x20one\x20selector',';\x0aconst\x20fail\x20=\x20(code,\x20message,\x20details)\x20=>\x20({\x20ok:\x20false,\x20error:\x20{\x20code,\x20message,\x20...(details\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20details\x20})\x20}\x20});\x0aconst\x20success\x20=\x20(value)\x20=>\x20({\x20ok:\x20true,\x20value\x20});\x0aconst\x20presentation\x20=\x20univerAPI.getPresentation(input.unitId);\x0aif\x20(!presentation)\x20return\x20fail(\x22INSPECTION_RESULT_INVALID\x22,\x20\x22Presentation\x20\x22\x20+\x20input.unitId\x20+\x20\x22\x20is\x20not\x20available\x20in\x20the\x20runtime\x22);\x0aconst\x20snapshot\x20=\x20presentation.save();\x0aconst\x20slideIds\x20=\x20Array.isArray(snapshot.slideOrder)\x20?\x20snapshot.slideOrder\x20:\x20Object.keys(snapshot.slides\x20||\x20{});\x0aconst\x20slides\x20=\x20slideIds.map((id)\x20=>\x20snapshot.slides\x20&&\x20snapshot.slides[id]).filter(Boolean);\x0a\x0afunction\x20documentText(documentData)\x20{\x0a\x20\x20const\x20stream\x20=\x20documentData\x20&&\x20documentData.body\x20&&\x20documentData.body.dataStream;\x0a\x20\x20return\x20typeof\x20stream\x20===\x20\x22string\x22\x20?\x20stream.replace(/\x5cr/g,\x20\x22\x5cn\x22).replace(/[\x5cu0000-\x5cu0009\x5cu000b-\x5cu001f]+/g,\x20\x22\x22).replace(/\x5cn+$/g,\x20\x22\x22)\x20:\x20\x22\x22;\x0a}\x0a\x0afunction\x20elementText(element)\x20{\x0a\x20\x20if\x20(typeof\x20element.text\x20===\x20\x22string\x22)\x20return\x20element.text;\x0a\x20\x20if\x20(element.textData)\x20return\x20documentText(element.textData);\x0a\x20\x20const\x20shapeData\x20=\x20element.shapeData\x20||\x20element.connectorData;\x0a\x20\x20const\x20shapeText\x20=\x20shapeData\x20&&\x20shapeData.shapeText;\x0a\x20\x20if\x20(shapeText\x20&&\x20typeof\x20shapeText.text\x20===\x20\x22string\x22)\x20return\x20shapeText.text;\x0a\x20\x20if\x20(shapeText\x20&&\x20shapeText.dataModel\x20&&\x20shapeText.dataModel.doc)\x20return\x20documentText(shapeText.dataModel.doc);\x0a\x20\x20return\x20\x22\x22;\x0a}\x0a\x0afunction\x20elementCountType(type)\x20{\x0a\x20\x20if\x20(type\x20===\x20\x22chart\x22)\x20return\x20\x22charts\x22;\x0a\x20\x20if\x20(type\x20===\x20\x22image\x22)\x20return\x20\x22images\x22;\x0a\x20\x20if\x20(type\x20===\x20\x22table\x22)\x20return\x20\x22tables\x22;\x0a\x20\x20if\x20(type\x20===\x20\x22group\x22)\x20return\x20\x22groups\x22;\x0a\x20\x20if\x20(type\x20===\x20\x22text\x22\x20||\x20type\x20===\x20\x22placeholder\x22)\x20return\x20\x22text\x22;\x0a\x20\x20return\x20\x22shapes\x22;\x0a}\x0a\x0afunction\x20collectElements(slide)\x20{\x0a\x20\x20const\x20elements\x20=\x20slide.elements\x20||\x20{};\x0a\x20\x20const\x20visited\x20=\x20new\x20Set();\x0a\x20\x20const\x20output\x20=\x20[];\x0a\x20\x20function\x20visit(id)\x20{\x0a\x20\x20\x20\x20if\x20(visited.has(id))\x20return;\x0a\x20\x20\x20\x20visited.add(id);\x0a\x20\x20\x20\x20const\x20element\x20=\x20elements[id];\x0a\x20\x20\x20\x20if\x20(!element)\x20return;\x0a\x20\x20\x20\x20output.push(element);\x0a\x20\x20\x20\x20if\x20(element.type\x20===\x20\x22group\x22\x20&&\x20Array.isArray(element.children))\x20element.children.forEach(visit);\x0a\x20\x20}\x0a\x20\x20(Array.isArray(slide.elementOrder)\x20?\x20slide.elementOrder\x20:\x20Object.keys(elements)).forEach(visit);\x0a\x20\x20Object.keys(elements).forEach(visit);\x0a\x20\x20return\x20output;\x0a}\x0a\x0afunction\x20elementCounts(slide)\x20{\x0a\x20\x20const\x20counts\x20=\x20{\x20total:\x200,\x20text:\x200,\x20shapes:\x200,\x20images:\x200,\x20charts:\x200,\x20tables:\x200,\x20groups:\x200\x20};\x0a\x20\x20for\x20(const\x20element\x20of\x20collectElements(slide))\x20{\x0a\x20\x20\x20\x20counts.total\x20+=\x201;\x0a\x20\x20\x20\x20counts[elementCountType(element.type)]\x20+=\x201;\x0a\x20\x20}\x0a\x20\x20return\x20counts;\x0a}\x0a\x0afunction\x20slideSummary(slide,\x20index)\x20{\x0a\x20\x20const\x20text\x20=\x20collectElements(slide).map(elementText).filter(Boolean).join(\x22\x20|\x20\x22).replace(/\x5cs+/g,\x20\x22\x20\x22).trim();\x0a\x20\x20const\x20preview\x20=\x20text.length\x20<=\x20160\x20?\x20text\x20:\x20text.slice(0,\x20157)\x20+\x20\x22...\x22;\x0a\x20\x20return\x20{\x0a\x20\x20\x20\x20id:\x20slide.id,\x0a\x20\x20\x20\x20index,\x0a\x20\x20\x20\x20name:\x20slide.name\x20||\x20\x22\x22,\x0a\x20\x20\x20\x20elementCounts:\x20elementCounts(slide),\x0a\x20\x20\x20\x20...(preview\x20===\x20\x22\x22\x20?\x20{}\x20:\x20{\x20textPreview:\x20preview\x20}),\x0a\x20\x20\x20\x20hasSpeakerNotes:\x20typeof\x20slide.speakerNotes\x20===\x20\x22string\x22\x20&&\x20slide.speakerNotes.length\x20>\x200,\x0a\x20\x20};\x0a}\x0a\x0afunction\x20parseTableResources()\x20{\x0a\x20\x20const\x20resource\x20=\x20(Array.isArray(snapshot.resources)\x20?\x20snapshot.resources\x20:\x20[]).find((item)\x20=>\x20item\x20&&\x20item.name\x20===\x20\x22SLIDE_TABLE_PLUGIN\x22);\x0a\x20\x20if\x20(!resource\x20||\x20typeof\x20resource.data\x20!==\x20\x22string\x22)\x20return\x20{};\x0a\x20\x20try\x20{\x0a\x20\x20\x20\x20const\x20parsed\x20=\x20JSON.parse(resource.data);\x0a\x20\x20\x20\x20return\x20parsed\x20&&\x20typeof\x20parsed.tables\x20===\x20\x22object\x22\x20?\x20parsed.tables\x20:\x20{};\x0a\x20\x20}\x20catch\x20{\x0a\x20\x20\x20\x20return\x20{};\x0a\x20\x20}\x0a}\x0a\x0aconst\x20tableResources\x20=\x20parseTableResources();\x0a\x0afunction\x20tableText(tableId)\x20{\x0a\x20\x20const\x20table\x20=\x20tableResources[tableId];\x0a\x20\x20if\x20(!table\x20||\x20!Array.isArray(table.rows))\x20return\x20undefined;\x0a\x20\x20return\x20table.rows.map((row)\x20=>\x20(Array.isArray(row.cells)\x20?\x20row.cells\x20:\x20[]).map((cell)\x20=>\x20documentText(cell\x20&&\x20cell.textData)));\x0a}\x0a\x0afunction\x20finite(value)\x20{\x0a\x20\x20return\x20typeof\x20value\x20===\x20\x22number\x22\x20&&\x20Number.isFinite(value)\x20?\x20value\x20:\x20undefined;\x0a}\x0a\x0afunction\x20transformOf(element)\x20{\x0a\x20\x20const\x20transform\x20=\x20element.transform\x20||\x20{};\x0a\x20\x20const\x20result\x20=\x20{};\x0a\x20\x20const\x20left\x20=\x20finite(transform.left\x20??\x20transform.x);\x0a\x20\x20const\x20top\x20=\x20finite(transform.top\x20??\x20transform.y);\x0a\x20\x20const\x20width\x20=\x20finite(transform.width);\x0a\x20\x20const\x20height\x20=\x20finite(transform.height);\x0a\x20\x20const\x20angle\x20=\x20finite(transform.angle\x20??\x20transform.rotation);\x0a\x20\x20if\x20(left\x20!==\x20undefined)\x20result.left\x20=\x20left;\x0a\x20\x20if\x20(top\x20!==\x20undefined)\x20result.top\x20=\x20top;\x0a\x20\x20if\x20(width\x20!==\x20undefined)\x20result.width\x20=\x20width;\x0a\x20\x20if\x20(height\x20!==\x20undefined)\x20result.height\x20=\x20height;\x0a\x20\x20if\x20(angle\x20!==\x20undefined)\x20result.angle\x20=\x20angle;\x0a\x20\x20return\x20Object.keys(result).length\x20===\x200\x20?\x20undefined\x20:\x20result;\x0a}\x0a\x0afunction\x20inspectElement(element,\x20elements,\x20ancestors)\x20{\x0a\x20\x20const\x20shapeData\x20=\x20element.shapeData\x20||\x20element.connectorData\x20||\x20{};\x0a\x20\x20const\x20shapeText\x20=\x20shapeData.shapeText\x20||\x20{};\x0a\x20\x20const\x20text\x20=\x20elementText(element);\x0a\x20\x20const\x20output\x20=\x20{\x0a\x20\x20\x20\x20id:\x20element.id,\x0a\x20\x20\x20\x20type:\x20String(element.type\x20||\x20\x22unknown\x22),\x0a\x20\x20\x20\x20name:\x20typeof\x20element.name\x20===\x20\x22string\x22\x20?\x20element.name\x20:\x20\x22\x22,\x0a\x20\x20\x20\x20visible:\x20element.visible\x20!==\x20false,\x0a\x20\x20};\x0a\x20\x20const\x20transform\x20=\x20transformOf(element);\x0a\x20\x20if\x20(transform)\x20output.transform\x20=\x20transform;\x0a\x20\x20if\x20(shapeData.fill\x20!==\x20undefined)\x20output.fill\x20=\x20shapeData.fill;\x0a\x20\x20if\x20((shapeData.stroke\x20??\x20element.stroke)\x20!==\x20undefined)\x20output.stroke\x20=\x20shapeData.stroke\x20??\x20element.stroke;\x0a\x20\x20if\x20(text\x20!==\x20\x22\x22)\x20{\x0a\x20\x20\x20\x20const\x20textDetails\x20=\x20{\x20text\x20};\x0a\x20\x20\x20\x20const\x20horizontal\x20=\x20shapeText.dataModel\x20&&\x20shapeText.dataModel.ha;\x0a\x20\x20\x20\x20const\x20vertical\x20=\x20shapeText.dataModel\x20&&\x20shapeText.dataModel.va;\x0a\x20\x20\x20\x20if\x20(horizontal\x20!==\x20undefined\x20||\x20vertical\x20!==\x20undefined)\x20textDetails.alignment\x20=\x20{\x0a\x20\x20\x20\x20\x20\x20...(horizontal\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20horizontal\x20}),\x0a\x20\x20\x20\x20\x20\x20...(vertical\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20vertical\x20}),\x0a\x20\x20\x20\x20};\x0a\x20\x20\x20\x20if\x20(shapeText.padding\x20!==\x20undefined\x20||\x20shapeText.insets\x20!==\x20undefined)\x20textDetails.insets\x20=\x20shapeText.padding\x20??\x20shapeText.insets;\x0a\x20\x20\x20\x20output.text\x20=\x20textDetails;\x0a\x20\x20}\x0a\x20\x20if\x20(typeof\x20element.chartId\x20===\x20\x22string\x22)\x20output.chartId\x20=\x20element.chartId;\x0a\x20\x20if\x20(typeof\x20element.tableId\x20===\x20\x22string\x22)\x20{\x0a\x20\x20\x20\x20output.tableId\x20=\x20element.tableId;\x0a\x20\x20\x20\x20const\x20grid\x20=\x20tableText(element.tableId);\x0a\x20\x20\x20\x20if\x20(grid)\x20output.tableText\x20=\x20grid;\x0a\x20\x20}\x0a\x20\x20if\x20(typeof\x20element.mediaType\x20===\x20\x22string\x22)\x20output.mediaType\x20=\x20element.mediaType;\x0a\x20\x20if\x20(element.type\x20===\x20\x22group\x22\x20&&\x20Array.isArray(element.children))\x20{\x0a\x20\x20\x20\x20output.children\x20=\x20element.children.filter((id)\x20=>\x20!ancestors.has(id)\x20&&\x20elements[id]).map((id)\x20=>\x20{\x0a\x20\x20\x20\x20\x20\x20const\x20next\x20=\x20new\x20Set(ancestors);\x0a\x20\x20\x20\x20\x20\x20next.add(id);\x0a\x20\x20\x20\x20\x20\x20return\x20inspectElement(elements[id],\x20elements,\x20next);\x0a\x20\x20\x20\x20});\x0a\x20\x20}\x0a\x20\x20return\x20output;\x0a}\x0a\x0afunction\x20slideDetails(slide,\x20index)\x20{\x0a\x20\x20const\x20summary\x20=\x20slideSummary(slide,\x20index);\x0a\x20\x20const\x20elements\x20=\x20slide.elements\x20||\x20{};\x0a\x20\x20const\x20ordered\x20=\x20Array.isArray(slide.elementOrder)\x20?\x20slide.elementOrder\x20:\x20Object.keys(elements);\x0a\x20\x20return\x20{\x0a\x20\x20\x20\x20...summary,\x0a\x20\x20\x20\x20speakerNotes:\x20typeof\x20slide.speakerNotes\x20===\x20\x22string\x22\x20?\x20slide.speakerNotes\x20:\x20\x22\x22,\x0a\x20\x20\x20\x20elements:\x20ordered.filter((id)\x20=>\x20elements[id]).map((id)\x20=>\x20inspectElement(elements[id],\x20elements,\x20new\x20Set([id]))),\x0a\x20\x20};\x0a}\x0a\x0afunction\x20resolveSlide(selector)\x20{\x0a\x20\x20if\x20(!selector\x20||\x20typeof\x20selector\x20!==\x20\x22object\x22)\x20return\x20{\x20error:\x20fail(\x22INSPECTION_SELECTOR_INVALID\x22,\x20\x22Slide\x20selector\x20must\x20be\x20an\x20object\x22)\x20};\x0a\x20\x20const\x20keys\x20=\x20[\x22id\x22,\x20\x22index\x22].filter((key)\x20=>\x20Object.hasOwn(selector,\x20key));\x0a\x20\x20if\x20(keys.length\x20!==\x201)\x20return\x20{\x20error:\x20fail(\x22INSPECTION_SELECTOR_INVALID\x22,\x20\x22Slide\x20selector\x20must\x20contain\x20exactly\x20one\x20of\x20id\x20or\x20index\x22,\x20selector)\x20};\x0a\x20\x20let\x20matches\x20=\x20[];\x0a\x20\x20if\x20(keys[0]\x20===\x20\x22id\x22\x20&&\x20typeof\x20selector.id\x20===\x20\x22string\x22\x20&&\x20selector.id.length\x20>\x200)\x20matches\x20=\x20slides.filter((slide)\x20=>\x20slide.id\x20===\x20selector.id);\x0a\x20\x20else\x20if\x20(keys[0]\x20===\x20\x22index\x22\x20&&\x20Number.isInteger(selector.index)\x20&&\x20selector.index\x20>=\x200)\x20matches\x20=\x20slides[selector.index]\x20?\x20[slides[selector.index]]\x20:\x20[];\x0a\x20\x20else\x20return\x20{\x20error:\x20fail(\x22INSPECTION_SELECTOR_INVALID\x22,\x20\x22Slide\x20selector\x20value\x20is\x20invalid\x22,\x20selector)\x20};\x0a\x20\x20if\x20(matches.length\x20===\x200)\x20return\x20{\x20error:\x20fail(\x22INSPECTION_SELECTOR_NOT_FOUND\x22,\x20\x22Slide\x20selector\x20did\x20not\x20match\x20a\x20slide\x22,\x20selector)\x20};\x0a\x20\x20if\x20(matches.length\x20>\x201)\x20return\x20{\x20error:\x20fail(\x22INSPECTION_SELECTOR_AMBIGUOUS\x22,\x20\x22Slide\x20selector\x20matched\x20more\x20than\x20one\x20slide\x22,\x20selector)\x20};\x0a\x20\x20return\x20{\x20slide:\x20matches[0],\x20index:\x20slides.indexOf(matches[0])\x20};\x0a}\x0a\x0aif\x20(input.query.kind\x20===\x20\x22presentation\x22)\x20{\x0a\x20\x20const\x20size\x20=\x20presentation.getPageSize();\x0a\x20\x20return\x20success({\x0a\x20\x20\x20\x20kind:\x20\x22presentation\x22,\x0a\x20\x20\x20\x20unitId:\x20input.unitId,\x0a\x20\x20\x20\x20name:\x20presentation.getName(),\x0a\x20\x20\x20\x20size:\x20{\x20width:\x20size.width,\x20height:\x20size.height\x20},\x0a\x20\x20\x20\x20masterSlideCount:\x20Array.isArray(snapshot.masterPageOrder)\x20?\x20snapshot.masterPageOrder.length\x20:\x20Object.keys(snapshot.masterPages\x20||\x20{}).length,\x0a\x20\x20\x20\x20layoutSlideCount:\x20Array.isArray(snapshot.layoutPageOrder)\x20?\x20snapshot.layoutPageOrder.length\x20:\x20Object.keys(snapshot.layoutPages\x20||\x20{}).length,\x0a\x20\x20\x20\x20slides:\x20slides.map(slideSummary),\x0a\x20\x20});\x0a}\x0a\x0aif\x20(input.query.kind\x20===\x20\x22slide\x22)\x20{\x0a\x20\x20const\x20selected\x20=\x20[];\x0a\x20\x20for\x20(const\x20selector\x20of\x20input.query.slides\x20||\x20[])\x20{\x0a\x20\x20\x20\x20const\x20item\x20=\x20resolveSlide(selector);\x0a\x20\x20\x20\x20if\x20(item.error)\x20return\x20item.error;\x0a\x20\x20\x20\x20selected.push(slideDetails(item.slide,\x20item.index));\x0a\x20\x20}\x0a\x20\x20return\x20success({\x20kind:\x20\x22slide\x22,\x20unitId:\x20input.unitId,\x20slides:\x20selected\x20});\x0a}\x0a\x0areturn\x20fail(\x22INSPECTION_RESULT_INVALID\x22,\x20\x22Unsupported\x20slide\x20inspection\x20target\x22);\x0a','doc','tableId','INSPECTION_SELECTOR_NOT_FOUND','INSPECTION_RESULT_INVALID','error','placeholder','labelStyle','slide','document','orderIndex','originalType','code','INSPECTION_SELECTOR_AMBIGUOUS','config','waypoints','851394VURXcc','curve','workbook','169864DQnxyx','labelText','kind','Inspection\x20runtime\x20returned\x20an\x20invalid\x20','number','index','worksheet','length','transform','worksheets','textContent','byType','width','presentation','ContentInspectionError','stringify','name','isSafeInteger','connectionSiteId','start','elements','\x20runtime,\x20received\x20','title','value','primaryFieldId','offsetY'];_0x9729=function(){return _0x538b31;};return _0x9729();}function a(_0x168fd8){const _0x12f8b4=_0x3141af;return _(_0x168fd8)&&typeof _0x168fd8['id']==_0x12f8b4(0x1c3)&&m(_0x168fd8[_0x12f8b4(0x169)])&&typeof _0x168fd8[_0x12f8b4(0x1b7)]==_0x12f8b4(0x1c3)&&typeof _0x168fd8[_0x12f8b4(0x156)]=='boolean'&&typeof _0x168fd8[_0x12f8b4(0x1ba)]==_0x12f8b4(0x193)&&typeof _0x168fd8[_0x12f8b4(0x19d)]==_0x12f8b4(0x193)&&_(_0x168fd8[_0x12f8b4(0x17a)])&&f(_0x168fd8[_0x12f8b4(0x182)])&&f(_0x168fd8['description'])&&f(_0x168fd8[_0x12f8b4(0x19e)])&&f(_0x168fd8[_0x12f8b4(0x1b8)])&&(_0x168fd8[_0x12f8b4(0x1a4)]===null||l(_0x168fd8[_0x12f8b4(0x1a4)]));}function o(_0x4332e5){const _0x1e89eb=_0x3141af;return!a(_0x4332e5)||_0x1e89eb(0x1a8)in _0x4332e5||_0x1e89eb(0x1b1)in _0x4332e5||_0x1e89eb(0x1a1)in _0x4332e5?!0x1:_0x4332e5[_0x1e89eb(0x1b7)]==='shape'?'shapeData'in _0x4332e5:_0x4332e5[_0x1e89eb(0x1b7)]===_0x1e89eb(0x199)?!(_0x1e89eb(0x1a6)in _0x4332e5)&&!(_0x1e89eb(0x191)in _0x4332e5)&&!(_0x1e89eb(0x1b0)in _0x4332e5)&&!(_0x1e89eb(0x1d0)in _0x4332e5)&&s(_0x4332e5[_0x1e89eb(0x1be)])&&_0x1e89eb(0x1cd)in _0x4332e5&&Array[_0x1e89eb(0x1ca)](_0x4332e5[_0x1e89eb(0x151)])&&_0x4332e5['labels'][_0x1e89eb(0x19c)](_0x4da3e2=>_(_0x4da3e2)&&typeof _0x4da3e2['id']==_0x1e89eb(0x1c3))&&_0x1e89eb(0x173)in _0x4332e5&&_0x1e89eb(0x166)in _0x4332e5:_0x4332e5[_0x1e89eb(0x1b7)]==='text'?_0x1e89eb(0x17c)in _0x4332e5&&_0x1e89eb(0x1a2)in _0x4332e5:_0x4332e5['type']===_0x1e89eb(0x1ab)||_0x4332e5[_0x1e89eb(0x1b7)]==='media'?typeof _0x4332e5[_0x1e89eb(0x1b2)]==_0x1e89eb(0x1c3):_0x4332e5[_0x1e89eb(0x1b7)]===_0x1e89eb(0x1aa)?typeof _0x4332e5[_0x1e89eb(0x1d2)]==_0x1e89eb(0x1c3):_0x4332e5[_0x1e89eb(0x1b7)]===_0x1e89eb(0x197)?_0x1e89eb(0x1bc)in _0x4332e5:_0x4332e5['type']==='diagram'?_0x1e89eb(0x18f)in _0x4332e5:_0x4332e5[_0x1e89eb(0x1b7)]===_0x1e89eb(0x196)?typeof _0x4332e5[_0x1e89eb(0x161)]==_0x1e89eb(0x1c3):_0x4332e5[_0x1e89eb(0x1b7)]===_0x1e89eb(0x192)?Array[_0x1e89eb(0x1ca)](_0x4332e5[_0x1e89eb(0x154)])&&_0x4332e5['children'][_0x1e89eb(0x19c)](_0x339e5f=>typeof _0x339e5f==_0x1e89eb(0x1c3)):_0x4332e5[_0x1e89eb(0x1b7)]===_0x1e89eb(0x165)?_0x1e89eb(0x165)in _0x4332e5:_0x4332e5[_0x1e89eb(0x1b7)]==='unknown'&&typeof _0x4332e5[_0x1e89eb(0x16a)]=='string'&&'data'in _0x4332e5;}function s(_0x8679b2){const _0x1dab52=_0x3141af;return _(_0x8679b2)&&c(_0x8679b2[_0x1dab52(0x185)])&&c(_0x8679b2['end'])&&(_0x8679b2['routing']===_0x1dab52(0x1cb)||_0x8679b2[_0x1dab52(0x1b9)]==='orthogonal'||_0x8679b2[_0x1dab52(0x1b9)]===_0x1dab52(0x170)||_0x8679b2[_0x1dab52(0x1b9)]===_0x1dab52(0x1ad))&&(_0x8679b2[_0x1dab52(0x1ce)]===_0x1dab52(0x1a3)||_0x8679b2[_0x1dab52(0x1ce)]===_0x1dab52(0x194)||_0x8679b2[_0x1dab52(0x1ce)]===_0x1dab52(0x190))&&Array[_0x1dab52(0x1ca)](_0x8679b2[_0x1dab52(0x16e)])&&_0x8679b2[_0x1dab52(0x16e)][_0x1dab52(0x19c)](_0x3e28dd=>_(_0x3e28dd)&&typeof _0x3e28dd['id']=='string'&&(_0x3e28dd[_0x1dab52(0x174)]===_0x1dab52(0x1a3)||_0x3e28dd[_0x1dab52(0x174)]===_0x1dab52(0x194))&&u(_0x3e28dd));}function c(_0x384e8d){const _0x160080=_0x3141af;return!_(_0x384e8d)||typeof _0x384e8d[_0x160080(0x174)]!='string'?!0x1:_0x384e8d['kind']===_0x160080(0x159)?u(_0x384e8d):_0x384e8d[_0x160080(0x174)]==='lifeline'?typeof _0x384e8d[_0x160080(0x1af)]==_0x160080(0x1c3)&&typeof _0x384e8d[_0x160080(0x18b)]==_0x160080(0x176):_0x384e8d['kind']===_0x160080(0x1c9)?typeof _0x384e8d[_0x160080(0x1af)]==_0x160080(0x1c3)&&typeof _0x384e8d[_0x160080(0x184)]=='number'&&d(_0x384e8d[_0x160080(0x1a0)]):_0x384e8d[_0x160080(0x174)]===_0x160080(0x1cc)&&typeof _0x384e8d['shapeId']==_0x160080(0x1c3)&&typeof _0x384e8d[_0x160080(0x1a5)]==_0x160080(0x176)&&typeof _0x384e8d[_0x160080(0x1bd)]==_0x160080(0x176)&&typeof _0x384e8d['segmentT']=='number';}function l(_0x1878e1){const _0x46e89b=_0x3141af;return _(_0x1878e1)&&typeof _0x1878e1[_0x46e89b(0x18d)]=='number'&&typeof _0x1878e1[_0x46e89b(0x1a9)]==_0x46e89b(0x176)&&typeof _0x1878e1[_0x46e89b(0x17e)]=='number'&&typeof _0x1878e1[_0x46e89b(0x1c5)]==_0x46e89b(0x176);}function u(_0x262fc9){const _0x391e76=_0x3141af;return _(_0x262fc9)&&typeof _0x262fc9['x']==_0x391e76(0x176)&&typeof _0x262fc9['y']==_0x391e76(0x176);}function d(_0x2d07a3){const _0xe33ebc=_0x3141af;return _0x2d07a3===void 0x0||typeof _0x2d07a3==_0xe33ebc(0x176);}function f(_0x5680c7){return _0x5680c7===void 0x0||typeof _0x5680c7=='string';}function p(_0x4c3ec3){const _0x305092=_0x3141af;return typeof _0x4c3ec3[_0x305092(0x182)]=='string'&&Array[_0x305092(0x1ca)](_0x4c3ec3[_0x305092(0x15a)])&&_0x4c3ec3['tables'][_0x305092(0x19c)]((_0x33991c,_0x398331)=>_(_0x33991c)&&m(_0x33991c[_0x305092(0x177)])&&_0x33991c[_0x305092(0x177)]===_0x398331&&typeof _0x33991c['id']==_0x305092(0x1c3)&&typeof _0x33991c[_0x305092(0x182)]=='string'&&typeof _0x33991c['formulaName']=='string'&&typeof _0x33991c[_0x305092(0x18a)]=='string'&&m(_0x33991c['recordCount'])&&Array['isArray'](_0x33991c[_0x305092(0x1cf)])&&_0x33991c[_0x305092(0x1cf)]['every']((_0x114119,_0x1010b3)=>_(_0x114119)&&m(_0x114119['index'])&&_0x114119[_0x305092(0x177)]===_0x1010b3&&typeof _0x114119['id']==_0x305092(0x1c3)&&typeof _0x114119[_0x305092(0x182)]==_0x305092(0x1c3)&&typeof _0x114119[_0x305092(0x1b7)]=='string'&&typeof _0x114119['isReadonly']==_0x305092(0x193)&&_0x305092(0x16d)in _0x114119&&h(_0x114119[_0x305092(0x16d)]))&&Array[_0x305092(0x1ca)](_0x33991c[_0x305092(0x1d1)])&&_0x33991c[_0x305092(0x1d1)][_0x305092(0x19c)]((_0x134d5f,_0x48980c)=>_(_0x134d5f)&&m(_0x134d5f[_0x305092(0x177)])&&_0x134d5f[_0x305092(0x177)]===_0x48980c&&typeof _0x134d5f['id']=='string'&&typeof _0x134d5f[_0x305092(0x182)]==_0x305092(0x1c3)&&typeof _0x134d5f[_0x305092(0x1b7)]==_0x305092(0x1c3)));}function m(_0x128854){const _0x2482c2=_0x3141af;return typeof _0x128854=='number'&&Number[_0x2482c2(0x183)](_0x128854)&&_0x128854>=0x0;}function h(_0x2ca08b){const _0x35594e=_0x3141af;return _0x2ca08b===null||typeof _0x2ca08b==_0x35594e(0x193)||typeof _0x2ca08b==_0x35594e(0x1c3)||typeof _0x2ca08b==_0x35594e(0x176)&&Number['isFinite'](_0x2ca08b)?!0x0:Array[_0x35594e(0x1ca)](_0x2ca08b)?_0x2ca08b['every'](h):_(_0x2ca08b)&&Object[_0x35594e(0x15b)](_0x2ca08b)['every'](h);}function g(_0x39fa77){const _0x21997d=_0x3141af;return new e(_0x21997d(0x163),_0x39fa77);}function _(_0x5d18f7){const _0x21f862=_0x3141af;return typeof _0x5d18f7=='object'&&!!_0x5d18f7&&!Array[_0x21f862(0x1ca)](_0x5d18f7);}function v(_0x2cb681){const _0x5bffd7=_0x3141af;return _0x2cb681==='INSPECTION_RANGE_OUT_OF_BOUNDS'||_0x2cb681===_0x5bffd7(0x163)||_0x2cb681===_0x5bffd7(0x16c)||_0x2cb681===_0x5bffd7(0x1b6)||_0x2cb681===_0x5bffd7(0x162)||_0x2cb681==='INSPECTION_UNIT_TYPE_MISMATCH';}function y(_0x155628){const _0x15345a=_0x3141af;return'\x0aconst\x20input\x20=\x20'+JSON[_0x15345a(0x181)]({'unitId':_0x155628})+_0x15345a(0x1b5);}function b(_0x1064e7,_0x252b12){return'\x0aconst\x20input\x20=\x20'+JSON['stringify']({'query':_0x252b12,'unitId':_0x1064e7})+';\x0aconst\x20fail\x20=\x20(code,\x20message,\x20details)\x20=>\x20({\x20ok:\x20false,\x20error:\x20{\x20code,\x20message,\x20...(details\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20details\x20})\x20}\x20});\x0aconst\x20success\x20=\x20(value)\x20=>\x20({\x20ok:\x20true,\x20value:\x20JSON.parse(JSON.stringify(value))\x20});\x0aconst\x20board\x20=\x20univerAPI.getBoard(input.unitId);\x0aif\x20(!board)\x20return\x20fail(\x22INSPECTION_RESULT_INVALID\x22,\x20\x22Board\x20\x22\x20+\x20input.unitId\x20+\x20\x22\x20is\x20not\x20available\x20in\x20the\x20runtime\x22);\x0a\x0aconst\x20descriptors\x20=\x20board.describeElements();\x0aconst\x20descriptorsById\x20=\x20new\x20Map(descriptors.map((descriptor)\x20=>\x20[descriptor.id,\x20descriptor]));\x0a\x0afunction\x20elementCounts()\x20{\x0a\x20\x20const\x20byType\x20=\x20{};\x0a\x20\x20for\x20(const\x20descriptor\x20of\x20descriptors)\x20{\x0a\x20\x20\x20\x20const\x20type\x20=\x20String(descriptor.type\x20||\x20\x22unknown\x22);\x0a\x20\x20\x20\x20byType[type]\x20=\x20(byType[type]\x20||\x200)\x20+\x201;\x0a\x20\x20}\x0a\x20\x20return\x20{\x20total:\x20descriptors.length,\x20byType\x20};\x0a}\x0a\x0afunction\x20inspectionBase(element,\x20descriptor)\x20{\x0a\x20\x20return\x20{\x0a\x20\x20\x20\x20id:\x20element.id,\x0a\x20\x20\x20\x20orderIndex:\x20descriptor.orderIndex,\x0a\x20\x20\x20\x20type:\x20String(element.type\x20||\x20\x22unknown\x22),\x0a\x20\x20\x20\x20...(descriptor.name\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20name:\x20descriptor.name\x20}),\x0a\x20\x20\x20\x20...(descriptor.description\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20description:\x20descriptor.description\x20}),\x0a\x20\x20\x20\x20...(descriptor.parentId\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20parentId:\x20descriptor.parentId\x20}),\x0a\x20\x20\x20\x20...(descriptor.laneId\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20laneId:\x20descriptor.laneId\x20}),\x0a\x20\x20\x20\x20visible:\x20descriptor.visible,\x0a\x20\x20\x20\x20selectable:\x20descriptor.selectable,\x0a\x20\x20\x20\x20locked:\x20descriptor.locked,\x0a\x20\x20\x20\x20transform:\x20element.transform\x20||\x20{},\x0a\x20\x20\x20\x20bounds:\x20descriptor.bounds,\x0a\x20\x20};\x0a}\x0a\x0afunction\x20richTextData(value)\x20{\x0a\x20\x20return\x20value\x20?\x20value.getData()\x20:\x20null;\x0a}\x0a\x0afunction\x20inspectElement(element,\x20descriptor)\x20{\x0a\x20\x20const\x20base\x20=\x20inspectionBase(element,\x20descriptor);\x0a\x20\x20if\x20(element.type\x20===\x20\x22shape\x22)\x20{\x0a\x20\x20\x20\x20return\x20{\x20...base,\x20type:\x20\x22shape\x22,\x20shapeData:\x20element.shapeData\x20||\x20{}\x20};\x0a\x20\x20}\x0a\x20\x20if\x20(element.type\x20===\x20\x22connector\x22)\x20{\x0a\x20\x20\x20\x20const\x20connection\x20=\x20board.getConnectorConnection(element.id);\x0a\x20\x20\x20\x20if\x20(!connection)\x20return\x20null;\x0a\x20\x20\x20\x20return\x20{\x0a\x20\x20\x20\x20\x20\x20...base,\x0a\x20\x20\x20\x20\x20\x20type:\x20\x22connector\x22,\x0a\x20\x20\x20\x20\x20\x20connection,\x0a\x20\x20\x20\x20\x20\x20style:\x20board.getConnectorStyle(element.id),\x0a\x20\x20\x20\x20\x20\x20labels:\x20board.getConnectorLabels(element.id),\x0a\x20\x20\x20\x20\x20\x20labelText:\x20richTextData(board.getConnectorLabelText(element.id)),\x0a\x20\x20\x20\x20\x20\x20labelStyle:\x20board.getConnectorLabelStyle(element.id),\x0a\x20\x20\x20\x20};\x0a\x20\x20}\x0a\x20\x20if\x20(element.type\x20===\x20\x22text\x22)\x20{\x0a\x20\x20\x20\x20return\x20{\x0a\x20\x20\x20\x20\x20\x20...base,\x0a\x20\x20\x20\x20\x20\x20type:\x20\x22text\x22,\x0a\x20\x20\x20\x20\x20\x20textContent:\x20richTextData(board.getTextContent(element.id)),\x0a\x20\x20\x20\x20\x20\x20textStyle:\x20element.textStyle\x20||\x20null,\x0a\x20\x20\x20\x20};\x0a\x20\x20}\x0a\x20\x20if\x20(element.type\x20===\x20\x22image\x22)\x20{\x0a\x20\x20\x20\x20return\x20{\x0a\x20\x20\x20\x20\x20\x20...base,\x0a\x20\x20\x20\x20\x20\x20type:\x20\x22image\x22,\x0a\x20\x20\x20\x20\x20\x20source:\x20element.source,\x0a\x20\x20\x20\x20\x20\x20...(element.imageSourceType\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20imageSourceType:\x20element.imageSourceType\x20}),\x0a\x20\x20\x20\x20\x20\x20...(element.crop\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20crop:\x20element.crop\x20}),\x0a\x20\x20\x20\x20\x20\x20...(element.prstGeom\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20prstGeom:\x20element.prstGeom\x20}),\x0a\x20\x20\x20\x20\x20\x20...(element.adjustValues\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20adjustValues:\x20element.adjustValues\x20}),\x0a\x20\x20\x20\x20};\x0a\x20\x20}\x0a\x20\x20if\x20(element.type\x20===\x20\x22chart\x22)\x20{\x0a\x20\x20\x20\x20return\x20{\x0a\x20\x20\x20\x20\x20\x20...base,\x0a\x20\x20\x20\x20\x20\x20type:\x20\x22chart\x22,\x0a\x20\x20\x20\x20\x20\x20chartId:\x20element.chartId,\x0a\x20\x20\x20\x20\x20\x20...(element.placeholder\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20placeholder:\x20element.placeholder\x20}),\x0a\x20\x20\x20\x20\x20\x20...(element.stroke\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20stroke:\x20element.stroke\x20}),\x0a\x20\x20\x20\x20};\x0a\x20\x20}\x0a\x20\x20if\x20(element.type\x20===\x20\x22container\x22)\x20{\x0a\x20\x20\x20\x20return\x20{\x20...base,\x20type:\x20\x22container\x22,\x20containerData:\x20element.containerData\x20||\x20{}\x20};\x0a\x20\x20}\x0a\x20\x20if\x20(element.type\x20===\x20\x22diagram\x22)\x20{\x0a\x20\x20\x20\x20const\x20{\x20id,\x20type,\x20transform,\x20parentId,\x20laneId,\x20name,\x20description,\x20visible,\x20selectable,\x20locked,\x20...data\x20}\x20=\x20element;\x0a\x20\x20\x20\x20return\x20{\x20...base,\x20type:\x20\x22diagram\x22,\x20data\x20};\x0a\x20\x20}\x0a\x20\x20if\x20(element.type\x20===\x20\x22table\x22)\x20{\x0a\x20\x20\x20\x20return\x20{\x0a\x20\x20\x20\x20\x20\x20...base,\x0a\x20\x20\x20\x20\x20\x20type:\x20\x22table\x22,\x0a\x20\x20\x20\x20\x20\x20tableId:\x20element.tableId,\x0a\x20\x20\x20\x20\x20\x20...(element.placeholder\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20placeholder:\x20element.placeholder\x20}),\x0a\x20\x20\x20\x20};\x0a\x20\x20}\x0a\x20\x20if\x20(element.type\x20===\x20\x22group\x22)\x20{\x0a\x20\x20\x20\x20return\x20{\x20...base,\x20type:\x20\x22group\x22,\x20children:\x20Array.isArray(element.children)\x20?\x20element.children\x20:\x20[]\x20};\x0a\x20\x20}\x0a\x20\x20if\x20(element.type\x20===\x20\x22media\x22)\x20{\x0a\x20\x20\x20\x20return\x20{\x0a\x20\x20\x20\x20\x20\x20...base,\x0a\x20\x20\x20\x20\x20\x20type:\x20\x22media\x22,\x0a\x20\x20\x20\x20\x20\x20mediaType:\x20String(element.mediaType\x20||\x20\x22unknown\x22),\x0a\x20\x20\x20\x20\x20\x20source:\x20element.source,\x0a\x20\x20\x20\x20\x20\x20...(element.poster\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20poster:\x20element.poster\x20}),\x0a\x20\x20\x20\x20};\x0a\x20\x20}\x0a\x20\x20if\x20(element.type\x20===\x20\x22placeholder\x22)\x20{\x0a\x20\x20\x20\x20return\x20{\x0a\x20\x20\x20\x20\x20\x20...base,\x0a\x20\x20\x20\x20\x20\x20type:\x20\x22placeholder\x22,\x0a\x20\x20\x20\x20\x20\x20placeholder:\x20element.placeholder\x20||\x20{},\x0a\x20\x20\x20\x20\x20\x20...(element.text\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20text:\x20element.text\x20}),\x0a\x20\x20\x20\x20\x20\x20...(element.style\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20style:\x20element.style\x20}),\x0a\x20\x20\x20\x20};\x0a\x20\x20}\x0a\x20\x20const\x20{\x20id,\x20type,\x20transform,\x20parentId,\x20laneId,\x20name,\x20description,\x20visible,\x20selectable,\x20locked,\x20...data\x20}\x20=\x20element;\x0a\x20\x20return\x20{\x20...base,\x20type:\x20\x22unknown\x22,\x20originalType:\x20String(type\x20||\x20\x22unknown\x22),\x20data\x20};\x0a}\x0a\x0aif\x20(input.query.kind\x20===\x20\x22board\x22)\x20{\x0a\x20\x20const\x20background\x20=\x20board.getBackground();\x0a\x20\x20return\x20success({\x0a\x20\x20\x20\x20kind:\x20\x22board\x22,\x0a\x20\x20\x20\x20unitId:\x20input.unitId,\x0a\x20\x20\x20\x20name:\x20board.getName(),\x0a\x20\x20\x20\x20...(background\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20background\x20}),\x0a\x20\x20\x20\x20themeData:\x20board.getThemeData(),\x0a\x20\x20\x20\x20elementCounts:\x20elementCounts(),\x0a\x20\x20\x20\x20elements:\x20descriptors,\x0a\x20\x20});\x0a}\x0a\x0aif\x20(input.query.kind\x20===\x20\x22board-element\x22)\x20{\x0a\x20\x20const\x20selected\x20=\x20[];\x0a\x20\x20for\x20(const\x20selector\x20of\x20input.query.elements\x20||\x20[])\x20{\x0a\x20\x20\x20\x20if\x20(!selector\x20||\x20typeof\x20selector\x20!==\x20\x22object\x22\x20||\x20Object.keys(selector).length\x20!==\x201\x20||\x20typeof\x20selector.id\x20!==\x20\x22string\x22\x20||\x20selector.id.length\x20===\x200)\x20{\x0a\x20\x20\x20\x20\x20\x20return\x20fail(\x22INSPECTION_SELECTOR_INVALID\x22,\x20\x22Board\x20element\x20selector\x20must\x20contain\x20exactly\x20one\x20non-empty\x20id\x22,\x20selector);\x0a\x20\x20\x20\x20}\x0a\x20\x20\x20\x20const\x20descriptor\x20=\x20descriptorsById.get(selector.id);\x0a\x20\x20\x20\x20const\x20element\x20=\x20board.getElement(selector.id);\x0a\x20\x20\x20\x20if\x20(!descriptor\x20||\x20!element)\x20{\x0a\x20\x20\x20\x20\x20\x20return\x20fail(\x22INSPECTION_SELECTOR_NOT_FOUND\x22,\x20\x22Board\x20element\x20selector\x20did\x20not\x20match\x20an\x20element\x22,\x20selector);\x0a\x20\x20\x20\x20}\x0a\x20\x20\x20\x20const\x20inspection\x20=\x20inspectElement(element,\x20descriptor);\x0a\x20\x20\x20\x20if\x20(!inspection)\x20{\x0a\x20\x20\x20\x20\x20\x20return\x20fail(\x22INSPECTION_RESULT_INVALID\x22,\x20\x22Board\x20element\x20\x22\x20+\x20selector.id\x20+\x20\x22\x20could\x20not\x20be\x20inspected\x22);\x0a\x20\x20\x20\x20}\x0a\x20\x20\x20\x20selected.push(inspection);\x0a\x20\x20}\x0a\x20\x20return\x20success({\x20kind:\x20\x22board-element\x22,\x20unitId:\x20input.unitId,\x20elements:\x20selected\x20});\x0a}\x0a\x0areturn\x20fail(\x22INSPECTION_RESULT_INVALID\x22,\x20\x22Unsupported\x20Board\x20inspection\x20target\x22);\x0a';}function x(_0x43a477,_0x4c4a5f){const _0x4d19b2=_0x3141af;return'\x0aconst\x20input\x20=\x20'+JSON[_0x4d19b2(0x181)]({'query':_0x4c4a5f,'unitId':_0x43a477})+_0x4d19b2(0x15c);}function S(_0xe247ce,_0x1a29e7){const _0x32877a=_0x3141af;return _0x32877a(0x19f)+JSON[_0x32877a(0x181)]({'query':_0x1a29e7,'unitId':_0xe247ce})+';\x0aconst\x20fail\x20=\x20(code,\x20message,\x20details)\x20=>\x20({\x20ok:\x20false,\x20error:\x20{\x20code,\x20message,\x20...(details\x20===\x20undefined\x20?\x20{}\x20:\x20{\x20details\x20})\x20}\x20});\x0aconst\x20success\x20=\x20(value)\x20=>\x20({\x20ok:\x20true,\x20value\x20});\x0aconst\x20workbook\x20=\x20univerAPI.getWorkbook(input.unitId);\x0aif\x20(!workbook)\x20return\x20fail(\x22INSPECTION_RESULT_INVALID\x22,\x20\x22Workbook\x20\x22\x20+\x20input.unitId\x20+\x20\x22\x20is\x20not\x20available\x20in\x20the\x20runtime\x22);\x0aconst\x20sheets\x20=\x20workbook.getSheets();\x0aconst\x20snapshot\x20=\x20workbook.save();\x0a\x0afunction\x20columnName(column)\x20{\x0a\x20\x20let\x20value\x20=\x20column\x20+\x201;\x0a\x20\x20let\x20name\x20=\x20\x22\x22;\x0a\x20\x20while\x20(value\x20>\x200)\x20{\x0a\x20\x20\x20\x20const\x20remainder\x20=\x20(value\x20-\x201)\x20%\x2026;\x0a\x20\x20\x20\x20name\x20=\x20String.fromCharCode(65\x20+\x20remainder)\x20+\x20name;\x0a\x20\x20\x20\x20value\x20=\x20Math.floor((value\x20-\x201)\x20/\x2026);\x0a\x20\x20}\x0a\x20\x20return\x20name;\x0a}\x0a\x0afunction\x20rangeNotation(range)\x20{\x0a\x20\x20const\x20start\x20=\x20columnName(range.startColumn)\x20+\x20String(range.startRow\x20+\x201);\x0a\x20\x20const\x20end\x20=\x20columnName(range.endColumn)\x20+\x20String(range.endRow\x20+\x201);\x0a\x20\x20return\x20start\x20===\x20end\x20?\x20start\x20:\x20start\x20+\x20\x22:\x22\x20+\x20end;\x0a}\x0a\x0afunction\x20parseA1Range(notation)\x20{\x0a\x20\x20const\x20match\x20=\x20/^\x5c$?([A-Za-z]+)\x5c$?(\x5cd+)(?::\x5c$?([A-Za-z]+)\x5c$?(\x5cd+))?$/.exec(notation);\x0a\x20\x20if\x20(!match)\x20return\x20null;\x0a\x20\x20const\x20columnIndex\x20=\x20(name)\x20=>\x20{\x0a\x20\x20\x20\x20let\x20column\x20=\x200;\x0a\x20\x20\x20\x20for\x20(const\x20character\x20of\x20name.toUpperCase())\x20column\x20=\x20column\x20*\x2026\x20+\x20character.charCodeAt(0)\x20-\x2064;\x0a\x20\x20\x20\x20return\x20column\x20-\x201;\x0a\x20\x20};\x0a\x20\x20const\x20startColumn\x20=\x20columnIndex(match[1]);\x0a\x20\x20const\x20startRow\x20=\x20Number(match[2])\x20-\x201;\x0a\x20\x20const\x20endColumn\x20=\x20columnIndex(match[3]\x20||\x20match[1]);\x0a\x20\x20const\x20endRow\x20=\x20Number(match[4]\x20||\x20match[2])\x20-\x201;\x0a\x20\x20if\x20(!Number.isSafeInteger(startRow)\x20||\x20!Number.isSafeInteger(endRow)\x20||\x20startRow\x20<\x200\x20||\x20endRow\x20<\x20startRow\x20||\x20endColumn\x20<\x20startColumn)\x20return\x20null;\x0a\x20\x20return\x20{\x20startRow,\x20endRow,\x20startColumn,\x20endColumn\x20};\x0a}\x0a\x0afunction\x20normalizeCellData(cellData)\x20{\x0a\x20\x20const\x20cells\x20=\x20[];\x0a\x20\x20for\x20(const\x20[rowKey,\x20columns]\x20of\x20Object.entries(cellData\x20||\x20{}))\x20{\x0a\x20\x20\x20\x20const\x20row\x20=\x20Number(rowKey);\x0a\x20\x20\x20\x20if\x20(!Number.isInteger(row)\x20||\x20!columns\x20||\x20typeof\x20columns\x20!==\x20\x22object\x22)\x20continue;\x0a\x20\x20\x20\x20for\x20(const\x20[columnKey,\x20cell]\x20of\x20Object.entries(columns))\x20{\x0a\x20\x20\x20\x20\x20\x20const\x20column\x20=\x20Number(columnKey);\x0a\x20\x20\x20\x20\x20\x20if\x20(Number.isInteger(column)\x20&&\x20cell\x20&&\x20typeof\x20cell\x20===\x20\x22object\x22)\x20cells.push({\x20row,\x20column,\x20cell\x20});\x0a\x20\x20\x20\x20}\x0a\x20\x20}\x0a\x20\x20cells.sort((left,\x20right)\x20=>\x20left.row\x20-\x20right.row\x20||\x20left.column\x20-\x20right.column);\x0a\x20\x20return\x20cells;\x0a}\x0a\x0a//\x20TODO:\x20profile\x20large\x20sparse\x20worksheets\x20and\x20move\x20this\x20scan\x20behind\x20an\x20incremental\x20index\x20if\x20needed.\x0afunction\x20compactUsedRanges(cells,\x20predicate)\x20{\x0a\x20\x20const\x20horizontal\x20=\x20[];\x0a\x20\x20let\x20active\x20=\x20null;\x0a\x20\x20for\x20(const\x20entry\x20of\x20cells)\x20{\x0a\x20\x20\x20\x20if\x20(!predicate(entry.cell))\x20continue;\x0a\x20\x20\x20\x20if\x20(active\x20&&\x20active.startRow\x20===\x20entry.row\x20&&\x20active.endColumn\x20+\x201\x20===\x20entry.column)\x20{\x0a\x20\x20\x20\x20\x20\x20active.endColumn\x20=\x20entry.column;\x0a\x20\x20\x20\x20}\x20else\x20{\x0a\x20\x20\x20\x20\x20\x20active\x20=\x20{\x20startRow:\x20entry.row,\x20endRow:\x20entry.row,\x20startColumn:\x20entry.column,\x20endColumn:\x20entry.column\x20};\x0a\x20\x20\x20\x20\x20\x20horizontal.push(active);\x0a\x20\x20\x20\x20}\x0a\x20\x20}\x0a\x20\x20const\x20rectangles\x20=\x20[];\x0a\x20\x20const\x20previousRow\x20=\x20new\x20Map();\x0a\x20\x20let\x20currentRow\x20=\x20-1;\x0a\x20\x20let\x20current\x20=\x20new\x20Map();\x0a\x20\x20for\x20(const\x20span\x20of\x20horizontal)\x20{\x0a\x20\x20\x20\x20if\x20(span.startRow\x20!==\x20currentRow)\x20{\x0a\x20\x20\x20\x20\x20\x20previousRow.clear();\x0a\x20\x20\x20\x20\x20\x20for\x20(const\x20[key,\x20value]\x20of\x20current)\x20previousRow.set(key,\x20value);\x0a\x20\x20\x20\x20\x20\x20current\x20=\x20new\x20Map();\x0a\x20\x20\x20\x20\x20\x20currentRow\x20=\x20span.startRow;\x0a\x20\x20\x20\x20}\x0a\x20\x20\x20\x20const\x20key\x20=\x20span.startColumn\x20+\x20\x22:\x22\x20+\x20span.endColumn;\x0a\x20\x20\x20\x20const\x20prior\x20=\x20previousRow.get(key);\x0a\x20\x20\x20\x20if\x20(prior\x20&&\x20prior.endRow\x20+\x201\x20===\x20span.startRow)\x20{\x0a\x20\x20\x20\x20\x20\x20prior.endRow\x20=\x20span.startRow;\x0a\x20\x20\x20\x20\x20\x20current.set(key,\x20prior);\x0a\x20\x20\x20\x20}\x20else\x20{\x0a\x20\x20\x20\x20\x20\x20const\x20rectangle\x20=\x20{\x20...span\x20};\x0a\x20\x20\x20\x20\x20\x20rectangles.push(rectangle);\x0a\x20\x20\x20\x20\x20\x20current.set(key,\x20rectangle);\x0a\x20\x20\x20\x20}\x0a\x20\x20}\x0a\x20\x20return\x20rectangles.map(rangeNotation);\x0a}\x0a\x0afunction\x20hasValue(cell)\x20{\x0a\x20\x20return\x20Object.entries(cell).some(([key,\x20value])\x20=>\x20key\x20!==\x20\x22s\x22\x20&&\x20key\x20!==\x20\x22t\x22\x20&&\x20value\x20!==\x20null\x20&&\x20value\x20!==\x20undefined\x20&&\x20value\x20!==\x20\x22\x22);\x0a}\x0a\x0afunction\x20hasFormula(cell)\x20{\x0a\x20\x20return\x20(typeof\x20cell.f\x20===\x20\x22string\x22\x20&&\x20cell.f.length\x20>\x200)\x20||\x20cell.si\x20!==\x20null\x20&&\x20cell.si\x20!==\x20undefined\x20&&\x20cell.si\x20!==\x20\x22\x22;\x0a}\x0a\x0afunction\x20hasStyle(cell)\x20{\x0a\x20\x20return\x20cell.s\x20!==\x20null\x20&&\x20cell.s\x20!==\x20undefined;\x0a}\x0a\x0afunction\x20uniqueRanges(ranges)\x20{\x0a\x20\x20return\x20[...new\x20Set(ranges.map(rangeNotation))].sort();\x0a}\x0a\x0afunction\x20worksheetIdentity(sheet,\x20index)\x20{\x0a\x20\x20return\x20{\x20id:\x20sheet.getSheetId(),\x20index,\x20name:\x20sheet.getSheetName()\x20};\x0a}\x0a\x0afunction\x20worksheetOverview(sheet,\x20index)\x20{\x0a\x20\x20const\x20identity\x20=\x20worksheetIdentity(sheet,\x20index);\x0a\x20\x20const\x20sheetData\x20=\x20snapshot.sheets\x20&&\x20snapshot.sheets[identity.id]\x20||\x20{};\x0a\x20\x20const\x20cells\x20=\x20normalizeCellData(sheetData.cellData);\x0a\x20\x20const\x20conditionalRules\x20=\x20typeof\x20sheet.getConditionalFormattingRules\x20===\x20\x22function\x22\x20?\x20sheet.getConditionalFormattingRules()\x20:\x20[];\x0a\x20\x20const\x20validationRules\x20=\x20typeof\x20sheet.getDataValidations\x20===\x20\x22function\x22\x20?\x20sheet.getDataValidations()\x20:\x20[];\x0a\x20\x20const\x20tables\x20=\x20typeof\x20sheet.getSubTableInfos\x20===\x20\x22function\x22\x20?\x20sheet.getSubTableInfos()\x20:\x20[];\x0a\x20\x20const\x20images\x20=\x20typeof\x20sheet.getImages\x20===\x20\x22function\x22\x20?\x20sheet.getImages().length\x20:\x200;\x0a\x20\x20const\x20shapes\x20=\x20typeof\x20sheet.getShapes\x20===\x20\x22function\x22\x20?\x20sheet.getShapes().length\x20:\x200;\x0a\x20\x20const\x20charts\x20=\x20sheet.charts\x20&&\x20typeof\x20sheet.charts.list\x20===\x20\x22function\x22\x20?\x20sheet.charts.list().length\x20:\x200;\x0a\x20\x20return\x20{\x0a\x20\x20\x20\x20...identity,\x0a\x20\x20\x20\x20rowCount:\x20sheet.getMaxRows(),\x0a\x20\x20\x20\x20columnCount:\x20sheet.getMaxColumns(),\x0a\x20\x20\x20\x20valueUsedRanges:\x20compactUsedRanges(cells,\x20hasValue),\x0a\x20\x20\x20\x20formulaUsedRanges:\x20compactUsedRanges(cells,\x20hasFormula),\x0a\x20\x20\x20\x20styleUsedRanges:\x20compactUsedRanges(cells,\x20hasStyle),\x0a\x20\x20\x20\x20mergedRanges:\x20sheet.getMergedRanges().map((range)\x20=>\x20range.getA1Notation()),\x0a\x20\x20\x20\x20tables:\x20tables.map((table)\x20=>\x20({\x20id:\x20table.id,\x20name:\x20table.name,\x20range:\x20rangeNotation(table.range)\x20})),\x0a\x20\x20\x20\x20conditionalFormatting:\x20{\x0a\x20\x20\x20\x20\x20\x20count:\x20conditionalRules.length,\x0a\x20\x20\x20\x20\x20\x20ranges:\x20uniqueRanges(conditionalRules.flatMap((rule)\x20=>\x20Array.isArray(rule.ranges)\x20?\x20rule.ranges\x20:\x20[])),\x0a\x20\x20\x20\x20},\x0a\x20\x20\x20\x20dataValidation:\x20{\x0a\x20\x20\x20\x20\x20\x20count:\x20validationRules.length,\x0a\x20\x20\x20\x20\x20\x20ranges:\x20uniqueRanges(validationRules.flatMap((validation)\x20=>\x20Array.isArray(validation.rule\x20&&\x20validation.rule.ranges)\x20?\x20validation.rule.ranges\x20:\x20[])),\x0a\x20\x20\x20\x20},\x0a\x20\x20\x20\x20drawings:\x20{\x20total:\x20charts\x20+\x20images\x20+\x20shapes,\x20charts,\x20images,\x20shapes\x20},\x0a\x20\x20};\x0a}\x0a\x0afunction\x20resolveWorksheet(selector)\x20{\x0a\x20\x20if\x20(!selector\x20||\x20typeof\x20selector\x20!==\x20\x22object\x22)\x20return\x20{\x20error:\x20fail(\x22INSPECTION_SELECTOR_INVALID\x22,\x20\x22Worksheet\x20selector\x20must\x20be\x20an\x20object\x22)\x20};\x0a\x20\x20const\x20keys\x20=\x20[\x22id\x22,\x20\x22index\x22,\x20\x22name\x22].filter((key)\x20=>\x20Object.hasOwn(selector,\x20key));\x0a\x20\x20if\x20(keys.length\x20!==\x201)\x20return\x20{\x20error:\x20fail(\x22INSPECTION_SELECTOR_INVALID\x22,\x20\x22Worksheet\x20selector\x20must\x20contain\x20exactly\x20one\x20of\x20id,\x20index,\x20or\x20name\x22,\x20selector)\x20};\x0a\x20\x20let\x20matches\x20=\x20[];\x0a\x20\x20if\x20(keys[0]\x20===\x20\x22id\x22\x20&&\x20typeof\x20selector.id\x20===\x20\x22string\x22\x20&&\x20selector.id.length\x20>\x200)\x20matches\x20=\x20sheets.filter((sheet)\x20=>\x20sheet.getSheetId()\x20===\x20selector.id);\x0a\x20\x20else\x20if\x20(keys[0]\x20===\x20\x22name\x22\x20&&\x20typeof\x20selector.name\x20===\x20\x22string\x22\x20&&\x20selector.name.length\x20>\x200)\x20matches\x20=\x20sheets.filter((sheet)\x20=>\x20sheet.getSheetName()\x20===\x20selector.name);\x0a\x20\x20else\x20if\x20(keys[0]\x20===\x20\x22index\x22\x20&&\x20Number.isInteger(selector.index)\x20&&\x20selector.index\x20>=\x200)\x20matches\x20=\x20sheets[selector.index]\x20?\x20[sheets[selector.index]]\x20:\x20[];\x0a\x20\x20else\x20return\x20{\x20error:\x20fail(\x22INSPECTION_SELECTOR_INVALID\x22,\x20\x22Worksheet\x20selector\x20value\x20is\x20invalid\x22,\x20selector)\x20};\x0a\x20\x20if\x20(matches.length\x20===\x200)\x20return\x20{\x20error:\x20fail(\x22INSPECTION_SELECTOR_NOT_FOUND\x22,\x20\x22Worksheet\x20selector\x20did\x20not\x20match\x20a\x20worksheet\x22,\x20selector)\x20};\x0a\x20\x20if\x20(matches.length\x20>\x201)\x20return\x20{\x20error:\x20fail(\x22INSPECTION_SELECTOR_AMBIGUOUS\x22,\x20\x22Worksheet\x20selector\x20matched\x20more\x20than\x20one\x20worksheet\x22,\x20selector)\x20};\x0a\x20\x20const\x20sheet\x20=\x20matches[0];\x0a\x20\x20return\x20{\x20sheet,\x20index:\x20sheets.indexOf(sheet)\x20};\x0a}\x0a\x0aif\x20(input.query.kind\x20===\x20\x22workbook\x22)\x20{\x0a\x20\x20return\x20success({\x20kind:\x20\x22workbook\x22,\x20unitId:\x20input.unitId,\x20name:\x20workbook.getName(),\x20worksheets:\x20sheets.map(worksheetOverview)\x20});\x0a}\x0a\x0aif\x20(input.query.kind\x20===\x20\x22worksheet\x22)\x20{\x0a\x20\x20const\x20resolved\x20=\x20[];\x0a\x20\x20for\x20(const\x20selector\x20of\x20input.query.worksheets\x20||\x20[])\x20{\x0a\x20\x20\x20\x20const\x20item\x20=\x20resolveWorksheet(selector);\x0a\x20\x20\x20\x20if\x20(item.error)\x20return\x20item.error;\x0a\x20\x20\x20\x20resolved.push(worksheetOverview(item.sheet,\x20item.index));\x0a\x20\x20}\x0a\x20\x20return\x20success({\x20kind:\x20\x22worksheet\x22,\x20unitId:\x20input.unitId,\x20worksheets:\x20resolved\x20});\x0a}\x0a\x0aif\x20(input.query.kind\x20===\x20\x22worksheet-range\x22)\x20{\x0a\x20\x20const\x20resolved\x20=\x20[];\x0a\x20\x20for\x20(const\x20request\x20of\x20input.query.ranges\x20||\x20[])\x20{\x0a\x20\x20\x20\x20const\x20item\x20=\x20resolveWorksheet(request.worksheet);\x0a\x20\x20\x20\x20if\x20(item.error)\x20return\x20item.error;\x0a\x20\x20\x20\x20if\x20(typeof\x20request.range\x20!==\x20\x22string\x22\x20||\x20request.range.length\x20===\x200)\x20return\x20fail(\x22INSPECTION_SELECTOR_INVALID\x22,\x20\x22Worksheet\x20range\x20must\x20be\x20a\x20non-empty\x20A1\x20notation\x22,\x20request);\x0a\x20\x20\x20\x20const\x20parsed\x20=\x20parseA1Range(request.range);\x0a\x20\x20\x20\x20if\x20(!parsed)\x20{\x0a\x20\x20\x20\x20\x20\x20return\x20fail(\x22INSPECTION_SELECTOR_INVALID\x22,\x20\x22Invalid\x20worksheet\x20A1\x20range:\x20\x22\x20+\x20request.range,\x20request);\x0a\x20\x20\x20\x20}\x0a\x20\x20\x20\x20const\x20maxRow\x20=\x20item.sheet.getMaxRows()\x20-\x201;\x0a\x20\x20\x20\x20const\x20maxColumn\x20=\x20item.sheet.getMaxColumns()\x20-\x201;\x0a\x20\x20\x20\x20if\x20(parsed.endRow\x20<\x200\x20||\x20parsed.endColumn\x20<\x200\x20||\x20parsed.startRow\x20>\x20maxRow\x20||\x20parsed.startColumn\x20>\x20maxColumn)\x20{\x0a\x20\x20\x20\x20\x20\x20return\x20fail(\x22INSPECTION_RANGE_OUT_OF_BOUNDS\x22,\x20\x22Worksheet\x20range\x20is\x20outside\x20the\x20worksheet\x20bounds:\x20\x22\x20+\x20request.range,\x20request);\x0a\x20\x20\x20\x20}\x0a\x20\x20\x20\x20const\x20clippedRange\x20=\x20{\x0a\x20\x20\x20\x20\x20\x20startRow:\x20Math.max(0,\x20parsed.startRow),\x0a\x20\x20\x20\x20\x20\x20endRow:\x20Math.min(maxRow,\x20parsed.endRow),\x0a\x20\x20\x20\x20\x20\x20startColumn:\x20Math.max(0,\x20parsed.startColumn),\x0a\x20\x20\x20\x20\x20\x20endColumn:\x20Math.min(maxColumn,\x20parsed.endColumn),\x0a\x20\x20\x20\x20};\x0a\x20\x20\x20\x20const\x20facadeRange\x20=\x20item.sheet.getRange(clippedRange.startRow,\x20clippedRange.startColumn,\x20clippedRange.endRow\x20-\x20clippedRange.startRow\x20+\x201,\x20clippedRange.endColumn\x20-\x20clippedRange.startColumn\x20+\x201);\x0a\x20\x20\x20\x20const\x20rawCells\x20=\x20facadeRange.getCellDatas();\x0a\x20\x20\x20\x20const\x20displayValues\x20=\x20facadeRange.getDisplayValues();\x0a\x20\x20\x20\x20const\x20cellData\x20=\x20rawCells.map((row)\x20=>\x20row.map((cell)\x20=>\x20cell\x20===\x20undefined\x20?\x20null\x20:\x20cell));\x0a\x20\x20\x20\x20const\x20clipped\x20=\x20clippedRange.startRow\x20!==\x20parsed.startRow\x20||\x20clippedRange.endRow\x20!==\x20parsed.endRow\x20||\x20clippedRange.startColumn\x20!==\x20parsed.startColumn\x20||\x20clippedRange.endColumn\x20!==\x20parsed.endColumn;\x0a\x20\x20\x20\x20resolved.push({\x0a\x20\x20\x20\x20\x20\x20worksheet:\x20worksheetIdentity(item.sheet,\x20item.index),\x0a\x20\x20\x20\x20\x20\x20requestedRange:\x20request.range,\x0a\x20\x20\x20\x20\x20\x20resolvedRange:\x20rangeNotation(clippedRange),\x0a\x20\x20\x20\x20\x20\x20clipped,\x0a\x20\x20\x20\x20\x20\x20cellData,\x0a\x20\x20\x20\x20\x20\x20displayValues,\x0a\x20\x20\x20\x20});\x0a\x20\x20}\x0a\x20\x20return\x20success({\x20kind:\x20\x22worksheet-range\x22,\x20unitId:\x20input.unitId,\x20ranges:\x20resolved\x20});\x0a}\x0a\x0areturn\x20fail(\x22INSPECTION_RESULT_INVALID\x22,\x20\x22Unsupported\x20sheet\x20inspection\x20target\x22);\x0a';}function C(_0x4fe7f0,_0x189727){const _0x391349=_0x3141af;return _0x391349(0x19f)+JSON[_0x391349(0x181)]({'query':_0x189727,'unitId':_0x4fe7f0})+_0x391349(0x15f);}async function w(_0xd2f44,_0x5879e0){const _0x5d0287=_0x3141af;E(_0x5879e0),D(_0xd2f44[_0x5d0287(0x1c8)],_0x5879e0[_0x5d0287(0x174)]);let _0x1bf671=T(_0xd2f44['unitId'],_0x5879e0),_0x22ebe9=t((await _0xd2f44['execute']({'code':_0x1bf671,'mode':_0x5d0287(0x18c)}))[_0x5d0287(0x189)]);return n(_0x22ebe9,_0x5879e0['kind']),_0x22ebe9;}function T(_0x3694eb,_0x510a00){const _0x4f9efb=_0x3141af;switch(_0x510a00[_0x4f9efb(0x174)]){case _0x4f9efb(0x171):case'worksheet':case'worksheet-range':return S(_0x3694eb,_0x510a00);case _0x4f9efb(0x168):case _0x4f9efb(0x1c6):return x(_0x3694eb,_0x510a00);case _0x4f9efb(0x17f):case'slide':return C(_0x3694eb,_0x510a00);case'base':return y(_0x3694eb);case _0x4f9efb(0x1c7):case'board-element':return b(_0x3694eb,_0x510a00);}}function E(_0x18dec5){const _0x4b460c=_0x3141af;let _0x13c2dc=_0x18dec5[_0x4b460c(0x174)]===_0x4b460c(0x178)?_0x18dec5[_0x4b460c(0x17b)]:_0x18dec5[_0x4b460c(0x174)]===_0x4b460c(0x18e)?_0x18dec5[_0x4b460c(0x1bf)]:_0x18dec5[_0x4b460c(0x174)]===_0x4b460c(0x167)?_0x18dec5[_0x4b460c(0x1c4)]:_0x18dec5[_0x4b460c(0x174)]===_0x4b460c(0x1c6)?_0x18dec5[_0x4b460c(0x1c0)]:_0x18dec5[_0x4b460c(0x174)]==='board-element'?_0x18dec5[_0x4b460c(0x186)]:null;if(_0x13c2dc!==null&&_0x13c2dc['length']===0x0)throw new e(_0x4b460c(0x1b6),_0x18dec5['kind']+_0x4b460c(0x15e));}function D(_0x44a068,_0x313fe2){const _0x1d4134=_0x3141af;let _0x2ee8c5=_0x313fe2===_0x1d4134(0x1b4)?_0x1d4134(0x1b4):_0x313fe2===_0x1d4134(0x1c7)||_0x313fe2===_0x1d4134(0x1ae)?_0x1d4134(0x1c7):_0x313fe2===_0x1d4134(0x171)||_0x313fe2===_0x1d4134(0x178)||_0x313fe2===_0x1d4134(0x18e)?_0x1d4134(0x153):_0x313fe2===_0x1d4134(0x17f)||_0x313fe2===_0x1d4134(0x167)?_0x1d4134(0x167):_0x1d4134(0x160);if(_0x44a068!==_0x2ee8c5)throw new e('INSPECTION_UNIT_TYPE_MISMATCH',_0x313fe2+_0x1d4134(0x19a)+_0x2ee8c5+_0x1d4134(0x187)+_0x44a068,{'actual':_0x44a068,'expected':_0x2ee8c5,'kind':_0x313fe2});}export{e as ContentInspectionError,w as inspectContent};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univer-cli/content-inspection",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0
|
|
4
|
+
"version": "1.0.0",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -18,6 +18,6 @@
|
|
|
18
18
|
"README.zh-CN.md"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@univerjs/core": "1.0.0
|
|
21
|
+
"@univerjs/core": "1.0.0"
|
|
22
22
|
}
|
|
23
23
|
}
|