@univer-cli/content-inspection 1.0.0-beta.2 → 1.0.0-rc.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
|
+
function _0x3473(_0x5a8608,_0x1351d6){_0x5a8608=_0x5a8608-0x16b;const _0x273398=_0x2733();let _0x34731b=_0x273398[_0x5a8608];return _0x34731b;}function _0x2733(){const _0x468859=['object','values','doc','173pMaNQC','number','execute','worksheet-range','message','top','routing','start','presentation','group','INSPECTION_SELECTOR_AMBIGUOUS',';\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','unitId','data','elements','slides','subtype','string','length','\x0aconst\x20input\x20=\x20','elementCounts','views','INSPECTION_RANGE_OUT_OF_BOUNDS','9364904bLpNDI','ranges','selectable','connectionPosition','labelStyle','parentId','total','waypoints','transform','freePolyline','segmentIndex','byType','orderIndex','auto',';\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','board','connectionSiteId','config','locked','name','worksheet','straight','routingMode','2742fnKBbX','base','shapeId','chartId','463337knqiMH','placeholder','chart','primaryFieldId','12awlRzv','containerData','startElementId','image','endElementId','error',';\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','originalType','laneId','paragraphs','document','9932754JfWZCC','stringify','code','shape','isFinite','INSPECTION_SELECTOR_INVALID','children','9564845emqUZC','isSafeInteger','height','diagram','shapeData','curve','title','text','media','boolean','Inspection\x20runtime\x20returned\x20an\x20invalid\x20envelope','Inspection\x20runtime\x20returned\x20an\x20invalid\x20','slide','board-element','19864062rAPwlu','connector','INSPECTION_SELECTOR_NOT_FOUND','108699flMnAW','paragraph','isArray','tables','shapeSite','type','segmentT','source','worksheets','reduce','labels','tableId','descriptor','unknown','read','description','value','INSPECTION_RESULT_INVALID',';\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','sheet','isReadonly','free','end','manual','container','textStyle','labelText','workbook','lifeline','offsetY','details','fields','style','every','bounds','Inspection\x20runtime\x20returned\x20an\x20invalid\x20error\x20envelope','index','kind'];_0x2733=function(){return _0x468859;};return _0x2733();}const _0x16f9f6=_0x3473;(function(_0x383039,_0x3fbe69){const _0x27c3ba=_0x3473,_0x400efa=_0x383039();while(!![]){try{const _0x436e2e=parseInt(_0x27c3ba(0x1d2))/0x1*(parseInt(_0x27c3ba(0x17e))/0x2)+parseInt(_0x27c3ba(0x1a9))/0x3*(-parseInt(_0x27c3ba(0x186))/0x4)+-parseInt(_0x27c3ba(0x198))/0x5+parseInt(_0x27c3ba(0x191))/0x6+parseInt(_0x27c3ba(0x182))/0x7+-parseInt(_0x27c3ba(0x1e9))/0x8+parseInt(_0x27c3ba(0x1a6))/0x9;if(_0x436e2e===_0x3fbe69)break;else _0x400efa['push'](_0x400efa['shift']());}catch(_0x46a900){_0x400efa['push'](_0x400efa['shift']());}}}(_0x2733,0xedb66));var e=class extends Error{['code'];[_0x16f9f6(0x1c7)];constructor(_0x587c35,_0x275b61,_0x27b90b){const _0x30633e=_0x16f9f6;super(_0x275b61),this[_0x30633e(0x193)]=_0x587c35,this[_0x30633e(0x1c7)]=_0x27b90b,this[_0x30633e(0x17a)]='ContentInspectionError';}};function t(_0x516902){const _0x2516b6=_0x16f9f6;if(!_(_0x516902)||typeof _0x516902['ok']!=_0x2516b6(0x1a1))throw g(_0x2516b6(0x1a2));if(_0x516902['ok']===!0x0&&_0x2516b6(0x1b9)in _0x516902)return _0x516902[_0x2516b6(0x1b9)];let _0x3b4326=_0x516902[_0x2516b6(0x18b)];if(_0x516902['ok']===!0x1&&_(_0x3b4326)){let _0x3a16ad=_0x3b4326[_0x2516b6(0x193)],_0x31d0fc=_0x3b4326[_0x2516b6(0x1d6)];if(v(_0x3a16ad)&&typeof _0x31d0fc==_0x2516b6(0x1e3))throw new e(_0x3a16ad,_0x31d0fc,_0x3b4326[_0x2516b6(0x1c7)]);}throw g(_0x2516b6(0x1cc));}function n(_0x30e5bd,_0x28d8b3){const _0x3e284f=_0x16f9f6;if(!_(_0x30e5bd)||_0x30e5bd[_0x3e284f(0x1ce)]!==_0x28d8b3||typeof _0x30e5bd[_0x3e284f(0x1de)]!=_0x3e284f(0x1e3)||!(_0x28d8b3===_0x3e284f(0x17f)?p(_0x30e5bd):_0x28d8b3===_0x3e284f(0x1c4)?typeof _0x30e5bd[_0x3e284f(0x17a)]=='string'&&Array['isArray'](_0x30e5bd[_0x3e284f(0x1b1)]):_0x28d8b3===_0x3e284f(0x17b)?Array[_0x3e284f(0x1ab)](_0x30e5bd[_0x3e284f(0x1b1)]):_0x28d8b3===_0x3e284f(0x1d5)?Array[_0x3e284f(0x1ab)](_0x30e5bd['ranges']):_0x28d8b3===_0x3e284f(0x1da)?typeof _0x30e5bd['name']==_0x3e284f(0x1e3)&&Array[_0x3e284f(0x1ab)](_0x30e5bd[_0x3e284f(0x1e1)]):_0x28d8b3===_0x3e284f(0x1a4)?Array[_0x3e284f(0x1ab)](_0x30e5bd[_0x3e284f(0x1e1)]):_0x28d8b3===_0x3e284f(0x190)?typeof _0x30e5bd[_0x3e284f(0x19e)]=='string'&&Array[_0x3e284f(0x1ab)](_0x30e5bd[_0x3e284f(0x18f)]):_0x28d8b3===_0x3e284f(0x1aa)?Array[_0x3e284f(0x1ab)](_0x30e5bd[_0x3e284f(0x18f)]):_0x28d8b3===_0x3e284f(0x176)?r(_0x30e5bd):_0x28d8b3===_0x3e284f(0x1a5)&&i(_0x30e5bd)))throw g(_0x3e284f(0x1a3)+_0x28d8b3+'\x20result');}function r(_0x23b530){const _0x32786e=_0x16f9f6;let _0x25758d=_0x23b530[_0x32786e(0x1e6)];return typeof _0x23b530[_0x32786e(0x17a)]==_0x32786e(0x1e3)&&'themeData'in _0x23b530&&_(_0x25758d)&&m(_0x25758d[_0x32786e(0x16d)])&&_(_0x25758d['byType'])&&Object[_0x32786e(0x1d0)](_0x25758d[_0x32786e(0x172)])[_0x32786e(0x1ca)](m)&&Array[_0x32786e(0x1ab)](_0x23b530[_0x32786e(0x1e0)])&&_0x25758d[_0x32786e(0x16d)]===_0x23b530[_0x32786e(0x1e0)]['length']&&Object['values'](_0x25758d['byType'])[_0x32786e(0x1b2)]((_0x2e825d,_0x254408)=>_0x2e825d+Number(_0x254408),0x0)===_0x25758d[_0x32786e(0x16d)]&&_0x23b530[_0x32786e(0x1e0)][_0x32786e(0x1ca)](a);}function i(_0x4dcc07){const _0x3cc5a7=_0x16f9f6;return Array[_0x3cc5a7(0x1ab)](_0x4dcc07[_0x3cc5a7(0x1e0)])&&_0x4dcc07['elements']['every'](o);}function a(_0x4152ef){const _0xbc4407=_0x16f9f6;return _(_0x4152ef)&&typeof _0x4152ef['id']==_0xbc4407(0x1e3)&&m(_0x4152ef[_0xbc4407(0x173)])&&typeof _0x4152ef[_0xbc4407(0x1ae)]=='string'&&typeof _0x4152ef['visible']==_0xbc4407(0x1a1)&&typeof _0x4152ef[_0xbc4407(0x1eb)]==_0xbc4407(0x1a1)&&typeof _0x4152ef[_0xbc4407(0x179)]==_0xbc4407(0x1a1)&&_(_0x4152ef[_0xbc4407(0x16f)])&&f(_0x4152ef[_0xbc4407(0x17a)])&&f(_0x4152ef[_0xbc4407(0x1b8)])&&f(_0x4152ef[_0xbc4407(0x16c)])&&f(_0x4152ef[_0xbc4407(0x18e)])&&(_0x4152ef[_0xbc4407(0x1cb)]===null||l(_0x4152ef[_0xbc4407(0x1cb)]));}function o(_0x1bdfd2){const _0x124b7b=_0x16f9f6;return!a(_0x1bdfd2)||_0x124b7b(0x1b5)in _0x1bdfd2||_0x124b7b(0x1c7)in _0x1bdfd2||'connectorData'in _0x1bdfd2?!0x1:_0x1bdfd2[_0x124b7b(0x1ae)]===_0x124b7b(0x194)?_0x124b7b(0x19c)in _0x1bdfd2:_0x1bdfd2['type']===_0x124b7b(0x1a7)?!(_0x124b7b(0x188)in _0x1bdfd2)&&!(_0x124b7b(0x18a)in _0x1bdfd2)&&!(_0x124b7b(0x1e2)in _0x1bdfd2)&&!('text'in _0x1bdfd2)&&s(_0x1bdfd2['connection'])&&_0x124b7b(0x1c9)in _0x1bdfd2&&Array['isArray'](_0x1bdfd2[_0x124b7b(0x1b3)])&&_0x1bdfd2[_0x124b7b(0x1b3)][_0x124b7b(0x1ca)](_0xcabdc4=>_(_0xcabdc4)&&typeof _0xcabdc4['id']==_0x124b7b(0x1e3))&&_0x124b7b(0x1c3)in _0x1bdfd2&&_0x124b7b(0x16b)in _0x1bdfd2:_0x1bdfd2[_0x124b7b(0x1ae)]===_0x124b7b(0x19f)?'textContent'in _0x1bdfd2&&_0x124b7b(0x1c2)in _0x1bdfd2:_0x1bdfd2[_0x124b7b(0x1ae)]===_0x124b7b(0x189)||_0x1bdfd2[_0x124b7b(0x1ae)]===_0x124b7b(0x1a0)?typeof _0x1bdfd2[_0x124b7b(0x1b0)]==_0x124b7b(0x1e3):_0x1bdfd2[_0x124b7b(0x1ae)]===_0x124b7b(0x184)?typeof _0x1bdfd2[_0x124b7b(0x181)]==_0x124b7b(0x1e3):_0x1bdfd2[_0x124b7b(0x1ae)]===_0x124b7b(0x1c1)?_0x124b7b(0x187)in _0x1bdfd2:_0x1bdfd2[_0x124b7b(0x1ae)]===_0x124b7b(0x19b)?_0x124b7b(0x1df)in _0x1bdfd2:_0x1bdfd2[_0x124b7b(0x1ae)]==='table'?typeof _0x1bdfd2[_0x124b7b(0x1b4)]=='string':_0x1bdfd2[_0x124b7b(0x1ae)]===_0x124b7b(0x1db)?Array['isArray'](_0x1bdfd2[_0x124b7b(0x197)])&&_0x1bdfd2[_0x124b7b(0x197)][_0x124b7b(0x1ca)](_0x319db0=>typeof _0x319db0=='string'):_0x1bdfd2['type']==='placeholder'?_0x124b7b(0x183)in _0x1bdfd2:_0x1bdfd2[_0x124b7b(0x1ae)]===_0x124b7b(0x1b6)&&typeof _0x1bdfd2[_0x124b7b(0x18d)]==_0x124b7b(0x1e3)&&_0x124b7b(0x1df)in _0x1bdfd2;}function s(_0x3b874e){const _0x3e7f2e=_0x16f9f6;return _(_0x3b874e)&&c(_0x3b874e[_0x3e7f2e(0x1d9)])&&c(_0x3b874e[_0x3e7f2e(0x1bf)])&&(_0x3b874e[_0x3e7f2e(0x1d8)]===_0x3e7f2e(0x17c)||_0x3b874e[_0x3e7f2e(0x1d8)]==='orthogonal'||_0x3b874e[_0x3e7f2e(0x1d8)]===_0x3e7f2e(0x19d)||_0x3b874e[_0x3e7f2e(0x1d8)]===_0x3e7f2e(0x170))&&(_0x3b874e[_0x3e7f2e(0x17d)]==='auto'||_0x3b874e[_0x3e7f2e(0x17d)]===_0x3e7f2e(0x1c0)||_0x3b874e[_0x3e7f2e(0x17d)]==='mixed')&&Array[_0x3e7f2e(0x1ab)](_0x3b874e[_0x3e7f2e(0x16e)])&&_0x3b874e[_0x3e7f2e(0x16e)]['every'](_0x27e7bf=>_(_0x27e7bf)&&typeof _0x27e7bf['id']==_0x3e7f2e(0x1e3)&&(_0x27e7bf[_0x3e7f2e(0x1ce)]===_0x3e7f2e(0x174)||_0x27e7bf[_0x3e7f2e(0x1ce)]===_0x3e7f2e(0x1c0))&&u(_0x27e7bf));}function c(_0x618314){const _0x1ac25a=_0x16f9f6;return!_(_0x618314)||typeof _0x618314[_0x1ac25a(0x1ce)]!=_0x1ac25a(0x1e3)?!0x1:_0x618314['kind']===_0x1ac25a(0x1be)?u(_0x618314):_0x618314[_0x1ac25a(0x1ce)]===_0x1ac25a(0x1c5)?typeof _0x618314[_0x1ac25a(0x180)]==_0x1ac25a(0x1e3)&&typeof _0x618314[_0x1ac25a(0x1c6)]==_0x1ac25a(0x1d3):_0x618314[_0x1ac25a(0x1ce)]===_0x1ac25a(0x1ad)?typeof _0x618314[_0x1ac25a(0x180)]==_0x1ac25a(0x1e3)&&typeof _0x618314[_0x1ac25a(0x177)]==_0x1ac25a(0x1d3)&&d(_0x618314[_0x1ac25a(0x1ec)]):_0x618314[_0x1ac25a(0x1ce)]==='shapeBoundary'&&typeof _0x618314[_0x1ac25a(0x180)]=='string'&&typeof _0x618314['outlineIndex']==_0x1ac25a(0x1d3)&&typeof _0x618314[_0x1ac25a(0x171)]==_0x1ac25a(0x1d3)&&typeof _0x618314[_0x1ac25a(0x1af)]==_0x1ac25a(0x1d3);}function l(_0x58d7dd){const _0x4e30d5=_0x16f9f6;return _(_0x58d7dd)&&typeof _0x58d7dd['left']=='number'&&typeof _0x58d7dd[_0x4e30d5(0x1d7)]=='number'&&typeof _0x58d7dd['width']==_0x4e30d5(0x1d3)&&typeof _0x58d7dd[_0x4e30d5(0x19a)]==_0x4e30d5(0x1d3);}function u(_0x112d17){const _0x5bd4ed=_0x16f9f6;return _(_0x112d17)&&typeof _0x112d17['x']==_0x5bd4ed(0x1d3)&&typeof _0x112d17['y']==_0x5bd4ed(0x1d3);}function d(_0x1e53ce){const _0x359ce1=_0x16f9f6;return _0x1e53ce===void 0x0||typeof _0x1e53ce==_0x359ce1(0x1d3);}function f(_0x50f8f4){return _0x50f8f4===void 0x0||typeof _0x50f8f4=='string';}function p(_0x5f3dde){const _0x564fcf=_0x16f9f6;return typeof _0x5f3dde[_0x564fcf(0x17a)]==_0x564fcf(0x1e3)&&Array[_0x564fcf(0x1ab)](_0x5f3dde[_0x564fcf(0x1ac)])&&_0x5f3dde[_0x564fcf(0x1ac)][_0x564fcf(0x1ca)]((_0x210bc9,_0x4851f2)=>_(_0x210bc9)&&m(_0x210bc9[_0x564fcf(0x1cd)])&&_0x210bc9['index']===_0x4851f2&&typeof _0x210bc9['id']=='string'&&typeof _0x210bc9[_0x564fcf(0x17a)]==_0x564fcf(0x1e3)&&typeof _0x210bc9['formulaName']==_0x564fcf(0x1e3)&&typeof _0x210bc9[_0x564fcf(0x185)]==_0x564fcf(0x1e3)&&m(_0x210bc9['recordCount'])&&Array[_0x564fcf(0x1ab)](_0x210bc9[_0x564fcf(0x1c8)])&&_0x210bc9[_0x564fcf(0x1c8)][_0x564fcf(0x1ca)]((_0x228cd0,_0x1301fb)=>_(_0x228cd0)&&m(_0x228cd0['index'])&&_0x228cd0[_0x564fcf(0x1cd)]===_0x1301fb&&typeof _0x228cd0['id']=='string'&&typeof _0x228cd0['name']=='string'&&typeof _0x228cd0[_0x564fcf(0x1ae)]==_0x564fcf(0x1e3)&&typeof _0x228cd0[_0x564fcf(0x1bd)]==_0x564fcf(0x1a1)&&_0x564fcf(0x178)in _0x228cd0&&h(_0x228cd0['config']))&&Array[_0x564fcf(0x1ab)](_0x210bc9['views'])&&_0x210bc9[_0x564fcf(0x1e7)][_0x564fcf(0x1ca)]((_0x3084ed,_0x4314ee)=>_(_0x3084ed)&&m(_0x3084ed[_0x564fcf(0x1cd)])&&_0x3084ed[_0x564fcf(0x1cd)]===_0x4314ee&&typeof _0x3084ed['id']==_0x564fcf(0x1e3)&&typeof _0x3084ed[_0x564fcf(0x17a)]==_0x564fcf(0x1e3)&&typeof _0x3084ed[_0x564fcf(0x1ae)]==_0x564fcf(0x1e3)));}function m(_0x4a7a31){const _0x47c72b=_0x16f9f6;return typeof _0x4a7a31=='number'&&Number[_0x47c72b(0x199)](_0x4a7a31)&&_0x4a7a31>=0x0;}function h(_0x12b8f6){const _0x434d31=_0x16f9f6;return _0x12b8f6===null||typeof _0x12b8f6==_0x434d31(0x1a1)||typeof _0x12b8f6=='string'||typeof _0x12b8f6=='number'&&Number[_0x434d31(0x195)](_0x12b8f6)?!0x0:Array[_0x434d31(0x1ab)](_0x12b8f6)?_0x12b8f6['every'](h):_(_0x12b8f6)&&Object[_0x434d31(0x1d0)](_0x12b8f6)[_0x434d31(0x1ca)](h);}function g(_0x1c2bf9){const _0x1d5e04=_0x16f9f6;return new e(_0x1d5e04(0x1ba),_0x1c2bf9);}function _(_0x3e22f5){const _0x1d5afa=_0x16f9f6;return typeof _0x3e22f5==_0x1d5afa(0x1cf)&&!!_0x3e22f5&&!Array[_0x1d5afa(0x1ab)](_0x3e22f5);}function v(_0x30cef3){const _0x5b133f=_0x16f9f6;return _0x30cef3===_0x5b133f(0x1e8)||_0x30cef3===_0x5b133f(0x1ba)||_0x30cef3===_0x5b133f(0x1dc)||_0x30cef3==='INSPECTION_SELECTOR_INVALID'||_0x30cef3===_0x5b133f(0x1a8)||_0x30cef3==='INSPECTION_UNIT_TYPE_MISMATCH';}function y(_0x2e0c3f){const _0xfd06f7=_0x16f9f6;return'\x0aconst\x20input\x20=\x20'+JSON[_0xfd06f7(0x192)]({'unitId':_0x2e0c3f})+_0xfd06f7(0x1bb);}function b(_0x328c4e,_0x5c642c){const _0x5dfced=_0x16f9f6;return'\x0aconst\x20input\x20=\x20'+JSON[_0x5dfced(0x192)]({'query':_0x5c642c,'unitId':_0x328c4e})+';\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(_0x1175ae,_0x5d695e){const _0x3f4194=_0x16f9f6;return'\x0aconst\x20input\x20=\x20'+JSON[_0x3f4194(0x192)]({'query':_0x5d695e,'unitId':_0x1175ae})+_0x3f4194(0x1dd);}function S(_0x26b5e3,_0x3e443d){const _0x5d7566=_0x16f9f6;return'\x0aconst\x20input\x20=\x20'+JSON[_0x5d7566(0x192)]({'query':_0x3e443d,'unitId':_0x26b5e3})+_0x5d7566(0x175);}function C(_0x4e7f5e,_0x26b05d){const _0x2fbc74=_0x16f9f6;return _0x2fbc74(0x1e5)+JSON[_0x2fbc74(0x192)]({'query':_0x26b05d,'unitId':_0x4e7f5e})+_0x2fbc74(0x18c);}async function w(_0x1c7a1b,_0x52445b){const _0x5da196=_0x16f9f6;E(_0x52445b),D(_0x1c7a1b['unitType'],_0x52445b[_0x5da196(0x1ce)]);let _0x17e937=T(_0x1c7a1b[_0x5da196(0x1de)],_0x52445b),_0x576ad4=t((await _0x1c7a1b[_0x5da196(0x1d4)]({'code':_0x17e937,'mode':_0x5da196(0x1b7)}))[_0x5da196(0x1b9)]);return n(_0x576ad4,_0x52445b[_0x5da196(0x1ce)]),_0x576ad4;}function T(_0x3ece7e,_0x51a5e2){const _0x5010aa=_0x16f9f6;switch(_0x51a5e2[_0x5010aa(0x1ce)]){case _0x5010aa(0x1c4):case _0x5010aa(0x17b):case _0x5010aa(0x1d5):return S(_0x3ece7e,_0x51a5e2);case _0x5010aa(0x190):case _0x5010aa(0x1aa):return x(_0x3ece7e,_0x51a5e2);case _0x5010aa(0x1da):case _0x5010aa(0x1a4):return C(_0x3ece7e,_0x51a5e2);case'base':return y(_0x3ece7e);case _0x5010aa(0x176):case'board-element':return b(_0x3ece7e,_0x51a5e2);}}function E(_0x4f60dc){const _0x5134e8=_0x16f9f6;let _0x2faecf=_0x4f60dc[_0x5134e8(0x1ce)]==='worksheet'?_0x4f60dc[_0x5134e8(0x1b1)]:_0x4f60dc[_0x5134e8(0x1ce)]===_0x5134e8(0x1d5)?_0x4f60dc[_0x5134e8(0x1ea)]:_0x4f60dc[_0x5134e8(0x1ce)]===_0x5134e8(0x1a4)?_0x4f60dc[_0x5134e8(0x1e1)]:_0x4f60dc[_0x5134e8(0x1ce)]===_0x5134e8(0x1aa)?_0x4f60dc[_0x5134e8(0x18f)]:_0x4f60dc[_0x5134e8(0x1ce)]===_0x5134e8(0x1a5)?_0x4f60dc[_0x5134e8(0x1e0)]:null;if(_0x2faecf!==null&&_0x2faecf[_0x5134e8(0x1e4)]===0x0)throw new e(_0x5134e8(0x196),_0x4f60dc[_0x5134e8(0x1ce)]+'\x20inspection\x20requires\x20at\x20least\x20one\x20selector');}function D(_0x47016d,_0xd2c1ac){const _0x3b37f9=_0x16f9f6;let _0x4236bb=_0xd2c1ac==='base'?'base':_0xd2c1ac===_0x3b37f9(0x176)||_0xd2c1ac===_0x3b37f9(0x1a5)?_0x3b37f9(0x176):_0xd2c1ac===_0x3b37f9(0x1c4)||_0xd2c1ac===_0x3b37f9(0x17b)||_0xd2c1ac===_0x3b37f9(0x1d5)?_0x3b37f9(0x1bc):_0xd2c1ac===_0x3b37f9(0x1da)||_0xd2c1ac==='slide'?_0x3b37f9(0x1a4):_0x3b37f9(0x1d1);if(_0x47016d!==_0x4236bb)throw new e('INSPECTION_UNIT_TYPE_MISMATCH',_0xd2c1ac+'\x20inspection\x20requires\x20a\x20'+_0x4236bb+'\x20runtime,\x20received\x20'+_0x47016d,{'actual':_0x47016d,'expected':_0x4236bb,'kind':_0xd2c1ac});}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-rc.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-rc.0"
|
|
22
22
|
}
|
|
23
23
|
}
|