@replohq/canopy-sdk 3.0.6 → 3.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/_vendor/replo-utils/lib/crypto.d.ts +8 -0
  2. package/_vendor/replo-utils/lib/fonts.mjs +2 -3
  3. package/_vendor/replo-utils/lib/geometry.mjs +0 -2
  4. package/_vendor/replo-utils/lib/json.d.ts +0 -4
  5. package/_vendor/replo-utils/lib/json.mjs +1 -4
  6. package/_vendor/replo-utils/lib/misc.mjs +2 -4
  7. package/_vendor/replo-utils/lib/posthogReplay.mjs +0 -2
  8. package/_vendor/replo-utils/lib/string.d.ts +0 -12
  9. package/_vendor/replo-utils/lib/url.d.ts +10 -3
  10. package/_vendor/replo-utils/lib/url.mjs +3 -4
  11. package/_vendor/replo-utils/react/use-iframe-rpc-channel.mjs +0 -1
  12. package/_vendor/schemas/agentBillingFeatureType.d.ts +1 -0
  13. package/_vendor/schemas/comments.d.ts +932 -0
  14. package/_vendor/schemas/designLibrary.d.ts +1 -1
  15. package/_vendor/schemas/designLibrary.mjs +72 -73
  16. package/_vendor/schemas/errors.d.ts +36 -45
  17. package/_vendor/schemas/generated/comments.d.ts +244 -0
  18. package/_vendor/schemas/generated/consent.d.ts +43 -2
  19. package/_vendor/schemas/generated/errors.d.ts +1 -0
  20. package/_vendor/schemas/generated/selectMode.d.ts +3 -1
  21. package/_vendor/schemas/generated/selectModeIframeRpc.d.ts +43 -0
  22. package/_vendor/schemas/iframeRpcChannel.d.ts +13 -1
  23. package/_vendor/schemas/iframeRpcChannel.mjs +167 -8
  24. package/_vendor/schemas/loaderKeys.mjs +0 -2
  25. package/_vendor/schemas/{money.d.ts → moneyFormat.d.ts} +11 -9
  26. package/_vendor/schemas/moneyFormat.mjs +119 -0
  27. package/_vendor/schemas/pageAnnotations.d.ts +1 -1
  28. package/_vendor/schemas/pageAnnotations.mjs +1 -2
  29. package/_vendor/schemas/reploError.d.ts +43 -0
  30. package/_vendor/schemas/routing/match.mjs +0 -1
  31. package/_vendor/schemas/routing/rules.d.ts +2 -2
  32. package/_vendor/schemas/routing/rules.mjs +5 -8
  33. package/_vendor/schemas/savedStyles.d.ts +1 -1
  34. package/_vendor/schemas/selectMode.d.ts +117 -4
  35. package/_vendor/schemas/selectMode.mjs +4 -6
  36. package/_vendor/schemas/selectModeIframeRpc.d.ts +373 -1
  37. package/_vendor/schemas/selectModeIframeRpc.mjs +77 -9
  38. package/chunk-B7XDEXPL.mjs +19 -0
  39. package/chunk-CJIK4NVP.mjs +547 -0
  40. package/chunk-DINTPZM2.mjs +71 -0
  41. package/{chunk-AKZNN7F2.mjs → chunk-IQCJXNJU.mjs} +1 -1
  42. package/{chunk-EXI4VDHP.mjs → chunk-PQEA6P4V.mjs} +20 -3
  43. package/{chunk-DINXH6YP.mjs → chunk-YGLYUC6R.mjs} +18 -7
  44. package/money.d.ts +1 -1
  45. package/package.json +2 -2
  46. package/_vendor/replo-utils/lib/object.d.ts +0 -31
  47. package/_vendor/schemas/money.mjs +0 -1937
  48. package/chunk-HGXQNZW7.mjs +0 -38
  49. package/chunk-ILGEM42C.mjs +0 -21
  50. package/chunk-RLFL66ST.mjs +0 -242
  51. package/chunk-UJCSKKID.mjs +0 -23
  52. package/chunk-VUXOGD76.mjs +0 -206
  53. /package/{chunk-FNTGY7I5.mjs → chunk-JELVREEB.mjs} +0 -0
@@ -1,10 +1,8 @@
1
- import { selectModeBoundingRectSchema, selectModeTiptapActiveMarksSchema, selectModeSelectionRectSchema, selectableDataSchema, selectModeHoverRectSchema, selectModeFormatCommandSchema, selectModeOptimisticUpdatePayloadSchema, selectModeSelectionTypeSchema, displayModeSchema, selectModeClickPositionSchema, selectedElementSchema } from '../../chunk-RLFL66ST.mjs';
2
- import '../../chunk-HGXQNZW7.mjs';
3
- import '../../chunk-EXI4VDHP.mjs';
4
- import '../../chunk-ILGEM42C.mjs';
5
- import '../../chunk-FNTGY7I5.mjs';
6
- import '../../chunk-UJCSKKID.mjs';
7
- import { z } from 'zod';
1
+ import { selectModeBoundingRectSchema, selectModeTiptapActiveMarksSchema, selectModeSelectionRectSchema, selectableDataSchema, selectModeHoverRectSchema, selectModeFormatCommandSchema, selectModeOptimisticUpdatePayloadSchema, selectModeSelectionTypeSchema, displayModeSchema, selectModeClickPositionSchema, selectedElementSchema } from '../../chunk-CJIK4NVP.mjs';
2
+ import '../../chunk-PQEA6P4V.mjs';
3
+ import '../../chunk-B7XDEXPL.mjs';
4
+ import '../../chunk-JELVREEB.mjs';
5
+ import * as z from 'zod';
8
6
 
9
7
  var SELECT_MODE_IFRAME_RPC_CHANNEL_ID = "replo:select-mode-iframe-rpc";
10
8
  var SELECT_MODE_IFRAME_RPC_CHANNEL_VERSION = 1;
@@ -17,8 +15,57 @@ var iframeRuntimeBuildMetadataSchema = z.object({
17
15
  version: z.string(),
18
16
  branch: z.string().nullable(),
19
17
  commit: z.string().nullable(),
20
- builtAt: z.string().nullable()
18
+ builtAt: z.string().nullable(),
19
+ capabilities: z.array(z.string()).optional()
21
20
  }).describe("IframeRuntimeBuildMetadata");
21
+ var SECTION_CANVAS_CAPABILITY = "sectionCanvas";
22
+ var sectionCanvasSectionSchema = z.object({
23
+ index: z.number().int().nonnegative(),
24
+ startLine: z.number().int().positive(),
25
+ endLine: z.number().int().positive(),
26
+ label: z.string(),
27
+ isLocked: z.boolean()
28
+ }).describe("SectionCanvasSection");
29
+ function isSectionCanvasPageFile({
30
+ filePath,
31
+ pageFilePath
32
+ }) {
33
+ const normalized = filePath.replace(/^file:\/\//u, "").replace(/^\.\//u, "");
34
+ return normalized === pageFilePath || normalized.endsWith(`/${pageFilePath}`) || pageFilePath.endsWith(`/${normalized}`);
35
+ }
36
+ var sectionCanvasStateSchema = z.object({
37
+ pageFilePath: z.string(),
38
+ sections: z.array(sectionCanvasSectionSchema),
39
+ previewScale: z.number().positive(),
40
+ isDisabled: z.boolean(),
41
+ insertingAt: z.number().int().nonnegative().nullish(),
42
+ occludedInsets: z.object({
43
+ left: z.number().nonnegative(),
44
+ right: z.number().nonnegative()
45
+ }).nullish()
46
+ }).describe("SectionCanvasState");
47
+ var sectionCanvasRequestSchema = z.discriminatedUnion("type", [
48
+ z.object({ type: z.literal("insert"), at: z.number().int().nonnegative() }),
49
+ z.object({
50
+ type: z.literal("move"),
51
+ moveId: z.string(),
52
+ index: z.number().int().nonnegative(),
53
+ to: z.number().int().nonnegative()
54
+ }),
55
+ z.object({
56
+ type: z.literal("remove"),
57
+ index: z.number().int().nonnegative()
58
+ }),
59
+ z.object({ type: z.literal("undo") }),
60
+ z.object({ type: z.literal("redo") }),
61
+ z.object({ type: z.literal("cancelInsert") })
62
+ ]).describe("SectionCanvasRequest");
63
+ var sectionCanvasLayoutEntrySchema = z.object({
64
+ index: z.number().int().nonnegative(),
65
+ startLine: z.number().int().positive(),
66
+ endLine: z.number().int().positive(),
67
+ rect: selectModeBoundingRectSchema
68
+ }).describe("SectionCanvasLayoutEntry");
22
69
  var selectModeEventInputSchemas = {
23
70
  hover: z.object({
24
71
  rect: selectModeHoverRectSchema.nullable()
@@ -38,6 +85,17 @@ var selectModeEventInputSchemas = {
38
85
  })
39
86
  };
40
87
  var websiteBuilderToPreviewIframeMethodConfig = {
88
+ setSectionCanvas: {
89
+ inputSchema: z.object({ canvas: sectionCanvasStateSchema.nullable() }),
90
+ outputSchema: z.void()
91
+ },
92
+ settleSectionMove: {
93
+ inputSchema: z.object({
94
+ moveId: z.string(),
95
+ outcome: z.enum(["persisted", "failed"])
96
+ }),
97
+ outputSchema: z.void()
98
+ },
41
99
  expandToSection: {
42
100
  inputSchema: z.object({ targetSelector: z.string() }),
43
101
  outputSchema: z.void()
@@ -111,6 +169,16 @@ var websiteBuilderToPreviewIframeMethodConfig = {
111
169
  }
112
170
  };
113
171
  var previewIframeToWebsiteBuilderMethodConfig = {
172
+ sectionCanvasRequest: {
173
+ inputSchema: z.object({ request: sectionCanvasRequestSchema }),
174
+ outputSchema: z.void()
175
+ },
176
+ sectionCanvasLayoutChanged: {
177
+ inputSchema: z.object({
178
+ sections: z.array(sectionCanvasLayoutEntrySchema)
179
+ }),
180
+ outputSchema: z.void()
181
+ },
114
182
  requestInlineTextEdit: {
115
183
  inputSchema: z.object({
116
184
  editId: z.string(),
@@ -266,4 +334,4 @@ var selectModeIframeMessageSchema = z.discriminatedUnion("method", [
266
334
  })
267
335
  ]).describe("SelectModeIframeMessage");
268
336
 
269
- export { SELECT_MODE_IFRAME_RPC_CHANNEL_ID, SELECT_MODE_IFRAME_RPC_CHANNEL_VERSION, iframeRuntimeBuildMetadataSchema, inlineEditFeedbackSchema, previewIframeToWebsiteBuilderMethodConfig, selectModeEventInputSchemas, selectModeIframeMessageSchema, selectModeParentMessageSchema, websiteBuilderToPreviewIframeMethodConfig };
337
+ export { SECTION_CANVAS_CAPABILITY, SELECT_MODE_IFRAME_RPC_CHANNEL_ID, SELECT_MODE_IFRAME_RPC_CHANNEL_VERSION, iframeRuntimeBuildMetadataSchema, inlineEditFeedbackSchema, isSectionCanvasPageFile, previewIframeToWebsiteBuilderMethodConfig, sectionCanvasLayoutEntrySchema, sectionCanvasRequestSchema, sectionCanvasSectionSchema, sectionCanvasStateSchema, selectModeEventInputSchemas, selectModeIframeMessageSchema, selectModeParentMessageSchema, websiteBuilderToPreviewIframeMethodConfig };
@@ -0,0 +1,19 @@
1
+ function parseJsonOrNull(json) {
2
+ try {
3
+ return JSON.parse(json);
4
+ } catch {
5
+ return null;
6
+ }
7
+ }
8
+ function jsonStringifyOrNull(value) {
9
+ if (value === null || value === void 0) {
10
+ return null;
11
+ }
12
+ try {
13
+ return JSON.stringify(value);
14
+ } catch {
15
+ return null;
16
+ }
17
+ }
18
+
19
+ export { jsonStringifyOrNull, parseJsonOrNull };
@@ -0,0 +1,547 @@
1
+ import { exhaustiveSwitch } from './chunk-PQEA6P4V.mjs';
2
+ import { parseJsonOrNull } from './chunk-B7XDEXPL.mjs';
3
+ import * as z from 'zod';
4
+
5
+ function parseSchemaOrNull(value, schema) {
6
+ const parseResult = schema.safeParse(value);
7
+ return parseResult.success ? parseResult.data : null;
8
+ }
9
+ z.string().min(1).refine((body) => body.trim().length > 0, {
10
+ message: "Write something before posting."
11
+ });
12
+ var commentSourceSchema = z.enum(["ui", "agent", "mcp", "api"]).describe("CommentSource");
13
+ var unitIntervalSchema = z.number().min(0).max(1);
14
+ var anchorUrlSchema = z.string().max(2048);
15
+ var anchorLocaleSchema = z.string().max(35);
16
+ var anchorSelectorSchema = z.string().max(4e3);
17
+ var anchorIdSchema = z.string().max(256);
18
+ var commentAnchorContextSchema = z.object({
19
+ url: anchorUrlSchema,
20
+ locale: anchorLocaleSchema.nullish()
21
+ }).describe("CommentAnchorContext");
22
+ var commentAnchorNoneSchema = z.object({
23
+ type: z.literal("none"),
24
+ context: commentAnchorContextSchema.optional()
25
+ }).describe("CommentAnchorNone");
26
+ var commentAnchorElementSchema = z.object({
27
+ type: z.literal("element"),
28
+ semanticSelector: anchorSelectorSchema.optional(),
29
+ selector: anchorSelectorSchema,
30
+ nthOfTypePath: anchorSelectorSchema,
31
+ source: z.object({
32
+ filePath: z.string().max(1024),
33
+ componentChain: z.array(anchorIdSchema).max(50),
34
+ line: z.number().int().optional(),
35
+ col: z.number().int().optional()
36
+ }).optional(),
37
+ listKey: anchorIdSchema.optional(),
38
+ tagName: z.string().max(64),
39
+ textPreview: z.string().max(200),
40
+ quote: z.object({
41
+ exact: z.string().max(2e3),
42
+ prefix: z.string().max(80),
43
+ suffix: z.string().max(80)
44
+ }).optional(),
45
+ offset: z.object({ x: unitIntervalSchema, y: unitIntervalSchema }),
46
+ context: commentAnchorContextSchema.optional()
47
+ }).describe("CommentAnchorElement");
48
+ var commentAnchorCanvasSchema = z.object({
49
+ type: z.literal("canvas"),
50
+ nodeId: anchorIdSchema,
51
+ layerId: anchorIdSchema.optional(),
52
+ point: z.object({ x: z.number(), y: z.number() }),
53
+ world: z.object({ x: z.number(), y: z.number() }).optional().describe("Set only for free-floating pins that sit on no node.")
54
+ }).describe("CommentAnchorCanvas");
55
+ var commentAnchorPointSchema = z.object({
56
+ type: z.literal("point"),
57
+ page: z.number().int().min(0).optional(),
58
+ x: unitIntervalSchema,
59
+ y: unitIntervalSchema
60
+ }).describe("CommentAnchorPoint");
61
+ var commentAnchorSchema = z.discriminatedUnion("type", [
62
+ commentAnchorNoneSchema,
63
+ commentAnchorElementSchema,
64
+ commentAnchorCanvasSchema,
65
+ commentAnchorPointSchema
66
+ ]).describe("CommentAnchor");
67
+ var commentTargetSchema = z.discriminatedUnion("kind", [
68
+ z.object({
69
+ kind: z.literal("file"),
70
+ fileId: z.uuid(),
71
+ folderId: z.uuid().optional().describe(
72
+ "The artifact folder the comment was left from; the file must be one of its pages."
73
+ )
74
+ }),
75
+ z.object({
76
+ kind: z.literal("sitePage"),
77
+ siteId: z.uuid(),
78
+ url: anchorUrlSchema,
79
+ locale: anchorLocaleSchema.nullish(),
80
+ routePatternHint: anchorUrlSchema.optional(),
81
+ via: z.object({ fileId: z.uuid(), shareId: z.uuid() }).optional().describe(
82
+ "Set when the site preview is embedded in an artifact or canvas."
83
+ )
84
+ }),
85
+ z.object({ kind: z.literal("order"), orderId: z.uuid() }),
86
+ z.object({ kind: z.literal("asset"), assetId: z.uuid() }),
87
+ z.object({
88
+ kind: z.literal("experiment"),
89
+ experimentId: z.uuid().describe("The A/B test the notes belong to.")
90
+ })
91
+ ]).describe("CommentTarget");
92
+ z.enum([
93
+ "artifact",
94
+ "canvas",
95
+ "image",
96
+ "markdown",
97
+ "pdf",
98
+ "file",
99
+ "websiteBuilder",
100
+ "embeddedPreview",
101
+ "orders",
102
+ "assets",
103
+ "experiments"
104
+ ]).describe("CommentSurface");
105
+ var commentAuthorSchema = z.object({
106
+ id: z.string(),
107
+ name: z.string(),
108
+ avatarUrl: z.string().nullable(),
109
+ deleted: z.boolean()
110
+ }).describe("CommentAuthor");
111
+ var commentSchema = z.object({
112
+ id: z.string(),
113
+ threadId: z.string(),
114
+ authorUserId: z.string(),
115
+ source: commentSourceSchema,
116
+ body: z.string().describe("Empty when the comment is deleted."),
117
+ createdAt: z.iso.datetime(),
118
+ editedAt: z.iso.datetime().nullable(),
119
+ deletedAt: z.iso.datetime().nullable()
120
+ }).describe("Comment");
121
+ var commentReactionSchema = z.object({
122
+ commentId: z.string(),
123
+ userId: z.string(),
124
+ emoji: z.string(),
125
+ createdAt: z.iso.datetime()
126
+ }).describe("CommentReaction");
127
+ var commentThreadTargetSchema = z.object({
128
+ fileId: z.string().optional(),
129
+ siteId: z.string().optional(),
130
+ path: z.string().optional(),
131
+ orderId: z.string().optional(),
132
+ assetId: z.string().optional(),
133
+ experimentId: z.string().optional()
134
+ }).describe("CommentThreadTarget");
135
+ var commentThreadSchema = z.object({
136
+ id: z.string(),
137
+ projectId: z.string(),
138
+ target: commentThreadTargetSchema,
139
+ viaFileId: z.string().nullable(),
140
+ viaFileName: z.string().nullable(),
141
+ anchor: commentAnchorSchema,
142
+ resolvedAt: z.iso.datetime().nullable(),
143
+ resolvedByUserId: z.string().nullable(),
144
+ resolvedSource: commentSourceSchema.nullable(),
145
+ createdAt: z.iso.datetime(),
146
+ updatedAt: z.iso.datetime(),
147
+ deletedAt: z.iso.datetime().nullable()
148
+ }).describe("CommentThread");
149
+ var commentViewerSchema = z.object({
150
+ userId: z.string().nullable().describe("The signed-in caller; null for anonymous viewers."),
151
+ isMember: z.boolean().describe("Holds a role on the project, so object mentions are on."),
152
+ canComment: z.boolean(),
153
+ canModerate: z.boolean().describe("A workspace admin, who can delete anyone's comment (D-10).")
154
+ }).describe("CommentViewer");
155
+ z.object({
156
+ threads: z.array(commentThreadSchema),
157
+ comments: z.array(commentSchema),
158
+ reactions: z.array(commentReactionSchema),
159
+ authors: z.array(commentAuthorSchema),
160
+ viewer: commentViewerSchema
161
+ }).describe("CommentThreadBundle");
162
+ z.object({
163
+ id: z.uuid(),
164
+ target: commentTargetSchema,
165
+ anchor: commentAnchorSchema,
166
+ body: z.object({ id: z.uuid(), body: z.string() })
167
+ }).describe("CreateCommentThreadBody");
168
+ z.object({
169
+ resolved: z.boolean().optional(),
170
+ path: z.string().optional().describe("Moves the thread to another page and resets its anchor."),
171
+ anchor: commentAnchorSchema.optional()
172
+ }).refine(
173
+ (patch) => {
174
+ return patch.resolved !== void 0 || patch.path !== void 0 || patch.anchor !== void 0;
175
+ },
176
+ { message: "Pass at least one of resolved, path or anchor." }
177
+ ).refine((patch) => patch.path === void 0 || patch.anchor === void 0, {
178
+ message: "Move a thread or re-anchor it, not both at once."
179
+ }).describe("UpdateCommentThreadBody");
180
+ z.object({
181
+ id: z.uuid(),
182
+ body: z.string()
183
+ }).describe("CreateCommentBody");
184
+ z.object({
185
+ body: z.string()
186
+ }).describe("UpdateCommentBody");
187
+ var commentThreadStatusSchema = z.enum(["open", "resolved"]).describe("CommentThreadStatus");
188
+ z.object({
189
+ fileId: z.uuid().optional(),
190
+ folderId: z.uuid().optional().describe("Artifact folder: every page under it."),
191
+ siteId: z.uuid().optional(),
192
+ path: z.string().optional().describe(
193
+ "A concrete page path or a route pattern, normalized the same way a new comment's URL is."
194
+ ),
195
+ locale: z.string().optional().describe("The locale prefixed to `path`, which is stripped first."),
196
+ viaFileId: z.uuid().optional(),
197
+ orderId: z.uuid().optional(),
198
+ assetId: z.uuid().optional(),
199
+ experimentId: z.uuid().optional(),
200
+ status: commentThreadStatusSchema.optional()
201
+ }).refine(
202
+ (query) => {
203
+ return [
204
+ query.fileId,
205
+ query.folderId,
206
+ query.siteId,
207
+ query.orderId,
208
+ query.assetId,
209
+ query.experimentId
210
+ ].filter((value) => value !== void 0).length === 1;
211
+ },
212
+ {
213
+ message: "Exactly one of fileId, folderId, siteId, orderId, assetId or experimentId is required."
214
+ }
215
+ ).refine(
216
+ (query) => {
217
+ return query.siteId !== void 0 || query.path === void 0 && query.locale === void 0 && query.viaFileId === void 0;
218
+ },
219
+ { message: "path, locale and viaFileId require siteId." }
220
+ ).describe("ListCommentThreadsQuery");
221
+ z.object({
222
+ kind: z.enum(["artifact", "miniapp", "commentsScreen", "gone"]),
223
+ url: z.string().optional(),
224
+ projectId: z.string().optional().describe(
225
+ "The thread's project, set for miniapp and commentsScreen locations so the dashboard can build the project route."
226
+ ),
227
+ miniappId: z.string().optional(),
228
+ miniappRoute: z.string().optional()
229
+ }).describe("CommentThreadLocation");
230
+ z.object({
231
+ target: commentTargetSchema,
232
+ contentType: z.string(),
233
+ contentLength: z.number().int().positive()
234
+ }).describe("PresignCommentAttachmentBody");
235
+ z.object({
236
+ objectKey: z.string(),
237
+ presignedPutUrl: z.string(),
238
+ publicUrl: z.string()
239
+ }).describe("PresignCommentAttachmentResponse");
240
+ z.object({
241
+ target: commentTargetSchema,
242
+ objectKey: z.string()
243
+ }).describe("CommitCommentAttachmentBody");
244
+ z.object({
245
+ publicUrl: z.string()
246
+ }).describe("CommitCommentAttachmentResponse");
247
+ z.object({
248
+ column: z.enum([
249
+ "page",
250
+ "excerpt",
251
+ "author",
252
+ "created",
253
+ "lastActivity",
254
+ "replies",
255
+ "status",
256
+ "from"
257
+ ]),
258
+ direction: z.enum(["asc", "desc"])
259
+ }).describe("CommentSiteThreadSort");
260
+ z.object({
261
+ threads: z.array(commentThreadSchema),
262
+ comments: z.array(commentSchema),
263
+ reactions: z.array(commentReactionSchema),
264
+ authors: z.array(commentAuthorSchema),
265
+ orphanedPaths: z.array(z.string()).nullable().describe(
266
+ "Paths on this page with no current site page; null when the site's pages couldn't be read."
267
+ ),
268
+ nextCursor: z.string().nullable()
269
+ }).describe("CommentSiteThreadPage");
270
+ z.object({
271
+ id: z.string(),
272
+ name: z.string(),
273
+ avatarUrl: z.string().nullable()
274
+ }).describe("CommentMentionPerson");
275
+ var mentionableDisplaySchema = z.object({
276
+ label: z.string(),
277
+ imageUrl: z.string().optional()
278
+ }).describe("MentionableDisplay");
279
+ z.discriminatedUnion("state", [
280
+ z.object({ state: z.literal("ok"), display: mentionableDisplaySchema }),
281
+ z.object({
282
+ state: z.literal("forbidden"),
283
+ category: z.string().describe(
284
+ `A category label such as "File", never the object's title.`
285
+ )
286
+ })
287
+ ]).describe("MentionableResolution");
288
+ var commentThreadTargetSummarySchema = z.object({
289
+ kind: z.enum(["file", "sitePage", "order", "asset", "experiment"]),
290
+ fileId: z.string().optional(),
291
+ fileName: z.string().optional(),
292
+ filePath: z.string().optional().describe("The file's path from its project's root folder."),
293
+ artifactFolderId: z.string().optional().describe("Set when the file is a page of an artifact."),
294
+ fileDeleted: z.boolean().optional().describe("True when the commented file no longer exists."),
295
+ siteId: z.string().optional(),
296
+ path: z.string().optional().describe("The site route pattern."),
297
+ url: z.string().optional().describe("The concrete page URL the comment was left on."),
298
+ orderId: z.string().optional(),
299
+ assetId: z.string().optional(),
300
+ experimentId: z.string().optional(),
301
+ experimentName: z.string().optional()
302
+ }).describe("CommentThreadTargetSummary");
303
+ z.object({
304
+ thread: commentThreadSchema,
305
+ comments: z.array(commentSchema),
306
+ reactions: z.array(commentReactionSchema),
307
+ authors: z.array(commentAuthorSchema),
308
+ target: commentThreadTargetSummarySchema
309
+ }).describe("CommentThreadDetail");
310
+
311
+ var SELECT_MODE_SELECTABLE_ATTRIBUTE = "data-replo-selectable";
312
+ var SELECT_MODE_SELECTABLE_PAYLOAD_ATTRIBUTE = "data-replo-selectable-payload";
313
+ var displayModeSchema = z.enum(["browse", "selection", "comment"]).describe("DisplayMode");
314
+ var selectModeInlineTextStatusSchema = z.enum(["editable", "dynamic", "translated"]).nullable().describe("SelectModeInlineTextStatus");
315
+ var selectModeTextMetricsSchema = z.object({
316
+ tightWidth: z.number(),
317
+ lineCount: z.number(),
318
+ lineHeight: z.number()
319
+ }).describe("SelectModeTextMetrics");
320
+ var selectModeClickPositionSchema = z.object({
321
+ x: z.number(),
322
+ y: z.number()
323
+ }).describe("SelectModeClickPosition");
324
+ var selectModeSourceLocationSchema = z.object({
325
+ filePath: z.string(),
326
+ lineNumber: z.number(),
327
+ columnNumber: z.number().optional(),
328
+ componentName: z.string().optional()
329
+ }).describe("SelectModeSourceLocation");
330
+ var selectModeFiberChainEntrySchema = z.object({
331
+ sourceLocation: selectModeSourceLocationSchema,
332
+ tagName: z.string().optional(),
333
+ componentName: z.string().optional(),
334
+ props: z.record(z.string(), z.unknown()).optional()
335
+ }).describe("SelectModeFiberChainEntry");
336
+ var selectModeBoundingRectSchema = z.object({
337
+ x: z.number(),
338
+ y: z.number(),
339
+ left: z.number(),
340
+ top: z.number(),
341
+ right: z.number(),
342
+ bottom: z.number(),
343
+ width: z.number(),
344
+ height: z.number()
345
+ }).describe("SelectModeBoundingRect");
346
+ var selectModeHoverRectSchema = selectModeBoundingRectSchema.extend({ isSection: z.boolean().optional() }).describe("SelectModeHoverRect");
347
+ var selectModeSelectionRectSchema = z.object({
348
+ id: z.string(),
349
+ rect: selectModeBoundingRectSchema
350
+ }).describe("SelectModeSelectionRect");
351
+ var selectModeStyleAtRuleSchema = z.object({
352
+ type: z.string(),
353
+ text: z.string()
354
+ }).describe("SelectModeStyleAtRule");
355
+ var selectModeStyleVariantSchema = z.object({
356
+ atRules: z.array(selectModeStyleAtRuleSchema),
357
+ pseudo: z.string().nullable()
358
+ }).describe("SelectModeStyleVariant");
359
+ var selectModeDefinedStyleSchema = z.object({
360
+ property: z.string(),
361
+ variant: selectModeStyleVariantSchema.nullable(),
362
+ className: z.string().nullable(),
363
+ raw: z.string(),
364
+ resolved: z.string()
365
+ }).describe("SelectModeDefinedStyle");
366
+ function transformRect({
367
+ rect,
368
+ offset,
369
+ scale = 1
370
+ }) {
371
+ return {
372
+ x: rect.x * scale + offset.left,
373
+ y: rect.y * scale + offset.top,
374
+ left: rect.left * scale + offset.left,
375
+ right: rect.right * scale + offset.left,
376
+ top: rect.top * scale + offset.top,
377
+ bottom: rect.bottom * scale + offset.top,
378
+ width: rect.width * scale,
379
+ height: rect.height * scale
380
+ };
381
+ }
382
+ function transformPoint({
383
+ point,
384
+ offset,
385
+ scale = 1
386
+ }) {
387
+ return {
388
+ x: point.x * scale + offset.left,
389
+ y: point.y * scale + offset.top
390
+ };
391
+ }
392
+ function getIframeOffset(iframe) {
393
+ if (!iframe) {
394
+ return { left: 0, top: 0 };
395
+ }
396
+ const iframeRect = iframe.getBoundingClientRect();
397
+ return { left: iframeRect.left, top: iframeRect.top };
398
+ }
399
+ var selectModeImageScopeSchema = z.discriminatedUnion("kind", [
400
+ z.object({ kind: z.literal("all") }),
401
+ z.object({ kind: z.literal("media"), media: z.string() })
402
+ ]).describe("SelectModeImageScope");
403
+ var selectModeImageSourceSchema = z.object({
404
+ srcSet: z.string(),
405
+ sizes: z.string(),
406
+ media: z.string(),
407
+ type: z.string(),
408
+ previewUrl: z.string().nullable()
409
+ }).describe("SelectModeImageSource");
410
+ var selectModeImageSchema = z.object({
411
+ src: z.string(),
412
+ currentSrc: z.string(),
413
+ srcSet: z.string(),
414
+ sizes: z.string(),
415
+ previewUrl: z.string().nullable(),
416
+ sources: z.array(selectModeImageSourceSchema)
417
+ }).describe("SelectModeImage");
418
+ var selectModeVideoSchema = z.object({
419
+ src: z.string(),
420
+ currentSrc: z.string()
421
+ }).describe("SelectModeVideo");
422
+ var selectedElementSchema = z.object({
423
+ kind: z.literal("react-element"),
424
+ selector: z.string(),
425
+ section: z.object({ selector: z.string() }).optional(),
426
+ tagName: z.string(),
427
+ elementType: z.string(),
428
+ textContent: z.string().nullable(),
429
+ sectionLabel: z.string().optional(),
430
+ rect: selectModeBoundingRectSchema,
431
+ textMetrics: selectModeTextMetricsSchema.nullable(),
432
+ outerHTML: z.string(),
433
+ image: selectModeImageSchema.optional(),
434
+ video: selectModeVideoSchema.optional(),
435
+ definedStyles: z.array(selectModeDefinedStyleSchema).default([]),
436
+ authoredStyles: z.record(z.string(), z.string()).default({}).describe(
437
+ "Authored CSS value of the winning declaration per control property, custom properties expanded (e.g. 1.5rem for text-2xl at a wide viewport)."
438
+ ),
439
+ inheritedStyles: z.record(z.string(), z.string()).default({}),
440
+ clickPosition: selectModeClickPositionSchema,
441
+ sourceLocation: selectModeSourceLocationSchema.optional(),
442
+ fiberChain: z.array(selectModeFiberChainEntrySchema).default([]),
443
+ siblingSelectors: z.array(z.string()).default([]),
444
+ anchor: commentAnchorElementSchema.optional().describe(
445
+ "The comments capture of the same element, so a selection can become a comment anchor."
446
+ )
447
+ }).describe("SelectedElement");
448
+ var selectablePlanDataSchema = z.object({
449
+ kind: z.literal("plan"),
450
+ planId: z.string(),
451
+ label: z.string(),
452
+ rect: selectModeBoundingRectSchema
453
+ }).describe("SelectablePlanData");
454
+ var selectablePlanPayloadSchema = selectablePlanDataSchema.omit({ rect: true }).describe("SelectablePlanPayload");
455
+ var selectableDataPayloadSchema = z.discriminatedUnion("kind", [selectablePlanPayloadSchema]).describe("SelectableDataPayload");
456
+ var selectableDataSchema = z.discriminatedUnion("kind", [selectedElementSchema, selectablePlanDataSchema]).describe("SelectableData");
457
+ function isSelectedSection(data) {
458
+ return data.kind === "react-element" && data.selector === data.section?.selector;
459
+ }
460
+ function transformSelectedElement({
461
+ element,
462
+ offset,
463
+ scale = 1
464
+ }) {
465
+ return {
466
+ ...element,
467
+ rect: transformRect({ rect: element.rect, offset, scale }),
468
+ clickPosition: transformPoint({
469
+ point: element.clickPosition,
470
+ offset,
471
+ scale
472
+ })
473
+ };
474
+ }
475
+ function transformSelectableData({
476
+ data,
477
+ offset
478
+ }) {
479
+ return exhaustiveSwitch(
480
+ data,
481
+ "kind"
482
+ )({
483
+ "react-element": (element) => transformSelectedElement({ element, offset }),
484
+ plan: (plan) => ({
485
+ ...plan,
486
+ rect: transformRect({ rect: plan.rect, offset })
487
+ })
488
+ });
489
+ }
490
+ function readSelectablePayload(rawPayload) {
491
+ if (!rawPayload) {
492
+ return null;
493
+ }
494
+ const parsedPayload = parseJsonOrNull(rawPayload);
495
+ if (!parsedPayload) {
496
+ return null;
497
+ }
498
+ return parseSchemaOrNull(parsedPayload, selectableDataPayloadSchema);
499
+ }
500
+ var selectModeOptimisticUpdatePayloadSchema = z.discriminatedUnion("kind", [
501
+ z.object({
502
+ kind: z.literal("image"),
503
+ image: selectModeImageSchema
504
+ }),
505
+ z.object({
506
+ kind: z.literal("css"),
507
+ fontSource: z.enum(["google", "site"]).optional(),
508
+ property: z.string(),
509
+ value: z.string().nullable()
510
+ }),
511
+ z.object({
512
+ kind: z.literal("content"),
513
+ innerHTML: z.string()
514
+ }),
515
+ z.object({
516
+ kind: z.literal("attribute"),
517
+ name: z.string(),
518
+ value: z.string()
519
+ })
520
+ ]).describe("SelectModeOptimisticUpdatePayload");
521
+ var selectModeTiptapActiveMarksSchema = z.object({
522
+ bold: z.boolean(),
523
+ italic: z.boolean(),
524
+ underline: z.boolean(),
525
+ strike: z.boolean()
526
+ }).describe("SelectModeTiptapActiveMarks");
527
+ var selectModeFormatCommandSchema = z.enum(["toggleBold", "toggleItalic", "toggleUnderline", "toggleStrike"]).describe("SelectModeFormatCommand");
528
+ var selectModeSelectionTypeSchema = z.enum(["none", "element", "area", "drag"]).describe("SelectModeSelectionType");
529
+ var selectModeSelectionSchema = z.discriminatedUnion("type", [
530
+ z.object({ type: z.literal("none") }),
531
+ z.object({
532
+ type: z.literal("element"),
533
+ data: selectableDataSchema
534
+ }),
535
+ z.object({
536
+ type: z.literal("area"),
537
+ rect: selectModeBoundingRectSchema,
538
+ items: z.array(selectableDataSchema)
539
+ }),
540
+ z.object({
541
+ type: z.literal("drag"),
542
+ dragRect: selectModeBoundingRectSchema,
543
+ selectionRects: z.array(selectModeSelectionRectSchema)
544
+ })
545
+ ]).describe("SelectModeSelection");
546
+
547
+ export { SELECT_MODE_SELECTABLE_ATTRIBUTE, SELECT_MODE_SELECTABLE_PAYLOAD_ATTRIBUTE, displayModeSchema, getIframeOffset, isSelectedSection, readSelectablePayload, selectModeBoundingRectSchema, selectModeClickPositionSchema, selectModeDefinedStyleSchema, selectModeFiberChainEntrySchema, selectModeFormatCommandSchema, selectModeHoverRectSchema, selectModeImageSchema, selectModeImageScopeSchema, selectModeImageSourceSchema, selectModeInlineTextStatusSchema, selectModeOptimisticUpdatePayloadSchema, selectModeSelectionRectSchema, selectModeSelectionSchema, selectModeSelectionTypeSchema, selectModeSourceLocationSchema, selectModeStyleAtRuleSchema, selectModeStyleVariantSchema, selectModeTextMetricsSchema, selectModeTiptapActiveMarksSchema, selectModeVideoSchema, selectableDataPayloadSchema, selectableDataSchema, selectablePlanDataSchema, selectablePlanPayloadSchema, selectedElementSchema, transformPoint, transformRect, transformSelectableData, transformSelectedElement };