puckeditor-plugin-ai 0.6.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/dist/index.mjs ADDED
@@ -0,0 +1,1123 @@
1
+ "use client";
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __spreadValues = (a, b) => {
10
+ for (var prop in b || (b = {}))
11
+ if (__hasOwnProp.call(b, prop))
12
+ __defNormalProp(a, prop, b[prop]);
13
+ if (__getOwnPropSymbols)
14
+ for (var prop of __getOwnPropSymbols(b)) {
15
+ if (__propIsEnum.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ }
18
+ return a;
19
+ };
20
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
+ var __objRest = (source, exclude) => {
22
+ var target = {};
23
+ for (var prop in source)
24
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
25
+ target[prop] = source[prop];
26
+ if (source != null && __getOwnPropSymbols)
27
+ for (var prop of __getOwnPropSymbols(source)) {
28
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
29
+ target[prop] = source[prop];
30
+ }
31
+ return target;
32
+ };
33
+ var __async = (__this, __arguments, generator) => {
34
+ return new Promise((resolve, reject) => {
35
+ var fulfilled = (value) => {
36
+ try {
37
+ step(generator.next(value));
38
+ } catch (e) {
39
+ reject(e);
40
+ }
41
+ };
42
+ var rejected = (value) => {
43
+ try {
44
+ step(generator.throw(value));
45
+ } catch (e) {
46
+ reject(e);
47
+ }
48
+ };
49
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
50
+ step((generator = generator.apply(__this, __arguments)).next());
51
+ });
52
+ };
53
+
54
+ // ../tsup-config/react-import.js
55
+ import React from "react";
56
+
57
+ // index.tsx
58
+ import {
59
+ useState,
60
+ useCallback,
61
+ useEffect,
62
+ useRef,
63
+ useContext,
64
+ createContext,
65
+ useMemo
66
+ } from "react";
67
+ import { useGetPuck, createUsePuck } from "@puckeditor/core";
68
+ import { useChat } from "@ai-sdk/react";
69
+ import {
70
+ DefaultChatTransport
71
+ } from "ai";
72
+ import ReactMarkdown from "react-markdown";
73
+ import TextareaAutosize from "react-textarea-autosize";
74
+ import { useStickToBottom } from "use-stick-to-bottom";
75
+
76
+ // ../../node_modules/.pnpm/lucide-react@0.452.0_react@19.2.4/node_modules/lucide-react/dist/esm/createLucideIcon.js
77
+ import { forwardRef as forwardRef2, createElement as createElement2 } from "react";
78
+
79
+ // ../../node_modules/.pnpm/lucide-react@0.452.0_react@19.2.4/node_modules/lucide-react/dist/esm/shared/src/utils.js
80
+ var toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
81
+ var mergeClasses = (...classes) => classes.filter((className, index, array) => {
82
+ return Boolean(className) && array.indexOf(className) === index;
83
+ }).join(" ");
84
+
85
+ // ../../node_modules/.pnpm/lucide-react@0.452.0_react@19.2.4/node_modules/lucide-react/dist/esm/Icon.js
86
+ import { forwardRef, createElement } from "react";
87
+
88
+ // ../../node_modules/.pnpm/lucide-react@0.452.0_react@19.2.4/node_modules/lucide-react/dist/esm/defaultAttributes.js
89
+ var defaultAttributes = {
90
+ xmlns: "http://www.w3.org/2000/svg",
91
+ width: 24,
92
+ height: 24,
93
+ viewBox: "0 0 24 24",
94
+ fill: "none",
95
+ stroke: "currentColor",
96
+ strokeWidth: 2,
97
+ strokeLinecap: "round",
98
+ strokeLinejoin: "round"
99
+ };
100
+
101
+ // ../../node_modules/.pnpm/lucide-react@0.452.0_react@19.2.4/node_modules/lucide-react/dist/esm/Icon.js
102
+ var Icon = forwardRef(
103
+ (_a, ref) => {
104
+ var _b = _a, {
105
+ color = "currentColor",
106
+ size = 24,
107
+ strokeWidth = 2,
108
+ absoluteStrokeWidth,
109
+ className = "",
110
+ children,
111
+ iconNode
112
+ } = _b, rest = __objRest(_b, [
113
+ "color",
114
+ "size",
115
+ "strokeWidth",
116
+ "absoluteStrokeWidth",
117
+ "className",
118
+ "children",
119
+ "iconNode"
120
+ ]);
121
+ return createElement(
122
+ "svg",
123
+ __spreadValues(__spreadProps(__spreadValues({
124
+ ref
125
+ }, defaultAttributes), {
126
+ width: size,
127
+ height: size,
128
+ stroke: color,
129
+ strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
130
+ className: mergeClasses("lucide", className)
131
+ }), rest),
132
+ [
133
+ ...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),
134
+ ...Array.isArray(children) ? children : [children]
135
+ ]
136
+ );
137
+ }
138
+ );
139
+
140
+ // ../../node_modules/.pnpm/lucide-react@0.452.0_react@19.2.4/node_modules/lucide-react/dist/esm/createLucideIcon.js
141
+ var createLucideIcon = (iconName, iconNode) => {
142
+ const Component = forwardRef2(
143
+ (_a, ref) => {
144
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
145
+ return createElement2(Icon, __spreadValues({
146
+ ref,
147
+ iconNode,
148
+ className: mergeClasses(`lucide-${toKebabCase(iconName)}`, className)
149
+ }, props));
150
+ }
151
+ );
152
+ Component.displayName = `${iconName}`;
153
+ return Component;
154
+ };
155
+
156
+ // ../../node_modules/.pnpm/lucide-react@0.452.0_react@19.2.4/node_modules/lucide-react/dist/esm/icons/arrow-up.js
157
+ var ArrowUp = createLucideIcon("ArrowUp", [
158
+ ["path", { d: "m5 12 7-7 7 7", key: "hav0vg" }],
159
+ ["path", { d: "M12 19V5", key: "x0mq9r" }]
160
+ ]);
161
+
162
+ // ../../node_modules/.pnpm/lucide-react@0.452.0_react@19.2.4/node_modules/lucide-react/dist/esm/icons/bot.js
163
+ var Bot = createLucideIcon("Bot", [
164
+ ["path", { d: "M12 8V4H8", key: "hb8ula" }],
165
+ ["rect", { width: "16", height: "12", x: "4", y: "8", rx: "2", key: "enze0r" }],
166
+ ["path", { d: "M2 14h2", key: "vft8re" }],
167
+ ["path", { d: "M20 14h2", key: "4cs60a" }],
168
+ ["path", { d: "M15 13v2", key: "1xurst" }],
169
+ ["path", { d: "M9 13v2", key: "rq6x2g" }]
170
+ ]);
171
+
172
+ // ../../node_modules/.pnpm/lucide-react@0.452.0_react@19.2.4/node_modules/lucide-react/dist/esm/icons/check.js
173
+ var Check = createLucideIcon("Check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);
174
+
175
+ // ../../node_modules/.pnpm/lucide-react@0.452.0_react@19.2.4/node_modules/lucide-react/dist/esm/icons/image.js
176
+ var Image = createLucideIcon("Image", [
177
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
178
+ ["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
179
+ ["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }]
180
+ ]);
181
+
182
+ // ../../node_modules/.pnpm/lucide-react@0.452.0_react@19.2.4/node_modules/lucide-react/dist/esm/icons/rotate-ccw.js
183
+ var RotateCcw = createLucideIcon("RotateCcw", [
184
+ ["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
185
+ ["path", { d: "M3 3v5h5", key: "1xhq8a" }]
186
+ ]);
187
+
188
+ // ../../node_modules/.pnpm/lucide-react@0.452.0_react@19.2.4/node_modules/lucide-react/dist/esm/icons/triangle-alert.js
189
+ var TriangleAlert = createLucideIcon("TriangleAlert", [
190
+ [
191
+ "path",
192
+ {
193
+ d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",
194
+ key: "wmoenq"
195
+ }
196
+ ],
197
+ ["path", { d: "M12 9v4", key: "juzpu7" }],
198
+ ["path", { d: "M12 17h.01", key: "p32p05" }]
199
+ ]);
200
+
201
+ // ../../node_modules/.pnpm/lucide-react@0.452.0_react@19.2.4/node_modules/lucide-react/dist/esm/icons/x.js
202
+ var X = createLucideIcon("X", [
203
+ ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
204
+ ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
205
+ ]);
206
+
207
+ // index.tsx
208
+ import qler from "qler";
209
+ import { ulid } from "ulid";
210
+ import html2canvas from "html2canvas-pro";
211
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
212
+ function readFileAsDataURL(file) {
213
+ return new Promise((resolve, reject) => {
214
+ const reader = new FileReader();
215
+ reader.onload = () => resolve(reader.result);
216
+ reader.onerror = reject;
217
+ reader.readAsDataURL(file);
218
+ });
219
+ }
220
+ function filesToAttachedImages(files) {
221
+ return __async(this, null, function* () {
222
+ const results = [];
223
+ for (const file of Array.from(files)) {
224
+ if (!file.type.startsWith("image/")) continue;
225
+ const dataUrl = yield readFileAsDataURL(file);
226
+ results.push({ id: prefixedUlid("img"), dataUrl, name: file.name });
227
+ }
228
+ return results;
229
+ });
230
+ }
231
+ var prefixedUlid = (prefix = "") => `${prefix ? `${prefix}_` : ""}${ulid()}`;
232
+ var q = qler();
233
+ var getSelectorForId = (state, id) => {
234
+ var _a, _b, _c, _d;
235
+ const node = (_b = (_a = state == null ? void 0 : state.indexes) == null ? void 0 : _a.nodes) == null ? void 0 : _b[id];
236
+ if (!node) return void 0;
237
+ const zoneCompound = `${node.parentId}:${node.zone}`;
238
+ const index = (_d = (_c = state.indexes.zones[zoneCompound]) == null ? void 0 : _c.contentIds) == null ? void 0 : _d.indexOf(id);
239
+ return { zone: zoneCompound, index };
240
+ };
241
+ var getItemById = (state, id) => {
242
+ var _a, _b, _c;
243
+ return (_c = (_b = (_a = state == null ? void 0 : state.indexes) == null ? void 0 : _a.nodes) == null ? void 0 : _b[id]) == null ? void 0 : _c.data;
244
+ };
245
+ var applyArrayDefaults = (oldProps, newProps, fields) => {
246
+ const updatedProps = __spreadValues(__spreadValues({}, oldProps), newProps);
247
+ for (const fieldName in fields) {
248
+ const field = fields[fieldName];
249
+ if (field.type === "array") {
250
+ const arrayField = field;
251
+ const arrayFields = arrayField.arrayFields;
252
+ updatedProps[fieldName] = (updatedProps[fieldName] || []).map((item, index) => {
253
+ var _a, _b, _c, _d, _e;
254
+ const newItem = {};
255
+ const defaultValue = typeof arrayField.defaultItemProps === "function" ? arrayField.defaultItemProps(index) : arrayField.defaultItemProps;
256
+ for (const arrayFieldName in arrayFields) {
257
+ const subField = arrayFields[arrayFieldName];
258
+ if (subField.type === "slot") {
259
+ newItem[arrayFieldName] = (_d = (_c = item[arrayFieldName]) != null ? _c : (_b = (_a = oldProps[fieldName]) == null ? void 0 : _a[index]) == null ? void 0 : _b[arrayFieldName]) != null ? _d : defaultValue == null ? void 0 : defaultValue[arrayFieldName];
260
+ } else {
261
+ newItem[arrayFieldName] = (_e = item[arrayFieldName]) != null ? _e : defaultValue == null ? void 0 : defaultValue[arrayFieldName];
262
+ }
263
+ }
264
+ return newItem;
265
+ });
266
+ }
267
+ }
268
+ return updatedProps;
269
+ };
270
+ var dispatchOp = (operation, { getState, dispatchAction, config }) => {
271
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
272
+ const state = getState();
273
+ try {
274
+ if (operation.op === "add") {
275
+ if (operation.zone) {
276
+ dispatchAction({
277
+ type: "insert",
278
+ destinationIndex: operation.index,
279
+ destinationZone: operation.zone,
280
+ componentType: operation.type,
281
+ id: operation.id,
282
+ recordHistory: false
283
+ });
284
+ const existing = getItemById(getState(), operation.id);
285
+ if (!existing) {
286
+ throw new Error(`Tried to update an item that doesn't exist: ${operation.id}`);
287
+ }
288
+ const newData = __spreadProps(__spreadValues({}, existing), {
289
+ props: applyArrayDefaults(
290
+ existing.props,
291
+ operation.props,
292
+ (_b = (_a = config.components[existing.type]) == null ? void 0 : _a.fields) != null ? _b : {}
293
+ )
294
+ });
295
+ dispatchAction({
296
+ type: "replace",
297
+ destinationIndex: operation.index,
298
+ destinationZone: operation.zone,
299
+ data: newData,
300
+ recordHistory: false
301
+ });
302
+ }
303
+ } else if (operation.op === "update") {
304
+ const selector = getSelectorForId(state, operation.id);
305
+ const existing = getItemById(state, operation.id);
306
+ if (!selector || !existing) {
307
+ throw new Error(`Tried to update an item that doesn't exist: ${operation.id}`);
308
+ }
309
+ const newData = __spreadProps(__spreadValues({}, existing), {
310
+ props: applyArrayDefaults(
311
+ existing.props,
312
+ operation.props,
313
+ (_d = (_c = config.components[existing.type]) == null ? void 0 : _c.fields) != null ? _d : {}
314
+ )
315
+ });
316
+ dispatchAction({
317
+ type: "replace",
318
+ destinationIndex: selector.index,
319
+ destinationZone: selector.zone,
320
+ data: newData,
321
+ recordHistory: false
322
+ });
323
+ } else if (operation.op === "updateRoot") {
324
+ const existing = (_e = state == null ? void 0 : state.data) == null ? void 0 : _e.root;
325
+ const defaultProps = (_g = (_f = config.root) == null ? void 0 : _f.defaultProps) != null ? _g : {};
326
+ dispatchAction({
327
+ type: "replaceRoot",
328
+ root: __spreadProps(__spreadValues({}, existing), {
329
+ props: __spreadValues(__spreadValues(__spreadValues({}, defaultProps), existing == null ? void 0 : existing.props), operation.props)
330
+ }),
331
+ recordHistory: false
332
+ });
333
+ } else if (operation.op === "delete") {
334
+ const selector = getSelectorForId(state, operation.id);
335
+ if (!selector) {
336
+ throw new Error(`Tried to delete an item that doesn't exist: ${operation.id}`);
337
+ }
338
+ dispatchAction({
339
+ type: "remove",
340
+ zone: selector.zone,
341
+ index: selector.index,
342
+ recordHistory: false
343
+ });
344
+ } else if (operation.op === "duplicate") {
345
+ const selector = getSelectorForId(state, operation.id);
346
+ if (!selector) {
347
+ throw new Error(`Tried to duplicate an item that doesn't exist: ${operation.id}`);
348
+ }
349
+ dispatchAction({
350
+ type: "duplicate",
351
+ sourceZone: selector.zone,
352
+ sourceIndex: selector.index,
353
+ recordHistory: false
354
+ });
355
+ } else if (operation.op === "move") {
356
+ const selector = getSelectorForId(state, operation.id);
357
+ if (!selector) {
358
+ throw new Error(`Tried to move an item that doesn't exist: ${operation.id}`);
359
+ }
360
+ dispatchAction({
361
+ type: "move",
362
+ sourceZone: selector.zone,
363
+ sourceIndex: selector.index,
364
+ destinationIndex: operation.index,
365
+ destinationZone: operation.zone,
366
+ recordHistory: false
367
+ });
368
+ } else if (operation.op === "reset") {
369
+ const defaultRootProps = (_i = (_h = config.root) == null ? void 0 : _h.defaultProps) != null ? _i : {};
370
+ dispatchAction({
371
+ type: "setData",
372
+ data: { content: [], root: defaultRootProps },
373
+ recordHistory: false
374
+ });
375
+ } else {
376
+ throw new Error(`Unknown operation: ${operation.op}`);
377
+ }
378
+ } catch (e) {
379
+ console.error("Error applying operation, skipping...", operation, e);
380
+ }
381
+ };
382
+ var toolStatusContext = createContext({});
383
+ var ToolStatusProvider = toolStatusContext.Provider;
384
+ function Loader({ size = 16 }) {
385
+ return /* @__PURE__ */ jsx(
386
+ "span",
387
+ {
388
+ className: "puck-ai-loader",
389
+ style: { width: size, height: size },
390
+ "aria-label": "loading"
391
+ }
392
+ );
393
+ }
394
+ function ToolStatusDisplay({ status }) {
395
+ return /* @__PURE__ */ jsx("div", { className: "puck-ai-chat-message-data", children: /* @__PURE__ */ jsxs("div", { className: "puck-ai-chat-message-data-inner", children: [
396
+ /* @__PURE__ */ jsx("div", { className: "puck-ai-chat-message-data-icon", children: status.error ? /* @__PURE__ */ jsx(TriangleAlert, { size: 18 }) : status.loading ? /* @__PURE__ */ jsx(Loader, { size: 16 }) : /* @__PURE__ */ jsx(Check, { size: 18 }) }),
397
+ /* @__PURE__ */ jsx("div", { children: status.label })
398
+ ] }) });
399
+ }
400
+ function PuckTool({
401
+ toolCallId,
402
+ output,
403
+ defaultLabel = "Thinking..."
404
+ }) {
405
+ const toolStatusMap = useContext(toolStatusContext);
406
+ const contextStatus = toolStatusMap[toolCallId];
407
+ const outputObj = output;
408
+ const status = outputObj && "status" in outputObj ? outputObj.status : contextStatus != null ? contextStatus : { loading: true, label: defaultLabel };
409
+ return /* @__PURE__ */ jsx(ToolStatusDisplay, { status });
410
+ }
411
+ function ChatMessagePart({ part, role }) {
412
+ if (part.type === "text") {
413
+ return /* @__PURE__ */ jsx("div", { className: "puck-ai-chat-message-text", children: role === "assistant" || role === "user" ? /* @__PURE__ */ jsx(ReactMarkdown, { children: part.text }) : /* @__PURE__ */ jsx("span", { children: part.text }) });
414
+ }
415
+ if (part.type === "tool-createPage" || part.type === "tool-updatePage" || part.type === "tool-userTool") {
416
+ return /* @__PURE__ */ jsx(PuckTool, __spreadValues({}, part));
417
+ }
418
+ return null;
419
+ }
420
+ function ChatMessage({ message }) {
421
+ const { role, parts } = message;
422
+ return /* @__PURE__ */ jsx(
423
+ "div",
424
+ {
425
+ className: `puck-ai-chat-message${role === "user" ? " puck-ai-chat-message--user-role" : ""}`,
426
+ "data-message-id": message.id,
427
+ children: parts.map((part, i) => /* @__PURE__ */ jsx(
428
+ ChatMessagePart,
429
+ {
430
+ part,
431
+ role
432
+ },
433
+ `${message.id}-${part.type}-${i}`
434
+ ))
435
+ }
436
+ );
437
+ }
438
+ function ExamplePrompt({
439
+ label,
440
+ href,
441
+ onClick
442
+ }) {
443
+ const El = href ? "a" : "button";
444
+ return /* @__PURE__ */ jsxs(El, { className: "puck-ai-chatbody-example-prompt", href, onClick, children: [
445
+ /* @__PURE__ */ jsx("div", { children: label }),
446
+ /* @__PURE__ */ jsx("div", { className: "puck-ai-chatbody-example-prompt-arrow", children: /* @__PURE__ */ jsx(ArrowUp, { size: 16 }) })
447
+ ] });
448
+ }
449
+ function PromptForm({
450
+ handleSubmit,
451
+ inputRef,
452
+ isLoading,
453
+ glow,
454
+ placeholder = "What do you want to build?",
455
+ minRows = 2,
456
+ maxRows = 5,
457
+ value = "",
458
+ images = [],
459
+ onImagesChange
460
+ }) {
461
+ const [prompt, setPrompt] = useState(value);
462
+ const [isDragOver, setIsDragOver] = useState(false);
463
+ const hasSetInitialPrompt = useRef(false);
464
+ const internalRef = useRef(null);
465
+ const fileInputRef = useRef(null);
466
+ useEffect(() => {
467
+ setPrompt(value);
468
+ }, [value]);
469
+ useEffect(() => {
470
+ const currentUrl = new URL(location.href);
471
+ const initialPrompt = currentUrl.searchParams.get("initialPrompt");
472
+ if (!hasSetInitialPrompt.current && initialPrompt && prompt === "") {
473
+ hasSetInitialPrompt.current = true;
474
+ setPrompt(initialPrompt);
475
+ }
476
+ }, []);
477
+ const addImages = useCallback((files) => __async(null, null, function* () {
478
+ const newImgs = yield filesToAttachedImages(files);
479
+ if (newImgs.length > 0) {
480
+ onImagesChange == null ? void 0 : onImagesChange([...images, ...newImgs]);
481
+ }
482
+ }), [images, onImagesChange]);
483
+ const removeImage = useCallback((id) => {
484
+ onImagesChange == null ? void 0 : onImagesChange(images.filter((img) => img.id !== id));
485
+ }, [images, onImagesChange]);
486
+ const sendPrompt = () => {
487
+ if (isLoading) return;
488
+ if (prompt.trim() || images.length > 0) {
489
+ handleSubmit(prompt);
490
+ }
491
+ setPrompt("");
492
+ };
493
+ const handleDragOver = (e) => {
494
+ e.preventDefault();
495
+ if (e.dataTransfer.types.some((t) => t === "Files")) {
496
+ setIsDragOver(true);
497
+ }
498
+ };
499
+ const handleDragLeave = (e) => {
500
+ if (!e.currentTarget.contains(e.relatedTarget)) {
501
+ setIsDragOver(false);
502
+ }
503
+ };
504
+ const handleDrop = (e) => __async(null, null, function* () {
505
+ e.preventDefault();
506
+ setIsDragOver(false);
507
+ if (e.dataTransfer.files.length > 0) {
508
+ yield addImages(e.dataTransfer.files);
509
+ }
510
+ });
511
+ const classNames = [
512
+ "puck-ai-prompt-form",
513
+ glow ? "puck-ai-prompt-form--glow" : "",
514
+ isLoading ? "puck-ai-prompt-form--is-loading" : "",
515
+ isDragOver ? "puck-ai-prompt-form--drag-over" : ""
516
+ ].filter(Boolean).join(" ");
517
+ return /* @__PURE__ */ jsx(
518
+ "div",
519
+ {
520
+ className: classNames,
521
+ onDragOver: handleDragOver,
522
+ onDragEnter: handleDragOver,
523
+ onDragLeave: handleDragLeave,
524
+ onDrop: handleDrop,
525
+ children: /* @__PURE__ */ jsxs("div", { className: "puck-ai-prompt-form-inner", children: [
526
+ /* @__PURE__ */ jsx("span", { className: "puck-ai-prompt-form-glow" }),
527
+ /* @__PURE__ */ jsx(
528
+ "input",
529
+ {
530
+ ref: fileInputRef,
531
+ type: "file",
532
+ accept: "image/*",
533
+ multiple: true,
534
+ style: { display: "none" },
535
+ onChange: (e) => __async(null, null, function* () {
536
+ if (e.target.files) {
537
+ yield addImages(e.target.files);
538
+ e.target.value = "";
539
+ }
540
+ })
541
+ }
542
+ ),
543
+ /* @__PURE__ */ jsxs(
544
+ "form",
545
+ {
546
+ onSubmit: (e) => {
547
+ e.preventDefault();
548
+ sendPrompt();
549
+ },
550
+ children: [
551
+ images.length > 0 && /* @__PURE__ */ jsx("div", { className: "puck-ai-image-thumbnails", children: images.map((img) => /* @__PURE__ */ jsxs("div", { className: "puck-ai-image-thumbnail", children: [
552
+ /* @__PURE__ */ jsx("img", { src: img.dataUrl, alt: img.name }),
553
+ /* @__PURE__ */ jsx(
554
+ "button",
555
+ {
556
+ type: "button",
557
+ className: "puck-ai-image-thumbnail-remove",
558
+ onClick: () => removeImage(img.id),
559
+ title: "Remove image",
560
+ children: /* @__PURE__ */ jsx(X, { size: 10 })
561
+ }
562
+ )
563
+ ] }, img.id)) }),
564
+ /* @__PURE__ */ jsxs("div", { className: "puck-ai-prompt-form-form-inner", children: [
565
+ /* @__PURE__ */ jsx(
566
+ TextareaAutosize,
567
+ {
568
+ className: "puck-ai-prompt-form-input",
569
+ name: "prompt",
570
+ minRows,
571
+ maxRows,
572
+ placeholder: isDragOver ? "Drop images here\u2026" : placeholder,
573
+ disabled: isLoading,
574
+ value: prompt,
575
+ ref: (node) => {
576
+ if (inputRef) {
577
+ inputRef.current = node;
578
+ }
579
+ internalRef.current = node;
580
+ },
581
+ onChange: (e) => setPrompt(e.target.value),
582
+ onKeyDown: (e) => {
583
+ if (!e.shiftKey && e.key === "Enter") {
584
+ e.preventDefault();
585
+ }
586
+ },
587
+ onKeyUp: (e) => {
588
+ if (!e.shiftKey && e.key === "Enter") {
589
+ e.preventDefault();
590
+ sendPrompt();
591
+ }
592
+ }
593
+ }
594
+ ),
595
+ /* @__PURE__ */ jsxs(
596
+ "div",
597
+ {
598
+ className: "puck-ai-prompt-form-actions",
599
+ onClick: () => {
600
+ var _a;
601
+ return (_a = internalRef.current) == null ? void 0 : _a.focus();
602
+ },
603
+ children: [
604
+ /* @__PURE__ */ jsx(
605
+ "div",
606
+ {
607
+ className: "puck-ai-prompt-form-actions-left",
608
+ onClick: (e) => e.stopPropagation(),
609
+ children: /* @__PURE__ */ jsx(
610
+ "button",
611
+ {
612
+ type: "button",
613
+ className: "puck-ai-image-attach-btn",
614
+ title: "Attach image",
615
+ onClick: () => {
616
+ var _a;
617
+ return (_a = fileInputRef.current) == null ? void 0 : _a.click();
618
+ },
619
+ disabled: isLoading,
620
+ children: /* @__PURE__ */ jsx(Image, { size: 15 })
621
+ }
622
+ )
623
+ }
624
+ ),
625
+ /* @__PURE__ */ jsx(
626
+ "div",
627
+ {
628
+ className: "puck-ai-prompt-form-actions-right",
629
+ onClick: (e) => e.stopPropagation(),
630
+ children: /* @__PURE__ */ jsx(
631
+ "button",
632
+ {
633
+ className: "puck-ai-prompt-form-action-submit",
634
+ type: "submit",
635
+ disabled: isLoading,
636
+ children: /* @__PURE__ */ jsx(ArrowUp, { size: 24 })
637
+ }
638
+ )
639
+ }
640
+ )
641
+ ]
642
+ }
643
+ )
644
+ ] })
645
+ ]
646
+ }
647
+ )
648
+ ] })
649
+ }
650
+ );
651
+ }
652
+ function ChatBody({
653
+ children,
654
+ examplePrompts,
655
+ handleSubmit,
656
+ hideInput,
657
+ inputRef,
658
+ messages = [],
659
+ status,
660
+ error,
661
+ handleRetry,
662
+ promptValue,
663
+ targetComponent,
664
+ onClearTarget,
665
+ images,
666
+ onImagesChange
667
+ }) {
668
+ const { scrollRef, contentRef } = useStickToBottom();
669
+ const hasMessages = messages && messages.length > 0;
670
+ const classNames = [
671
+ "puck-ai-chatbody",
672
+ hasMessages ? "puck-ai-chatbody--has-messages" : "",
673
+ children ? "puck-ai-chatbody--has-children" : "",
674
+ hideInput ? "puck-ai-chatbody--hide-input" : ""
675
+ ].filter(Boolean).join(" ");
676
+ return /* @__PURE__ */ jsxs("div", { className: classNames, children: [
677
+ children ? /* @__PURE__ */ jsx("div", { className: "puck-ai-chatbody-default", children }) : null,
678
+ /* @__PURE__ */ jsxs("div", { className: "puck-ai-chatbody-inner", ref: scrollRef, children: [
679
+ /* @__PURE__ */ jsx("div", { className: "puck-ai-chatbody-messages", ref: contentRef, children: [...messages].reverse().map((message) => /* @__PURE__ */ jsx(ChatMessage, { message }, message.id)) }),
680
+ status === "submitted" && /* @__PURE__ */ jsx("div", { className: "puck-ai-chatbody-loader", children: /* @__PURE__ */ jsx(Loader, { size: 14 }) }),
681
+ error && /* @__PURE__ */ jsxs("div", { className: "puck-ai-chatbody-error", children: [
682
+ /* @__PURE__ */ jsx("div", { className: "puck-ai-chatbody-error-label", children: "Something went wrong." }),
683
+ handleRetry && /* @__PURE__ */ jsx("div", { className: "puck-ai-chatbody-error-action", children: /* @__PURE__ */ jsx(
684
+ "button",
685
+ {
686
+ className: "puck-ai-icon-button",
687
+ title: "Retry",
688
+ onClick: handleRetry,
689
+ children: /* @__PURE__ */ jsx(RotateCcw, { size: 14 })
690
+ }
691
+ ) })
692
+ ] }),
693
+ /* @__PURE__ */ jsxs("div", { className: "puck-ai-chatbody-form", children: [
694
+ targetComponent && /* @__PURE__ */ jsxs("div", { className: "puck-ai-target-banner", children: [
695
+ /* @__PURE__ */ jsx("span", { className: "puck-ai-target-banner-label", children: "Targeting:" }),
696
+ /* @__PURE__ */ jsx("span", { className: "puck-ai-target-banner-name", children: targetComponent.label || targetComponent.type }),
697
+ /* @__PURE__ */ jsx("code", { className: "puck-ai-target-banner-id", children: targetComponent.id }),
698
+ onClearTarget && /* @__PURE__ */ jsx(
699
+ "button",
700
+ {
701
+ className: "puck-ai-target-banner-clear",
702
+ onClick: onClearTarget,
703
+ title: "Clear target",
704
+ type: "button",
705
+ children: "\xD7"
706
+ }
707
+ )
708
+ ] }),
709
+ /* @__PURE__ */ jsx(
710
+ PromptForm,
711
+ {
712
+ glow: !hasMessages && !targetComponent,
713
+ handleSubmit,
714
+ inputRef,
715
+ isLoading: status === "submitted" || status === "streaming",
716
+ placeholder: targetComponent ? `What should I do with the ${targetComponent.label || targetComponent.type}?` : "What do you want to build?",
717
+ value: promptValue,
718
+ images,
719
+ onImagesChange
720
+ }
721
+ ),
722
+ examplePrompts ? /* @__PURE__ */ jsx("div", { className: "puck-ai-chatbody-example-prompts", children: examplePrompts }) : null
723
+ ] })
724
+ ] })
725
+ ] });
726
+ }
727
+ function isScrolledIntoView(el) {
728
+ const rect = el.getBoundingClientRect();
729
+ return rect.top >= 0 && rect.bottom <= window.innerHeight;
730
+ }
731
+ function Placeholder({
732
+ dispatch,
733
+ inputRef,
734
+ pluginRef
735
+ }) {
736
+ const handleEnterPromptClick = () => {
737
+ var _a;
738
+ (_a = inputRef.current) == null ? void 0 : _a.focus({ preventScroll: true });
739
+ setTimeout(() => {
740
+ if (pluginRef.current && inputRef.current && !isScrolledIntoView(inputRef.current)) {
741
+ const box = pluginRef.current.getBoundingClientRect();
742
+ const top = box.top - (window.innerHeight - box.height) / 2;
743
+ window.scrollTo({ behavior: "smooth", top });
744
+ }
745
+ }, 10);
746
+ };
747
+ return /* @__PURE__ */ jsxs("div", { className: "puck-ai-chat-placeholder", children: [
748
+ /* @__PURE__ */ jsx(Bot, { size: 24 }),
749
+ /* @__PURE__ */ jsx("div", { children: "Use AI to build a page using the available blocks" }),
750
+ /* @__PURE__ */ jsxs("div", { className: "puck-ai-chat-actions", children: [
751
+ /* @__PURE__ */ jsx("button", { className: "puck-ai-chat-action", onClick: handleEnterPromptClick, children: "Enter prompt" }),
752
+ /* @__PURE__ */ jsx(
753
+ "button",
754
+ {
755
+ className: "puck-ai-chat-action-outlined",
756
+ onClick: () => {
757
+ dispatch({ type: "setUi", ui: { plugin: { current: "blocks" } } });
758
+ },
759
+ children: "Build manually"
760
+ }
761
+ )
762
+ ] })
763
+ ] });
764
+ }
765
+ function scrollIntoViewLocal(el, win, behavior = "smooth") {
766
+ var _a, _b;
767
+ const scroller = ((_a = el.ownerDocument) == null ? void 0 : _a.scrollingElement) || ((_b = el.ownerDocument) == null ? void 0 : _b.documentElement);
768
+ const rect = el.getBoundingClientRect();
769
+ const vpH = win.innerHeight;
770
+ const current = scroller.scrollTop;
771
+ const offset = win.innerHeight / 2;
772
+ let targetTop = current;
773
+ if (rect.top < 0) {
774
+ targetTop = current + rect.top;
775
+ } else if (rect.bottom > vpH) {
776
+ targetTop = current + (rect.bottom - vpH);
777
+ }
778
+ if (targetTop !== current) {
779
+ scroller.scrollTo({ top: targetTop + offset, behavior });
780
+ }
781
+ }
782
+ function useFrameMutationObserver(callback) {
783
+ return useCallback(() => {
784
+ var _a;
785
+ const frame = document == null ? void 0 : document.getElementById("preview-frame");
786
+ if (!frame) return;
787
+ let observer = null;
788
+ const win = frame.contentWindow;
789
+ let enabled = true;
790
+ const disable = () => {
791
+ enabled = false;
792
+ };
793
+ const attachObserver = () => {
794
+ const win2 = frame.contentWindow;
795
+ const doc = frame.contentDocument || (win2 == null ? void 0 : win2.document);
796
+ if (!win2 || !doc) return;
797
+ const target = doc.querySelector("#frame-root > div");
798
+ if (!target) return;
799
+ observer = new MutationObserver((entries) => {
800
+ if (enabled) callback(entries, win2);
801
+ });
802
+ observer.observe(target, { childList: true, subtree: true });
803
+ win2.addEventListener("pointerdown", disable);
804
+ win2.addEventListener("wheel", disable);
805
+ };
806
+ if (((_a = frame.contentDocument) == null ? void 0 : _a.readyState) === "complete") {
807
+ attachObserver();
808
+ } else {
809
+ frame.addEventListener("load", attachObserver, { once: true });
810
+ }
811
+ return () => {
812
+ frame.removeEventListener("load", attachObserver);
813
+ win == null ? void 0 : win.removeEventListener("pointerdown", disable);
814
+ win == null ? void 0 : win.removeEventListener("wheel", disable);
815
+ observer == null ? void 0 : observer.disconnect();
816
+ };
817
+ }, [callback]);
818
+ }
819
+ function ScrollTracking({ children }) {
820
+ const followedRefs = useRef([]);
821
+ const follow = useFrameMutationObserver((records, win) => {
822
+ if (records.length > 0) {
823
+ const lastRecord = records[records.length - 1];
824
+ if (followedRefs.current.includes(lastRecord.target)) return;
825
+ followedRefs.current.push(lastRecord.target);
826
+ requestAnimationFrame(() => {
827
+ const el = lastRecord.target;
828
+ scrollIntoViewLocal(el, win);
829
+ });
830
+ }
831
+ });
832
+ useEffect(() => {
833
+ const cleanup = follow();
834
+ return cleanup;
835
+ }, [follow]);
836
+ return /* @__PURE__ */ jsx(Fragment, { children });
837
+ }
838
+ var usePuck = createUsePuck();
839
+ function Chat({
840
+ chat,
841
+ host = "/api/puck/chat",
842
+ prepareRequest
843
+ }) {
844
+ const { examplePrompts } = chat != null ? chat : {};
845
+ const puckDispatch = usePuck((s) => s.dispatch);
846
+ const getPuck = useGetPuck();
847
+ const localChatId = useRef("");
848
+ const inputRef = useRef(null);
849
+ const pluginRef = useRef(null);
850
+ const [error, setError] = useState();
851
+ const [toolStatus, setToolStatus] = useState({});
852
+ const uploadScreenshot = useCallback(
853
+ (width, bucketUrl) => __async(null, null, function* () {
854
+ var _a, _b, _c;
855
+ const iframeDocument = (_c = (_b = (_a = document == null ? void 0 : document.getElementById("preview-frame")) == null ? void 0 : _a.contentDocument) == null ? void 0 : _b.documentElement) != null ? _c : null;
856
+ if (!iframeDocument) return;
857
+ const canvas = yield html2canvas(iframeDocument, {
858
+ scale: 2,
859
+ backgroundColor: "#ffffff",
860
+ width,
861
+ windowWidth: width,
862
+ foreignObjectRendering: false,
863
+ imageTimeout: 3e4,
864
+ logging: false,
865
+ allowTaint: false,
866
+ useCORS: true,
867
+ scrollY: 0,
868
+ ignoreElements: (el) => Array.from(el.classList).some(
869
+ (c) => c.startsWith("_DraggableComponent--hover") || c.startsWith("_ActionBar")
870
+ )
871
+ });
872
+ const image = canvas.toDataURL("image/webp", 0.8);
873
+ const blob = yield (yield fetch(image)).blob();
874
+ yield fetch(bucketUrl, { method: "PUT", body: blob });
875
+ }),
876
+ []
877
+ );
878
+ const processData = useCallback(
879
+ (dataPart) => {
880
+ switch (dataPart.type) {
881
+ case "data-new-chat-created": {
882
+ localChatId.current = dataPart.data.chatId;
883
+ return;
884
+ }
885
+ case "data-puck-actions": {
886
+ dataPart.data.forEach((action) => {
887
+ try {
888
+ puckDispatch(action);
889
+ } catch (e) {
890
+ console.error("Bad action: ", action);
891
+ console.error(e);
892
+ }
893
+ });
894
+ return;
895
+ }
896
+ case "data-build-op": {
897
+ const data = dataPart.data;
898
+ q.queue(() => {
899
+ const puck = getPuck();
900
+ if (!puck) return;
901
+ dispatchOp(data, {
902
+ getState: () => {
903
+ var _a;
904
+ return (_a = puck.__private) == null ? void 0 : _a.appState;
905
+ },
906
+ dispatchAction: puck.dispatch,
907
+ config: puck.config
908
+ });
909
+ });
910
+ return;
911
+ }
912
+ case "data-tool-status": {
913
+ const { toolCallId, status: toolSt } = dataPart.data;
914
+ setToolStatus((s) => __spreadProps(__spreadValues({}, s), { [toolCallId]: toolSt }));
915
+ return;
916
+ }
917
+ case "data-send-screenshot": {
918
+ const { urls } = dataPart.data;
919
+ urls.forEach((obj) => {
920
+ const entries = Object.entries(obj);
921
+ if (entries.length === 0) return;
922
+ const [key, value] = entries[0];
923
+ const breakpoint = Number(key);
924
+ uploadScreenshot(breakpoint, value);
925
+ });
926
+ return;
927
+ }
928
+ default:
929
+ console.warn("dataPart without case:", dataPart);
930
+ return;
931
+ }
932
+ },
933
+ [getPuck, puckDispatch, uploadScreenshot]
934
+ );
935
+ const { messages, status, sendMessage, regenerate, setMessages } = useChat({
936
+ generateId: () => prefixedUlid("msg"),
937
+ messages: [],
938
+ transport: new DefaultChatTransport({
939
+ api: host,
940
+ prepareSendMessagesRequest: (opts) => __async(null, null, function* () {
941
+ var _a, _b, _c, _d;
942
+ const puck = getPuck();
943
+ const config = (_a = puck == null ? void 0 : puck.config) != null ? _a : { components: {} };
944
+ const appState = (_b = puck == null ? void 0 : puck.appState) != null ? _b : { data: { root: { props: {} }, content: [], zones: {} } };
945
+ const root = (_c = config.root) != null ? _c : {
946
+ fields: {
947
+ title: {
948
+ type: "text",
949
+ ai: { instructions: "The title for the page" }
950
+ }
951
+ }
952
+ };
953
+ const configWithRoot = __spreadProps(__spreadValues({}, config), { root });
954
+ const defaultBody = __spreadValues(__spreadValues(__spreadProps(__spreadValues({}, opts.body), {
955
+ chatId: localChatId.current,
956
+ trigger: opts.trigger,
957
+ messages: opts.messages,
958
+ pageData: appState.data,
959
+ config: configWithRoot
960
+ }), targetComponentRef.current ? { selectedComponentId: targetComponentRef.current.id } : {}), pendingSendImagesRef.current.length > 0 ? (() => {
961
+ const imgs = pendingSendImagesRef.current;
962
+ pendingSendImagesRef.current = [];
963
+ return { images: imgs };
964
+ })() : {});
965
+ const defaultOptions = {
966
+ headers: opts.headers,
967
+ credentials: opts.credentials,
968
+ body: defaultBody
969
+ };
970
+ if (prepareRequest) {
971
+ const userOptions = yield prepareRequest(defaultOptions);
972
+ return {
973
+ headers: __spreadValues(__spreadValues({}, defaultOptions.headers), userOptions.headers),
974
+ credentials: (_d = userOptions.credentials) != null ? _d : defaultOptions.credentials,
975
+ body: __spreadValues(__spreadValues({}, defaultBody), userOptions.body)
976
+ };
977
+ }
978
+ return {
979
+ headers: defaultOptions.headers,
980
+ credentials: defaultOptions.credentials,
981
+ body: defaultBody
982
+ };
983
+ })
984
+ }),
985
+ onData: processData,
986
+ onError: (e) => {
987
+ console.error(e);
988
+ setError(e.message);
989
+ },
990
+ onFinish: () => {
991
+ const puck = getPuck();
992
+ if (puck == null ? void 0 : puck.appState) {
993
+ puckDispatch({ type: "set", state: puck.appState, recordHistory: true });
994
+ }
995
+ }
996
+ });
997
+ const [forcedStatus, setForcedStatus] = useState();
998
+ const resolvedStatus = useMemo(
999
+ () => forcedStatus != null ? forcedStatus : status,
1000
+ [status, forcedStatus]
1001
+ );
1002
+ const [promptValue, setPromptValue] = useState("");
1003
+ const [attachedImages, setAttachedImages] = useState([]);
1004
+ const pendingSendImagesRef = useRef([]);
1005
+ const [targetComponent, setTargetComponent] = useState(null);
1006
+ const targetComponentRef = useRef(null);
1007
+ useEffect(() => {
1008
+ targetComponentRef.current = targetComponent;
1009
+ }, [targetComponent]);
1010
+ useEffect(() => {
1011
+ window.__PUCK_AI = {
1012
+ processData,
1013
+ setMessages,
1014
+ setStatus: setForcedStatus,
1015
+ sendMessage,
1016
+ setPrompt: (value) => {
1017
+ var _a;
1018
+ setPromptValue(value);
1019
+ (_a = inputRef.current) == null ? void 0 : _a.focus();
1020
+ },
1021
+ setTargetComponent: (target) => {
1022
+ var _a;
1023
+ setTargetComponent(target);
1024
+ (_a = inputRef.current) == null ? void 0 : _a.focus();
1025
+ }
1026
+ };
1027
+ }, [processData, setMessages, sendMessage]);
1028
+ const handleSubmit = (prompt) => {
1029
+ const text = prompt.trim();
1030
+ if (chat == null ? void 0 : chat.onSubmit) {
1031
+ chat.onSubmit(text);
1032
+ return;
1033
+ }
1034
+ if (!text && attachedImages.length === 0) return;
1035
+ setError("");
1036
+ setPromptValue("");
1037
+ pendingSendImagesRef.current = attachedImages.map((img) => img.dataUrl);
1038
+ setAttachedImages([]);
1039
+ sendMessage({ text }).catch((e) => {
1040
+ console.error(e);
1041
+ });
1042
+ };
1043
+ const messagesWithStatuses = useMemo(() => {
1044
+ return messages.map((msg) => __spreadProps(__spreadValues({}, msg), {
1045
+ parts: msg.parts.map((part) => {
1046
+ if ("toolCallId" in part) {
1047
+ return __spreadProps(__spreadValues({}, part), { status: toolStatus[part.toolCallId] });
1048
+ }
1049
+ return part;
1050
+ })
1051
+ }));
1052
+ }, [messages, toolStatus]);
1053
+ return /* @__PURE__ */ jsxs("div", { className: "puck-ai-chat", ref: pluginRef, children: [
1054
+ /* @__PURE__ */ jsx("div", { className: "puck-ai-chat-header", children: "AI page builder" }),
1055
+ /* @__PURE__ */ jsx(ToolStatusProvider, { value: toolStatus, children: /* @__PURE__ */ jsx(
1056
+ ChatBody,
1057
+ {
1058
+ messages: messagesWithStatuses,
1059
+ handleSubmit,
1060
+ inputRef,
1061
+ status: resolvedStatus,
1062
+ examplePrompts: examplePrompts == null ? void 0 : examplePrompts.map(({ label, href, onClick }) => /* @__PURE__ */ jsx(ExamplePrompt, { label, href, onClick }, label)),
1063
+ error,
1064
+ handleRetry: () => {
1065
+ setError("");
1066
+ regenerate();
1067
+ },
1068
+ promptValue,
1069
+ targetComponent,
1070
+ onClearTarget: () => setTargetComponent(null),
1071
+ images: attachedImages,
1072
+ onImagesChange: setAttachedImages,
1073
+ children: /* @__PURE__ */ jsx(Placeholder, { dispatch: puckDispatch, inputRef, pluginRef })
1074
+ }
1075
+ ) })
1076
+ ] });
1077
+ }
1078
+ function createAiPlugin(opts = {}) {
1079
+ const { scrollTracking = true, host, chat, prepareRequest } = opts;
1080
+ return {
1081
+ label: "AI",
1082
+ name: "ai",
1083
+ icon: /* @__PURE__ */ jsx(Bot, {}),
1084
+ mobilePanelHeight: "min-content",
1085
+ render: () => /* @__PURE__ */ jsx(Chat, { host, chat, prepareRequest }),
1086
+ overrides: {
1087
+ preview: ({ children }) => {
1088
+ if (scrollTracking) {
1089
+ return /* @__PURE__ */ jsx(ScrollTracking, { children });
1090
+ }
1091
+ return /* @__PURE__ */ jsx(Fragment, { children });
1092
+ }
1093
+ }
1094
+ };
1095
+ }
1096
+ var index_default = createAiPlugin;
1097
+ export {
1098
+ Chat,
1099
+ createAiPlugin,
1100
+ index_default as default
1101
+ };
1102
+ /*! Bundled license information:
1103
+
1104
+ lucide-react/dist/esm/shared/src/utils.js:
1105
+ lucide-react/dist/esm/defaultAttributes.js:
1106
+ lucide-react/dist/esm/Icon.js:
1107
+ lucide-react/dist/esm/createLucideIcon.js:
1108
+ lucide-react/dist/esm/icons/arrow-up.js:
1109
+ lucide-react/dist/esm/icons/bot.js:
1110
+ lucide-react/dist/esm/icons/check.js:
1111
+ lucide-react/dist/esm/icons/image.js:
1112
+ lucide-react/dist/esm/icons/rotate-ccw.js:
1113
+ lucide-react/dist/esm/icons/triangle-alert.js:
1114
+ lucide-react/dist/esm/icons/x.js:
1115
+ lucide-react/dist/esm/lucide-react.js:
1116
+ (**
1117
+ * @license lucide-react v0.452.0 - ISC
1118
+ *
1119
+ * This source code is licensed under the ISC license.
1120
+ * See the LICENSE file in the root directory of this source tree.
1121
+ *)
1122
+ */
1123
+ //# sourceMappingURL=index.mjs.map