@brainfish-ai/components 0.0.39 → 0.0.41

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../node_modules/style-inject/dist/style-inject.es.js","../../node_modules/tslib/tslib.es6.js","../../node_modules/@radix-ui/react-compose-refs/dist/index.mjs","../../node_modules/@radix-ui/react-slot/dist/index.mjs","../../src/lib/utils.ts","../../src/components/ui/button.tsx","../../src/components/ui/dropdown-menu.tsx","../../src/components/ui/tooltip.tsx","../../src/components/chat-search/Suggestions.tsx","../../src/components/markdown/utils/codeblock.ts","../../src/components/markdown/CodeBlock.tsx","../../src/components/markdown/Frame.tsx","../../src/components/markdown/embeds/Loom.tsx","../../src/components/markdown/embeds/Supademo.tsx","../../src/components/markdown/embeds/Typeform.tsx","../../src/components/markdown/embeds/Vimeo.tsx","../../src/components/markdown/embeds/Wistia.tsx","../../src/components/markdown/embeds/Youtube.tsx","../../src/components/markdown/embeds/index.tsx","../../src/components/markdown/MemoizedReactMarkdown.tsx","../../src/components/markdown/MermaidDiagram.tsx","../../src/components/markdown/ZoomableImage.tsx","../../src/components/markdown/FormattedMessage.tsx","../../src/components/markdown/utils/stripNewLines.ts","../../src/components/ui/feedback.tsx","../../src/components/ui/generating-star.tsx","../../src/components/chat-search/SearchResults.tsx","../../src/components/chat-search/FollowUpQuestions.tsx","../../src/components/chat-search/TimelineNavigation.tsx","../../src/components/chat-search/ScrollToBottomArrow.tsx","../../src/lib/fetchClient.ts","../../src/lib/api.ts","../../src/components/chat-search/theme.ts","../../src/components/chat-search/text-config.ts","../../src/components/chat-search/ChatSearch.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n function next() {\r\n while (env.stack.length) {\r\n var rec = env.stack.pop();\r\n try {\r\n var result = rec.dispose && rec.dispose.call(rec.value);\r\n if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n};\r\n","// packages/react/compose-refs/src/composeRefs.tsx\nimport * as React from \"react\";\nfunction setRef(ref, value) {\n if (typeof ref === \"function\") {\n return ref(value);\n } else if (ref !== null && ref !== void 0) {\n ref.current = value;\n }\n}\nfunction composeRefs(...refs) {\n return (node) => {\n let hasCleanup = false;\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node);\n if (!hasCleanup && typeof cleanup == \"function\") {\n hasCleanup = true;\n }\n return cleanup;\n });\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < cleanups.length; i++) {\n const cleanup = cleanups[i];\n if (typeof cleanup == \"function\") {\n cleanup();\n } else {\n setRef(refs[i], null);\n }\n }\n };\n }\n };\n}\nfunction useComposedRefs(...refs) {\n return React.useCallback(composeRefs(...refs), refs);\n}\nexport {\n composeRefs,\n useComposedRefs\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/slot/src/Slot.tsx\nimport * as React from \"react\";\nimport { composeRefs } from \"@radix-ui/react-compose-refs\";\nimport { Fragment, jsx } from \"react/jsx-runtime\";\nvar Slot = React.forwardRef((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n const childrenArray = React.Children.toArray(children);\n const slottable = childrenArray.find(isSlottable);\n if (slottable) {\n const newElement = slottable.props.children;\n const newChildren = childrenArray.map((child) => {\n if (child === slottable) {\n if (React.Children.count(newElement) > 1) return React.Children.only(null);\n return React.isValidElement(newElement) ? newElement.props.children : null;\n } else {\n return child;\n }\n });\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });\n }\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });\n});\nSlot.displayName = \"Slot\";\nvar SlotClone = React.forwardRef((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n if (React.isValidElement(children)) {\n const childrenRef = getElementRef(children);\n return React.cloneElement(children, {\n ...mergeProps(slotProps, children.props),\n // @ts-ignore\n ref: forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef\n });\n }\n return React.Children.count(children) > 1 ? React.Children.only(null) : null;\n});\nSlotClone.displayName = \"SlotClone\";\nvar Slottable = ({ children }) => {\n return /* @__PURE__ */ jsx(Fragment, { children });\n};\nfunction isSlottable(child) {\n return React.isValidElement(child) && child.type === Slottable;\n}\nfunction mergeProps(slotProps, childProps) {\n const overrideProps = { ...childProps };\n for (const propName in childProps) {\n const slotPropValue = slotProps[propName];\n const childPropValue = childProps[propName];\n const isHandler = /^on[A-Z]/.test(propName);\n if (isHandler) {\n if (slotPropValue && childPropValue) {\n overrideProps[propName] = (...args) => {\n childPropValue(...args);\n slotPropValue(...args);\n };\n } else if (slotPropValue) {\n overrideProps[propName] = slotPropValue;\n }\n } else if (propName === \"style\") {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue };\n } else if (propName === \"className\") {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(\" \");\n }\n }\n return { ...slotProps, ...overrideProps };\n}\nfunction getElementRef(element) {\n let getter = Object.getOwnPropertyDescriptor(element.props, \"ref\")?.get;\n let mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.ref;\n }\n getter = Object.getOwnPropertyDescriptor(element, \"ref\")?.get;\n mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.props.ref;\n }\n return element.props.ref || element.ref;\n}\nvar Root = Slot;\nexport {\n Root,\n Slot,\n Slottable\n};\n//# sourceMappingURL=index.mjs.map\n","import { useRef } from 'react';\nimport { clsx } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\nexport function cn(...inputs) {\n return twMerge(clsx(inputs));\n}\nlet globalId = 0;\nconst genId = () => ++globalId;\nexport function useId(prefix) {\n const idRef = useRef();\n if (idRef.current === undefined) {\n idRef.current = `${prefix || 'id'}-${genId()}`;\n }\n return idRef.current;\n}\nexport function isAnswerUncertain(response) {\n // Define uncertainty patterns for various languages\n const uncertaintyPatternsByLanguage = {\n en: [\n /i(?:\\s|['\\u2018\\u2019])?m(?:\\s+really)?\\s+not\\s+sure/i,\n /i(?:\\s+am)?(?:\\s+really)?\\s+not\\s+sure/i,\n /i\\s+don(?:['\\u2018\\u2019])?t\\s+know/i,\n /it(?:['\\u2018\\u2019]s| is) unclear/i,\n /cannot determine/i,\n /hard to say/i,\n /difficult to determine/i,\n /need more information/i,\n ],\n es: [/no (?:lo )?sé/i, /no estoy seguro/i, /no es claro/i, /desconocido/i],\n fr: [/je ne sais pas/i, /je ne suis pas sûr/i, /ce n'est pas clair/i, /inconnu/i],\n de: [/ich weiß nicht/i, /ich bin nicht sicher/i, /es ist unklar/i, /unbekannt/i],\n it: [/non lo so/i, /non sono sicuro/i, /non è chiaro/i, /sconosciuto/i],\n pt: [/não sei/i, /não tenho certeza/i, /não está claro/i, /desconhecido/i],\n nl: [/ik weet het niet/i, /ik weet niet zeker/i, /het is onduidelijk/i, /onbekend/i],\n pl: [/nie wiem/i, /nie jestem pewien/i, /to nie jest jasne/i, /nieznany/i],\n ru: [/я не знаю/i, /я не уверен/i, /это не ясно/i, /неизвестно/i],\n ja: [/知りません/i, /よくわからない/i, /不明です/i, /未知/i],\n ko: [/모릅니다/i, /잘 모르겠습니다/i, /불확실합니다/i, /알 수 없음/i],\n zh: [/我不知道/i, /我不确定/i, /不清楚/i, /未知/i],\n 'zh-TW': [/我不知道/i, /我不確定/i, /不清楚/i, /未知/i],\n };\n let earliestMatch = null;\n // Find the earliest match across all languages\n for (const [language, patterns] of Object.entries(uncertaintyPatternsByLanguage)) {\n for (const pattern of patterns) {\n const match = response.match(pattern);\n if (match && (earliestMatch === null || match.index < earliestMatch.index)) {\n earliestMatch = { index: match.index, language };\n }\n }\n }\n return earliestMatch ? { uncertain: true, language: earliestMatch.language } : { uncertain: false, language: null };\n}\n","import { __rest } from \"tslib\";\nimport * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva } from \"class-variance-authority\";\nimport { cn } from \"@/lib/utils\";\nconst buttonVariants = cva(\"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\", {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground shadow hover:bg-primary/90\",\n destructive: \"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90\",\n outline: \"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground\",\n secondary: \"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n size: {\n default: \"h-9 px-4 py-2\",\n sm: \"h-8 rounded-md px-3 text-xs\",\n lg: \"h-10 rounded-md px-8\",\n icon: \"h-9 w-9\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n});\nconst Button = React.forwardRef((_a, ref) => {\n var { className, variant, size, asChild = false } = _a, props = __rest(_a, [\"className\", \"variant\", \"size\", \"asChild\"]);\n const Comp = asChild ? Slot : \"button\";\n return (React.createElement(Comp, Object.assign({ className: cn(buttonVariants({ variant, size, className })), ref: ref }, props)));\n});\nButton.displayName = \"Button\";\nexport { Button, buttonVariants };\n","import { __rest } from \"tslib\";\nimport * as React from \"react\";\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport { cn } from \"@/lib/utils\";\nimport { CheckIcon, ChevronRightIcon, DotFilledIcon } from \"@radix-ui/react-icons\";\nconst DropdownMenu = DropdownMenuPrimitive.Root;\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group;\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal;\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub;\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\nconst DropdownMenuSubTrigger = React.forwardRef((_a, ref) => {\n var { className, inset, children } = _a, props = __rest(_a, [\"className\", \"inset\", \"children\"]);\n return (React.createElement(DropdownMenuPrimitive.SubTrigger, Object.assign({ ref: ref, className: cn(\"flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\", inset && \"pl-8\", className) }, props),\n children,\n React.createElement(ChevronRightIcon, { className: \"ml-auto\" })));\n});\nDropdownMenuSubTrigger.displayName =\n DropdownMenuPrimitive.SubTrigger.displayName;\nconst DropdownMenuSubContent = React.forwardRef((_a, ref) => {\n var { className } = _a, props = __rest(_a, [\"className\"]);\n return (React.createElement(DropdownMenuPrimitive.SubContent, Object.assign({ ref: ref, className: cn(\"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\", className) }, props)));\n});\nDropdownMenuSubContent.displayName =\n DropdownMenuPrimitive.SubContent.displayName;\nconst DropdownMenuContent = React.forwardRef((_a, ref) => {\n var { className, sideOffset = 4 } = _a, props = __rest(_a, [\"className\", \"sideOffset\"]);\n return (React.createElement(DropdownMenuPrimitive.Portal, null,\n React.createElement(DropdownMenuPrimitive.Content, Object.assign({ ref: ref, sideOffset: sideOffset, className: cn(\"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md\", \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\", className) }, props))));\n});\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;\nconst DropdownMenuItem = React.forwardRef((_a, ref) => {\n var { className, inset } = _a, props = __rest(_a, [\"className\", \"inset\"]);\n return (React.createElement(DropdownMenuPrimitive.Item, Object.assign({ ref: ref, className: cn(\"relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0\", inset && \"pl-8\", className) }, props)));\n});\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;\nconst DropdownMenuCheckboxItem = React.forwardRef((_a, ref) => {\n var { className, children, checked } = _a, props = __rest(_a, [\"className\", \"children\", \"checked\"]);\n return (React.createElement(DropdownMenuPrimitive.CheckboxItem, Object.assign({ ref: ref, className: cn(\"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\", className), checked: checked }, props),\n React.createElement(\"span\", { className: \"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\" },\n React.createElement(DropdownMenuPrimitive.ItemIndicator, null,\n React.createElement(CheckIcon, { className: \"h-4 w-4\" }))),\n children));\n});\nDropdownMenuCheckboxItem.displayName =\n DropdownMenuPrimitive.CheckboxItem.displayName;\nconst DropdownMenuRadioItem = React.forwardRef((_a, ref) => {\n var { className, children } = _a, props = __rest(_a, [\"className\", \"children\"]);\n return (React.createElement(DropdownMenuPrimitive.RadioItem, Object.assign({ ref: ref, className: cn(\"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\", className) }, props),\n React.createElement(\"span\", { className: \"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\" },\n React.createElement(DropdownMenuPrimitive.ItemIndicator, null,\n React.createElement(DotFilledIcon, { className: \"h-2 w-2 fill-current\" }))),\n children));\n});\nDropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;\nconst DropdownMenuLabel = React.forwardRef((_a, ref) => {\n var { className, inset } = _a, props = __rest(_a, [\"className\", \"inset\"]);\n return (React.createElement(DropdownMenuPrimitive.Label, Object.assign({ ref: ref, className: cn(\"px-2 py-1.5 text-sm font-semibold\", inset && \"pl-8\", className) }, props)));\n});\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;\nconst DropdownMenuSeparator = React.forwardRef((_a, ref) => {\n var { className } = _a, props = __rest(_a, [\"className\"]);\n return (React.createElement(DropdownMenuPrimitive.Separator, Object.assign({ ref: ref, className: cn(\"-mx-1 my-1 h-px bg-muted\", className) }, props)));\n});\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;\nconst DropdownMenuShortcut = (_a) => {\n var { className } = _a, props = __rest(_a, [\"className\"]);\n return (React.createElement(\"span\", Object.assign({ className: cn(\"ml-auto text-xs tracking-widest opacity-60\", className) }, props)));\n};\nDropdownMenuShortcut.displayName = \"DropdownMenuShortcut\";\nexport { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuGroup, DropdownMenuPortal, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuRadioGroup, };\n","import { __rest } from \"tslib\";\nimport * as React from \"react\";\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\nimport { cn } from \"@/lib/utils\";\nconst TooltipProvider = (_a) => {\n var { delayDuration = 200 } = _a, props = __rest(_a, [\"delayDuration\"]);\n return (React.createElement(TooltipPrimitive.Provider, Object.assign({ delayDuration: delayDuration }, props)));\n};\nconst Tooltip = TooltipPrimitive.Root;\nconst TooltipTrigger = TooltipPrimitive.Trigger;\nconst TooltipContent = React.forwardRef((_a, ref) => {\n var { className, sideOffset = 4, background, textColor, borderColor, style } = _a, props = __rest(_a, [\"className\", \"sideOffset\", \"background\", \"textColor\", \"borderColor\", \"style\"]);\n return (React.createElement(TooltipPrimitive.Portal, null,\n React.createElement(TooltipPrimitive.Content, Object.assign({ ref: ref, sideOffset: sideOffset, className: cn(\"z-50 overflow-hidden rounded-lg px-4 py-3 text-sm font-medium shadow-lg animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\", className), style: Object.assign(Object.assign({}, style), { backgroundColor: background || '#ffffff', color: textColor || 'rgb(31 41 55)', borderColor: borderColor || 'rgb(243 244 246)', borderWidth: '1px', borderStyle: 'solid' }) }, props))));\n});\nTooltipContent.displayName = TooltipPrimitive.Content.displayName;\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };\n","import React from 'react';\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from '../ui/tooltip';\nexport function Suggestions({ suggestions, onQuestionClick, borderColor, title = 'Suggested questions', }) {\n if (!suggestions || suggestions.length === 0)\n return null;\n return (React.createElement(\"div\", { className: \"w-full\" },\n React.createElement(\"h3\", { className: \"text-base font-medium mb-4 text-gray-900\" }, title),\n React.createElement(\"div\", { className: \"flex flex-wrap gap-2\" }, suggestions.map((suggestion) => (React.createElement(\"button\", { key: suggestion.id, onClick: () => onQuestionClick(suggestion), className: \"px-4 py-2 rounded-lg border border-gray-300 text-gray-700 hover:bg-gray-50 transition-colors duration-200 text-sm flex items-center gap-2\", style: { borderColor } },\n suggestion.messageCount !== undefined && (React.createElement(TooltipProvider, null,\n React.createElement(Tooltip, null,\n React.createElement(TooltipTrigger, { asChild: true },\n React.createElement(\"span\", { className: \"bg-gray-100 text-gray-600 px-2 py-0.5 rounded-full text-xs min-w-[20px] border flex items-center justify-center\", style: { borderColor } }, suggestion.messageCount)),\n React.createElement(TooltipContent, null,\n React.createElement(\"p\", null,\n suggestion.messageCount,\n \" messages in this conversation\"))))),\n React.createElement(\"span\", null, suggestion.question)))))));\n}\nexport default Suggestions;\n","export const programmingLanguages = {\n javascript: '.js',\n python: '.py',\n java: '.java',\n c: '.c',\n cpp: '.cpp',\n 'c++': '.cpp',\n 'c#': '.cs',\n ruby: '.rb',\n php: '.php',\n swift: '.swift',\n 'objective-c': '.m',\n kotlin: '.kt',\n typescript: '.ts',\n go: '.go',\n perl: '.pl',\n rust: '.rs',\n scala: '.scala',\n haskell: '.hs',\n lua: '.lua',\n shell: '.sh',\n sql: '.sql',\n html: '.html',\n css: '.css',\n // add more file extensions here, make sure the key is same as language prop in CodeBlock.tsx component\n};\nexport const generateRandomString = (length, lowercase = false) => {\n const chars = 'ABCDEFGHJKLMNPQRSTUVWXY3456789'; // excluding similar looking characters like Z, 2, I, 1, O, 0\n let result = '';\n for (let i = 0; i < length; i += 1) {\n result += chars.charAt(Math.floor(Math.random() * chars.length));\n }\n return lowercase ? result.toLowerCase() : result;\n};\n","import { __awaiter } from \"tslib\";\nimport React, { memo, useState } from 'react';\nimport { CheckCircle, Clipboard, Download } from 'lucide-react';\nimport { Prism } from 'react-syntax-highlighter';\nimport { a11yDark } from 'react-syntax-highlighter/dist/cjs/styles/prism';\nimport { Button } from '../ui/button';\nimport { generateRandomString, programmingLanguages } from './utils/codeblock';\nconst HighlighterComponent = Prism;\nexport const CodeBlock = memo(({ language, value }) => {\n const [isCopied, setIsCopied] = useState(false);\n const copyToClipboard = () => __awaiter(void 0, void 0, void 0, function* () {\n if (!navigator.clipboard || !navigator.clipboard.writeText) {\n return;\n }\n try {\n yield navigator.clipboard.writeText(value);\n setIsCopied(true);\n setTimeout(() => {\n setIsCopied(false);\n }, 2000);\n }\n catch (error) {\n console.error('Failed to copy:', error);\n }\n });\n const downloadAsFile = () => {\n const fileExtension = programmingLanguages[language] || '.file';\n const suggestedFileName = `file-${generateRandomString(3, true)}${fileExtension}`;\n const fileName = suggestedFileName;\n const blob = new Blob([value], { type: 'text/plain' });\n const url = URL.createObjectURL(blob);\n const link = document.createElement('a');\n link.download = fileName;\n link.href = url;\n link.style.display = 'none';\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n URL.revokeObjectURL(url);\n };\n return (React.createElement(\"div\", { className: \"relative font-sans text-sm mt-1\" },\n React.createElement(\"div\", { className: \"relative rounded-t-lg bg-zinc-800/80 font-sans text-sm backdrop-blur\" },\n React.createElement(\"div\", { className: \"flex h-8 items-center justify-between px-3\" },\n React.createElement(\"span\", { className: \"text-xs font-medium text-zinc-400\" }, language),\n React.createElement(\"div\", { className: \"flex gap-1\" },\n React.createElement(Button, { variant: \"ghost\", size: \"icon\", className: \"size-5 text-zinc-400 hover:bg-zinc-700/50 hover:text-zinc-100\", onClick: () => void copyToClipboard() }, isCopied ? React.createElement(CheckCircle, { size: 18 }) : React.createElement(Clipboard, { size: 18 })),\n React.createElement(Button, { variant: \"ghost\", size: \"icon\", className: \"size-5 text-zinc-400 hover:bg-zinc-700/50 hover:text-zinc-100\", onClick: downloadAsFile },\n React.createElement(Download, { size: 18 }))))),\n React.createElement(\"div\", { className: \"rounded-b-lg\" },\n React.createElement(HighlighterComponent, { language: language, style: a11yDark, PreTag: \"div\", wrapLongLines: true, customStyle: {\n margin: 0,\n borderTopLeftRadius: 0,\n borderTopRightRadius: 0,\n } }, value))));\n});\nCodeBlock.displayName = 'CodeBlock';\n","import * as React from 'react';\n// eslint-disable-next-line react/display-name\nconst Frame = React.forwardRef(({ src, border, width = '100%', height = '400px', title }, ref) => {\n const [isLoaded, setIsLoaded] = React.useState(false);\n const [iframeLoaded, setIframeLoaded] = React.useState(false);\n React.useEffect(() => {\n let mounted = true;\n setTimeout(() => {\n if (mounted) {\n setIsLoaded(true);\n }\n }, 0);\n return () => {\n mounted = false;\n };\n }, []);\n return (React.createElement(\"div\", { className: `overflow-hidden rounded-lg mt-4 ${border ? 'border' : ''}`, style: {\n width,\n height,\n } }, isLoaded && (React.createElement(React.Fragment, null,\n React.createElement(\"div\", { className: `relative w-full h-full ${!iframeLoaded ? 'block' : 'hidden'}` },\n React.createElement(\"div\", { className: \"absolute inset-0 bg-muted/10 rounded-lg\" },\n React.createElement(\"div\", { className: \"absolute inset-0\" },\n React.createElement(\"div\", { className: \"h-full w-full shimmer\" }),\n React.createElement(\"div\", { className: \"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 flex flex-col items-center gap-2\" },\n React.createElement(\"div\", { className: \"modern-spinner\" }),\n React.createElement(\"div\", { className: \"text-sm text-muted-foreground\" }, \"Loading...\"))))),\n React.createElement(\"div\", { className: !iframeLoaded ? 'invisible' : 'visible' },\n React.createElement(\"iframe\", { ref: ref, src: src, sandbox: \"allow-same-origin allow-scripts allow-popups allow-forms allow-downloads\", width: width, height: height, frameBorder: \"0\", title: \"embed\", loading: \"lazy\", allowFullScreen: true, className: \"block rounded-lg\", onLoad: () => setIframeLoaded(true) }),\n title && React.createElement(\"span\", { className: \"block text-center text-sm font-medium\" }, title))))));\n});\nexport default Frame;\n","import * as React from 'react';\nimport Frame from '../Frame';\nfunction Loom(props) {\n const normalizedUrl = props.attrs.href.replace('share', 'embed');\n return React.createElement(Frame, Object.assign({}, props, { src: normalizedUrl, title: \"Loom Embed\" }));\n}\nLoom.isMatch = (href) => {\n const loomRegex = /^https:\\/\\/(www\\.)?(use)?loom\\.com\\/(embed|share)\\/(.*)$/;\n return loomRegex.test(href);\n};\nexport default Loom;\n","import * as React from 'react';\nimport Frame from '../Frame';\nfunction Supademo(props) {\n return React.createElement(Frame, Object.assign({}, props, { src: props.attrs.href, title: \"Supademo Embed\" }));\n}\nSupademo.isMatch = (href) => {\n const urlRegex = /^https:\\/\\/app\\.supademo\\.com\\/embed\\/(.*)$/;\n return urlRegex.test(href);\n};\nexport default Supademo;\n","import * as React from 'react';\nimport Frame from '../Frame';\nfunction Typeform(props) {\n return React.createElement(Frame, Object.assign({}, props, { src: props.attrs.href, title: \"Typeform Embed\" }));\n}\n// Static method to check if the URL matches the Typeform embed pattern\nTypeform.isMatch = (href) => {\n const urlRegex = /^https:\\/\\/([A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)\\.typeform\\.com\\/to\\/(.*)$/;\n return urlRegex.test(href);\n};\nexport default Typeform;\n","import * as React from 'react';\nimport Frame from '../Frame';\nfunction Vimeo(props) {\n // Extract matches directly within the component\n const extractMatches = (href) => {\n const regex = /(http|https)?:\\/\\/(www\\.)?vimeo\\.com\\/(?:channels\\/(?:\\w+\\/)?|groups\\/([^/]*)\\/videos\\/|)(\\d+)(?:\\/|\\?)?([\\d\\w]+)?/;\n return href.match(regex);\n };\n // Extract the matches from the URL\n const matches = extractMatches(props.attrs.href);\n if (!matches)\n return null; // If no match is found, return null\n const videoId = matches[4];\n const hId = matches[5];\n // Construct the Vimeo embed URL\n const embedUrl = `https://player.vimeo.com/video/${videoId}?byline=0${hId ? `&h=${hId}` : ''}`;\n return (React.createElement(Frame, Object.assign({}, props, { src: embedUrl, title: `Vimeo Embed (${videoId})`, height: \"412px\", border: false })));\n}\nVimeo.isMatch = (href) => {\n const regex = /^(https?):\\/\\/(www\\.)?vimeo\\.com\\/(?:channels\\/(?:\\w+\\/)?|groups\\/([^/]*)\\/videos\\/|)?(\\d+)(\\/)?(?:\\?.*|#.*)?$/i;\n return regex.test(href);\n};\nexport default Vimeo;\n","import * as React from 'react';\nimport Frame from '../Frame';\nfunction Wistia(props) {\n // Function to extract matches directly within the component\n const extractMatches = (href) => {\n const urlRegexes = [\n /^https?:\\/\\/([a-zA-Z0-9-_~]+)\\.wistia\\.com\\/medias\\/([a-zA-Z0-9-_~]+)\\/?$/,\n /^https?:\\/\\/fast\\.wistia\\.com\\/embed\\/iframe\\/([a-zA-Z0-9-_~]+)\\/?$/,\n /^fast\\.wistia\\.com\\/embed\\/iframe\\/([a-zA-Z0-9-_~]+)\\/?$/,\n /^([a-zA-Z0-9-_~]+)\\.wistia\\.com\\/medias\\/([a-zA-Z0-9-_~]+)\\/?$/,\n ];\n // eslint-disable-next-line no-restricted-syntax\n for (const regex of urlRegexes) {\n const match = href.match(regex);\n if (match)\n return match;\n }\n return null;\n };\n // Extract matches from the provided URL\n const matches = extractMatches(props.attrs.href);\n if (!matches)\n return null; // If no matches are found, return null\n const domain = matches[1];\n const videoId = matches[2] || matches[1]; // Fallback for fast embed URLs\n // Determine the embed URL based on whether a domain is present\n const embedUrl = domain\n ? `https://${domain}.wistia.com/embed/iframe/${videoId}?seo=true&videoFoam=false`\n : `https://fast.wistia.com/embed/iframe/${videoId}`;\n return (React.createElement(Frame, Object.assign({}, props, { src: embedUrl, border: true, title: `Wistia Embed (${videoId})` })));\n}\nWistia.isMatch = (href) => {\n const urlRegexes = [\n /^https?:\\/\\/([a-zA-Z0-9-_~]+)\\.wistia\\.com\\/medias\\/([a-zA-Z0-9-_~]+)(\\/)?(\\?.*)?$/i,\n /^https?:\\/\\/fast\\.wistia\\.com\\/embed\\/iframe\\/([a-zA-Z0-9-_~]+)(\\/)?(\\?.*)?$/i,\n /^fast\\.wistia\\.com\\/embed\\/iframe\\/([a-zA-Z0-9-_~]+)(\\/)?(\\?.*)?$/i,\n /^([a-zA-Z0-9-_~]+)\\.wistia\\.com\\/medias\\/([a-zA-Z0-9-_~]+)(\\/)?(\\?.*)?$/i,\n ];\n return urlRegexes.some((regex) => regex.test(href));\n};\nexport default Wistia;\n","import * as React from 'react';\nimport Frame from '../Frame';\nfunction YouTube(props) {\n // Extract the video ID directly within the component\n const extractVideoId = (href) => {\n const urlRegex = /(?:https?:\\/\\/)?(?:www\\.)?youtu\\.?be(?:\\.com)?\\/?.*(?:watch|embed)?(?:.*v=|v\\/|\\/)([a-zA-Z0-9_-]{11})$/i;\n const match = href.match(urlRegex);\n return match ? match[1] : null;\n };\n // Extract video ID from the provided URL\n const videoId = extractVideoId(props.attrs.href);\n if (!videoId)\n return null; // Return null if video ID is not found\n return (React.createElement(Frame, Object.assign({}, props, { src: `https://www.youtube.com/embed/${videoId}?modestbranding=1`, title: `YouTube Embed (${videoId})` })));\n}\n// Static method to check if the URL matches the YouTube embed pattern\nYouTube.isMatch = (href) => {\n const urlRegex = /^(?:https?:\\/\\/)?(?:www\\.)?(?:youtube\\.com\\/(?:watch\\?v=|embed\\/|v\\/|shorts\\/)|youtu\\.be\\/)([a-zA-Z0-9_-]{11})(?:\\/|[?&].*)?$/i;\n return urlRegex.test(href);\n};\nexport default YouTube;\n","import * as React from 'react';\nimport { useEffect, useState } from 'react';\nimport Loom from './Loom';\nimport Supademo from './Supademo';\nimport Typeform from './Typeform';\nimport Vimeo from './Vimeo';\nimport Wistia from './Wistia';\nimport Youtube from './Youtube';\nconst syncEmbedComponents = [Loom, Supademo, Typeform, Youtube, Wistia, Vimeo];\nconst EmbedComponent = (props) => {\n const { href } = props.attrs;\n const [matched, setMatched] = useState(null);\n useEffect(() => {\n let mounted = true;\n const findMatch = () => {\n try {\n const syncMatch = syncEmbedComponents.find((Embed) => Embed.isMatch(href));\n if (syncMatch && mounted) {\n setMatched({ Component: syncMatch, props });\n }\n }\n catch (error) {\n console.error('Error finding embed match:', error);\n }\n };\n findMatch();\n return () => {\n mounted = false;\n };\n }, [href, props]);\n if (matched) {\n const { Component, props: matchedProps } = matched;\n return React.createElement(Component, Object.assign({}, matchedProps));\n }\n return null;\n};\nexport default EmbedComponent;\n","import { memo } from 'react';\nimport ReactMarkdown from 'react-markdown';\nexport const MemoizedReactMarkdown = memo(ReactMarkdown, (prevProps, nextProps) => prevProps.children === nextProps.children);\n","import { __awaiter } from \"tslib\";\nimport React, { useEffect, useRef, useState } from 'react';\nimport mermaid from 'mermaid';\nconst config = {\n startOnLoad: false,\n theme: 'default',\n securityLevel: 'loose',\n fontFamily: 'inherit',\n};\nexport const MermaidDiagram = ({ content }) => {\n const [svg, setSvg] = useState('');\n const [error, setError] = useState(null);\n const containerRef = useRef(null);\n const [isInitialized, setIsInitialized] = useState(false);\n useEffect(() => {\n const initializeMermaid = () => {\n try {\n mermaid.initialize(config);\n setIsInitialized(true);\n }\n catch (err) {\n console.error('Error initializing mermaid:', err);\n setError('Failed to initialize diagram renderer');\n }\n };\n initializeMermaid();\n }, []);\n useEffect(() => {\n if (!isInitialized)\n return;\n const renderDiagram = () => __awaiter(void 0, void 0, void 0, function* () {\n try {\n const id = `mermaid-${Math.random().toString(36).substr(2, 9)}`;\n const result = yield mermaid.render(id, content);\n setSvg(result.svg);\n setError(null);\n }\n catch (err) {\n console.error('Error rendering mermaid diagram:', err);\n setError('Failed to render diagram');\n }\n });\n void renderDiagram();\n }, [content, isInitialized]);\n if (error) {\n return (React.createElement(\"div\", { className: \"text-red-500 bg-red-50 p-4 rounded-md\" },\n error,\n React.createElement(\"pre\", { className: \"mt-2 text-sm\" }, content)));\n }\n return React.createElement(\"div\", { ref: containerRef, className: \"my-4 overflow-auto\", dangerouslySetInnerHTML: { __html: svg } });\n};\nexport default MermaidDiagram;\n","import * as React from 'react';\nimport { motion, AnimatePresence } from 'framer-motion';\nimport { Expand } from 'lucide-react';\nexport const ZoomableImage = ({ src, alt }) => {\n const [isZoomed, setIsZoomed] = React.useState(false);\n const [showFullCaption, setShowFullCaption] = React.useState(false);\n const [imageError, setImageError] = React.useState(false);\n const [isLoading, setIsLoading] = React.useState(true);\n const [dimensions, setDimensions] = React.useState({ width: 0, height: 0 });\n const imgRef = React.useRef(null);\n const toggleZoom = () => {\n setIsZoomed(!isZoomed);\n };\n const handleImageError = () => {\n setIsLoading(false);\n setImageError(true);\n };\n const handleImageLoad = () => {\n if (imgRef.current) {\n const { naturalWidth, naturalHeight } = imgRef.current;\n const maxHeight = 300;\n const aspectRatio = naturalWidth / naturalHeight;\n const height = Math.min(maxHeight, naturalHeight);\n const width = height * aspectRatio;\n setDimensions({ width, height });\n }\n setIsLoading(false);\n };\n if (!src || imageError) {\n return null;\n }\n return (React.createElement(\"figure\", { className: \"relative inline-block my-4 px-4 w-full sm:w-auto\" },\n React.createElement(\"div\", { className: \"flex items-center justify-center min-h-[100px]\" },\n React.createElement(\"button\", { type: \"button\", onClick: toggleZoom, className: \"border-0 p-0 bg-transparent relative group\", \"aria-label\": isZoomed ? 'Zoom out image' : 'Zoom in image' },\n isLoading && (React.createElement(\"div\", { className: \"rounded-md bg-gray-200 dark:bg-gray-800 animate-pulse\", style: {\n width: dimensions.width || 300,\n height: dimensions.height || 200,\n maxHeight: 300\n } })),\n React.createElement(\"img\", { ref: imgRef, src: src, alt: alt, onError: handleImageError, onLoad: handleImageLoad, className: `max-h-[300px] w-auto object-contain cursor-zoom-in hover:opacity-90 transition-opacity ${isLoading ? 'opacity-0 absolute' : 'opacity-100 relative'}` }),\n !isLoading && (React.createElement(\"div\", { className: \"absolute bottom-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity\" },\n React.createElement(\"div\", { className: \"bg-black/50 text-white p-1.5 rounded-lg\" },\n React.createElement(Expand, { size: 16 })))))),\n alt && !isLoading && (React.createElement(\"div\", { className: \"relative mt-1\" },\n React.createElement(\"figcaption\", { className: \"text-sm text-gray-600 dark:text-gray-400 text-center group cursor-default\", onMouseEnter: () => setShowFullCaption(true), onMouseLeave: () => setShowFullCaption(false) },\n React.createElement(\"div\", { className: \"line-clamp-2 hover:text-gray-700 dark:hover:text-gray-300\" }, alt)),\n showFullCaption && (React.createElement(\"div\", { className: \"absolute bottom-full left-0 right-0 mb-1 p-2 bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 text-sm text-gray-600 dark:text-gray-400 z-10\" }, alt)))),\n React.createElement(AnimatePresence, null, isZoomed && (React.createElement(React.Fragment, null,\n React.createElement(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, className: \"fixed inset-0 bg-black/80 z-50\", onClick: toggleZoom }),\n React.createElement(motion.div, { initial: { scale: 0.5, opacity: 0 }, animate: { scale: 1, opacity: 1 }, exit: { scale: 0.5, opacity: 0 }, className: \"fixed inset-0 z-50 flex flex-col items-center justify-center cursor-zoom-out gap-4 p-4 sm:p-8\", onClick: toggleZoom },\n React.createElement(\"div\", { className: \"max-w-[95vw] sm:max-w-[90vw] max-h-[80vh]\" },\n React.createElement(\"img\", { src: src, alt: alt, className: \"w-full h-full object-contain\" })),\n alt && React.createElement(\"div\", { className: \"max-w-[95vw] sm:max-w-[90vw] text-white text-center text-sm\" }, alt)))))));\n};\nexport default ZoomableImage;\n","import { __rest } from \"tslib\";\nimport React, { memo, useEffect, useState } from 'react';\nimport rehypeRaw from 'rehype-raw';\nimport remarkGfm from 'remark-gfm';\nimport { CodeBlock } from './CodeBlock';\nimport EmbedComponent from './embeds';\nimport { MemoizedReactMarkdown } from './MemoizedReactMarkdown';\nimport { MermaidDiagram } from './MermaidDiagram';\nimport { ZoomableImage } from './ZoomableImage';\nimport { stripNewLines } from './utils/stripNewLines';\nimport { isAnswerUncertain } from '../../lib/utils';\nexport const FormattedMessage = memo(({ message, isStreaming }) => {\n const [displayContent, setDisplayContent] = useState(message.content);\n useEffect(() => {\n var _a;\n const result = isAnswerUncertain(message.content);\n if (result.uncertain && result.language && ((_a = message.uncertaintyFallbackText) === null || _a === void 0 ? void 0 : _a[result.language])) {\n setDisplayContent(message.uncertaintyFallbackText[result.language]);\n }\n else {\n setDisplayContent(message.content);\n }\n }, [message.content, message.uncertaintyFallbackText, isStreaming]);\n const strippedContent = stripNewLines(displayContent);\n return (React.createElement(MemoizedReactMarkdown, { className: \"dark:prose-invert prose flex-1\", remarkPlugins: [remarkGfm], rehypePlugins: [rehypeRaw], components: {\n code: (_a) => {\n var { inline, className, children } = _a, props = __rest(_a, [\"inline\", \"className\", \"children\"]);\n const match = /language-(\\w+)/.exec(className || '');\n const language = match && match[1];\n if (!inline && (language === 'mermaid' || language === 'mermaidjs')) {\n return React.createElement(MermaidDiagram, { content: String(children).replace(/\\n$/, '') });\n }\n return !inline && language ? (React.createElement(CodeBlock, Object.assign({ key: Math.random(), language: language, value: String(children).replace(/\\n$/, '') }, props))) : (React.createElement(\"code\", Object.assign({ className: `text-red-400 bg-slate-200 border-slate-300 border rounded p-0.5 ${className}`.trim() }, props), children));\n },\n marker({ children }) {\n return (React.createElement(\"div\", { className: \"my-2\" },\n React.createElement(\"span\", { className: \"highlight\" }, children)));\n },\n table({ children }) {\n return React.createElement(\"table\", { className: \"border-collapse border border-black px-3 py-1 dark:border-white\" }, children);\n },\n th({ children }) {\n return (React.createElement(\"th\", { className: \"break-words border border-black bg-gray-500 px-3 py-1 text-white dark:border-white\" }, children));\n },\n td({ children }) {\n return React.createElement(\"td\", { className: \"break-words border border-black px-3 py-1 dark:border-white\" }, children);\n },\n a(_a) {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n if (props.href) {\n const embedComponent = EmbedComponent({\n attrs: { href: props.href },\n });\n if (React.isValidElement(embedComponent)) {\n return embedComponent;\n }\n }\n return (React.createElement(\"a\", Object.assign({ className: \"link\", target: \"_blank\", rel: \"noopener noreferrer\" }, props), children));\n },\n pre: ({ children }) => React.createElement(React.Fragment, null, children),\n img({ src, alt }) {\n const embedComponent = EmbedComponent({\n attrs: { href: src !== null && src !== void 0 ? src : '' },\n });\n if (React.isValidElement(embedComponent)) {\n return embedComponent;\n }\n return React.createElement(ZoomableImage, { src: src, alt: alt });\n },\n li: (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (React.createElement(\"li\", Object.assign({ className: \"py-1\" }, props), children));\n },\n ul({ children }) {\n return React.createElement(\"ul\", { className: \"ml-4 list-outside list-disc\" }, children);\n },\n ol({ children }) {\n return React.createElement(\"ol\", { className: \"ml-4 list-outside list-decimal\" }, children);\n },\n strong: (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (React.createElement(\"span\", Object.assign({ className: \"font-semibold\" }, props), children));\n },\n h1: (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (React.createElement(\"h1\", Object.assign({ className: \"mb-2 mt-6 text-3xl font-semibold\" }, props), children));\n },\n h2: (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (React.createElement(\"h2\", Object.assign({ className: \"mb-2 mt-6 text-2xl font-semibold\" }, props), children));\n },\n h3: (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (React.createElement(\"h3\", Object.assign({ className: \"mb-2 mt-6 text-xl font-semibold\" }, props), children));\n },\n h4: (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (React.createElement(\"h4\", Object.assign({ className: \"mb-2 mt-6 text-lg font-semibold\" }, props), children));\n },\n h5: (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (React.createElement(\"h5\", Object.assign({ className: \"mb-2 mt-6 text-base font-semibold\" }, props), children));\n },\n h6: (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (React.createElement(\"h6\", Object.assign({ className: \"mb-2 mt-6 text-sm font-semibold\" }, props), children));\n },\n } }, strippedContent));\n});\nFormattedMessage.displayName = 'FormattedMessage';\n","export const stripNewLines = (content) => content.replace(/^\\n+|(\\n+|\\\\)+$/g, '');\n","import React, { useState } from 'react';\nimport { ThumbsUp, ThumbsDown, Heart } from 'lucide-react';\nimport { motion, AnimatePresence } from 'framer-motion';\nimport { Button } from '@/components/ui/button';\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';\nexport function Feedback({ feedback, onFeedback, theme, textConfig = {}, disabled = false, }) {\n const [showHearts, setShowHearts] = useState(false);\n const handleFeedback = (response) => {\n if (onFeedback) {\n if (response === 'accept') {\n setShowHearts(true);\n setTimeout(() => setShowHearts(false), 2000);\n }\n onFeedback(response);\n }\n };\n return (React.createElement(\"div\", { className: \"flex justify-end gap-2\" },\n React.createElement(TooltipProvider, null,\n React.createElement(Tooltip, null,\n React.createElement(TooltipTrigger, { asChild: true },\n React.createElement(\"div\", { className: \"relative\" },\n React.createElement(AnimatePresence, null, showHearts && (React.createElement(React.Fragment, null,\n Array.from({ length: 8 }).map((_, i) => (React.createElement(motion.div, { key: i, className: \"absolute\", initial: { opacity: 0, scale: 0.3, x: 0, y: 0 }, animate: {\n opacity: [0, 1, 1, 0],\n scale: [0.3, 1, 1, 0],\n x: [0, Math.cos(i * (Math.PI / 4)) * 30],\n y: [0, Math.sin(i * (Math.PI / 4)) * 30],\n rotate: [0, i % 2 ? 45 : -45],\n }, transition: {\n duration: 1.2,\n ease: [0.4, 0, 0.2, 1],\n times: [0, 0.3, 0.7, 1],\n delay: i * 0.1,\n }, style: {\n top: '50%',\n left: '50%',\n transformOrigin: 'center',\n } },\n React.createElement(Heart, { className: \"w-4 h-4\", style: {\n color: '#ff4b6e',\n filter: 'drop-shadow(0 0 3px rgba(255, 75, 110, 0.8))',\n strokeWidth: 2.5,\n } })))),\n React.createElement(motion.div, { className: \"absolute inset-0 rounded-full\", initial: { opacity: 0, scale: 0.8 }, animate: {\n opacity: [0, 0.15, 0.15, 0],\n scale: [0.8, 1.8, 1.8, 2],\n }, transition: {\n duration: 1.2,\n ease: 'easeOut',\n times: [0, 0.3, 0.7, 1],\n }, style: {\n backgroundColor: theme.primary,\n } })))),\n React.createElement(Button, { variant: \"ghost\", size: \"sm\", className: `rounded-md h-8 w-8 flex items-center justify-center transition-all duration-200 transform hover:scale-105 active:scale-95 ${feedback === 'accept' ? 'bg-green-100 text-green-600 hover:bg-green-200' : ''}`, onClick: () => handleFeedback('accept'), disabled: disabled },\n React.createElement(motion.div, { initial: { scale: 1 }, animate: { scale: feedback === 'accept' ? [1, 1.2, 1] : 1 }, transition: { duration: 0.3 } },\n React.createElement(ThumbsUp, { className: \"h-4 w-4\" }))))),\n React.createElement(TooltipContent, null,\n React.createElement(\"p\", null, textConfig.positiveAnswerText || 'Helpful')))),\n React.createElement(TooltipProvider, null,\n React.createElement(Tooltip, null,\n React.createElement(TooltipTrigger, { asChild: true },\n React.createElement(Button, { variant: \"ghost\", size: \"sm\", className: `rounded-md h-8 w-8 flex items-center justify-center transition-all duration-200 transform hover:scale-105 active:scale-95 ${feedback === 'reject' ? 'bg-red-100 text-red-600 hover:bg-red-200' : ''}`, onClick: () => handleFeedback('reject'), disabled: disabled },\n React.createElement(motion.div, { initial: { scale: 1 }, animate: { scale: feedback === 'reject' ? [1, 1.2, 1] : 1 }, transition: { duration: 0.3 } },\n React.createElement(ThumbsDown, { className: \"h-4 w-4\" })))),\n React.createElement(TooltipContent, null,\n React.createElement(\"p\", null, textConfig.negativeAnswerText || 'Not helpful'))))));\n}\n","import React from \"react\";\nimport styles from \"./generating-star.module.css\";\nconst GeneratingStar = ({ loading, color = \"#000\" }) => (React.createElement(\"svg\", { width: \"24\", height: \"24\", viewBox: \"0 0 24 24\", fill: \"currentColor\", xmlns: \"http://www.w3.org/2000/svg\", className: \"mt-[-5px] inline-block flex-shrink-0\", style: { minWidth: '24px', minHeight: '24px' } },\n React.createElement(\"path\", { className: loading ? styles['animate-spin'] : '', d: \"M7.54672 16.0031L2.66234 14.2031C2.51881 14.1498 2.39502 14.0539 2.3076 13.9282C2.22019 13.8025 2.17333 13.6531 2.17333 13.5C2.17333 13.3469 2.22019 13.1975 2.3076 13.0718C2.39502 12.9461 2.51881 12.8501 2.66234 12.7969L7.54672 10.9969C7.64981 10.9589 7.74344 10.899 7.82113 10.8213C7.89882 10.7436 7.95873 10.65 7.99672 10.5469L9.79672 5.66249C9.84999 5.51896 9.94592 5.39517 10.0716 5.30775C10.1973 5.22033 10.3467 5.17348 10.4998 5.17348C10.6529 5.17348 10.8024 5.22033 10.9281 5.30775C11.0538 5.39517 11.1497 5.51896 11.203 5.66249L13.003 10.5469C13.041 10.65 13.1009 10.7436 13.1786 10.8213C13.2562 10.899 13.3499 10.9589 13.453 10.9969L18.3373 12.7969C18.4809 12.8501 18.6047 12.9461 18.6921 13.0718C18.7795 13.1975 18.8264 13.3469 18.8264 13.5C18.8264 13.6531 18.7795 13.8025 18.6921 13.9282C18.6047 14.0539 18.4809 14.1498 18.3373 14.2031L13.453 16.0031C13.3499 16.0411 13.2562 16.101 13.1786 16.1787C13.1009 16.2564 13.041 16.35 13.003 16.4531L11.203 21.3375C11.1497 21.481 11.0538 21.6048 10.9281 21.6922C10.8024 21.7796 10.6529 21.8265 10.4998 21.8265C10.3467 21.8265 10.1973 21.7796 10.0716 21.6922C9.94592 21.6048 9.84999 21.481 9.79672 21.3375L7.99672 16.4531C7.95873 16.35 7.89882 16.2564 7.82113 16.1787C7.74344 16.101 7.64981 16.0411 7.54672 16.0031Z\", stroke: color, strokeWidth: \"1.5\", strokeLinecap: \"round\", fill: loading ? color : 'none', strokeLinejoin: \"round\" }),\n React.createElement(\"path\", { d: \"M18.7497 3.75L14.2497 3.75\", stroke: color, strokeWidth: \"1.5\", strokeLinecap: \"round\", strokeLinejoin: \"round\" }),\n React.createElement(\"path\", { d: \"M16.4999 6V1.5\", stroke: color, strokeWidth: \"1.5\", strokeLinecap: \"round\", strokeLinejoin: \"round\" }),\n React.createElement(\"path\", { d: \"M22.4999 8.25001H19.4999\", stroke: color, strokeWidth: \"1.5\", strokeLinecap: \"round\", strokeLinejoin: \"round\" }),\n React.createElement(\"path\", { d: \"M20.9998 9.75002V6.75002\", stroke: color, strokeWidth: \"1.5\", strokeLinecap: \"round\", strokeLinejoin: \"round\" })));\nexport default GeneratingStar;\n","import { __awaiter } from \"tslib\";\nimport React, { useState } from 'react';\nimport { Copy, FileText, ChevronDown, Check, ExternalLink } from 'lucide-react';\nimport { FormattedMessage } from '../markdown/FormattedMessage';\nimport { Feedback } from '@/components/ui/feedback';\nimport GeneratingStar from '@/components/ui/generating-star';\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';\nexport function SearchResults({ answer, question, theme, searchResults, isStreaming = false, searchQueryId, feedback, onFeedback, disableFeedback = false, textConfig = {}, isLoading = false, isSearchLoading = false, }) {\n const [isCopied, setIsCopied] = useState(false);\n const [isExpanded, setIsExpanded] = useState(false);\n const handleCopy = () => __awaiter(this, void 0, void 0, function* () {\n try {\n yield navigator.clipboard.writeText(answer);\n setIsCopied(true);\n setTimeout(() => setIsCopied(false), 2000);\n }\n catch (err) {\n console.error('Failed to copy text:', err);\n }\n });\n const handleFeedback = (response) => {\n if (onFeedback && searchQueryId) {\n onFeedback(response);\n }\n };\n return (React.createElement(\"div\", { className: \"rounded-lg p-6 relative mx-auto max-w-3xl\", style: {\n backgroundColor: theme.cardBackground,\n borderColor: theme.border,\n borderWidth: '1px',\n borderStyle: 'solid',\n } },\n React.createElement(\"div\", { className: \"flex items-start justify-between\" },\n React.createElement(\"div\", { className: \"flex items-center gap-2 mb-4\" },\n React.createElement(\"div\", { className: \"mt-1\" },\n React.createElement(GeneratingStar, { loading: isLoading || isStreaming, color: theme.primary })),\n React.createElement(\"h2\", { className: \"text-xl leading-normal font-semibold\", style: { color: theme.text } }, question)),\n answer && (React.createElement(TooltipProvider, null,\n React.createElement(Tooltip, null,\n React.createElement(TooltipTrigger, { asChild: true },\n React.createElement(\"button\", { onClick: () => void handleCopy(), className: \"flex items-center justify-center w-8 h-8 rounded-md hover:bg-gray-100 transition-colors duration-200\" }, isCopied ? React.createElement(Check, { className: \"h-4 w-4 text-green-500\" }) : React.createElement(Copy, { className: \"h-4 w-4 text-gray-500\" }))),\n React.createElement(TooltipContent, null,\n React.createElement(\"p\", null, isCopied ? 'Copied!' : 'Copy')))))),\n isLoading ? (React.createElement(\"div\", { className: \"space-y-4\" },\n React.createElement(\"div\", { className: \"flex items-center gap-2\" },\n React.createElement(\"div\", { className: \"h-5 rounded-full w-5\", style: { backgroundColor: `${theme.primary}30` } }),\n React.createElement(\"div\", { className: \"flex items-center gap-2 text-sm\", style: { color: theme.text } }, isSearchLoading ? textConfig.loadingSearchText : textConfig.loadingAnswerText)),\n React.createElement(\"div\", { className: \"space-y-3\" },\n React.createElement(\"div\", { className: \"h-4 bg-gray-200 rounded w-3/4\", style: { backgroundColor: `${theme.border}40` } }),\n React.createElement(\"div\", { className: \"h-4 bg-gray-200 rounded w-full\", style: { backgroundColor: `${theme.border}40` } }),\n React.createElement(\"div\", { className: \"h-4 bg-gray-200 rounded w-5/6\", style: { backgroundColor: `${theme.border}40` } })),\n React.createElement(\"div\", { className: \"mt-6 space-y-3\" },\n React.createElement(\"div\", { className: \"h-4 bg-gray-200 rounded w-1/4\", style: { backgroundColor: `${theme.border}40` } }),\n React.createElement(\"div\", { className: \"flex gap-2\" },\n React.createElement(\"div\", { className: \"h-8 bg-gray-200 rounded w-32\", style: { backgroundColor: `${theme.border}40` } }),\n React.createElement(\"div\", { className: \"h-8 bg-gray-200 rounded w-40\", style: { backgroundColor: `${theme.border}40` } }))))) : answer ? (React.createElement(\"div\", { className: \"prose prose-sm max-w-none\", style: { color: theme.text } },\n React.createElement(FormattedMessage, { message: {\n content: answer,\n theme: {\n primary: theme.primary,\n text: theme.text,\n },\n uncertaintyFallbackText: textConfig.uncertaintyFallbackText,\n }, isStreaming: isStreaming }))) : (React.createElement(\"div\", { className: \"prose prose-sm max-w-none\", style: { color: theme.text } },\n React.createElement(FormattedMessage, { message: {\n content: 'Sorry, there was an error generating the answer. Please try again.',\n theme: {\n primary: theme.primary,\n text: theme.text,\n },\n }, isStreaming: isStreaming }))),\n answer && !isStreaming && !disableFeedback && (React.createElement(\"div\", { className: \"mt-2\" },\n React.createElement(Feedback, { feedback: feedback, onFeedback: handleFeedback, theme: theme, textConfig: textConfig, disabled: disableFeedback }))),\n searchResults && searchResults.length > 0 && (React.createElement(\"div\", { className: \"mt-6 rounded-lg overflow-hidden\", style: {\n backgroundColor: theme.surface,\n borderWidth: '1px',\n borderStyle: 'solid',\n borderColor: theme.border,\n } },\n React.createElement(\"button\", { onClick: () => setIsExpanded(!isExpanded), className: \"w-full flex items-center justify-between p-3 transition-all duration-200 hover:bg-opacity-50\", style: {\n color: theme.text,\n borderBottom: isExpanded ? `1px solid ${theme.surfaceBorder}` : 'none',\n } },\n React.createElement(\"div\", { className: \"flex items-center gap-2\" },\n React.createElement(FileText, { className: \"h-4 w-4 flex-shrink-0\", style: { color: theme.primary } }),\n React.createElement(\"span\", { className: \"font-medium truncate\" }, `Related Sources (${searchResults.length})`)),\n React.createElement(ChevronDown, { className: `h-4 w-4 flex-shrink-0 transition-transform duration-200 ${isExpanded ? 'rotate-180' : ''}`, style: { color: theme.text } })),\n React.createElement(\"div\", { className: \"overflow-hidden transition-all duration-200 ease-in-out\", style: {\n maxHeight: isExpanded ? `${searchResults.length * 48}px` : '0',\n opacity: isExpanded ? 1 : 0,\n transform: `translateY(${isExpanded ? '0' : '-10px'})`,\n } },\n React.createElement(\"div\", { className: \"divide-y divide-gray-200\" }, searchResults.map((result) => (React.createElement(\"a\", { key: result.id, href: result.url, target: \"_blank\", rel: \"noopener noreferrer\", className: \"flex items-center gap-2 p-3 transition-colors duration-200 hover:bg-gray-50\", style: {\n color: theme.text,\n backgroundColor: theme.surface,\n } },\n React.createElement(\"span\", { className: \"flex-grow truncate\" }, result.title),\n React.createElement(ExternalLink, { className: \"h-4 w-4 flex-shrink-0\", style: { color: `${theme.text}60` } }))))))))));\n}\n","import React from 'react';\nimport { HelpCircle, ChevronRight } from 'lucide-react';\nimport { motion } from 'framer-motion';\nexport function FollowUpQuestions({ questions, onQuestionClick, theme }) {\n if (!questions.length)\n return null;\n return (React.createElement(motion.div, { initial: { opacity: 0, y: 20 }, animate: { opacity: 1, y: 0 }, exit: { opacity: 0, y: -20 }, className: \"w-full\" },\n React.createElement(\"div\", { className: \"rounded-lg overflow-hidden\", style: {\n backgroundColor: theme.surface,\n borderWidth: '1px',\n borderStyle: 'solid',\n borderColor: theme.border,\n } },\n React.createElement(\"div\", { className: \"p-3 border-b\", style: { borderColor: theme.surfaceBorder } },\n React.createElement(\"div\", { className: \"flex items-center gap-2\" },\n React.createElement(HelpCircle, { className: \"h-4 w-4 flex-shrink-0\", style: { color: theme.primary } }),\n React.createElement(\"span\", { className: \"font-medium\" }, \"Follow-up Questions\"))),\n React.createElement(\"div\", { className: \"divide-y divide-gray-200\" }, questions.map((question, index) => (React.createElement(motion.button, { key: index, initial: { opacity: 0, x: -20 }, animate: { opacity: 1, x: 0 }, transition: { delay: index * 0.1 }, onClick: () => onQuestionClick(question), className: \"w-full flex items-center gap-2 p-3 transition-colors duration-200 hover:bg-gray-50 text-left\", style: {\n color: theme.text,\n backgroundColor: theme.surface,\n } },\n React.createElement(\"span\", { className: \"flex-grow\" }, question),\n React.createElement(ChevronRight, { className: \"h-4 w-4 flex-shrink-0\", style: { color: `${theme.text}60` } }))))))));\n}\n","import React, { useState, useEffect } from 'react';\nimport { MoreVertical } from 'lucide-react';\nimport { motion, AnimatePresence } from 'framer-motion';\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';\nexport function TimelineNavigation({ questions, activeIndex, onNavigate, theme, offset }) {\n const [prevActiveIndex, setPrevActiveIndex] = useState(activeIndex);\n useEffect(() => {\n setPrevActiveIndex(activeIndex);\n }, [activeIndex]);\n // Show 2 items before and after the active item\n const VISIBLE_ITEMS_EACH_SIDE = 2;\n const totalItems = questions.length;\n const getVisibleIndexes = () => {\n const indexes = [];\n let lastAddedIndex = null;\n const addIndex = (index) => {\n if (lastAddedIndex !== null && index - lastAddedIndex > 1) {\n indexes.push('ellipsis');\n }\n indexes.push(index);\n lastAddedIndex = index;\n };\n // Always show first item\n addIndex(0);\n // Show items around active index\n for (let i = Math.max(1, activeIndex - VISIBLE_ITEMS_EACH_SIDE); i <= Math.min(totalItems - 2, activeIndex + VISIBLE_ITEMS_EACH_SIDE); i++) {\n addIndex(i);\n }\n // Always show last item if we have more than one item\n if (totalItems > 1) {\n addIndex(totalItems - 1);\n }\n return indexes;\n };\n const visibleIndexes = getVisibleIndexes();\n return (React.createElement(\"nav\", { \"aria-label\": \"Question timeline navigation\", className: \"fixed left-4 top-1/2 -translate-y-1/2 z-40 flex flex-col gap-3\", style: Object.assign({}, (offset ? { left: `${offset}px` } : {})) },\n React.createElement(motion.div, { className: \"flex flex-col items-center space-y-3\", role: \"list\", initial: false, animate: { y: 0 }, transition: { type: 'spring', stiffness: 300, damping: 30 } },\n React.createElement(AnimatePresence, null, visibleIndexes.map((indexOrEllipsis, arrayIndex) => {\n if (indexOrEllipsis === 'ellipsis') {\n return (React.createElement(motion.div, { key: `ellipsis-${arrayIndex}`, className: \"h-8 flex items-center justify-center\", \"aria-hidden\": \"true\", initial: { opacity: 0, y: prevActiveIndex > activeIndex ? -20 : 20 }, animate: { opacity: 1, y: 0 }, exit: { opacity: 0, y: prevActiveIndex > activeIndex ? 20 : -20 }, transition: { duration: 0.2 } },\n React.createElement(MoreVertical, { className: \"w-4 h-4\", style: { color: theme.text } })));\n }\n const index = indexOrEllipsis;\n const question = questions[index];\n return (React.createElement(motion.div, { key: index, className: \"relative group isolate\", role: \"listitem\", initial: { opacity: 0, y: prevActiveIndex > activeIndex ? -20 : 20 }, animate: { opacity: 1, y: 0 }, exit: { opacity: 0, y: prevActiveIndex > activeIndex ? 20 : -20 }, transition: { duration: 0.2 }, layout: true },\n React.createElement(TooltipProvider, { delayDuration: 100 },\n React.createElement(Tooltip, null,\n React.createElement(TooltipTrigger, { asChild: true },\n React.createElement(\"button\", { onClick: () => onNavigate(index), onKeyDown: (e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n onNavigate(index);\n }\n }, className: \"flex items-center justify-center w-8 h-8 rounded-full transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 hover:opacity-90\", style: {\n backgroundColor: index === activeIndex ? theme.primary : '#ccc',\n color: index === activeIndex ? theme.background : '#333',\n cursor: 'pointer',\n '--tw-ring-color': theme.primary,\n }, \"aria-label\": `Navigate to question ${index + 1}: ${question}`, \"aria-current\": index === activeIndex ? 'step' : undefined }, index + 1)),\n React.createElement(TooltipContent, { side: \"right\", sideOffset: 8, className: \"max-w-[300px]\", background: theme.background, textColor: theme.text, borderColor: `${theme.text}33` },\n React.createElement(\"p\", { className: \"break-words leading-relaxed\" }, question))))));\n })))));\n}\n","import { ArrowDown } from 'lucide-react';\nimport React from 'react';\nimport { Button } from '@/components/ui/button';\nexport function ScrollToBottomArrow({ onClick, theme }) {\n return (React.createElement(Button, { className: \"fixed bottom-20 right-4 rounded-full p-2 transition-opacity duration-300\", style: {\n backgroundColor: theme.background,\n borderColor: theme.border,\n borderWidth: '1px',\n borderStyle: 'solid',\n boxShadow: '0 4px 6px -1px rgba(0, 0, 0, 0.1)',\n }, onClick: onClick },\n React.createElement(ArrowDown, { className: \"h-5 w-5\", style: { color: theme.text } })));\n}\n","import { __awaiter, __rest } from \"tslib\";\nconst defaultRetryOptions = {\n maxRetries: 3,\n baseDelay: 1000,\n shouldRetry: (error) => {\n // By default, retry on network errors and 5xx server errors\n if (error instanceof TypeError) {\n return true; // Network errors\n }\n const apiError = error;\n return apiError.status ? apiError.status >= 500 : false;\n },\n};\nconst defaultFallbackConfig = {\n emptyResponse: \"I apologize, but I couldn't generate an answer at this time. Please try again.\",\n errorResponse: 'I encountered an error while processing your request. Please try again.',\n};\nlet globalRetryOptions = Object.assign({}, defaultRetryOptions);\nlet globalFallbackConfig = Object.assign({}, defaultFallbackConfig);\nexport function configureRetry(options) {\n globalRetryOptions = Object.assign(Object.assign({}, defaultRetryOptions), options);\n}\nexport function configureFallback(config) {\n globalFallbackConfig = Object.assign(Object.assign({}, defaultFallbackConfig), config);\n}\nfunction delay(ms) {\n return __awaiter(this, void 0, void 0, function* () {\n return new Promise((resolve) => setTimeout(resolve, ms));\n });\n}\nexport function makeRequest(url, config = {}) {\n return __awaiter(this, void 0, void 0, function* () {\n const { retry = {}, headers = {}, body, isStream = false, fallback = {} } = config, fetchConfig = __rest(config, [\"retry\", \"headers\", \"body\", \"isStream\", \"fallback\"]);\n const retryOptions = Object.assign(Object.assign({}, globalRetryOptions), retry);\n const fallbackOptions = Object.assign(Object.assign({}, globalFallbackConfig), fallback);\n let attempt = 1;\n // eslint-disable-next-line no-constant-condition\n while (true) {\n try {\n const response = yield fetch(url, Object.assign(Object.assign({}, fetchConfig), { headers: Object.assign({ 'Content-Type': 'application/json' }, headers), body: body ? JSON.stringify(body) : undefined }));\n if (response.ok) {\n // For streaming responses, return the response object directly\n if (isStream) {\n if (!response.ok) {\n throw new Error('Failed to fetch answer');\n }\n return response;\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const data = yield response.json();\n // Check for empty response in JSON\n if (!data || (typeof data === 'object' && Object.keys(data).length === 0)) {\n const emptyError = new Error(fallbackOptions.emptyResponse);\n emptyError.name = 'EmptyResponseError';\n throw emptyError;\n }\n return data;\n }\n const error = new Error(fallbackOptions.errorResponse);\n error.status = response.status;\n error.data = yield response.json().catch(() => undefined);\n throw error;\n }\n catch (error) {\n const shouldAttemptRetry = yield Promise.resolve(retryOptions.shouldRetry(error, attempt));\n if (attempt >= retryOptions.maxRetries || !shouldAttemptRetry) {\n if (error instanceof Error && error.name === 'EmptyResponseError') {\n return { message: error.message };\n }\n throw error;\n }\n console.warn(`Request failed, attempt ${attempt} of ${retryOptions.maxRetries}. Retrying...`);\n // Exponential backoff with jitter to prevent thundering herd\n const jitter = Math.random() * 0.3 + 0.85; // Random between 0.85-1.15\n yield delay(retryOptions.baseDelay * Math.pow(2, attempt - 1) * jitter);\n attempt++;\n }\n }\n });\n}\n","import { __awaiter } from \"tslib\";\nimport { makeRequest } from './fetchClient';\n// Retry configurations for different endpoints\nconst searchRetryConfig = {\n maxRetries: 3,\n baseDelay: 300,\n shouldRetry: (error) => {\n if (error instanceof TypeError) {\n return true; // Network errors\n }\n const apiError = error;\n // Retry on server errors (5xx) and rate limits (429)\n return apiError.status ? apiError.status >= 500 || apiError.status === 429 : false;\n },\n};\nconst answerRetryConfig = {\n maxRetries: 3,\n baseDelay: 500,\n shouldRetry: (error) => {\n if (error instanceof TypeError) {\n return true; // Network errors\n }\n const apiError = error;\n // Only retry on server errors, not on client errors\n return apiError.status ? apiError.status >= 500 : false;\n },\n};\n// Helper function to generate UUID v4\nfunction uuidv4() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0;\n const v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\nexport function searchApi({ endpoint, query, collectionId, headers, conversationId, }) {\n var _a;\n return __awaiter(this, void 0, void 0, function* () {\n const payload = yield makeRequest(endpoint, {\n method: 'POST',\n headers,\n retry: searchRetryConfig,\n body: Object.assign(Object.assign({ query, limit: 5 }, (collectionId && collectionId !== 'all' && { collectionId })), (conversationId && { conversationId })),\n });\n return {\n results: payload === null || payload === void 0 ? void 0 : payload.data,\n searchQueryId: (_a = payload === null || payload === void 0 ? void 0 : payload.searchQuery) === null || _a === void 0 ? void 0 : _a.id,\n };\n });\n}\nexport function fetchAnswer({ endpoint, searchQueryId, headers, conversationId, }) {\n return __awaiter(this, void 0, void 0, function* () {\n return makeRequest(endpoint, {\n method: 'POST',\n headers,\n retry: answerRetryConfig,\n isStream: true,\n fallback: {\n emptyResponse: \"I apologize, but I couldn't generate an answer for your query. Please try rephrasing your question.\",\n errorResponse: 'I encountered an issue while generating the answer. Please try again in a moment.',\n },\n body: Object.assign({ searchQueryId }, (conversationId && { conversationId })),\n });\n });\n}\n// Helper function to generate conversation ID\nexport function getConversationId() {\n // Generate a unique ID combining:\n // 1. bf-conversation- prefix\n // 2. timestamp for chronological reference\n // 3. UUID v4 for uniqueness\n const timestamp = Date.now();\n const uuid = uuidv4();\n return `bf-conversation-${timestamp}-${uuid}`;\n}\nexport function sendFeedback({ endpoint, searchQueryId, response, headers, conversationId, }) {\n return __awaiter(this, void 0, void 0, function* () {\n yield makeRequest(endpoint, {\n method: 'POST',\n headers,\n body: Object.assign({ searchQueryId,\n response }, (conversationId && { conversationId })),\n });\n });\n}\nexport function loadConversation({ endpoint, conversationId, headers, }) {\n return __awaiter(this, void 0, void 0, function* () {\n const payload = yield makeRequest(endpoint, {\n method: 'POST',\n headers,\n body: { conversationId },\n });\n const convertedData = payload.data.map((answer) => (Object.assign(Object.assign({}, answer), { feedback: answer.feedback ? (answer.feedback === 'positive' ? 'accept' : 'reject') : undefined })));\n return { data: convertedData };\n });\n}\nexport function fetchFollowUpQuestions({ endpoint, searchQueryId, headers, conversationId, }) {\n return __awaiter(this, void 0, void 0, function* () {\n const data = yield makeRequest(endpoint, {\n method: 'POST',\n headers,\n body: Object.assign({ searchQueryId }, (conversationId && { conversationId })),\n });\n return data.questions;\n });\n}\n","export const defaultTheme = {\n primary: '#A3E635',\n accent: '#f9fafb',\n background: 'white',\n text: '#171717',\n border: '#171717',\n hover: '#171717',\n surface: '#F9FAFB',\n surfaceBorder: '#E5E7EB',\n surfaceHover: '#F3F4F6',\n cardBackground: 'white', // white\n};\n","export const defaultTextConfig = {\n headerText: 'How can we help you today?',\n searchPlaceholder: 'Ask a question or type a search term here ...',\n attachImageText: 'Attach image',\n allDocumentsText: 'All documents',\n loadingSearchText: 'Searching for relevant content...',\n loadingAnswerText: 'Crafting a response...',\n errorText: 'Sorry, there was an error generating the answer.',\n followUpPlaceholder: 'Ask follow-up',\n positiveAnswerText: 'Helpful',\n negativeAnswerText: 'Not helpful',\n uncertaintyFallbackText: {\n 'en': \"Sorry, I can't find a clear answer to your question. Please try rephrasing or check the related sources below.\",\n 'es': 'Lo siento, no puedo encontrar una respuesta clara. Intente reformular la pregunta o consulte las fuentes relacionadas.',\n 'fr': 'Désolé, je ne trouve pas de réponse claire. Essayez de reformuler ou consultez les sources connexes.',\n 'de': 'Entschuldigung, ich finde keine klare Antwort. Versuchen Sie es anders zu formulieren oder sehen Sie sich die verwandten Quellen an.',\n 'it': 'Mi dispiace, non trovo una risposta chiara. Prova a riformulare o consulta le fonti correlate.',\n 'pt': 'Desculpe, não encontro uma resposta clara. Tente reformular ou consulte as fontes relacionadas.',\n 'nl': 'Sorry, ik kan geen duidelijk antwoord vinden. Probeer het anders te formuleren of bekijk de gerelateerde bronnen.',\n 'pl': 'Przepraszam, nie znajduję jasnej odpowiedzi. Spróbuj przeformułować pytanie lub sprawdź powiązane źródła.',\n 'ru': 'Извините, я не могу найти четкого ответа. Попробуйте переформулировать или ознакомьтесь со связанными источниками.',\n 'ja': '申し訳ありませんが、明確な回答が見つかりません。質問の言い換えや、関連ソースをご確認ください。',\n 'ko': '죄송합니다. 명확한 답변을 찾을 수 없습니다. 질문을 다시 작성하거나 관련 소스를 확인해 주세요.',\n 'zh': '抱歉,找不到明确的答案。请尝试重新表述或查看相关来源。',\n 'zh-TW': '抱歉,找不到明確的答案。請嘗試重新表述或查看相關來源。',\n },\n};\n","import { __awaiter } from \"tslib\";\nimport React, { useState, useRef, useEffect, useImperativeHandle, forwardRef } from 'react';\nimport { Search, ArrowRight, ArrowUp, X, Circle, CheckCircle2, ChevronDown, Image } from 'lucide-react';\nimport { AnimatePresence, motion } from 'framer-motion';\nimport { Button } from '../ui/button';\nimport { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '../ui/dropdown-menu';\nimport { Suggestions } from './Suggestions';\nimport { SearchResults } from './SearchResults';\nimport { FollowUpQuestions } from './FollowUpQuestions';\nimport { TimelineNavigation } from './TimelineNavigation';\nimport { ScrollToBottomArrow } from './ScrollToBottomArrow';\nimport { searchApi, fetchAnswer, loadConversation, sendFeedback, getConversationId, fetchFollowUpQuestions, } from '../../lib/api';\nimport { defaultTheme } from './theme';\nimport { defaultTextConfig } from './text-config';\nimport { isAnswerUncertain } from '../../lib/utils';\nconst ChatSearch = forwardRef(({ suggestions, theme = {}, collections = [], selectedCollectionId, onCollectionChange, searchEndpoint, answerEndpoint, feedbackEndpoint, loadConversationEndpoint, disableFollowUpQuestions = false, disableImageAttachment = false, disableFeedback = false, siblingNode, offset = 0, headers, textConfig = {}, followUpQuestionsEndpoint, searchPath, }, ref) => {\n var _a;\n const mergedTheme = Object.assign(Object.assign({}, defaultTheme), theme);\n const mergedTextConfig = Object.assign(Object.assign({}, defaultTextConfig), textConfig);\n const [query, setQuery] = useState('');\n const [followUpQuery, setFollowUpQuery] = useState('');\n const [isSearching, setIsSearching] = useState(false);\n const [showResults, setShowResults] = useState(false);\n const [answers, setAnswers] = useState([]);\n const [showScrollArrow, setShowScrollArrow] = useState(false);\n const [activeAnswerIndex, setActiveAnswerIndex] = useState(0);\n const [attachedImages, setAttachedImages] = useState([]);\n const [currentCollectionId, setCurrentCollectionId] = useState(selectedCollectionId);\n const [showFollowUp, setShowFollowUp] = useState(true);\n const [conversationId, setConversationId] = useState('');\n const [isLoadingConversation, setIsLoadingConversation] = useState(false);\n const [loadError, setLoadError] = useState();\n const primaryTextareaRef = useRef(null);\n const followUpInputRef = useRef(null);\n const answerRefs = useRef([]);\n const containerRef = useRef(null);\n const fileInputRef = useRef(null);\n const stateSubscribersRef = useRef([]);\n // Load conversation from URL query param\n useEffect(() => {\n const urlParams = new URLSearchParams(window.location.search);\n const urlConversationId = urlParams.get('conversation');\n if (urlConversationId && loadConversationEndpoint) {\n setIsLoadingConversation(true);\n setShowResults(true);\n loadConversation({\n endpoint: loadConversationEndpoint,\n conversationId: urlConversationId,\n headers,\n })\n .then((payload) => {\n setAnswers(payload.data);\n setConversationId(urlConversationId);\n setShowResults(true);\n })\n .catch((error) => {\n console.error('Error loading conversation:', error);\n setLoadError(mergedTextConfig.errorText || 'An error occurred');\n // Redirect to primary search if loading fails\n setShowResults(false);\n setAnswers([]);\n const newId = getConversationId();\n setConversationId(newId);\n // Update URL without conversation param\n const newUrl = new URL(window.location.href);\n newUrl.pathname = '/';\n newUrl.searchParams.delete('conversation');\n window.history.replaceState({}, '', newUrl.toString());\n })\n .finally(() => {\n setIsLoadingConversation(false);\n });\n }\n else {\n const newId = getConversationId();\n setConversationId(newId);\n }\n }, [loadConversationEndpoint]);\n // Update URL when conversation ID changes and there are answers\n useEffect(() => {\n if (conversationId && answers.length > 0) {\n // Create new URL with search path\n const newUrl = new URL(window.location.href);\n if (searchPath) {\n newUrl.pathname = searchPath;\n newUrl.searchParams.set('conversation', conversationId);\n }\n else {\n // Default behavior when no searchPath is provided\n newUrl.searchParams.set('conversation', conversationId);\n }\n window.history.replaceState({}, '', newUrl.toString());\n }\n }, [conversationId, answers.length, searchPath]);\n // Notify subscribers when state changes\n useEffect(() => {\n const state = {\n showResults,\n answers,\n isLoading: isLoadingConversation,\n error: loadError,\n };\n stateSubscribersRef.current.forEach((callback) => callback(state));\n }, [showResults, answers, isLoadingConversation, loadError]);\n const scrollToLastAnswer = () => {\n requestAnimationFrame(() => {\n const lastAnswer = answerRefs.current[answerRefs.current.length - 1];\n if (lastAnswer) {\n const rect = lastAnswer.getBoundingClientRect();\n const scrollTop = window.pageYOffset || document.documentElement.scrollTop;\n const targetScroll = rect.top + scrollTop - 80;\n window.scrollTo({\n top: targetScroll,\n behavior: 'smooth',\n });\n }\n });\n };\n const scrollToAnswer = (index) => {\n requestAnimationFrame(() => {\n const answer = answerRefs.current[index];\n if (answer) {\n const rect = answer.getBoundingClientRect();\n const scrollTop = window.pageYOffset || document.documentElement.scrollTop;\n const targetScroll = rect.top + scrollTop - 80;\n window.scrollTo({\n top: targetScroll,\n behavior: 'smooth',\n });\n }\n });\n };\n const streamAnswer = (response) => __awaiter(void 0, void 0, void 0, function* () {\n var _b;\n const reader = (_b = response.body) === null || _b === void 0 ? void 0 : _b.getReader();\n if (!reader)\n return;\n // Set streaming state immediately\n setAnswers((prev) => {\n const newAnswers = [...prev];\n const lastAnswer = newAnswers[newAnswers.length - 1];\n if (lastAnswer) {\n lastAnswer.isLoading = false;\n lastAnswer.isStreaming = true;\n lastAnswer.searchResults = lastAnswer.searchResults || []; // Ensure search results exist\n }\n return newAnswers;\n });\n let accumulatedAnswer = '';\n try {\n let done, value;\n while ((({ done, value } = yield reader.read()), !done)) {\n const chunk = new TextDecoder().decode(value);\n accumulatedAnswer += chunk;\n // Check for uncertainty in the accumulated answer\n const { uncertain, language } = isAnswerUncertain(accumulatedAnswer);\n setAnswers((prev) => {\n var _a;\n const newAnswers = [...prev];\n const lastAnswer = newAnswers[newAnswers.length - 1];\n if (lastAnswer) {\n lastAnswer.answer = accumulatedAnswer;\n lastAnswer.isLoading = false;\n lastAnswer.isStreaming = true;\n lastAnswer.searchResults = lastAnswer.searchResults || [];\n lastAnswer.isUncertain = uncertain;\n lastAnswer.uncertaintyLanguage = language;\n if (uncertain && language && ((_a = mergedTextConfig.uncertaintyFallbackText) === null || _a === void 0 ? void 0 : _a[language])) {\n lastAnswer.uncertaintyFallbackText = mergedTextConfig.uncertaintyFallbackText[language];\n }\n }\n return newAnswers;\n });\n }\n }\n catch (error) {\n console.error('Error streaming answer:', error);\n }\n finally {\n setAnswers((prev) => {\n const newAnswers = [...prev];\n const lastAnswer = newAnswers[newAnswers.length - 1];\n if (lastAnswer) {\n lastAnswer.isStreaming = false;\n lastAnswer.isLoading = false;\n // Fetch follow-up questions if endpoint is provided and searchQueryId exists\n if (followUpQuestionsEndpoint && !disableFollowUpQuestions && lastAnswer.searchQueryId) {\n void (() => __awaiter(void 0, void 0, void 0, function* () {\n try {\n const questions = yield fetchFollowUpQuestions({\n endpoint: followUpQuestionsEndpoint,\n searchQueryId: lastAnswer.searchQueryId,\n headers,\n conversationId,\n });\n setAnswers((prev) => {\n const updatedAnswers = [...prev];\n const lastAnswer = updatedAnswers[updatedAnswers.length - 1];\n if (lastAnswer) {\n lastAnswer.followUpQuestions = questions;\n }\n return updatedAnswers;\n });\n }\n catch (error) {\n console.error('Error fetching follow-up questions:', error);\n }\n }))();\n }\n }\n return newAnswers;\n });\n reader.releaseLock();\n }\n });\n const handleSearch = (searchQuery = query.trim()) => __awaiter(void 0, void 0, void 0, function* () {\n if (searchQuery) {\n // 1. Set initial states synchronously\n setIsSearching(true);\n setShowResults(true);\n // 2. Create conversation ID\n const currentConversationId = conversationId || getConversationId();\n if (!conversationId) {\n setConversationId(currentConversationId);\n }\n // Update URL immediately when search starts\n const newUrl = new URL(window.location.href);\n const shouldUpdateUrl = searchPath\n ? newUrl.pathname !== searchPath || newUrl.searchParams.get('conversation') !== currentConversationId\n : newUrl.searchParams.get('conversation') !== currentConversationId;\n if (shouldUpdateUrl) {\n if (searchPath) {\n newUrl.pathname = searchPath;\n newUrl.searchParams.set('conversation', currentConversationId);\n }\n else {\n // Default behavior when no searchPath is provided\n newUrl.searchParams.set('conversation', currentConversationId);\n }\n window.history.replaceState({}, '', newUrl.toString());\n }\n // 3. Create new answer with loading states\n const newAnswer = {\n question: searchQuery,\n answer: '',\n isLoading: true,\n isSearchLoading: true,\n searchResults: [],\n searchQueryId: undefined,\n isStreaming: false,\n };\n // 4. Update answers state synchronously\n setAnswers((prev) => [...prev, newAnswer]);\n // 5. Set active index & scroll\n const newAnswerIndex = answers.length;\n setActiveAnswerIndex(newAnswerIndex);\n scrollToLastAnswer();\n // 6. Use Promise to defer API call to next tick\n yield Promise.resolve();\n // 7. Start API calls after render\n try {\n const searchResponse = yield searchApi({\n endpoint: searchEndpoint,\n query: searchQuery,\n collectionId: currentCollectionId,\n headers,\n conversationId: currentConversationId,\n });\n setAnswers((prev) => {\n const newAnswers = [...prev];\n if (newAnswers[newAnswers.length - 1]) {\n newAnswers[newAnswers.length - 1] = Object.assign(Object.assign({}, newAnswers[newAnswers.length - 1]), { searchResults: searchResponse.results, searchQueryId: searchResponse.searchQueryId, isSearchLoading: false });\n }\n return newAnswers;\n });\n const response = yield fetchAnswer({\n endpoint: answerEndpoint,\n searchQueryId: searchResponse.searchQueryId,\n headers,\n conversationId: currentConversationId,\n });\n yield streamAnswer(response);\n }\n catch (error) {\n console.error('Error generating answer:', error);\n setAnswers((prev) => {\n const newAnswers = [...prev];\n if (newAnswers[newAnswers.length - 1]) {\n newAnswers[newAnswers.length - 1] = Object.assign(Object.assign({}, newAnswers[newAnswers.length - 1]), { answer: mergedTextConfig.errorText || 'An error occurred', isLoading: false, isSearchLoading: false, isStreaming: false });\n }\n return newAnswers;\n });\n }\n finally {\n setIsSearching(false);\n }\n }\n });\n // Expose the methods via ref\n useImperativeHandle(ref, () => ({\n createNewThread: (firstQuery) => {\n setQuery('');\n setFollowUpQuery('');\n setShowResults(false);\n setAnswers([]);\n setActiveAnswerIndex(0);\n setAttachedImages([]);\n const newId = getConversationId();\n setConversationId(newId);\n // Remove conversation ID from URL when creating new thread\n const newUrl = new URL(window.location.href);\n newUrl.searchParams.delete('conversation');\n window.history.replaceState({}, '', newUrl.toString());\n if (primaryTextareaRef.current) {\n primaryTextareaRef.current.style.height = 'auto';\n }\n // If firstQuery is provided, set it and trigger search\n if (firstQuery) {\n setQuery(firstQuery);\n void handleSearch(firstQuery);\n }\n },\n showFollowUpThread: (show) => {\n setShowFollowUp(show);\n },\n subscribeToStateChanges: (callback) => {\n stateSubscribersRef.current.push(callback);\n // Initial state notification\n callback({\n showResults,\n answers,\n isLoading: false,\n error: undefined,\n });\n // Return unsubscribe function\n // eslint-disable-next-line newline-before-return\n return () => {\n stateSubscribersRef.current = stateSubscribersRef.current.filter((cb) => cb !== callback);\n };\n },\n }));\n // Update currentCollectionId when selectedCollectionId prop changes\n useEffect(() => {\n setCurrentCollectionId(selectedCollectionId);\n }, [selectedCollectionId]);\n const adjustTextareaHeight = (textarea) => {\n textarea.style.height = 'auto';\n textarea.style.height = `${textarea.scrollHeight}px`;\n };\n const handleFeedback = (response, searchQueryId, answerIndex) => __awaiter(void 0, void 0, void 0, function* () {\n if (!feedbackEndpoint)\n return;\n // Update UI state immediately\n setAnswers((prev) => {\n const newAnswers = [...prev];\n if (newAnswers[answerIndex]) {\n newAnswers[answerIndex] = Object.assign(Object.assign({}, newAnswers[answerIndex]), { feedback: response });\n }\n return newAnswers;\n });\n try {\n yield sendFeedback({\n endpoint: feedbackEndpoint,\n searchQueryId,\n response,\n headers,\n conversationId,\n });\n }\n catch (error) {\n console.error('Error sending feedback:', error);\n // Revert UI state on error\n setAnswers((prev) => {\n const newAnswers = [...prev];\n if (newAnswers[answerIndex]) {\n newAnswers[answerIndex] = Object.assign(Object.assign({}, newAnswers[answerIndex]), { feedback: undefined });\n }\n return newAnswers;\n });\n }\n });\n const handleFollowUpSearch = () => __awaiter(void 0, void 0, void 0, function* () {\n if (followUpQuery.trim()) {\n const currentQuery = followUpQuery;\n setQuery(currentQuery);\n setFollowUpQuery('');\n // Reset textarea height\n if (followUpInputRef.current) {\n followUpInputRef.current.style.height = 'auto';\n }\n yield handleSearch(currentQuery);\n }\n });\n const handleKeyPress = (e) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n void handleFollowUpSearch();\n }\n };\n const handleMainKeyPress = (e) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n void handleSearch();\n }\n };\n const handleSuggestedQuestionClick = (suggestion) => {\n if (suggestion.conversationId && loadConversationEndpoint) {\n setIsLoadingConversation(true);\n setShowResults(true);\n loadConversation({\n endpoint: loadConversationEndpoint,\n conversationId: suggestion.conversationId,\n headers,\n })\n .then((payload) => {\n setAnswers(payload.data);\n setConversationId(suggestion.conversationId);\n setShowResults(true);\n })\n .catch((error) => {\n console.error('Error loading conversation:', error);\n setLoadError(mergedTextConfig.errorText || 'An error occurred');\n // Redirect to primary search if loading fails\n setShowResults(false);\n setAnswers([]);\n const newId = getConversationId();\n setConversationId(newId);\n // Update URL without conversation param\n const newUrl = new URL(window.location.href);\n newUrl.pathname = '/';\n newUrl.searchParams.delete('conversation');\n window.history.replaceState({}, '', newUrl.toString());\n })\n .finally(() => {\n setIsLoadingConversation(false);\n });\n return;\n }\n setShowResults(true);\n setIsSearching(true);\n // Only generate new conversation ID if there isn't one already\n if (!conversationId) {\n const newId = getConversationId();\n setConversationId(newId);\n }\n setAnswers((prev) => [\n ...prev,\n {\n question: suggestion.question,\n answer: '',\n isLoading: true,\n isSearchLoading: true,\n },\n ]);\n void (() => __awaiter(void 0, void 0, void 0, function* () {\n try {\n // First get search results\n const searchResponse = yield searchApi({\n endpoint: searchEndpoint,\n query: suggestion.question,\n collectionId: currentCollectionId,\n headers,\n conversationId,\n });\n const searchResults = searchResponse.results;\n // Update with search results immediately\n setAnswers((prev) => {\n const newAnswers = [...prev];\n newAnswers[newAnswers.length - 1] = Object.assign(Object.assign({}, newAnswers[newAnswers.length - 1]), { searchResults, searchQueryId: searchResponse.searchQueryId, isSearchLoading: false });\n return newAnswers;\n });\n // Then start streaming the answer\n const response = yield fetchAnswer({\n endpoint: answerEndpoint,\n searchQueryId: searchResponse.searchQueryId,\n headers,\n conversationId,\n });\n yield streamAnswer(response);\n }\n catch (error) {\n console.error('Error generating answer:', error);\n setAnswers((prev) => {\n const newAnswers = [...prev];\n newAnswers[newAnswers.length - 1] = Object.assign(Object.assign({}, newAnswers[newAnswers.length - 1]), { answer: mergedTextConfig.errorText || 'An error occurred', isLoading: false, isSearchLoading: false });\n return newAnswers;\n });\n }\n finally {\n setIsSearching(false);\n scrollToLastAnswer();\n }\n }))();\n };\n useEffect(() => {\n const handleScroll = () => {\n const isNearBottom = window.innerHeight + window.pageYOffset >= document.documentElement.scrollHeight - 100;\n setShowScrollArrow(!isNearBottom);\n };\n window.addEventListener('scroll', handleScroll);\n return () => window.removeEventListener('scroll', handleScroll);\n }, []);\n useEffect(() => {\n return () => {\n attachedImages.forEach((image) => URL.revokeObjectURL(image.preview));\n };\n }, [attachedImages]);\n const handleImageUpload = (event) => {\n const files = event.target.files;\n if (files) {\n const newImages = Array.from(files).map((file) => ({\n file,\n preview: URL.createObjectURL(file),\n }));\n setAttachedImages((prev) => [...prev, ...newImages]);\n }\n if (fileInputRef.current) {\n fileInputRef.current.value = '';\n }\n };\n const removeImage = (index) => {\n setAttachedImages((prev) => {\n URL.revokeObjectURL(prev[index].preview);\n return prev.filter((_, i) => i !== index);\n });\n };\n const handleCollectionChange = (collectionId) => {\n setCurrentCollectionId(collectionId);\n onCollectionChange === null || onCollectionChange === void 0 ? void 0 : onCollectionChange(collectionId);\n };\n // Listen for URL changes and reset state when conversation param is removed\n useEffect(() => {\n const handleUrlChange = () => {\n const urlParams = new URLSearchParams(window.location.search);\n const urlConversationId = urlParams.get('conversation');\n if (!urlConversationId) {\n setQuery('');\n setFollowUpQuery('');\n setShowResults(false);\n setAnswers([]);\n setActiveAnswerIndex(0);\n setAttachedImages([]);\n if (primaryTextareaRef.current) {\n primaryTextareaRef.current.style.height = 'auto';\n }\n }\n };\n window.addEventListener('popstate', handleUrlChange);\n return () => window.removeEventListener('popstate', handleUrlChange);\n }, []);\n // Update the follow-up question click handler to use handleSearch\n const handleFollowUpQuestionClick = (question) => {\n void handleSearch(question);\n };\n return (React.createElement(\"div\", { className: \"relative min-h-screen\" },\n React.createElement(\"div\", { ref: containerRef, className: \"w-full max-w-3xl mx-auto flex flex-col items-center space-y-8 px-4 py-20\", style: {\n '--surface-border': mergedTheme.surfaceBorder,\n '--surface-hover': mergedTheme.surfaceHover,\n } },\n React.createElement(AnimatePresence, null, isLoadingConversation ? (React.createElement(motion.div, { key: \"loading\", initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, className: \"w-full flex items-center justify-center py-20\" },\n React.createElement(\"div\", { className: \"flex flex-col items-center gap-4\" },\n React.createElement(\"div\", { className: \"animate-spin rounded-full h-8 w-8 border-2 border-t-transparent\", style: { borderColor: mergedTheme.primary } }),\n React.createElement(\"p\", { className: \"text-sm\", style: { color: mergedTheme.text } }, \"Loading conversation...\")))) : !showResults ? (React.createElement(motion.div, { key: \"search\", initial: { opacity: 0, y: 20 }, animate: { opacity: 1, y: 0 }, exit: { opacity: 0, y: -20 }, transition: { duration: 0.5 }, className: \"w-full space-y-8\" },\n React.createElement(\"div\", { className: \"w-full text-center space-y-4\" },\n React.createElement(motion.h1, { initial: { opacity: 0, y: 20 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.5, delay: 0.3 }, className: \"text-5xl font-bold\", style: { color: mergedTheme.text } }, mergedTextConfig.headerText)),\n React.createElement(motion.div, { initial: { opacity: 0, y: 20 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.5, delay: 0.4 } },\n React.createElement(\"div\", { className: \"relative w-full rounded-md overflow-hidden\", style: {\n backgroundColor: mergedTheme.background,\n borderColor: mergedTheme.border,\n borderWidth: '1px',\n borderStyle: 'solid',\n } },\n React.createElement(\"div\", { className: \"p-3 flex items-center\" },\n React.createElement(Search, { className: \"h-5 w-5 text-gray-400 mr-2\" }),\n React.createElement(\"textarea\", { ref: primaryTextareaRef, placeholder: mergedTextConfig.searchPlaceholder, value: query, onChange: (e) => {\n setQuery(e.target.value);\n adjustTextareaHeight(e.target);\n }, onKeyDown: handleMainKeyPress, className: \"w-full resize-none outline-none text-lg py-1 font-light min-h-[36px] overflow-hidden placeholder:text-gray-400 border-none bg-transparent\", style: {\n color: mergedTheme.text,\n outline: 'none',\n boxShadow: 'none',\n fontSize: '16px',\n }, rows: 1 })),\n !disableImageAttachment && attachedImages.length > 0 && (React.createElement(\"div\", { className: \"flex gap-2 mt-3 overflow-x-auto pb-1 px-3\" }, attachedImages.map((image, index) => (React.createElement(\"div\", { key: index, className: \"relative group rounded-lg overflow-hidden flex-shrink-0\", style: { width: '80px', height: '80px' } },\n React.createElement(\"img\", { src: image.preview, alt: `Attached ${index + 1}`, className: \"w-full h-full object-cover\" }),\n React.createElement(\"button\", { onClick: () => removeImage(index), className: \"absolute top-1 right-1 bg-black bg-opacity-50 rounded-full p-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200\" },\n React.createElement(X, { className: \"h-3 w-3 text-white\" }))))))),\n React.createElement(\"div\", { className: \"flex items-center justify-between px-3 py-2 bg-gray-100 border-t border-gray-200\" },\n React.createElement(\"div\", { className: \"flex gap-2\" },\n collections.length > 0 && (React.createElement(DropdownMenu, null,\n React.createElement(DropdownMenuTrigger, { asChild: true },\n React.createElement(Button, { variant: \"ghost\", size: \"sm\", className: \"hover:bg-gray-200 transition-all duration-200 rounded-md h-8 flex items-center gap-2 text-gray-700\" },\n currentCollectionId && currentCollectionId !== 'all' ? (React.createElement(CheckCircle2, { className: \"h-5 w-5 text-green-500\" })) : (React.createElement(Circle, { className: \"h-5 w-5 text-gray-400\" })),\n ((_a = collections.find((c) => c.id === currentCollectionId)) === null || _a === void 0 ? void 0 : _a.name) ||\n mergedTextConfig.allDocumentsText,\n React.createElement(ChevronDown, { className: \"h-4 w-4 opacity-50\" }))),\n React.createElement(DropdownMenuContent, null, collections.map((collection) => (React.createElement(DropdownMenuItem, { key: collection.id, onClick: () => handleCollectionChange(collection.id), className: collection.id === currentCollectionId ? 'bg-gray-100' : '' },\n collection.id === currentCollectionId ? (React.createElement(CheckCircle2, { className: \"h-4 w-4 mr-2 text-green-500\" })) : (React.createElement(Circle, { className: \"h-4 w-4 mr-2 text-gray-400\" })),\n collection.name)))))),\n !disableImageAttachment && (React.createElement(React.Fragment, null,\n React.createElement(\"input\", { type: \"file\", ref: fileInputRef, accept: \"image/*\", multiple: true, className: \"hidden\", onChange: handleImageUpload }),\n React.createElement(Button, { variant: \"ghost\", size: \"sm\", className: \"hover:bg-gray-200 rounded-md h-8 text-gray-700\", onClick: () => { var _a; return (_a = fileInputRef.current) === null || _a === void 0 ? void 0 : _a.click(); } },\n React.createElement(Image, { className: \"h-4 w-4 mr-1.5\" }),\n mergedTextConfig.attachImageText)))),\n React.createElement(\"div\", { className: \"flex items-center\" },\n React.createElement(Button, { size: \"sm\", disabled: !query || isSearching, className: \"rounded-md h-8 w-8 bg-[#86efac] hover:bg-[#86efac]/90 disabled:opacity-50\", onClick: () => {\n void handleSearch();\n } }, isSearching ? (React.createElement(\"div\", { className: \"animate-spin rounded-full h-4 w-4 border-2 border-t-transparent\", style: { borderColor: 'white' } })) : (React.createElement(ArrowRight, { className: \"h-4 w-4 text-gray-700\" }))))))),\n React.createElement(Suggestions, { suggestions: suggestions || [], onQuestionClick: handleSuggestedQuestionClick, borderColor: mergedTheme.border, title: mergedTextConfig.suggestionsTitle }),\n siblingNode)) : (React.createElement(motion.div, { key: \"results\", initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.5 }, className: \"w-full space-y-4 py-4 mb-20\" }, answers.map((answer, i) => (React.createElement(motion.div, { key: i, ref: (el) => (answerRefs.current[i] = el), initial: { opacity: 0, y: 20 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.5, delay: i * 0.1 } },\n React.createElement(SearchResults, { answer: answer.answer, question: answer.question, theme: mergedTheme, searchResults: answer.searchResults, isStreaming: answer.isStreaming, searchQueryId: answer.searchQueryId, feedback: answer.feedback, onFeedback: (response) => void handleFeedback(response, answer.searchQueryId, i), disableFeedback: disableFeedback, textConfig: mergedTextConfig, isLoading: answer.isLoading, isSearchLoading: answer.isSearchLoading }),\n i === answers.length - 1 &&\n !disableFollowUpQuestions &&\n answer.followUpQuestions &&\n !answer.isStreaming && (React.createElement(\"div\", { className: \"mt-4\" },\n React.createElement(FollowUpQuestions, { questions: answer.followUpQuestions, onQuestionClick: handleFollowUpQuestionClick, theme: mergedTheme }))))))))),\n showResults && answers.length > 1 && (React.createElement(\"div\", { className: \"hidden sm:block\" },\n React.createElement(TimelineNavigation, { questions: answers.map((a) => a.question), activeIndex: activeAnswerIndex, onNavigate: (index) => {\n setActiveAnswerIndex(index);\n scrollToAnswer(index);\n }, theme: mergedTheme, offset: offset }))),\n showResults && showFollowUp && (React.createElement(motion.div, { initial: { opacity: 0, y: 20 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.5 }, className: \"fixed bottom-4 left-4 right-4 max-w-3xl mx-auto z-10\", style: { left: `${offset}px` } },\n React.createElement(\"div\", { className: \"rounded-full h-[44px] sm:h-[52px] flex items-center justify-between\", style: {\n backgroundColor: mergedTheme.background,\n borderColor: mergedTheme.border,\n borderWidth: '1px',\n borderStyle: 'solid',\n boxShadow: '0 4px 6px -1px rgba(0, 0, 0, 0.1)',\n padding: '0 15px',\n } },\n React.createElement(\"div\", { className: \"flex items-center gap-2 sm:gap-3 flex-grow overflow-hidden h-full\" },\n React.createElement(Search, { className: \"h-4 w-4 sm:h-5 sm:w-5 flex-shrink-0\", style: { color: mergedTheme.primary } }),\n React.createElement(\"div\", { className: \"flex-grow\", style: { paddingTop: '15px', paddingBottom: '10px' } },\n React.createElement(\"textarea\", { ref: followUpInputRef, placeholder: mergedTextConfig.followUpPlaceholder, value: followUpQuery, onChange: (e) => {\n setFollowUpQuery(e.target.value);\n const maxHeight = 100; // Maximum height in pixels\n e.target.style.height = 'auto';\n e.target.style.height = `${Math.min(e.target.scrollHeight, maxHeight)}px`;\n if (e.target.scrollHeight > maxHeight) {\n e.target.style.overflowY = 'auto';\n }\n else {\n e.target.style.overflowY = 'hidden';\n }\n }, onKeyDown: handleKeyPress, disabled: isSearching, className: \"w-full bg-transparent outline-none text-sm sm:text-base resize-none overflow-hidden disabled:opacity-50 border-none min-h-[24px] max-h-[100px] placeholder:text-sm sm:placeholder:text-base\", style: {\n color: mergedTheme.text,\n outline: 'none',\n boxShadow: 'none',\n fontSize: '16px',\n lineHeight: '24px',\n }, rows: 1 }))),\n React.createElement(\"div\", { className: \"flex items-center gap-2 sm:gap-3 ml-2 sm:ml-3 flex-shrink-0\" },\n React.createElement(Button, { size: \"icon\", variant: \"ghost\", disabled: isSearching || !followUpQuery.trim(), className: \"rounded-full transition-colors duration-200 disabled:opacity-50 h-8 w-8 sm:h-9 sm:w-9 flex items-center justify-center\", style: {\n color: mergedTheme.text,\n backgroundColor: 'transparent',\n }, onClick: () => {\n void handleFollowUpSearch();\n } }, isSearching ? (React.createElement(\"div\", { className: \"animate-spin rounded-full h-4 w-4 sm:h-5 sm:w-5 border-2\", style: {\n borderColor: `${mergedTheme.text}40`,\n borderTopColor: mergedTheme.text,\n } })) : (React.createElement(ArrowUp, { className: \"h-4 w-4 sm:h-5 sm:w-5\" }))))))),\n showScrollArrow && showResults && React.createElement(ScrollToBottomArrow, { onClick: scrollToLastAnswer, theme: mergedTheme }))));\n});\nChatSearch.displayName = 'ChatSearch';\nexport default ChatSearch;\n"],"names":["styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","value","step","next","rejected","result","done","then","apply","setRef","current","composeRefs","refs","node","hasCleanup","cleanups","map","cleanup","SuppressedError","Slot","React","forwardRef","props","forwardedRef","children","slotProps","childrenArray","Children","toArray","slottable","find","isSlottable","newElement","newChildren","child","count","only","isValidElement","jsx","SlotClone","cloneElement","displayName","childrenRef","element","getter","getOwnPropertyDescriptor","get","mayWarn","isReactWarning","getElementRef","mergeProps","Slottable","Fragment","childProps","overrideProps","propName","slotPropValue","childPropValue","test","args","filter","Boolean","join","cn","inputs","twMerge","clsx","isAnswerUncertain","response","uncertaintyPatternsByLanguage","en","es","fr","de","it","pt","nl","pl","ru","ja","ko","zh","earliestMatch","language","patterns","entries","pattern","match","index","uncertain","buttonVariants","cva","variants","variant","default","destructive","outline","secondary","ghost","link","size","sm","lg","icon","defaultVariants","Button","_a","className","asChild","Comp","assign","DropdownMenu","DropdownMenuPrimitive","Root","DropdownMenuTrigger","Trigger","inset","SubTrigger","ChevronRightIcon","SubContent","DropdownMenuContent","sideOffset","Portal","Content","DropdownMenuItem","Item","checked","CheckboxItem","ItemIndicator","CheckIcon","RadioItem","DotFilledIcon","Label","Separator","TooltipProvider","delayDuration","TooltipPrimitive","Provider","Tooltip","TooltipTrigger","TooltipContent","background","textColor","borderColor","backgroundColor","color","borderWidth","borderStyle","Suggestions","suggestions","onQuestionClick","title","suggestion","key","id","onClick","undefined","messageCount","question","programmingLanguages","javascript","python","java","c","cpp","ruby","php","swift","kotlin","typescript","go","perl","rust","scala","haskell","lua","shell","sql","html","HighlighterComponent","Prism","CodeBlock","memo","isCopied","setIsCopied","useState","navigator","clipboard","writeText","setTimeout","error","console","CheckCircle","Clipboard","fileExtension","fileName","lowercase","chars","charAt","Math","floor","random","toLowerCase","generateRandomString","blob","Blob","url","URL","createObjectURL","download","href","display","body","click","removeChild","revokeObjectURL","Download","a11yDark","PreTag","wrapLongLines","customStyle","margin","borderTopLeftRadius","borderTopRightRadius","Frame","src","border","width","height","isLoaded","setIsLoaded","iframeLoaded","setIframeLoaded","useEffect","mounted","sandbox","frameBorder","loading","allowFullScreen","onLoad","Loom","normalizedUrl","attrs","replace","Supademo","Typeform","Vimeo","matches","videoId","hId","embedUrl","Wistia","urlRegexes","regex","extractMatches","domain","YouTube","extractVideoId","isMatch","some","syncEmbedComponents","Youtube","EmbedComponent","matched","setMatched","syncMatch","Embed","Component","findMatch","matchedProps","MemoizedReactMarkdown","ReactMarkdown","prevProps","nextProps","config","startOnLoad","theme","securityLevel","fontFamily","MermaidDiagram","content","svg","setSvg","setError","containerRef","useRef","isInitialized","setIsInitialized","mermaid","initialize","err","initializeMermaid","toString","substr","render","dangerouslySetInnerHTML","__html","ZoomableImage","alt","isZoomed","setIsZoomed","showFullCaption","setShowFullCaption","imageError","setImageError","isLoading","setIsLoading","dimensions","setDimensions","imgRef","toggleZoom","maxHeight","onError","naturalWidth","naturalHeight","aspectRatio","min","Expand","onMouseEnter","onMouseLeave","AnimatePresence","motion","div","initial","opacity","animate","exit","scale","FormattedMessage","message","isStreaming","displayContent","setDisplayContent","uncertaintyFallbackText","strippedContent","remarkPlugins","remarkGfm","rehypePlugins","rehypeRaw","components","code","inline","exec","String","trim","marker","table","th","td","a","embedComponent","target","rel","pre","img","li","ul","ol","strong","h1","h2","h3","h4","h5","h6","Feedback","feedback","onFeedback","textConfig","disabled","showHearts","setShowHearts","handleFeedback","Array","from","_","x","y","cos","PI","sin","rotate","transition","duration","ease","times","delay","top","left","transformOrigin","Heart","strokeWidth","primary","ThumbsUp","positiveAnswerText","ThumbsDown","negativeAnswerText","GeneratingStar","viewBox","fill","xmlns","minWidth","minHeight","styles","d","stroke","strokeLinecap","strokeLinejoin","SearchResults","answer","searchResults","searchQueryId","disableFeedback","isSearchLoading","isExpanded","setIsExpanded","handleCopy","this","cardBackground","text","Check","Copy","loadingSearchText","loadingAnswerText","surface","borderBottom","surfaceBorder","FileText","ChevronDown","transform","ExternalLink","FollowUpQuestions","questions","HelpCircle","button","ChevronRight","TimelineNavigation","activeIndex","onNavigate","offset","prevActiveIndex","setPrevActiveIndex","totalItems","visibleIndexes","indexes","lastAddedIndex","addIndex","push","max","getVisibleIndexes","role","stiffness","damping","indexOrEllipsis","arrayIndex","MoreVertical","layout","onKeyDown","cursor","side","ScrollToBottomArrow","boxShadow","ArrowDown","defaultRetryOptions","maxRetries","baseDelay","shouldRetry","TypeError","apiError","status","globalRetryOptions","globalFallbackConfig","emptyResponse","errorResponse","ms","makeRequest","retry","headers","isStream","fallback","fetchConfig","retryOptions","fallbackOptions","attempt","fetch","JSON","stringify","ok","Error","data","json","keys","emptyError","name","catch","shouldAttemptRetry","warn","jitter","pow","searchRetryConfig","answerRetryConfig","searchApi","endpoint","query","collectionId","conversationId","payload","method","limit","results","searchQuery","fetchAnswer","getConversationId","Date","now","r","loadConversation","defaultTheme","accent","hover","surfaceHover","defaultTextConfig","headerText","searchPlaceholder","attachImageText","allDocumentsText","errorText","followUpPlaceholder","ChatSearch","collections","selectedCollectionId","onCollectionChange","searchEndpoint","answerEndpoint","feedbackEndpoint","loadConversationEndpoint","disableFollowUpQuestions","disableImageAttachment","siblingNode","followUpQuestionsEndpoint","searchPath","mergedTheme","mergedTextConfig","setQuery","followUpQuery","setFollowUpQuery","isSearching","setIsSearching","showResults","setShowResults","answers","setAnswers","showScrollArrow","setShowScrollArrow","activeAnswerIndex","setActiveAnswerIndex","attachedImages","setAttachedImages","currentCollectionId","setCurrentCollectionId","showFollowUp","setShowFollowUp","setConversationId","isLoadingConversation","setIsLoadingConversation","loadError","setLoadError","primaryTextareaRef","followUpInputRef","answerRefs","fileInputRef","stateSubscribersRef","urlConversationId","URLSearchParams","window","location","search","newId","newUrl","pathname","searchParams","delete","history","replaceState","finally","set","state","forEach","callback","scrollToLastAnswer","requestAnimationFrame","lastAnswer","rect","getBoundingClientRect","scrollTop","pageYOffset","documentElement","targetScroll","scrollTo","behavior","streamAnswer","_b","reader","getReader","prev","newAnswers","accumulatedAnswer","read","chunk","TextDecoder","decode","isUncertain","uncertaintyLanguage","fetchFollowUpQuestions","updatedAnswers","followUpQuestions","releaseLock","handleSearch","currentConversationId","newAnswer","newAnswerIndex","searchResponse","useImperativeHandle","createNewThread","firstQuery","showFollowUpThread","show","subscribeToStateChanges","cb","answerIndex","sendFeedback","handleFollowUpSearch","currentQuery","handleScroll","isNearBottom","innerHeight","scrollHeight","addEventListener","removeEventListener","image","preview","handleUrlChange","handleFollowUpQuestionClick","el","Search","placeholder","onChange","textarea","shiftKey","preventDefault","fontSize","rows","removeImage","X","CheckCircle2","Circle","collection","handleCollectionChange","accept","multiple","event","files","newImages","file","Image","ArrowRight","suggestionsTitle","scrollToAnswer","padding","paddingTop","paddingBottom","overflowY","lineHeight","borderTopColor","ArrowUp"],"mappings":"8xBAAA,SAASA,EAAYC,EAAKC,QACX,IAARA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAKF,GAA2B,oBAAbG,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK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AA0H1I,MAAO,CAClPgL,MAAO4Y,EAAY1H,KACnBnR,gBAAiB,eAClBW,QAAS,KACH4d,IAAsB,GAC1BrF,EAAe9gB,EAAMlD,cAAc,MAAO,CAAEyI,UAAW,2DAA4D1I,MAAO,CAC3H8K,YAAa,GAAG8Y,EAAY1H,SAC5B8P,eAAgBpI,EAAY1H,QACvB/Y,EAAMlD,cAAcgsB,UAAS,CAAEvjB,UAAW,8BACnE6b,GAAmBJ,GAAehhB,EAAMlD,cAAc0e,GAAqB,CAAEjT,QAASkb,GAAoBzT,MAAOyQ,KAAkB,IAE/Ib,GAAWve,YAAc","x_google_ignoreList":[0,1,2,3]}
1
+ {"version":3,"file":"index.js","sources":["../../node_modules/style-inject/dist/style-inject.es.js","../../node_modules/tslib/tslib.es6.js","../../node_modules/@radix-ui/react-compose-refs/dist/index.mjs","../../node_modules/@radix-ui/react-slot/dist/index.mjs","../../src/lib/utils.ts","../../src/components/ui/button.tsx","../../src/components/ui/dropdown-menu.tsx","../../src/components/ui/tooltip.tsx","../../src/components/chat-search/Suggestions.tsx","../../src/components/markdown/utils/codeblock.ts","../../src/components/markdown/CodeBlock.tsx","../../src/components/markdown/Frame.tsx","../../src/components/markdown/embeds/Loom.tsx","../../src/components/markdown/embeds/Supademo.tsx","../../src/components/markdown/embeds/Typeform.tsx","../../src/components/markdown/embeds/Vimeo.tsx","../../src/components/markdown/embeds/Wistia.tsx","../../src/components/markdown/embeds/Youtube.tsx","../../src/components/markdown/embeds/index.tsx","../../src/components/markdown/MemoizedReactMarkdown.tsx","../../src/components/markdown/MermaidDiagram.tsx","../../src/components/markdown/ZoomableImage.tsx","../../src/components/markdown/FormattedMessage.tsx","../../src/components/markdown/utils/stripNewLines.ts","../../src/components/ui/feedback.tsx","../../src/components/ui/generating-star.tsx","../../src/components/chat-search/SearchResults.tsx","../../src/components/chat-search/FollowUpQuestions.tsx","../../src/components/chat-search/TimelineNavigation.tsx","../../src/components/chat-search/ScrollToBottomArrow.tsx","../../src/lib/fetchClient.ts","../../src/lib/api.ts","../../src/components/chat-search/theme.ts","../../src/components/chat-search/text-config.ts","../../src/components/chat-search/ChatSearch.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n function next() {\r\n while (env.stack.length) {\r\n var rec = env.stack.pop();\r\n try {\r\n var result = rec.dispose && rec.dispose.call(rec.value);\r\n if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n};\r\n","// packages/react/compose-refs/src/composeRefs.tsx\nimport * as React from \"react\";\nfunction setRef(ref, value) {\n if (typeof ref === \"function\") {\n return ref(value);\n } else if (ref !== null && ref !== void 0) {\n ref.current = value;\n }\n}\nfunction composeRefs(...refs) {\n return (node) => {\n let hasCleanup = false;\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node);\n if (!hasCleanup && typeof cleanup == \"function\") {\n hasCleanup = true;\n }\n return cleanup;\n });\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < cleanups.length; i++) {\n const cleanup = cleanups[i];\n if (typeof cleanup == \"function\") {\n cleanup();\n } else {\n setRef(refs[i], null);\n }\n }\n };\n }\n };\n}\nfunction useComposedRefs(...refs) {\n return React.useCallback(composeRefs(...refs), refs);\n}\nexport {\n composeRefs,\n useComposedRefs\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/slot/src/Slot.tsx\nimport * as React from \"react\";\nimport { composeRefs } from \"@radix-ui/react-compose-refs\";\nimport { Fragment, jsx } from \"react/jsx-runtime\";\nvar Slot = React.forwardRef((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n const childrenArray = React.Children.toArray(children);\n const slottable = childrenArray.find(isSlottable);\n if (slottable) {\n const newElement = slottable.props.children;\n const newChildren = childrenArray.map((child) => {\n if (child === slottable) {\n if (React.Children.count(newElement) > 1) return React.Children.only(null);\n return React.isValidElement(newElement) ? newElement.props.children : null;\n } else {\n return child;\n }\n });\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });\n }\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });\n});\nSlot.displayName = \"Slot\";\nvar SlotClone = React.forwardRef((props, forwardedRef) => {\n const { children, ...slotProps } = props;\n if (React.isValidElement(children)) {\n const childrenRef = getElementRef(children);\n return React.cloneElement(children, {\n ...mergeProps(slotProps, children.props),\n // @ts-ignore\n ref: forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef\n });\n }\n return React.Children.count(children) > 1 ? React.Children.only(null) : null;\n});\nSlotClone.displayName = \"SlotClone\";\nvar Slottable = ({ children }) => {\n return /* @__PURE__ */ jsx(Fragment, { children });\n};\nfunction isSlottable(child) {\n return React.isValidElement(child) && child.type === Slottable;\n}\nfunction mergeProps(slotProps, childProps) {\n const overrideProps = { ...childProps };\n for (const propName in childProps) {\n const slotPropValue = slotProps[propName];\n const childPropValue = childProps[propName];\n const isHandler = /^on[A-Z]/.test(propName);\n if (isHandler) {\n if (slotPropValue && childPropValue) {\n overrideProps[propName] = (...args) => {\n childPropValue(...args);\n slotPropValue(...args);\n };\n } else if (slotPropValue) {\n overrideProps[propName] = slotPropValue;\n }\n } else if (propName === \"style\") {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue };\n } else if (propName === \"className\") {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(\" \");\n }\n }\n return { ...slotProps, ...overrideProps };\n}\nfunction getElementRef(element) {\n let getter = Object.getOwnPropertyDescriptor(element.props, \"ref\")?.get;\n let mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.ref;\n }\n getter = Object.getOwnPropertyDescriptor(element, \"ref\")?.get;\n mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.props.ref;\n }\n return element.props.ref || element.ref;\n}\nvar Root = Slot;\nexport {\n Root,\n Slot,\n Slottable\n};\n//# sourceMappingURL=index.mjs.map\n","import { useRef } from 'react';\nimport { clsx } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\nexport function cn(...inputs) {\n return twMerge(clsx(inputs));\n}\nlet globalId = 0;\nconst genId = () => ++globalId;\nexport function useId(prefix) {\n const idRef = useRef();\n if (idRef.current === undefined) {\n idRef.current = `${prefix || 'id'}-${genId()}`;\n }\n return idRef.current;\n}\nexport function isAnswerUncertain(response) {\n // Define uncertainty patterns for various languages\n const uncertaintyPatternsByLanguage = {\n en: [\n /i(?:\\s|['\\u2018\\u2019])?m(?:\\s+really)?\\s+not\\s+sure/i,\n /i(?:\\s+am)?(?:\\s+really)?\\s+not\\s+sure/i,\n /i\\s+don(?:['\\u2018\\u2019])?t\\s+know/i,\n /it(?:['\\u2018\\u2019]s| is) unclear/i,\n /cannot determine/i,\n /hard to say/i,\n /difficult to determine/i,\n /need more information/i,\n ],\n es: [/no (?:lo )?sé/i, /no estoy seguro/i, /no es claro/i, /desconocido/i],\n fr: [/je ne sais pas/i, /je ne suis pas sûr/i, /ce n'est pas clair/i, /inconnu/i],\n de: [/ich weiß nicht/i, /ich bin nicht sicher/i, /es ist unklar/i, /unbekannt/i],\n it: [/non lo so/i, /non sono sicuro/i, /non è chiaro/i, /sconosciuto/i],\n pt: [/não sei/i, /não tenho certeza/i, /não está claro/i, /desconhecido/i],\n nl: [/ik weet het niet/i, /ik weet niet zeker/i, /het is onduidelijk/i, /onbekend/i],\n pl: [/nie wiem/i, /nie jestem pewien/i, /to nie jest jasne/i, /nieznany/i],\n ru: [/я не знаю/i, /я не уверен/i, /это не ясно/i, /неизвестно/i],\n ja: [/知りません/i, /よくわからない/i, /不明です/i, /未知/i],\n ko: [/모릅니다/i, /잘 모르겠습니다/i, /불확실합니다/i, /알 수 없음/i],\n zh: [/我不知道/i, /我不确定/i, /不清楚/i, /未知/i],\n 'zh-TW': [/我不知道/i, /我不確定/i, /不清楚/i, /未知/i],\n };\n let earliestMatch = null;\n // Find the earliest match across all languages\n for (const [language, patterns] of Object.entries(uncertaintyPatternsByLanguage)) {\n for (const pattern of patterns) {\n const match = response.match(pattern);\n if (match && (earliestMatch === null || match.index < earliestMatch.index)) {\n earliestMatch = { index: match.index, language };\n }\n }\n }\n return earliestMatch ? { uncertain: true, language: earliestMatch.language } : { uncertain: false, language: null };\n}\n","import { __rest } from \"tslib\";\nimport * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva } from \"class-variance-authority\";\nimport { cn } from \"@/lib/utils\";\nconst buttonVariants = cva(\"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\", {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground shadow hover:bg-primary/90\",\n destructive: \"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90\",\n outline: \"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground\",\n secondary: \"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n size: {\n default: \"h-9 px-4 py-2\",\n sm: \"h-8 rounded-md px-3 text-xs\",\n lg: \"h-10 rounded-md px-8\",\n icon: \"h-9 w-9\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n});\nconst Button = React.forwardRef((_a, ref) => {\n var { className, variant, size, asChild = false } = _a, props = __rest(_a, [\"className\", \"variant\", \"size\", \"asChild\"]);\n const Comp = asChild ? Slot : \"button\";\n return (React.createElement(Comp, Object.assign({ className: cn(buttonVariants({ variant, size, className })), ref: ref }, props)));\n});\nButton.displayName = \"Button\";\nexport { Button, buttonVariants };\n","import { __rest } from \"tslib\";\nimport * as React from \"react\";\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport { cn } from \"@/lib/utils\";\nimport { CheckIcon, ChevronRightIcon, DotFilledIcon } from \"@radix-ui/react-icons\";\nconst DropdownMenu = DropdownMenuPrimitive.Root;\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group;\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal;\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub;\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\nconst DropdownMenuSubTrigger = React.forwardRef((_a, ref) => {\n var { className, inset, children } = _a, props = __rest(_a, [\"className\", \"inset\", \"children\"]);\n return (React.createElement(DropdownMenuPrimitive.SubTrigger, Object.assign({ ref: ref, className: cn(\"flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\", inset && \"pl-8\", className) }, props),\n children,\n React.createElement(ChevronRightIcon, { className: \"ml-auto\" })));\n});\nDropdownMenuSubTrigger.displayName =\n DropdownMenuPrimitive.SubTrigger.displayName;\nconst DropdownMenuSubContent = React.forwardRef((_a, ref) => {\n var { className } = _a, props = __rest(_a, [\"className\"]);\n return (React.createElement(DropdownMenuPrimitive.SubContent, Object.assign({ ref: ref, className: cn(\"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\", className) }, props)));\n});\nDropdownMenuSubContent.displayName =\n DropdownMenuPrimitive.SubContent.displayName;\nconst DropdownMenuContent = React.forwardRef((_a, ref) => {\n var { className, sideOffset = 4 } = _a, props = __rest(_a, [\"className\", \"sideOffset\"]);\n return (React.createElement(DropdownMenuPrimitive.Portal, null,\n React.createElement(DropdownMenuPrimitive.Content, Object.assign({ ref: ref, sideOffset: sideOffset, className: cn(\"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md\", \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\", className) }, props))));\n});\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;\nconst DropdownMenuItem = React.forwardRef((_a, ref) => {\n var { className, inset } = _a, props = __rest(_a, [\"className\", \"inset\"]);\n return (React.createElement(DropdownMenuPrimitive.Item, Object.assign({ ref: ref, className: cn(\"relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0\", inset && \"pl-8\", className) }, props)));\n});\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;\nconst DropdownMenuCheckboxItem = React.forwardRef((_a, ref) => {\n var { className, children, checked } = _a, props = __rest(_a, [\"className\", \"children\", \"checked\"]);\n return (React.createElement(DropdownMenuPrimitive.CheckboxItem, Object.assign({ ref: ref, className: cn(\"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\", className), checked: checked }, props),\n React.createElement(\"span\", { className: \"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\" },\n React.createElement(DropdownMenuPrimitive.ItemIndicator, null,\n React.createElement(CheckIcon, { className: \"h-4 w-4\" }))),\n children));\n});\nDropdownMenuCheckboxItem.displayName =\n DropdownMenuPrimitive.CheckboxItem.displayName;\nconst DropdownMenuRadioItem = React.forwardRef((_a, ref) => {\n var { className, children } = _a, props = __rest(_a, [\"className\", \"children\"]);\n return (React.createElement(DropdownMenuPrimitive.RadioItem, Object.assign({ ref: ref, className: cn(\"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\", className) }, props),\n React.createElement(\"span\", { className: \"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\" },\n React.createElement(DropdownMenuPrimitive.ItemIndicator, null,\n React.createElement(DotFilledIcon, { className: \"h-2 w-2 fill-current\" }))),\n children));\n});\nDropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;\nconst DropdownMenuLabel = React.forwardRef((_a, ref) => {\n var { className, inset } = _a, props = __rest(_a, [\"className\", \"inset\"]);\n return (React.createElement(DropdownMenuPrimitive.Label, Object.assign({ ref: ref, className: cn(\"px-2 py-1.5 text-sm font-semibold\", inset && \"pl-8\", className) }, props)));\n});\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;\nconst DropdownMenuSeparator = React.forwardRef((_a, ref) => {\n var { className } = _a, props = __rest(_a, [\"className\"]);\n return (React.createElement(DropdownMenuPrimitive.Separator, Object.assign({ ref: ref, className: cn(\"-mx-1 my-1 h-px bg-muted\", className) }, props)));\n});\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;\nconst DropdownMenuShortcut = (_a) => {\n var { className } = _a, props = __rest(_a, [\"className\"]);\n return (React.createElement(\"span\", Object.assign({ className: cn(\"ml-auto text-xs tracking-widest opacity-60\", className) }, props)));\n};\nDropdownMenuShortcut.displayName = \"DropdownMenuShortcut\";\nexport { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuGroup, DropdownMenuPortal, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuRadioGroup, };\n","import { __rest } from \"tslib\";\nimport * as React from \"react\";\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\nimport { cn } from \"@/lib/utils\";\nconst TooltipProvider = (_a) => {\n var { delayDuration = 200 } = _a, props = __rest(_a, [\"delayDuration\"]);\n return (React.createElement(TooltipPrimitive.Provider, Object.assign({ delayDuration: delayDuration }, props)));\n};\nconst Tooltip = TooltipPrimitive.Root;\nconst TooltipTrigger = TooltipPrimitive.Trigger;\nconst TooltipContent = React.forwardRef((_a, ref) => {\n var { className, sideOffset = 4, background, textColor, borderColor, style } = _a, props = __rest(_a, [\"className\", \"sideOffset\", \"background\", \"textColor\", \"borderColor\", \"style\"]);\n return (React.createElement(TooltipPrimitive.Portal, null,\n React.createElement(TooltipPrimitive.Content, Object.assign({ ref: ref, sideOffset: sideOffset, className: cn(\"z-50 overflow-hidden rounded-lg px-4 py-3 text-sm font-medium shadow-lg animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\", className), style: Object.assign(Object.assign({}, style), { backgroundColor: background || '#ffffff', color: textColor || 'rgb(31 41 55)', borderColor: borderColor || 'rgb(243 244 246)', borderWidth: '1px', borderStyle: 'solid' }) }, props))));\n});\nTooltipContent.displayName = TooltipPrimitive.Content.displayName;\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };\n","import React from 'react';\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from '../ui/tooltip';\nexport function Suggestions({ suggestions, onQuestionClick, borderColor, title = 'Suggested questions', }) {\n if (!suggestions || suggestions.length === 0)\n return null;\n return (React.createElement(\"div\", { className: \"w-full\" },\n React.createElement(\"h3\", { className: \"text-base font-medium mb-4 text-gray-900\" }, title),\n React.createElement(\"div\", { className: \"flex flex-wrap gap-2\" }, suggestions.map((suggestion) => (React.createElement(\"button\", { key: suggestion.id, onClick: () => onQuestionClick(suggestion), className: \"px-4 py-2 rounded-lg border border-gray-300 text-gray-700 hover:bg-gray-50 transition-colors duration-200 text-sm flex items-center gap-2\", style: { borderColor } },\n suggestion.messageCount !== undefined && (React.createElement(TooltipProvider, null,\n React.createElement(Tooltip, null,\n React.createElement(TooltipTrigger, { asChild: true },\n React.createElement(\"span\", { className: \"bg-gray-100 text-gray-600 px-2 py-0.5 rounded-full text-xs min-w-[20px] border flex items-center justify-center\", style: { borderColor } }, suggestion.messageCount)),\n React.createElement(TooltipContent, null,\n React.createElement(\"p\", null,\n suggestion.messageCount,\n \" messages in this conversation\"))))),\n React.createElement(\"span\", null, suggestion.question)))))));\n}\nexport default Suggestions;\n","export const programmingLanguages = {\n javascript: '.js',\n python: '.py',\n java: '.java',\n c: '.c',\n cpp: '.cpp',\n 'c++': '.cpp',\n 'c#': '.cs',\n ruby: '.rb',\n php: '.php',\n swift: '.swift',\n 'objective-c': '.m',\n kotlin: '.kt',\n typescript: '.ts',\n go: '.go',\n perl: '.pl',\n rust: '.rs',\n scala: '.scala',\n haskell: '.hs',\n lua: '.lua',\n shell: '.sh',\n sql: '.sql',\n html: '.html',\n css: '.css',\n // add more file extensions here, make sure the key is same as language prop in CodeBlock.tsx component\n};\nexport const generateRandomString = (length, lowercase = false) => {\n const chars = 'ABCDEFGHJKLMNPQRSTUVWXY3456789'; // excluding similar looking characters like Z, 2, I, 1, O, 0\n let result = '';\n for (let i = 0; i < length; i += 1) {\n result += chars.charAt(Math.floor(Math.random() * chars.length));\n }\n return lowercase ? result.toLowerCase() : result;\n};\n","import { __awaiter } from \"tslib\";\nimport React, { memo, useState } from 'react';\nimport { CheckCircle, Clipboard, Download } from 'lucide-react';\nimport { Prism } from 'react-syntax-highlighter';\nimport { a11yDark } from 'react-syntax-highlighter/dist/cjs/styles/prism';\nimport { Button } from '../ui/button';\nimport { generateRandomString, programmingLanguages } from './utils/codeblock';\nconst HighlighterComponent = Prism;\nexport const CodeBlock = memo(({ language, value }) => {\n const [isCopied, setIsCopied] = useState(false);\n const copyToClipboard = () => __awaiter(void 0, void 0, void 0, function* () {\n if (!navigator.clipboard || !navigator.clipboard.writeText) {\n return;\n }\n try {\n yield navigator.clipboard.writeText(value);\n setIsCopied(true);\n setTimeout(() => {\n setIsCopied(false);\n }, 2000);\n }\n catch (error) {\n console.error('Failed to copy:', error);\n }\n });\n const downloadAsFile = () => {\n const fileExtension = programmingLanguages[language] || '.file';\n const suggestedFileName = `file-${generateRandomString(3, true)}${fileExtension}`;\n const fileName = suggestedFileName;\n const blob = new Blob([value], { type: 'text/plain' });\n const url = URL.createObjectURL(blob);\n const link = document.createElement('a');\n link.download = fileName;\n link.href = url;\n link.style.display = 'none';\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n URL.revokeObjectURL(url);\n };\n return (React.createElement(\"div\", { className: \"relative font-sans text-sm mt-1\" },\n React.createElement(\"div\", { className: \"relative rounded-t-lg bg-zinc-800/80 font-sans text-sm backdrop-blur\" },\n React.createElement(\"div\", { className: \"flex h-8 items-center justify-between px-3\" },\n React.createElement(\"span\", { className: \"text-xs font-medium text-zinc-400\" }, language),\n React.createElement(\"div\", { className: \"flex gap-1\" },\n React.createElement(Button, { variant: \"ghost\", size: \"icon\", className: \"size-5 text-zinc-400 hover:bg-zinc-700/50 hover:text-zinc-100\", onClick: () => void copyToClipboard() }, isCopied ? React.createElement(CheckCircle, { size: 18 }) : React.createElement(Clipboard, { size: 18 })),\n React.createElement(Button, { variant: \"ghost\", size: \"icon\", className: \"size-5 text-zinc-400 hover:bg-zinc-700/50 hover:text-zinc-100\", onClick: downloadAsFile },\n React.createElement(Download, { size: 18 }))))),\n React.createElement(\"div\", { className: \"rounded-b-lg\" },\n React.createElement(HighlighterComponent, { language: language, style: a11yDark, PreTag: \"div\", wrapLongLines: true, customStyle: {\n margin: 0,\n borderTopLeftRadius: 0,\n borderTopRightRadius: 0,\n } }, value))));\n});\nCodeBlock.displayName = 'CodeBlock';\n","import * as React from 'react';\n// eslint-disable-next-line react/display-name\nconst Frame = React.forwardRef(({ src, border, width = '100%', height = '400px', title }, ref) => {\n const [isLoaded, setIsLoaded] = React.useState(false);\n const [iframeLoaded, setIframeLoaded] = React.useState(false);\n React.useEffect(() => {\n let mounted = true;\n setTimeout(() => {\n if (mounted) {\n setIsLoaded(true);\n }\n }, 0);\n return () => {\n mounted = false;\n };\n }, []);\n return (React.createElement(\"div\", { className: `overflow-hidden rounded-lg mt-4 ${border ? 'border' : ''}`, style: {\n width,\n height,\n } }, isLoaded && (React.createElement(React.Fragment, null,\n React.createElement(\"div\", { className: `relative w-full h-full ${!iframeLoaded ? 'block' : 'hidden'}` },\n React.createElement(\"div\", { className: \"absolute inset-0 bg-muted/10 rounded-lg\" },\n React.createElement(\"div\", { className: \"absolute inset-0\" },\n React.createElement(\"div\", { className: \"h-full w-full shimmer\" }),\n React.createElement(\"div\", { className: \"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 flex flex-col items-center gap-2\" },\n React.createElement(\"div\", { className: \"modern-spinner\" }),\n React.createElement(\"div\", { className: \"text-sm text-muted-foreground\" }, \"Loading...\"))))),\n React.createElement(\"div\", { className: !iframeLoaded ? 'invisible' : 'visible' },\n React.createElement(\"iframe\", { ref: ref, src: src, sandbox: \"allow-same-origin allow-scripts allow-popups allow-forms allow-downloads\", width: width, height: height, frameBorder: \"0\", title: \"embed\", loading: \"lazy\", allowFullScreen: true, className: \"block rounded-lg\", onLoad: () => setIframeLoaded(true) }),\n title && React.createElement(\"span\", { className: \"block text-center text-sm font-medium\" }, title))))));\n});\nexport default Frame;\n","import * as React from 'react';\nimport Frame from '../Frame';\nfunction Loom(props) {\n const normalizedUrl = props.attrs.href.replace('share', 'embed');\n return React.createElement(Frame, Object.assign({}, props, { src: normalizedUrl, title: \"Loom Embed\" }));\n}\nLoom.isMatch = (href) => {\n const loomRegex = /^https:\\/\\/(www\\.)?(use)?loom\\.com\\/(embed|share)\\/(.*)$/;\n return loomRegex.test(href);\n};\nexport default Loom;\n","import * as React from 'react';\nimport Frame from '../Frame';\nfunction Supademo(props) {\n return React.createElement(Frame, Object.assign({}, props, { src: props.attrs.href, title: \"Supademo Embed\" }));\n}\nSupademo.isMatch = (href) => {\n const urlRegex = /^https:\\/\\/app\\.supademo\\.com\\/embed\\/(.*)$/;\n return urlRegex.test(href);\n};\nexport default Supademo;\n","import * as React from 'react';\nimport Frame from '../Frame';\nfunction Typeform(props) {\n return React.createElement(Frame, Object.assign({}, props, { src: props.attrs.href, title: \"Typeform Embed\" }));\n}\n// Static method to check if the URL matches the Typeform embed pattern\nTypeform.isMatch = (href) => {\n const urlRegex = /^https:\\/\\/([A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?)\\.typeform\\.com\\/to\\/(.*)$/;\n return urlRegex.test(href);\n};\nexport default Typeform;\n","import * as React from 'react';\nimport Frame from '../Frame';\nfunction Vimeo(props) {\n // Extract matches directly within the component\n const extractMatches = (href) => {\n const regex = /(http|https)?:\\/\\/(www\\.)?vimeo\\.com\\/(?:channels\\/(?:\\w+\\/)?|groups\\/([^/]*)\\/videos\\/|)(\\d+)(?:\\/|\\?)?([\\d\\w]+)?/;\n return href.match(regex);\n };\n // Extract the matches from the URL\n const matches = extractMatches(props.attrs.href);\n if (!matches)\n return null; // If no match is found, return null\n const videoId = matches[4];\n const hId = matches[5];\n // Construct the Vimeo embed URL\n const embedUrl = `https://player.vimeo.com/video/${videoId}?byline=0${hId ? `&h=${hId}` : ''}`;\n return (React.createElement(Frame, Object.assign({}, props, { src: embedUrl, title: `Vimeo Embed (${videoId})`, height: \"412px\", border: false })));\n}\nVimeo.isMatch = (href) => {\n const regex = /^(https?):\\/\\/(www\\.)?vimeo\\.com\\/(?:channels\\/(?:\\w+\\/)?|groups\\/([^/]*)\\/videos\\/|)?(\\d+)(\\/)?(?:\\?.*|#.*)?$/i;\n return regex.test(href);\n};\nexport default Vimeo;\n","import * as React from 'react';\nimport Frame from '../Frame';\nfunction Wistia(props) {\n // Function to extract matches directly within the component\n const extractMatches = (href) => {\n const urlRegexes = [\n /^https?:\\/\\/([a-zA-Z0-9-_~]+)\\.wistia\\.com\\/medias\\/([a-zA-Z0-9-_~]+)\\/?$/,\n /^https?:\\/\\/fast\\.wistia\\.com\\/embed\\/iframe\\/([a-zA-Z0-9-_~]+)\\/?$/,\n /^fast\\.wistia\\.com\\/embed\\/iframe\\/([a-zA-Z0-9-_~]+)\\/?$/,\n /^([a-zA-Z0-9-_~]+)\\.wistia\\.com\\/medias\\/([a-zA-Z0-9-_~]+)\\/?$/,\n ];\n // eslint-disable-next-line no-restricted-syntax\n for (const regex of urlRegexes) {\n const match = href.match(regex);\n if (match)\n return match;\n }\n return null;\n };\n // Extract matches from the provided URL\n const matches = extractMatches(props.attrs.href);\n if (!matches)\n return null; // If no matches are found, return null\n const domain = matches[1];\n const videoId = matches[2] || matches[1]; // Fallback for fast embed URLs\n // Determine the embed URL based on whether a domain is present\n const embedUrl = domain\n ? `https://${domain}.wistia.com/embed/iframe/${videoId}?seo=true&videoFoam=false`\n : `https://fast.wistia.com/embed/iframe/${videoId}`;\n return (React.createElement(Frame, Object.assign({}, props, { src: embedUrl, border: true, title: `Wistia Embed (${videoId})` })));\n}\nWistia.isMatch = (href) => {\n const urlRegexes = [\n /^https?:\\/\\/([a-zA-Z0-9-_~]+)\\.wistia\\.com\\/medias\\/([a-zA-Z0-9-_~]+)(\\/)?(\\?.*)?$/i,\n /^https?:\\/\\/fast\\.wistia\\.com\\/embed\\/iframe\\/([a-zA-Z0-9-_~]+)(\\/)?(\\?.*)?$/i,\n /^fast\\.wistia\\.com\\/embed\\/iframe\\/([a-zA-Z0-9-_~]+)(\\/)?(\\?.*)?$/i,\n /^([a-zA-Z0-9-_~]+)\\.wistia\\.com\\/medias\\/([a-zA-Z0-9-_~]+)(\\/)?(\\?.*)?$/i,\n ];\n return urlRegexes.some((regex) => regex.test(href));\n};\nexport default Wistia;\n","import * as React from 'react';\nimport Frame from '../Frame';\nfunction YouTube(props) {\n // Extract the video ID directly within the component\n const extractVideoId = (href) => {\n const urlRegex = /(?:https?:\\/\\/)?(?:www\\.)?youtu\\.?be(?:\\.com)?\\/?.*(?:watch|embed)?(?:.*v=|v\\/|\\/)([a-zA-Z0-9_-]{11})$/i;\n const match = href.match(urlRegex);\n return match ? match[1] : null;\n };\n // Extract video ID from the provided URL\n const videoId = extractVideoId(props.attrs.href);\n if (!videoId)\n return null; // Return null if video ID is not found\n return (React.createElement(Frame, Object.assign({}, props, { src: `https://www.youtube.com/embed/${videoId}?modestbranding=1`, title: `YouTube Embed (${videoId})` })));\n}\n// Static method to check if the URL matches the YouTube embed pattern\nYouTube.isMatch = (href) => {\n const urlRegex = /^(?:https?:\\/\\/)?(?:www\\.)?(?:youtube\\.com\\/(?:watch\\?v=|embed\\/|v\\/|shorts\\/)|youtu\\.be\\/)([a-zA-Z0-9_-]{11})(?:\\/|[?&].*)?$/i;\n return urlRegex.test(href);\n};\nexport default YouTube;\n","import * as React from 'react';\nimport { useEffect, useState } from 'react';\nimport Loom from './Loom';\nimport Supademo from './Supademo';\nimport Typeform from './Typeform';\nimport Vimeo from './Vimeo';\nimport Wistia from './Wistia';\nimport Youtube from './Youtube';\nconst syncEmbedComponents = [Loom, Supademo, Typeform, Youtube, Wistia, Vimeo];\nconst EmbedComponent = (props) => {\n const { href } = props.attrs;\n const [matched, setMatched] = useState(null);\n useEffect(() => {\n let mounted = true;\n const findMatch = () => {\n try {\n const syncMatch = syncEmbedComponents.find((Embed) => Embed.isMatch(href));\n if (syncMatch && mounted) {\n setMatched({ Component: syncMatch, props });\n }\n }\n catch (error) {\n console.error('Error finding embed match:', error);\n }\n };\n findMatch();\n return () => {\n mounted = false;\n };\n }, [href, props]);\n if (matched) {\n const { Component, props: matchedProps } = matched;\n return React.createElement(Component, Object.assign({}, matchedProps));\n }\n return null;\n};\nexport default EmbedComponent;\n","import { memo } from 'react';\nimport ReactMarkdown from 'react-markdown';\nexport const MemoizedReactMarkdown = memo(ReactMarkdown, (prevProps, nextProps) => prevProps.children === nextProps.children);\n","import { __awaiter } from \"tslib\";\nimport React, { useEffect, useRef, useState } from 'react';\nimport mermaid from 'mermaid';\nconst config = {\n startOnLoad: false,\n theme: 'default',\n securityLevel: 'loose',\n fontFamily: 'inherit',\n};\nexport const MermaidDiagram = ({ content }) => {\n const [svg, setSvg] = useState('');\n const [error, setError] = useState(null);\n const containerRef = useRef(null);\n const [isInitialized, setIsInitialized] = useState(false);\n useEffect(() => {\n const initializeMermaid = () => {\n try {\n mermaid.initialize(config);\n setIsInitialized(true);\n }\n catch (err) {\n console.error('Error initializing mermaid:', err);\n setError('Failed to initialize diagram renderer');\n }\n };\n initializeMermaid();\n }, []);\n useEffect(() => {\n if (!isInitialized)\n return;\n const renderDiagram = () => __awaiter(void 0, void 0, void 0, function* () {\n try {\n const id = `mermaid-${Math.random().toString(36).substr(2, 9)}`;\n const result = yield mermaid.render(id, content);\n setSvg(result.svg);\n setError(null);\n }\n catch (err) {\n console.error('Error rendering mermaid diagram:', err);\n setError('Failed to render diagram');\n }\n });\n void renderDiagram();\n }, [content, isInitialized]);\n if (error) {\n return (React.createElement(\"div\", { className: \"text-red-500 bg-red-50 p-4 rounded-md\" },\n error,\n React.createElement(\"pre\", { className: \"mt-2 text-sm\" }, content)));\n }\n return React.createElement(\"div\", { ref: containerRef, className: \"my-4 overflow-auto\", dangerouslySetInnerHTML: { __html: svg } });\n};\nexport default MermaidDiagram;\n","import * as React from 'react';\nimport { motion, AnimatePresence } from 'framer-motion';\nimport { Expand } from 'lucide-react';\nexport const ZoomableImage = ({ src, alt }) => {\n const [isZoomed, setIsZoomed] = React.useState(false);\n const [showFullCaption, setShowFullCaption] = React.useState(false);\n const [imageError, setImageError] = React.useState(false);\n const [isLoading, setIsLoading] = React.useState(true);\n const [dimensions, setDimensions] = React.useState({ width: 0, height: 0 });\n const imgRef = React.useRef(null);\n const toggleZoom = () => {\n setIsZoomed(!isZoomed);\n };\n const handleImageError = () => {\n setIsLoading(false);\n setImageError(true);\n };\n const handleImageLoad = () => {\n if (imgRef.current) {\n const { naturalWidth, naturalHeight } = imgRef.current;\n const maxHeight = 300;\n const aspectRatio = naturalWidth / naturalHeight;\n const height = Math.min(maxHeight, naturalHeight);\n const width = height * aspectRatio;\n setDimensions({ width, height });\n }\n setIsLoading(false);\n };\n if (!src || imageError) {\n return null;\n }\n return (React.createElement(\"figure\", { className: \"relative inline-block my-4 px-4 w-full sm:w-auto\" },\n React.createElement(\"div\", { className: \"flex items-center justify-center min-h-[100px]\" },\n React.createElement(\"button\", { type: \"button\", onClick: toggleZoom, className: \"border-0 p-0 bg-transparent relative group\", \"aria-label\": isZoomed ? 'Zoom out image' : 'Zoom in image' },\n isLoading && (React.createElement(\"div\", { className: \"rounded-md bg-gray-200 dark:bg-gray-800 animate-pulse\", style: {\n width: dimensions.width || 300,\n height: dimensions.height || 200,\n maxHeight: 300\n } })),\n React.createElement(\"img\", { ref: imgRef, src: src, alt: alt, onError: handleImageError, onLoad: handleImageLoad, className: `max-h-[300px] w-auto object-contain cursor-zoom-in hover:opacity-90 transition-opacity ${isLoading ? 'opacity-0 absolute' : 'opacity-100 relative'}` }),\n !isLoading && (React.createElement(\"div\", { className: \"absolute bottom-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity\" },\n React.createElement(\"div\", { className: \"bg-black/50 text-white p-1.5 rounded-lg\" },\n React.createElement(Expand, { size: 16 })))))),\n alt && !isLoading && (React.createElement(\"div\", { className: \"relative mt-1\" },\n React.createElement(\"figcaption\", { className: \"text-sm text-gray-600 dark:text-gray-400 text-center group cursor-default\", onMouseEnter: () => setShowFullCaption(true), onMouseLeave: () => setShowFullCaption(false) },\n React.createElement(\"div\", { className: \"line-clamp-2 hover:text-gray-700 dark:hover:text-gray-300\" }, alt)),\n showFullCaption && (React.createElement(\"div\", { className: \"absolute bottom-full left-0 right-0 mb-1 p-2 bg-white dark:bg-gray-800 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 text-sm text-gray-600 dark:text-gray-400 z-10\" }, alt)))),\n React.createElement(AnimatePresence, null, isZoomed && (React.createElement(React.Fragment, null,\n React.createElement(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, className: \"fixed inset-0 bg-black/80 z-50\", onClick: toggleZoom }),\n React.createElement(motion.div, { initial: { scale: 0.5, opacity: 0 }, animate: { scale: 1, opacity: 1 }, exit: { scale: 0.5, opacity: 0 }, className: \"fixed inset-0 z-50 flex flex-col items-center justify-center cursor-zoom-out gap-4 p-4 sm:p-8\", onClick: toggleZoom },\n React.createElement(\"div\", { className: \"max-w-[95vw] sm:max-w-[90vw] max-h-[80vh]\" },\n React.createElement(\"img\", { src: src, alt: alt, className: \"w-full h-full object-contain\" })),\n alt && React.createElement(\"div\", { className: \"max-w-[95vw] sm:max-w-[90vw] text-white text-center text-sm\" }, alt)))))));\n};\nexport default ZoomableImage;\n","import { __rest } from \"tslib\";\nimport React, { memo, useEffect, useState } from 'react';\nimport rehypeRaw from 'rehype-raw';\nimport remarkGfm from 'remark-gfm';\nimport { CodeBlock } from './CodeBlock';\nimport EmbedComponent from './embeds';\nimport { MemoizedReactMarkdown } from './MemoizedReactMarkdown';\nimport { MermaidDiagram } from './MermaidDiagram';\nimport { ZoomableImage } from './ZoomableImage';\nimport { stripNewLines } from './utils/stripNewLines';\nimport { isAnswerUncertain } from '../../lib/utils';\nexport const FormattedMessage = memo(({ message, isStreaming }) => {\n const [displayContent, setDisplayContent] = useState(message.content);\n useEffect(() => {\n var _a;\n const result = isAnswerUncertain(message.content);\n if (result.uncertain && result.language && ((_a = message.uncertaintyFallbackText) === null || _a === void 0 ? void 0 : _a[result.language])) {\n setDisplayContent(message.uncertaintyFallbackText[result.language]);\n }\n else {\n setDisplayContent(message.content);\n }\n }, [message.content, message.uncertaintyFallbackText, isStreaming]);\n const strippedContent = stripNewLines(displayContent);\n return (React.createElement(MemoizedReactMarkdown, { className: \"dark:prose-invert prose flex-1\", remarkPlugins: [remarkGfm], rehypePlugins: [rehypeRaw], components: {\n code: (_a) => {\n var { inline, className, children } = _a, props = __rest(_a, [\"inline\", \"className\", \"children\"]);\n const match = /language-(\\w+)/.exec(className || '');\n const language = match && match[1];\n if (!inline && (language === 'mermaid' || language === 'mermaidjs')) {\n return React.createElement(MermaidDiagram, { content: String(children).replace(/\\n$/, '') });\n }\n return !inline && language ? (React.createElement(CodeBlock, Object.assign({ key: Math.random(), language: language, value: String(children).replace(/\\n$/, '') }, props))) : (React.createElement(\"code\", Object.assign({ className: `text-red-400 bg-slate-200 border-slate-300 border rounded p-0.5 ${className}`.trim() }, props), children));\n },\n marker({ children }) {\n return (React.createElement(\"div\", { className: \"my-2\" },\n React.createElement(\"span\", { className: \"highlight\" }, children)));\n },\n table({ children }) {\n return React.createElement(\"table\", { className: \"border-collapse border border-black px-3 py-1 dark:border-white\" }, children);\n },\n th({ children }) {\n return (React.createElement(\"th\", { className: \"break-words border border-black bg-gray-500 px-3 py-1 text-white dark:border-white\" }, children));\n },\n td({ children }) {\n return React.createElement(\"td\", { className: \"break-words border border-black px-3 py-1 dark:border-white\" }, children);\n },\n a(_a) {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n if (props.href) {\n const embedComponent = EmbedComponent({\n attrs: { href: props.href },\n });\n if (React.isValidElement(embedComponent)) {\n return embedComponent;\n }\n }\n return (React.createElement(\"a\", Object.assign({ className: \"link\", target: \"_blank\", rel: \"noopener noreferrer\" }, props), children));\n },\n pre: ({ children }) => React.createElement(React.Fragment, null, children),\n img({ src, alt }) {\n const embedComponent = EmbedComponent({\n attrs: { href: src !== null && src !== void 0 ? src : '' },\n });\n if (React.isValidElement(embedComponent)) {\n return embedComponent;\n }\n return React.createElement(ZoomableImage, { src: src, alt: alt });\n },\n li: (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (React.createElement(\"li\", Object.assign({ className: \"py-1\" }, props), children));\n },\n ul({ children }) {\n return React.createElement(\"ul\", { className: \"ml-4 list-outside list-disc\" }, children);\n },\n ol({ children }) {\n return React.createElement(\"ol\", { className: \"ml-4 list-outside list-decimal\" }, children);\n },\n strong: (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (React.createElement(\"span\", Object.assign({ className: \"font-semibold\" }, props), children));\n },\n h1: (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (React.createElement(\"h1\", Object.assign({ className: \"mb-2 mt-6 text-3xl font-semibold\" }, props), children));\n },\n h2: (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (React.createElement(\"h2\", Object.assign({ className: \"mb-2 mt-6 text-2xl font-semibold\" }, props), children));\n },\n h3: (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (React.createElement(\"h3\", Object.assign({ className: \"mb-2 mt-6 text-xl font-semibold\" }, props), children));\n },\n h4: (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (React.createElement(\"h4\", Object.assign({ className: \"mb-2 mt-6 text-lg font-semibold\" }, props), children));\n },\n h5: (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (React.createElement(\"h5\", Object.assign({ className: \"mb-2 mt-6 text-base font-semibold\" }, props), children));\n },\n h6: (_a) => {\n var { children } = _a, props = __rest(_a, [\"children\"]);\n return (React.createElement(\"h6\", Object.assign({ className: \"mb-2 mt-6 text-sm font-semibold\" }, props), children));\n },\n } }, strippedContent));\n});\nFormattedMessage.displayName = 'FormattedMessage';\n","export const stripNewLines = (content) => content.replace(/^\\n+|(\\n+|\\\\)+$/g, '');\n","import React, { useState } from 'react';\nimport { ThumbsUp, ThumbsDown, Heart } from 'lucide-react';\nimport { motion, AnimatePresence } from 'framer-motion';\nimport { Button } from '@/components/ui/button';\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';\nexport function Feedback({ feedback, onFeedback, theme, textConfig = {}, disabled = false, }) {\n const [showHearts, setShowHearts] = useState(false);\n const handleFeedback = (response) => {\n if (onFeedback) {\n if (response === 'accept') {\n setShowHearts(true);\n setTimeout(() => setShowHearts(false), 2000);\n }\n onFeedback(response);\n }\n };\n return (React.createElement(\"div\", { className: \"flex justify-end gap-2\" },\n React.createElement(TooltipProvider, null,\n React.createElement(Tooltip, null,\n React.createElement(TooltipTrigger, { asChild: true },\n React.createElement(\"div\", { className: \"relative\" },\n React.createElement(AnimatePresence, null, showHearts && (React.createElement(React.Fragment, null,\n Array.from({ length: 8 }).map((_, i) => (React.createElement(motion.div, { key: i, className: \"absolute\", initial: { opacity: 0, scale: 0.3, x: 0, y: 0 }, animate: {\n opacity: [0, 1, 1, 0],\n scale: [0.3, 1, 1, 0],\n x: [0, Math.cos(i * (Math.PI / 4)) * 30],\n y: [0, Math.sin(i * (Math.PI / 4)) * 30],\n rotate: [0, i % 2 ? 45 : -45],\n }, transition: {\n duration: 1.2,\n ease: [0.4, 0, 0.2, 1],\n times: [0, 0.3, 0.7, 1],\n delay: i * 0.1,\n }, style: {\n top: '50%',\n left: '50%',\n transformOrigin: 'center',\n } },\n React.createElement(Heart, { className: \"w-4 h-4\", style: {\n color: '#ff4b6e',\n filter: 'drop-shadow(0 0 3px rgba(255, 75, 110, 0.8))',\n strokeWidth: 2.5,\n } })))),\n React.createElement(motion.div, { className: \"absolute inset-0 rounded-full\", initial: { opacity: 0, scale: 0.8 }, animate: {\n opacity: [0, 0.15, 0.15, 0],\n scale: [0.8, 1.8, 1.8, 2],\n }, transition: {\n duration: 1.2,\n ease: 'easeOut',\n times: [0, 0.3, 0.7, 1],\n }, style: {\n backgroundColor: theme.primary,\n } })))),\n React.createElement(Button, { variant: \"ghost\", size: \"sm\", className: `rounded-md h-8 w-8 flex items-center justify-center transition-all duration-200 transform hover:scale-105 active:scale-95 ${feedback === 'accept' ? 'bg-green-100 text-green-600 hover:bg-green-200' : ''}`, onClick: () => handleFeedback('accept'), disabled: disabled },\n React.createElement(motion.div, { initial: { scale: 1 }, animate: { scale: feedback === 'accept' ? [1, 1.2, 1] : 1 }, transition: { duration: 0.3 } },\n React.createElement(ThumbsUp, { className: \"h-4 w-4\" }))))),\n React.createElement(TooltipContent, null,\n React.createElement(\"p\", null, textConfig.positiveAnswerText || 'Helpful')))),\n React.createElement(TooltipProvider, null,\n React.createElement(Tooltip, null,\n React.createElement(TooltipTrigger, { asChild: true },\n React.createElement(Button, { variant: \"ghost\", size: \"sm\", className: `rounded-md h-8 w-8 flex items-center justify-center transition-all duration-200 transform hover:scale-105 active:scale-95 ${feedback === 'reject' ? 'bg-red-100 text-red-600 hover:bg-red-200' : ''}`, onClick: () => handleFeedback('reject'), disabled: disabled },\n React.createElement(motion.div, { initial: { scale: 1 }, animate: { scale: feedback === 'reject' ? [1, 1.2, 1] : 1 }, transition: { duration: 0.3 } },\n React.createElement(ThumbsDown, { className: \"h-4 w-4\" })))),\n React.createElement(TooltipContent, null,\n React.createElement(\"p\", null, textConfig.negativeAnswerText || 'Not helpful'))))));\n}\n","import React from \"react\";\nimport styles from \"./generating-star.module.css\";\nconst GeneratingStar = ({ loading, color = \"#000\" }) => (React.createElement(\"svg\", { width: \"24\", height: \"24\", viewBox: \"0 0 24 24\", fill: \"currentColor\", xmlns: \"http://www.w3.org/2000/svg\", className: \"mt-[-5px] inline-block flex-shrink-0\", style: { minWidth: '24px', minHeight: '24px' } },\n React.createElement(\"path\", { className: loading ? styles['animate-spin'] : '', d: \"M7.54672 16.0031L2.66234 14.2031C2.51881 14.1498 2.39502 14.0539 2.3076 13.9282C2.22019 13.8025 2.17333 13.6531 2.17333 13.5C2.17333 13.3469 2.22019 13.1975 2.3076 13.0718C2.39502 12.9461 2.51881 12.8501 2.66234 12.7969L7.54672 10.9969C7.64981 10.9589 7.74344 10.899 7.82113 10.8213C7.89882 10.7436 7.95873 10.65 7.99672 10.5469L9.79672 5.66249C9.84999 5.51896 9.94592 5.39517 10.0716 5.30775C10.1973 5.22033 10.3467 5.17348 10.4998 5.17348C10.6529 5.17348 10.8024 5.22033 10.9281 5.30775C11.0538 5.39517 11.1497 5.51896 11.203 5.66249L13.003 10.5469C13.041 10.65 13.1009 10.7436 13.1786 10.8213C13.2562 10.899 13.3499 10.9589 13.453 10.9969L18.3373 12.7969C18.4809 12.8501 18.6047 12.9461 18.6921 13.0718C18.7795 13.1975 18.8264 13.3469 18.8264 13.5C18.8264 13.6531 18.7795 13.8025 18.6921 13.9282C18.6047 14.0539 18.4809 14.1498 18.3373 14.2031L13.453 16.0031C13.3499 16.0411 13.2562 16.101 13.1786 16.1787C13.1009 16.2564 13.041 16.35 13.003 16.4531L11.203 21.3375C11.1497 21.481 11.0538 21.6048 10.9281 21.6922C10.8024 21.7796 10.6529 21.8265 10.4998 21.8265C10.3467 21.8265 10.1973 21.7796 10.0716 21.6922C9.94592 21.6048 9.84999 21.481 9.79672 21.3375L7.99672 16.4531C7.95873 16.35 7.89882 16.2564 7.82113 16.1787C7.74344 16.101 7.64981 16.0411 7.54672 16.0031Z\", stroke: color, strokeWidth: \"1.5\", strokeLinecap: \"round\", fill: loading ? color : 'none', strokeLinejoin: \"round\" }),\n React.createElement(\"path\", { d: \"M18.7497 3.75L14.2497 3.75\", stroke: color, strokeWidth: \"1.5\", strokeLinecap: \"round\", strokeLinejoin: \"round\" }),\n React.createElement(\"path\", { d: \"M16.4999 6V1.5\", stroke: color, strokeWidth: \"1.5\", strokeLinecap: \"round\", strokeLinejoin: \"round\" }),\n React.createElement(\"path\", { d: \"M22.4999 8.25001H19.4999\", stroke: color, strokeWidth: \"1.5\", strokeLinecap: \"round\", strokeLinejoin: \"round\" }),\n React.createElement(\"path\", { d: \"M20.9998 9.75002V6.75002\", stroke: color, strokeWidth: \"1.5\", strokeLinecap: \"round\", strokeLinejoin: \"round\" })));\nexport default GeneratingStar;\n","import { __awaiter } from \"tslib\";\nimport React, { useState } from 'react';\nimport { Copy, FileText, ChevronDown, Check, ExternalLink } from 'lucide-react';\nimport { FormattedMessage } from '../markdown/FormattedMessage';\nimport { Feedback } from '@/components/ui/feedback';\nimport GeneratingStar from '@/components/ui/generating-star';\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';\nexport function SearchResults({ answer, question, theme, searchResults, isStreaming = false, searchQueryId, feedback, onFeedback, disableFeedback = false, textConfig = {}, isLoading = false, isSearchLoading = false, }) {\n const [isCopied, setIsCopied] = useState(false);\n const [isExpanded, setIsExpanded] = useState(false);\n const handleCopy = () => __awaiter(this, void 0, void 0, function* () {\n try {\n yield navigator.clipboard.writeText(answer);\n setIsCopied(true);\n setTimeout(() => setIsCopied(false), 2000);\n }\n catch (err) {\n console.error('Failed to copy text:', err);\n }\n });\n const handleFeedback = (response) => {\n if (onFeedback && searchQueryId) {\n onFeedback(response);\n }\n };\n return (React.createElement(\"div\", { className: \"rounded-lg p-6 relative mx-auto max-w-3xl\", style: {\n backgroundColor: theme.cardBackground,\n borderColor: theme.border,\n borderWidth: '1px',\n borderStyle: 'solid',\n } },\n React.createElement(\"div\", { className: \"flex items-start justify-between\" },\n React.createElement(\"div\", { className: \"flex items-center gap-2 mb-4\" },\n React.createElement(\"div\", { className: \"mt-1\" },\n React.createElement(GeneratingStar, { loading: isLoading || isStreaming, color: theme.primary })),\n React.createElement(\"h2\", { className: \"text-xl leading-normal font-semibold\", style: { color: theme.text } }, question)),\n answer && (React.createElement(TooltipProvider, null,\n React.createElement(Tooltip, null,\n React.createElement(TooltipTrigger, { asChild: true },\n React.createElement(\"button\", { onClick: () => void handleCopy(), className: \"flex items-center justify-center w-8 h-8 rounded-md hover:bg-gray-100 transition-colors duration-200\" }, isCopied ? (React.createElement(Check, { className: \"h-4 w-4\", style: { color: theme.feedbackPositive } })) : (React.createElement(Copy, { className: \"h-4 w-4\", style: { color: theme.iconColor } })))),\n React.createElement(TooltipContent, null,\n React.createElement(\"p\", null, isCopied ? 'Copied!' : 'Copy')))))),\n isLoading ? (React.createElement(\"div\", { className: \"space-y-4\" },\n React.createElement(\"div\", { className: \"flex items-center gap-2\" },\n React.createElement(\"div\", { className: \"h-5 rounded-full w-5\", style: { backgroundColor: `${theme.primary}30` } }),\n React.createElement(\"div\", { className: \"flex items-center gap-2 text-sm\", style: { color: theme.text } }, isSearchLoading ? textConfig.loadingSearchText : textConfig.loadingAnswerText)),\n React.createElement(\"div\", { className: \"space-y-3\" },\n React.createElement(\"div\", { className: \"h-4 bg-gray-200 rounded w-3/4\", style: { backgroundColor: `${theme.border}40` } }),\n React.createElement(\"div\", { className: \"h-4 bg-gray-200 rounded w-full\", style: { backgroundColor: `${theme.border}40` } }),\n React.createElement(\"div\", { className: \"h-4 bg-gray-200 rounded w-5/6\", style: { backgroundColor: `${theme.border}40` } })),\n React.createElement(\"div\", { className: \"mt-6 space-y-3\" },\n React.createElement(\"div\", { className: \"h-4 bg-gray-200 rounded w-1/4\", style: { backgroundColor: `${theme.border}40` } }),\n React.createElement(\"div\", { className: \"flex gap-2\" },\n React.createElement(\"div\", { className: \"h-8 bg-gray-200 rounded w-32\", style: { backgroundColor: `${theme.border}40` } }),\n React.createElement(\"div\", { className: \"h-8 bg-gray-200 rounded w-40\", style: { backgroundColor: `${theme.border}40` } }))))) : answer ? (React.createElement(\"div\", { className: \"prose prose-sm max-w-none\", style: { color: theme.text } },\n React.createElement(FormattedMessage, { message: {\n content: answer,\n theme: {\n primary: theme.primary,\n text: theme.text,\n },\n uncertaintyFallbackText: textConfig.uncertaintyFallbackText,\n }, isStreaming: isStreaming }))) : (React.createElement(\"div\", { className: \"prose prose-sm max-w-none\", style: { color: theme.text } },\n React.createElement(FormattedMessage, { message: {\n content: 'Sorry, there was an error generating the answer. Please try again.',\n theme: {\n primary: theme.primary,\n text: theme.text,\n },\n }, isStreaming: isStreaming }))),\n answer && !isStreaming && !disableFeedback && (React.createElement(\"div\", { className: \"mt-2\" },\n React.createElement(Feedback, { feedback: feedback, onFeedback: handleFeedback, theme: theme, textConfig: textConfig, disabled: disableFeedback }))),\n searchResults && searchResults.length > 0 && (React.createElement(\"div\", { className: \"mt-6 rounded-lg overflow-hidden\", style: {\n backgroundColor: theme.cardBackground,\n borderWidth: '1px',\n borderStyle: 'solid',\n borderColor: theme.border,\n } },\n React.createElement(\"button\", { onClick: () => setIsExpanded(!isExpanded), className: \"w-full flex items-center justify-between p-3 transition-all duration-200 hover:bg-opacity-50\", style: {\n color: theme.text,\n borderBottom: isExpanded ? `1px solid ${theme.surfaceBorder}` : 'none',\n } },\n React.createElement(\"div\", { className: \"flex items-center gap-2\" },\n React.createElement(FileText, { className: \"h-4 w-4 flex-shrink-0\", style: { color: theme.iconColor } }),\n React.createElement(\"span\", { className: \"font-medium truncate\" }, `Related Sources (${searchResults.length})`)),\n React.createElement(ChevronDown, { className: `h-4 w-4 flex-shrink-0 transition-transform duration-200 ${isExpanded ? 'rotate-180' : ''}`, style: { color: theme.iconColor } })),\n React.createElement(\"div\", { className: \"overflow-hidden transition-all duration-200 ease-in-out\", style: {\n maxHeight: isExpanded ? `${searchResults.length * 48}px` : '0',\n opacity: isExpanded ? 1 : 0,\n transform: `translateY(${isExpanded ? '0' : '-10px'})`,\n } },\n React.createElement(\"div\", { className: \"divide-y divide-gray-200\" }, searchResults.map((result) => (React.createElement(\"a\", { key: result.id, href: result.url, target: \"_blank\", rel: \"noopener noreferrer\", className: \"flex items-center gap-2 p-3 transition-colors duration-200 hover:bg-opacity-80\", style: {\n color: theme.text,\n backgroundColor: theme.cardBackground,\n } },\n React.createElement(\"span\", { className: \"flex-grow truncate\" }, result.title),\n React.createElement(ExternalLink, { className: \"h-4 w-4 flex-shrink-0\", style: { color: theme.iconColor } }))))))))));\n}\n","import React from 'react';\nimport { HelpCircle, ChevronRight } from 'lucide-react';\nimport { motion } from 'framer-motion';\nexport function FollowUpQuestions({ questions, onQuestionClick, theme }) {\n if (!questions.length)\n return null;\n return (React.createElement(motion.div, { initial: { opacity: 0, y: 20 }, animate: { opacity: 1, y: 0 }, exit: { opacity: 0, y: -20 }, className: \"w-full\" },\n React.createElement(\"div\", { className: \"rounded-lg overflow-hidden\", style: {\n backgroundColor: theme.surface,\n borderWidth: '1px',\n borderStyle: 'solid',\n borderColor: theme.border,\n } },\n React.createElement(\"div\", { className: \"p-3 border-b\", style: { borderColor: theme.surfaceBorder } },\n React.createElement(\"div\", { className: \"flex items-center gap-2\" },\n React.createElement(HelpCircle, { className: \"h-4 w-4 flex-shrink-0\", style: { color: theme.iconColor } }),\n React.createElement(\"span\", { className: \"font-medium\" }, \"Follow-up Questions\"))),\n React.createElement(\"div\", { className: \"divide-y divide-gray-200\" }, questions.map((question, index) => (React.createElement(motion.button, { key: index, initial: { opacity: 0, x: -20 }, animate: { opacity: 1, x: 0 }, transition: { delay: index * 0.1 }, onClick: () => onQuestionClick(question), className: \"w-full flex items-center gap-2 p-3 transition-colors duration-200 hover:bg-gray-50 text-left\", style: {\n color: theme.text,\n backgroundColor: theme.surface,\n } },\n React.createElement(\"span\", { className: \"flex-grow\" }, question),\n React.createElement(ChevronRight, { className: \"h-4 w-4 flex-shrink-0\", style: { color: `${theme.text}60` } }))))))));\n}\n","import React, { useState, useEffect } from 'react';\nimport { MoreVertical } from 'lucide-react';\nimport { motion, AnimatePresence } from 'framer-motion';\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';\nexport function TimelineNavigation({ questions, activeIndex, onNavigate, theme, offset }) {\n const [prevActiveIndex, setPrevActiveIndex] = useState(activeIndex);\n useEffect(() => {\n setPrevActiveIndex(activeIndex);\n }, [activeIndex]);\n // Show 2 items before and after the active item\n const VISIBLE_ITEMS_EACH_SIDE = 2;\n const totalItems = questions.length;\n const getVisibleIndexes = () => {\n const indexes = [];\n let lastAddedIndex = null;\n const addIndex = (index) => {\n if (lastAddedIndex !== null && index - lastAddedIndex > 1) {\n indexes.push('ellipsis');\n }\n indexes.push(index);\n lastAddedIndex = index;\n };\n // Always show first item\n addIndex(0);\n // Show items around active index\n for (let i = Math.max(1, activeIndex - VISIBLE_ITEMS_EACH_SIDE); i <= Math.min(totalItems - 2, activeIndex + VISIBLE_ITEMS_EACH_SIDE); i++) {\n addIndex(i);\n }\n // Always show last item if we have more than one item\n if (totalItems > 1) {\n addIndex(totalItems - 1);\n }\n return indexes;\n };\n const visibleIndexes = getVisibleIndexes();\n return (React.createElement(\"nav\", { \"aria-label\": \"Question timeline navigation\", className: \"fixed left-4 top-1/2 -translate-y-1/2 z-40 flex flex-col gap-3\", style: Object.assign({}, (offset ? { left: `${offset}px` } : {})) },\n React.createElement(motion.div, { className: \"flex flex-col items-center space-y-3\", role: \"list\", initial: false, animate: { y: 0 }, transition: { type: 'spring', stiffness: 300, damping: 30 } },\n React.createElement(AnimatePresence, null, visibleIndexes.map((indexOrEllipsis, arrayIndex) => {\n if (indexOrEllipsis === 'ellipsis') {\n return (React.createElement(motion.div, { key: `ellipsis-${arrayIndex}`, className: \"h-8 flex items-center justify-center\", \"aria-hidden\": \"true\", initial: { opacity: 0, y: prevActiveIndex > activeIndex ? -20 : 20 }, animate: { opacity: 1, y: 0 }, exit: { opacity: 0, y: prevActiveIndex > activeIndex ? 20 : -20 }, transition: { duration: 0.2 } },\n React.createElement(MoreVertical, { className: \"w-4 h-4\", style: { color: theme.text } })));\n }\n const index = indexOrEllipsis;\n const question = questions[index];\n return (React.createElement(motion.div, { key: index, className: \"relative group isolate\", role: \"listitem\", initial: { opacity: 0, y: prevActiveIndex > activeIndex ? -20 : 20 }, animate: { opacity: 1, y: 0 }, exit: { opacity: 0, y: prevActiveIndex > activeIndex ? 20 : -20 }, transition: { duration: 0.2 }, layout: true },\n React.createElement(TooltipProvider, { delayDuration: 100 },\n React.createElement(Tooltip, null,\n React.createElement(TooltipTrigger, { asChild: true },\n React.createElement(\"button\", { onClick: () => onNavigate(index), onKeyDown: (e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n onNavigate(index);\n }\n }, className: \"flex items-center justify-center w-8 h-8 rounded-full transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 hover:opacity-90\", style: {\n backgroundColor: index === activeIndex ? theme.primary : '#ccc',\n color: index === activeIndex ? theme.buttonText : '#333',\n cursor: 'pointer',\n '--tw-ring-color': theme.primary,\n }, \"aria-label\": `Navigate to question ${index + 1}: ${question}`, \"aria-current\": index === activeIndex ? 'step' : undefined }, index + 1)),\n React.createElement(TooltipContent, { side: \"right\", sideOffset: 8, className: \"max-w-[300px]\", background: theme.cardBackground, textColor: theme.text, borderColor: `${theme.text}33` },\n React.createElement(\"p\", { className: \"break-words leading-relaxed\" }, question))))));\n })))));\n}\n","import { ArrowDown } from 'lucide-react';\nimport React from 'react';\nimport { Button } from '@/components/ui/button';\nexport function ScrollToBottomArrow({ onClick, theme }) {\n return (React.createElement(Button, { className: \"fixed bottom-20 right-4 rounded-full p-2 transition-opacity duration-300\", style: {\n backgroundColor: theme.background,\n borderColor: theme.border,\n borderWidth: '1px',\n borderStyle: 'solid',\n boxShadow: '0 4px 6px -1px rgba(0, 0, 0, 0.1)',\n }, onClick: onClick },\n React.createElement(ArrowDown, { className: \"h-5 w-5\", style: { color: theme.text } })));\n}\n","import { __awaiter, __rest } from \"tslib\";\nconst defaultRetryOptions = {\n maxRetries: 3,\n baseDelay: 1000,\n shouldRetry: (error) => {\n // By default, retry on network errors and 5xx server errors\n if (error instanceof TypeError) {\n return true; // Network errors\n }\n const apiError = error;\n return apiError.status ? apiError.status >= 500 : false;\n },\n};\nconst defaultFallbackConfig = {\n emptyResponse: \"I apologize, but I couldn't generate an answer at this time. Please try again.\",\n errorResponse: 'I encountered an error while processing your request. Please try again.',\n};\nlet globalRetryOptions = Object.assign({}, defaultRetryOptions);\nlet globalFallbackConfig = Object.assign({}, defaultFallbackConfig);\nexport function configureRetry(options) {\n globalRetryOptions = Object.assign(Object.assign({}, defaultRetryOptions), options);\n}\nexport function configureFallback(config) {\n globalFallbackConfig = Object.assign(Object.assign({}, defaultFallbackConfig), config);\n}\nfunction delay(ms) {\n return __awaiter(this, void 0, void 0, function* () {\n return new Promise((resolve) => setTimeout(resolve, ms));\n });\n}\nexport function makeRequest(url, config = {}) {\n return __awaiter(this, void 0, void 0, function* () {\n const { retry = {}, headers = {}, body, isStream = false, fallback = {} } = config, fetchConfig = __rest(config, [\"retry\", \"headers\", \"body\", \"isStream\", \"fallback\"]);\n const retryOptions = Object.assign(Object.assign({}, globalRetryOptions), retry);\n const fallbackOptions = Object.assign(Object.assign({}, globalFallbackConfig), fallback);\n let attempt = 1;\n // eslint-disable-next-line no-constant-condition\n while (true) {\n try {\n const response = yield fetch(url, Object.assign(Object.assign({}, fetchConfig), { headers: Object.assign({ 'Content-Type': 'application/json' }, headers), body: body ? JSON.stringify(body) : undefined }));\n if (response.ok) {\n // For streaming responses, return the response object directly\n if (isStream) {\n if (!response.ok) {\n throw new Error('Failed to fetch answer');\n }\n return response;\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const data = yield response.json();\n // Check for empty response in JSON\n if (!data || (typeof data === 'object' && Object.keys(data).length === 0)) {\n const emptyError = new Error(fallbackOptions.emptyResponse);\n emptyError.name = 'EmptyResponseError';\n throw emptyError;\n }\n return data;\n }\n const error = new Error(fallbackOptions.errorResponse);\n error.status = response.status;\n error.data = yield response.json().catch(() => undefined);\n throw error;\n }\n catch (error) {\n const shouldAttemptRetry = yield Promise.resolve(retryOptions.shouldRetry(error, attempt));\n if (attempt >= retryOptions.maxRetries || !shouldAttemptRetry) {\n if (error instanceof Error && error.name === 'EmptyResponseError') {\n return { message: error.message };\n }\n throw error;\n }\n console.warn(`Request failed, attempt ${attempt} of ${retryOptions.maxRetries}. Retrying...`);\n // Exponential backoff with jitter to prevent thundering herd\n const jitter = Math.random() * 0.3 + 0.85; // Random between 0.85-1.15\n yield delay(retryOptions.baseDelay * Math.pow(2, attempt - 1) * jitter);\n attempt++;\n }\n }\n });\n}\n","import { __awaiter } from \"tslib\";\nimport { makeRequest } from './fetchClient';\n// Retry configurations for different endpoints\nconst searchRetryConfig = {\n maxRetries: 3,\n baseDelay: 300,\n shouldRetry: (error) => {\n if (error instanceof TypeError) {\n return true; // Network errors\n }\n const apiError = error;\n // Retry on server errors (5xx) and rate limits (429)\n return apiError.status ? apiError.status >= 500 || apiError.status === 429 : false;\n },\n};\nconst answerRetryConfig = {\n maxRetries: 3,\n baseDelay: 500,\n shouldRetry: (error) => {\n if (error instanceof TypeError) {\n return true; // Network errors\n }\n const apiError = error;\n // Only retry on server errors, not on client errors\n return apiError.status ? apiError.status >= 500 : false;\n },\n};\n// Helper function to generate UUID v4\nfunction uuidv4() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0;\n const v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\nexport function searchApi({ endpoint, query, collectionId, headers, conversationId, }) {\n var _a;\n return __awaiter(this, void 0, void 0, function* () {\n const payload = yield makeRequest(endpoint, {\n method: 'POST',\n headers,\n retry: searchRetryConfig,\n body: Object.assign(Object.assign({ query, limit: 5 }, (collectionId && collectionId !== 'all' && { collectionId })), (conversationId && { conversationId })),\n });\n return {\n results: payload === null || payload === void 0 ? void 0 : payload.data,\n searchQueryId: (_a = payload === null || payload === void 0 ? void 0 : payload.searchQuery) === null || _a === void 0 ? void 0 : _a.id,\n };\n });\n}\nexport function fetchAnswer({ endpoint, searchQueryId, headers, conversationId, }) {\n return __awaiter(this, void 0, void 0, function* () {\n return makeRequest(endpoint, {\n method: 'POST',\n headers,\n retry: answerRetryConfig,\n isStream: true,\n fallback: {\n emptyResponse: \"I apologize, but I couldn't generate an answer for your query. Please try rephrasing your question.\",\n errorResponse: 'I encountered an issue while generating the answer. Please try again in a moment.',\n },\n body: Object.assign({ searchQueryId }, (conversationId && { conversationId })),\n });\n });\n}\n// Helper function to generate conversation ID\nexport function getConversationId() {\n // Generate a unique ID combining:\n // 1. bf-conversation- prefix\n // 2. timestamp for chronological reference\n // 3. UUID v4 for uniqueness\n const timestamp = Date.now();\n const uuid = uuidv4();\n return `bf-conversation-${timestamp}-${uuid}`;\n}\nexport function sendFeedback({ endpoint, searchQueryId, response, headers, conversationId, }) {\n return __awaiter(this, void 0, void 0, function* () {\n yield makeRequest(endpoint, {\n method: 'POST',\n headers,\n body: Object.assign({ searchQueryId,\n response }, (conversationId && { conversationId })),\n });\n });\n}\nexport function loadConversation({ endpoint, conversationId, headers, }) {\n return __awaiter(this, void 0, void 0, function* () {\n const payload = yield makeRequest(endpoint, {\n method: 'POST',\n headers,\n body: { conversationId },\n });\n const convertedData = payload.data.map((answer) => (Object.assign(Object.assign({}, answer), { feedback: answer.feedback ? (answer.feedback === 'positive' ? 'accept' : 'reject') : undefined })));\n return { data: convertedData };\n });\n}\nexport function fetchFollowUpQuestions({ endpoint, searchQueryId, headers, conversationId, }) {\n return __awaiter(this, void 0, void 0, function* () {\n const data = yield makeRequest(endpoint, {\n method: 'POST',\n headers,\n body: Object.assign({ searchQueryId }, (conversationId && { conversationId })),\n });\n return data.questions;\n });\n}\n","export const defaultTheme = {\n primary: '#A3E635',\n background: '#e5e5e5',\n text: '#171717',\n border: '#171717',\n surface: 'white',\n surfaceBorder: '#E5E7EB',\n surfaceHover: '#F3F4F6',\n cardBackground: 'white',\n textSecondary: '#4B5563',\n iconColor: '#4B5563',\n buttonBackground: 'white',\n buttonText: '#171717',\n loadingBackground: '#E5E7EB',\n overlayBackground: 'rgba(0, 0, 0, 0.5)',\n overlayText: 'white',\n feedbackPositive: '#22C55E',\n feedbackNegative: '#EF4444', // red-500\n};\n","export const defaultTextConfig = {\n headerText: 'How can we help you today?',\n searchPlaceholder: 'Ask a question or type a search term here ...',\n attachImageText: 'Attach image',\n allDocumentsText: 'All documents',\n loadingSearchText: 'Searching for relevant content...',\n loadingAnswerText: 'Crafting a response...',\n errorText: 'Sorry, there was an error generating the answer.',\n followUpPlaceholder: 'Ask follow-up',\n positiveAnswerText: 'Helpful',\n negativeAnswerText: 'Not helpful',\n uncertaintyFallbackText: {\n 'en': \"Sorry, I can't find a clear answer to your question. Please try rephrasing or check the related sources below.\",\n 'es': 'Lo siento, no puedo encontrar una respuesta clara. Intente reformular la pregunta o consulte las fuentes relacionadas.',\n 'fr': 'Désolé, je ne trouve pas de réponse claire. Essayez de reformuler ou consultez les sources connexes.',\n 'de': 'Entschuldigung, ich finde keine klare Antwort. Versuchen Sie es anders zu formulieren oder sehen Sie sich die verwandten Quellen an.',\n 'it': 'Mi dispiace, non trovo una risposta chiara. Prova a riformulare o consulta le fonti correlate.',\n 'pt': 'Desculpe, não encontro uma resposta clara. Tente reformular ou consulte as fontes relacionadas.',\n 'nl': 'Sorry, ik kan geen duidelijk antwoord vinden. Probeer het anders te formuleren of bekijk de gerelateerde bronnen.',\n 'pl': 'Przepraszam, nie znajduję jasnej odpowiedzi. Spróbuj przeformułować pytanie lub sprawdź powiązane źródła.',\n 'ru': 'Извините, я не могу найти четкого ответа. Попробуйте переформулировать или ознакомьтесь со связанными источниками.',\n 'ja': '申し訳ありませんが、明確な回答が見つかりません。質問の言い換えや、関連ソースをご確認ください。',\n 'ko': '죄송합니다. 명확한 답변을 찾을 수 없습니다. 질문을 다시 작성하거나 관련 소스를 확인해 주세요.',\n 'zh': '抱歉,找不到明确的答案。请尝试重新表述或查看相关来源。',\n 'zh-TW': '抱歉,找不到明確的答案。請嘗試重新表述或查看相關來源。',\n },\n};\n","import { __awaiter } from \"tslib\";\nimport React, { useState, useRef, useEffect, useImperativeHandle, forwardRef } from 'react';\nimport { Search, ArrowRight, ArrowUp, X, Circle, CheckCircle2, ChevronDown, Image } from 'lucide-react';\nimport { AnimatePresence, motion } from 'framer-motion';\nimport { Button } from '../ui/button';\nimport { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '../ui/dropdown-menu';\nimport { Suggestions } from './Suggestions';\nimport { SearchResults } from './SearchResults';\nimport { FollowUpQuestions } from './FollowUpQuestions';\nimport { TimelineNavigation } from './TimelineNavigation';\nimport { ScrollToBottomArrow } from './ScrollToBottomArrow';\nimport { searchApi, fetchAnswer, loadConversation, sendFeedback, getConversationId, fetchFollowUpQuestions, } from '../../lib/api';\nimport { defaultTheme } from './theme';\nimport { defaultTextConfig } from './text-config';\nimport { isAnswerUncertain } from '../../lib/utils';\nconst ChatSearch = forwardRef(({ suggestions, theme = {}, collections = [], selectedCollectionId, onCollectionChange, searchEndpoint, answerEndpoint, feedbackEndpoint, loadConversationEndpoint, disableFollowUpQuestions = false, disableImageAttachment = false, disableFeedback = false, siblingNode, offset = 0, headers, textConfig = {}, followUpQuestionsEndpoint, searchPath, }, ref) => {\n var _a;\n const mergedTheme = Object.assign(Object.assign({}, defaultTheme), theme);\n const mergedTextConfig = Object.assign(Object.assign({}, defaultTextConfig), textConfig);\n const [query, setQuery] = useState('');\n const [followUpQuery, setFollowUpQuery] = useState('');\n const [isSearching, setIsSearching] = useState(false);\n const [showResults, setShowResults] = useState(false);\n const [answers, setAnswers] = useState([]);\n const [showScrollArrow, setShowScrollArrow] = useState(false);\n const [activeAnswerIndex, setActiveAnswerIndex] = useState(0);\n const [attachedImages, setAttachedImages] = useState([]);\n const [currentCollectionId, setCurrentCollectionId] = useState(selectedCollectionId);\n const [showFollowUp, setShowFollowUp] = useState(true);\n const [conversationId, setConversationId] = useState('');\n const [isLoadingConversation, setIsLoadingConversation] = useState(false);\n const [loadError, setLoadError] = useState();\n const primaryTextareaRef = useRef(null);\n const followUpInputRef = useRef(null);\n const answerRefs = useRef([]);\n const containerRef = useRef(null);\n const fileInputRef = useRef(null);\n const stateSubscribersRef = useRef([]);\n // Load conversation from URL query param\n useEffect(() => {\n const urlParams = new URLSearchParams(window.location.search);\n const urlConversationId = urlParams.get('conversation');\n if (urlConversationId && loadConversationEndpoint) {\n setIsLoadingConversation(true);\n setShowResults(true);\n loadConversation({\n endpoint: loadConversationEndpoint,\n conversationId: urlConversationId,\n headers,\n })\n .then((payload) => {\n setAnswers(payload.data);\n setConversationId(urlConversationId);\n setShowResults(true);\n })\n .catch((error) => {\n console.error('Error loading conversation:', error);\n setLoadError(mergedTextConfig.errorText || 'An error occurred');\n // Redirect to primary search if loading fails\n setShowResults(false);\n setAnswers([]);\n const newId = getConversationId();\n setConversationId(newId);\n // Update URL without conversation param\n const newUrl = new URL(window.location.href);\n newUrl.pathname = '/';\n newUrl.searchParams.delete('conversation');\n window.history.replaceState({}, '', newUrl.toString());\n })\n .finally(() => {\n setIsLoadingConversation(false);\n });\n }\n else {\n const newId = getConversationId();\n setConversationId(newId);\n }\n }, [loadConversationEndpoint]);\n // Update URL when conversation ID changes and there are answers\n useEffect(() => {\n if (conversationId && answers.length > 0) {\n // Create new URL with search path\n const newUrl = new URL(window.location.href);\n if (searchPath) {\n newUrl.pathname = searchPath;\n newUrl.searchParams.set('conversation', conversationId);\n }\n else {\n // Default behavior when no searchPath is provided\n newUrl.searchParams.set('conversation', conversationId);\n }\n window.history.replaceState({}, '', newUrl.toString());\n }\n }, [conversationId, answers.length, searchPath]);\n // Notify subscribers when state changes\n useEffect(() => {\n const state = {\n showResults,\n answers,\n isLoading: isLoadingConversation,\n error: loadError,\n };\n stateSubscribersRef.current.forEach((callback) => callback(state));\n }, [showResults, answers, isLoadingConversation, loadError]);\n const scrollToLastAnswer = () => {\n requestAnimationFrame(() => {\n const lastAnswer = answerRefs.current[answerRefs.current.length - 1];\n if (lastAnswer) {\n const rect = lastAnswer.getBoundingClientRect();\n const scrollTop = window.pageYOffset || document.documentElement.scrollTop;\n const targetScroll = rect.top + scrollTop - 80;\n window.scrollTo({\n top: targetScroll,\n behavior: 'smooth',\n });\n }\n });\n };\n const scrollToAnswer = (index) => {\n requestAnimationFrame(() => {\n const answer = answerRefs.current[index];\n if (answer) {\n const rect = answer.getBoundingClientRect();\n const scrollTop = window.pageYOffset || document.documentElement.scrollTop;\n const targetScroll = rect.top + scrollTop - 80;\n window.scrollTo({\n top: targetScroll,\n behavior: 'smooth',\n });\n }\n });\n };\n const streamAnswer = (response) => __awaiter(void 0, void 0, void 0, function* () {\n var _b;\n const reader = (_b = response.body) === null || _b === void 0 ? void 0 : _b.getReader();\n if (!reader)\n return;\n // Set streaming state immediately\n setAnswers((prev) => {\n const newAnswers = [...prev];\n const lastAnswer = newAnswers[newAnswers.length - 1];\n if (lastAnswer) {\n lastAnswer.isLoading = false;\n lastAnswer.isStreaming = true;\n lastAnswer.searchResults = lastAnswer.searchResults || []; // Ensure search results exist\n }\n return newAnswers;\n });\n let accumulatedAnswer = '';\n try {\n let done, value;\n while ((({ done, value } = yield reader.read()), !done)) {\n const chunk = new TextDecoder().decode(value);\n accumulatedAnswer += chunk;\n // Check for uncertainty in the accumulated answer\n const { uncertain, language } = isAnswerUncertain(accumulatedAnswer);\n setAnswers((prev) => {\n var _a;\n const newAnswers = [...prev];\n const lastAnswer = newAnswers[newAnswers.length - 1];\n if (lastAnswer) {\n lastAnswer.answer = accumulatedAnswer;\n lastAnswer.isLoading = false;\n lastAnswer.isStreaming = true;\n lastAnswer.searchResults = lastAnswer.searchResults || [];\n lastAnswer.isUncertain = uncertain;\n lastAnswer.uncertaintyLanguage = language;\n if (uncertain && language && ((_a = mergedTextConfig.uncertaintyFallbackText) === null || _a === void 0 ? void 0 : _a[language])) {\n lastAnswer.uncertaintyFallbackText = mergedTextConfig.uncertaintyFallbackText[language];\n }\n }\n return newAnswers;\n });\n }\n }\n catch (error) {\n console.error('Error streaming answer:', error);\n }\n finally {\n setAnswers((prev) => {\n const newAnswers = [...prev];\n const lastAnswer = newAnswers[newAnswers.length - 1];\n if (lastAnswer) {\n lastAnswer.isStreaming = false;\n lastAnswer.isLoading = false;\n // Fetch follow-up questions if endpoint is provided and searchQueryId exists\n if (followUpQuestionsEndpoint && !disableFollowUpQuestions && lastAnswer.searchQueryId) {\n void (() => __awaiter(void 0, void 0, void 0, function* () {\n try {\n const questions = yield fetchFollowUpQuestions({\n endpoint: followUpQuestionsEndpoint,\n searchQueryId: lastAnswer.searchQueryId,\n headers,\n conversationId,\n });\n setAnswers((prev) => {\n const updatedAnswers = [...prev];\n const lastAnswer = updatedAnswers[updatedAnswers.length - 1];\n if (lastAnswer) {\n lastAnswer.followUpQuestions = questions;\n }\n return updatedAnswers;\n });\n }\n catch (error) {\n console.error('Error fetching follow-up questions:', error);\n }\n }))();\n }\n }\n return newAnswers;\n });\n reader.releaseLock();\n }\n });\n const handleSearch = (searchQuery = query.trim()) => __awaiter(void 0, void 0, void 0, function* () {\n if (searchQuery) {\n // 1. Set initial states synchronously\n setIsSearching(true);\n setShowResults(true);\n // 2. Create conversation ID\n const currentConversationId = conversationId || getConversationId();\n if (!conversationId) {\n setConversationId(currentConversationId);\n }\n // Update URL immediately when search starts\n const newUrl = new URL(window.location.href);\n const shouldUpdateUrl = searchPath\n ? newUrl.pathname !== searchPath || newUrl.searchParams.get('conversation') !== currentConversationId\n : newUrl.searchParams.get('conversation') !== currentConversationId;\n if (shouldUpdateUrl) {\n if (searchPath) {\n newUrl.pathname = searchPath;\n newUrl.searchParams.set('conversation', currentConversationId);\n }\n else {\n // Default behavior when no searchPath is provided\n newUrl.searchParams.set('conversation', currentConversationId);\n }\n window.history.replaceState({}, '', newUrl.toString());\n }\n // 3. Create new answer with loading states\n const newAnswer = {\n question: searchQuery,\n answer: '',\n isLoading: true,\n isSearchLoading: true,\n searchResults: [],\n searchQueryId: undefined,\n isStreaming: false,\n };\n // 4. Update answers state synchronously\n setAnswers((prev) => [...prev, newAnswer]);\n // 5. Set active index & scroll\n const newAnswerIndex = answers.length;\n setActiveAnswerIndex(newAnswerIndex);\n scrollToLastAnswer();\n // 6. Use Promise to defer API call to next tick\n yield Promise.resolve();\n // 7. Start API calls after render\n try {\n const searchResponse = yield searchApi({\n endpoint: searchEndpoint,\n query: searchQuery,\n collectionId: currentCollectionId,\n headers,\n conversationId: currentConversationId,\n });\n setAnswers((prev) => {\n const newAnswers = [...prev];\n if (newAnswers[newAnswers.length - 1]) {\n newAnswers[newAnswers.length - 1] = Object.assign(Object.assign({}, newAnswers[newAnswers.length - 1]), { searchResults: searchResponse.results, searchQueryId: searchResponse.searchQueryId, isSearchLoading: false });\n }\n return newAnswers;\n });\n const response = yield fetchAnswer({\n endpoint: answerEndpoint,\n searchQueryId: searchResponse.searchQueryId,\n headers,\n conversationId: currentConversationId,\n });\n yield streamAnswer(response);\n }\n catch (error) {\n console.error('Error generating answer:', error);\n setAnswers((prev) => {\n const newAnswers = [...prev];\n if (newAnswers[newAnswers.length - 1]) {\n newAnswers[newAnswers.length - 1] = Object.assign(Object.assign({}, newAnswers[newAnswers.length - 1]), { answer: mergedTextConfig.errorText || 'An error occurred', isLoading: false, isSearchLoading: false, isStreaming: false });\n }\n return newAnswers;\n });\n }\n finally {\n setIsSearching(false);\n }\n }\n });\n // Expose the methods via ref\n useImperativeHandle(ref, () => ({\n createNewThread: (firstQuery) => {\n setQuery('');\n setFollowUpQuery('');\n setShowResults(false);\n setAnswers([]);\n setActiveAnswerIndex(0);\n setAttachedImages([]);\n const newId = getConversationId();\n setConversationId(newId);\n // Remove conversation ID from URL when creating new thread\n const newUrl = new URL(window.location.href);\n newUrl.searchParams.delete('conversation');\n window.history.replaceState({}, '', newUrl.toString());\n if (primaryTextareaRef.current) {\n primaryTextareaRef.current.style.height = 'auto';\n }\n // If firstQuery is provided, set it and trigger search\n if (firstQuery) {\n setQuery(firstQuery);\n void handleSearch(firstQuery);\n }\n },\n showFollowUpThread: (show) => {\n setShowFollowUp(show);\n },\n subscribeToStateChanges: (callback) => {\n stateSubscribersRef.current.push(callback);\n // Initial state notification\n callback({\n showResults,\n answers,\n isLoading: false,\n error: undefined,\n });\n // Return unsubscribe function\n // eslint-disable-next-line newline-before-return\n return () => {\n stateSubscribersRef.current = stateSubscribersRef.current.filter((cb) => cb !== callback);\n };\n },\n }));\n // Update currentCollectionId when selectedCollectionId prop changes\n useEffect(() => {\n setCurrentCollectionId(selectedCollectionId);\n }, [selectedCollectionId]);\n const adjustTextareaHeight = (textarea) => {\n textarea.style.height = 'auto';\n textarea.style.height = `${textarea.scrollHeight}px`;\n };\n const handleFeedback = (response, searchQueryId, answerIndex) => __awaiter(void 0, void 0, void 0, function* () {\n if (!feedbackEndpoint)\n return;\n // Update UI state immediately\n setAnswers((prev) => {\n const newAnswers = [...prev];\n if (newAnswers[answerIndex]) {\n newAnswers[answerIndex] = Object.assign(Object.assign({}, newAnswers[answerIndex]), { feedback: response });\n }\n return newAnswers;\n });\n try {\n yield sendFeedback({\n endpoint: feedbackEndpoint,\n searchQueryId,\n response,\n headers,\n conversationId,\n });\n }\n catch (error) {\n console.error('Error sending feedback:', error);\n // Revert UI state on error\n setAnswers((prev) => {\n const newAnswers = [...prev];\n if (newAnswers[answerIndex]) {\n newAnswers[answerIndex] = Object.assign(Object.assign({}, newAnswers[answerIndex]), { feedback: undefined });\n }\n return newAnswers;\n });\n }\n });\n const handleFollowUpSearch = () => __awaiter(void 0, void 0, void 0, function* () {\n if (followUpQuery.trim()) {\n const currentQuery = followUpQuery;\n setQuery(currentQuery);\n setFollowUpQuery('');\n // Reset textarea height\n if (followUpInputRef.current) {\n followUpInputRef.current.style.height = 'auto';\n }\n yield handleSearch(currentQuery);\n }\n });\n const handleKeyPress = (e) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n void handleFollowUpSearch();\n }\n };\n const handleMainKeyPress = (e) => {\n if (e.key === 'Enter' && !e.shiftKey) {\n e.preventDefault();\n void handleSearch();\n }\n };\n const handleSuggestedQuestionClick = (suggestion) => {\n if (suggestion.conversationId && loadConversationEndpoint) {\n setIsLoadingConversation(true);\n setShowResults(true);\n loadConversation({\n endpoint: loadConversationEndpoint,\n conversationId: suggestion.conversationId,\n headers,\n })\n .then((payload) => {\n setAnswers(payload.data);\n setConversationId(suggestion.conversationId);\n setShowResults(true);\n })\n .catch((error) => {\n console.error('Error loading conversation:', error);\n setLoadError(mergedTextConfig.errorText || 'An error occurred');\n // Redirect to primary search if loading fails\n setShowResults(false);\n setAnswers([]);\n const newId = getConversationId();\n setConversationId(newId);\n // Update URL without conversation param\n const newUrl = new URL(window.location.href);\n newUrl.pathname = '/';\n newUrl.searchParams.delete('conversation');\n window.history.replaceState({}, '', newUrl.toString());\n })\n .finally(() => {\n setIsLoadingConversation(false);\n });\n return;\n }\n setShowResults(true);\n setIsSearching(true);\n // Only generate new conversation ID if there isn't one already\n if (!conversationId) {\n const newId = getConversationId();\n setConversationId(newId);\n }\n setAnswers((prev) => [\n ...prev,\n {\n question: suggestion.question,\n answer: '',\n isLoading: true,\n isSearchLoading: true,\n },\n ]);\n void (() => __awaiter(void 0, void 0, void 0, function* () {\n try {\n // First get search results\n const searchResponse = yield searchApi({\n endpoint: searchEndpoint,\n query: suggestion.question,\n collectionId: currentCollectionId,\n headers,\n conversationId,\n });\n const searchResults = searchResponse.results;\n // Update with search results immediately\n setAnswers((prev) => {\n const newAnswers = [...prev];\n newAnswers[newAnswers.length - 1] = Object.assign(Object.assign({}, newAnswers[newAnswers.length - 1]), { searchResults, searchQueryId: searchResponse.searchQueryId, isSearchLoading: false });\n return newAnswers;\n });\n // Then start streaming the answer\n const response = yield fetchAnswer({\n endpoint: answerEndpoint,\n searchQueryId: searchResponse.searchQueryId,\n headers,\n conversationId,\n });\n yield streamAnswer(response);\n }\n catch (error) {\n console.error('Error generating answer:', error);\n setAnswers((prev) => {\n const newAnswers = [...prev];\n newAnswers[newAnswers.length - 1] = Object.assign(Object.assign({}, newAnswers[newAnswers.length - 1]), { answer: mergedTextConfig.errorText || 'An error occurred', isLoading: false, isSearchLoading: false });\n return newAnswers;\n });\n }\n finally {\n setIsSearching(false);\n scrollToLastAnswer();\n }\n }))();\n };\n useEffect(() => {\n const handleScroll = () => {\n const isNearBottom = window.innerHeight + window.pageYOffset >= document.documentElement.scrollHeight - 100;\n setShowScrollArrow(!isNearBottom);\n };\n window.addEventListener('scroll', handleScroll);\n return () => window.removeEventListener('scroll', handleScroll);\n }, []);\n useEffect(() => {\n return () => {\n attachedImages.forEach((image) => URL.revokeObjectURL(image.preview));\n };\n }, [attachedImages]);\n const handleImageUpload = (event) => {\n const files = event.target.files;\n if (files) {\n const newImages = Array.from(files).map((file) => ({\n file,\n preview: URL.createObjectURL(file),\n }));\n setAttachedImages((prev) => [...prev, ...newImages]);\n }\n if (fileInputRef.current) {\n fileInputRef.current.value = '';\n }\n };\n const removeImage = (index) => {\n setAttachedImages((prev) => {\n URL.revokeObjectURL(prev[index].preview);\n return prev.filter((_, i) => i !== index);\n });\n };\n const handleCollectionChange = (collectionId) => {\n setCurrentCollectionId(collectionId);\n onCollectionChange === null || onCollectionChange === void 0 ? void 0 : onCollectionChange(collectionId);\n };\n // Listen for URL changes and reset state when conversation param is removed\n useEffect(() => {\n const handleUrlChange = () => {\n const urlParams = new URLSearchParams(window.location.search);\n const urlConversationId = urlParams.get('conversation');\n if (!urlConversationId) {\n setQuery('');\n setFollowUpQuery('');\n setShowResults(false);\n setAnswers([]);\n setActiveAnswerIndex(0);\n setAttachedImages([]);\n if (primaryTextareaRef.current) {\n primaryTextareaRef.current.style.height = 'auto';\n }\n }\n };\n window.addEventListener('popstate', handleUrlChange);\n return () => window.removeEventListener('popstate', handleUrlChange);\n }, []);\n // Update the follow-up question click handler to use handleSearch\n const handleFollowUpQuestionClick = (question) => {\n void handleSearch(question);\n };\n return (React.createElement(\"div\", { className: \"relative\" },\n React.createElement(\"div\", { ref: containerRef, className: \"w-full max-w-3xl mx-auto flex flex-col items-center space-y-8 px-4 py-20\", style: {\n '--surface-border': mergedTheme.surfaceBorder,\n '--surface-hover': mergedTheme.surfaceHover,\n } },\n React.createElement(AnimatePresence, null, isLoadingConversation ? (React.createElement(motion.div, { key: \"loading\", initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, className: \"w-full flex items-center justify-center py-20\" },\n React.createElement(\"div\", { className: \"flex flex-col items-center gap-4\" },\n React.createElement(\"div\", { className: \"animate-spin rounded-full h-8 w-8 border-2 border-t-transparent\", style: { borderColor: mergedTheme.primary } }),\n React.createElement(\"p\", { className: \"text-sm\", style: { color: mergedTheme.textSecondary } }, \"Loading conversation...\")))) : !showResults ? (React.createElement(motion.div, { key: \"search\", initial: { opacity: 0, y: 20 }, animate: { opacity: 1, y: 0 }, exit: { opacity: 0, y: -20 }, transition: { duration: 0.5 }, className: \"w-full space-y-8\" },\n React.createElement(\"div\", { className: \"w-full text-center space-y-4\" },\n React.createElement(motion.h1, { initial: { opacity: 0, y: 20 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.5, delay: 0.3 }, className: \"text-5xl font-bold\", style: { color: mergedTheme.text } }, mergedTextConfig.headerText)),\n React.createElement(motion.div, { initial: { opacity: 0, y: 20 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.5, delay: 0.4 } },\n React.createElement(\"div\", { className: \"relative w-full rounded-md overflow-hidden\", style: {\n backgroundColor: mergedTheme.background,\n borderColor: mergedTheme.border,\n borderWidth: '1px',\n borderStyle: 'solid',\n } },\n React.createElement(\"div\", { className: \"p-3 flex items-center\", style: { backgroundColor: mergedTheme.cardBackground } },\n React.createElement(Search, { className: \"h-5 w-5 mr-2\", style: { color: mergedTheme.iconColor } }),\n React.createElement(\"textarea\", { ref: primaryTextareaRef, placeholder: mergedTextConfig.searchPlaceholder, value: query, onChange: (e) => {\n setQuery(e.target.value);\n adjustTextareaHeight(e.target);\n }, onKeyDown: handleMainKeyPress, className: \"w-full resize-none outline-none text-lg py-1 font-light min-h-[36px] overflow-hidden border-none bg-transparent placeholder:text-gray-400\", style: {\n color: mergedTheme.text,\n outline: 'none',\n boxShadow: 'none',\n fontSize: '16px',\n }, rows: 1 })),\n !disableImageAttachment && attachedImages.length > 0 && (React.createElement(\"div\", { className: \"flex gap-2 mt-3 overflow-x-auto pb-1 px-3\" }, attachedImages.map((image, index) => (React.createElement(\"div\", { key: index, className: \"relative group rounded-lg overflow-hidden flex-shrink-0\", style: { width: '80px', height: '80px' } },\n React.createElement(\"img\", { src: image.preview, alt: `Attached ${index + 1}`, className: \"w-full h-full object-cover\" }),\n React.createElement(\"button\", { onClick: () => removeImage(index), className: \"absolute top-1 right-1 rounded-full p-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 hover:bg-opacity-70\", style: { backgroundColor: mergedTheme.overlayBackground } },\n React.createElement(X, { className: \"h-3 w-3\", style: { color: mergedTheme.overlayText } }))))))),\n React.createElement(\"div\", { className: \"flex items-center justify-between px-3 py-2 border-t\", style: { borderColor: mergedTheme.border } },\n React.createElement(\"div\", { className: \"flex gap-2\" },\n collections.length > 0 && (React.createElement(DropdownMenu, null,\n React.createElement(DropdownMenuTrigger, { asChild: true },\n React.createElement(Button, { variant: \"ghost\", size: \"sm\", className: \"transition-all duration-200 rounded-md h-8 flex items-center gap-2 hover:bg-opacity-80\", style: {\n color: mergedTheme.buttonText,\n } },\n currentCollectionId && currentCollectionId !== 'all' ? (React.createElement(CheckCircle2, { className: \"h-5 w-5\", style: { color: mergedTheme.feedbackPositive } })) : (React.createElement(Circle, { className: \"h-5 w-5\", style: { color: mergedTheme.iconColor } })),\n ((_a = collections.find((c) => c.id === currentCollectionId)) === null || _a === void 0 ? void 0 : _a.name) ||\n mergedTextConfig.allDocumentsText,\n React.createElement(ChevronDown, { className: \"h-4 w-4\", style: { color: mergedTheme.iconColor } }))),\n React.createElement(DropdownMenuContent, null, collections.map((collection) => (React.createElement(DropdownMenuItem, { key: collection.id, onClick: () => handleCollectionChange(collection.id), style: {\n backgroundColor: collection.id === currentCollectionId\n ? `${mergedTheme.buttonBackground}80`\n : 'transparent',\n } },\n collection.id === currentCollectionId ? (React.createElement(CheckCircle2, { className: \"h-4 w-4 mr-2\", style: { color: mergedTheme.feedbackPositive } })) : (React.createElement(Circle, { className: \"h-4 w-4 mr-2\", style: { color: mergedTheme.iconColor } })),\n collection.name)))))),\n !disableImageAttachment && (React.createElement(React.Fragment, null,\n React.createElement(\"input\", { type: \"file\", ref: fileInputRef, accept: \"image/*\", multiple: true, className: \"hidden\", onChange: handleImageUpload }),\n React.createElement(Button, { variant: \"ghost\", size: \"sm\", className: \"rounded-md h-8 hover:bg-opacity-80\", style: {\n color: mergedTheme.buttonText,\n }, onClick: () => { var _a; return (_a = fileInputRef.current) === null || _a === void 0 ? void 0 : _a.click(); } },\n React.createElement(Image, { className: \"h-4 w-4 mr-1.5\", style: { color: mergedTheme.iconColor } }),\n mergedTextConfig.attachImageText)))),\n React.createElement(\"div\", { className: \"flex items-center\" },\n React.createElement(Button, { size: \"sm\", disabled: !query || isSearching, className: \"rounded-md h-8 w-8 disabled:opacity-50\", style: { backgroundColor: mergedTheme.primary }, onClick: () => {\n void handleSearch();\n } }, isSearching ? (React.createElement(\"div\", { className: \"animate-spin rounded-full h-4 w-4 border-2 border-t-transparent\", style: { borderColor: mergedTheme.overlayText } })) : (React.createElement(ArrowRight, { className: \"h-4 w-4\", style: { color: mergedTheme.buttonText } }))))))),\n React.createElement(Suggestions, { suggestions: suggestions || [], onQuestionClick: handleSuggestedQuestionClick, borderColor: mergedTheme.border, title: mergedTextConfig.suggestionsTitle }),\n siblingNode)) : (React.createElement(motion.div, { key: \"results\", initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.5 }, className: \"w-full space-y-4 py-4 mb-20\" }, answers.map((answer, i) => (React.createElement(motion.div, { key: i, ref: (el) => (answerRefs.current[i] = el), initial: { opacity: 0, y: 20 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.5, delay: i * 0.1 } },\n React.createElement(SearchResults, { answer: answer.answer, question: answer.question, theme: mergedTheme, searchResults: answer.searchResults, isStreaming: answer.isStreaming, searchQueryId: answer.searchQueryId, feedback: answer.feedback, onFeedback: (response) => void handleFeedback(response, answer.searchQueryId, i), disableFeedback: disableFeedback, textConfig: mergedTextConfig, isLoading: answer.isLoading, isSearchLoading: answer.isSearchLoading }),\n i === answers.length - 1 &&\n !disableFollowUpQuestions &&\n answer.followUpQuestions &&\n !answer.isStreaming && (React.createElement(\"div\", { className: \"mt-4\" },\n React.createElement(FollowUpQuestions, { questions: answer.followUpQuestions, onQuestionClick: handleFollowUpQuestionClick, theme: mergedTheme }))))))))),\n showResults && answers.length > 1 && (React.createElement(\"div\", { className: \"hidden sm:block\" },\n React.createElement(TimelineNavigation, { questions: answers.map((a) => a.question), activeIndex: activeAnswerIndex, onNavigate: (index) => {\n setActiveAnswerIndex(index);\n scrollToAnswer(index);\n }, theme: mergedTheme, offset: offset }))),\n showResults && showFollowUp && (React.createElement(motion.div, { initial: { opacity: 0, y: 20 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.5 }, className: \"fixed bottom-4 left-4 right-4 max-w-3xl mx-auto z-10\", style: { left: `${offset}px` } },\n React.createElement(\"div\", { className: \"rounded-full h-[44px] sm:h-[52px] flex items-center justify-between\", style: {\n backgroundColor: mergedTheme.cardBackground,\n borderColor: mergedTheme.border,\n borderWidth: '1px',\n borderStyle: 'solid',\n boxShadow: '0 4px 6px -1px rgba(0, 0, 0, 0.1)',\n padding: '0 15px',\n } },\n React.createElement(\"div\", { className: \"flex items-center gap-2 sm:gap-3 flex-grow overflow-hidden h-full\" },\n React.createElement(Search, { className: \"h-4 w-4 sm:h-5 sm:w-5 flex-shrink-0\", style: { color: mergedTheme.iconColor } }),\n React.createElement(\"div\", { className: \"flex-grow\", style: { paddingTop: '15px', paddingBottom: '10px' } },\n React.createElement(\"textarea\", { ref: followUpInputRef, placeholder: mergedTextConfig.followUpPlaceholder, value: followUpQuery, onChange: (e) => {\n setFollowUpQuery(e.target.value);\n const maxHeight = 100;\n e.target.style.height = 'auto';\n e.target.style.height = `${Math.min(e.target.scrollHeight, maxHeight)}px`;\n if (e.target.scrollHeight > maxHeight) {\n e.target.style.overflowY = 'auto';\n }\n else {\n e.target.style.overflowY = 'hidden';\n }\n }, onKeyDown: handleKeyPress, disabled: isSearching, className: \"w-full bg-transparent outline-none text-sm sm:text-base resize-none overflow-hidden disabled:opacity-50 border-none min-h-[24px] max-h-[100px] placeholder:text-gray-400\", style: {\n color: mergedTheme.text,\n outline: 'none',\n boxShadow: 'none',\n fontSize: '16px',\n lineHeight: '24px',\n }, rows: 1 }))),\n React.createElement(\"div\", { className: \"flex items-center gap-2 sm:gap-3 ml-2 sm:ml-3 flex-shrink-0\" },\n React.createElement(Button, { size: \"icon\", variant: \"ghost\", disabled: isSearching || !followUpQuery.trim(), className: \"rounded-full transition-colors duration-200 disabled:opacity-50 h-8 w-8 sm:h-9 sm:w-9 flex items-center justify-center hover:bg-opacity-80\", style: {\n backgroundColor: mergedTheme.buttonBackground,\n color: mergedTheme.buttonText,\n }, onClick: () => {\n void handleFollowUpSearch();\n } }, isSearching ? (React.createElement(\"div\", { className: \"animate-spin rounded-full h-4 w-4 sm:h-5 sm:w-5 border-2\", style: {\n borderColor: `${mergedTheme.text}40`,\n borderTopColor: mergedTheme.text,\n } })) : (React.createElement(ArrowUp, { className: \"h-4 w-4 sm:h-5 sm:w-5\", style: { color: mergedTheme.iconColor } }))))))),\n showScrollArrow && showResults && React.createElement(ScrollToBottomArrow, { onClick: scrollToLastAnswer, theme: mergedTheme }))));\n});\nChatSearch.displayName = 'ChatSearch';\nexport default ChatSearch;\n"],"names":["styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","value","step","next","rejected","result","done","then","apply","setRef","current","composeRefs","refs","node","hasCleanup","cleanups","map","cleanup","SuppressedError","Slot","React","forwardRef","props","forwardedRef","children","slotProps","childrenArray","Children","toArray","slottable","find","isSlottable","newElement","newChildren","child","count","only","isValidElement","jsx","SlotClone","cloneElement","displayName","childrenRef","element","getter","getOwnPropertyDescriptor","get","mayWarn","isReactWarning","getElementRef","mergeProps","Slottable","Fragment","childProps","overrideProps","propName","slotPropValue","childPropValue","test","args","filter","Boolean","join","cn","inputs","twMerge","clsx","isAnswerUncertain","response","uncertaintyPatternsByLanguage","en","es","fr","de","it","pt","nl","pl","ru","ja","ko","zh","earliestMatch","language","patterns","entries","pattern","match","index","uncertain","buttonVariants","cva","variants","variant","default","destructive","outline","secondary","ghost","link","size","sm","lg","icon","defaultVariants","Button","_a","className","asChild","Comp","assign","DropdownMenu","DropdownMenuPrimitive","Root","DropdownMenuTrigger","Trigger","inset","SubTrigger","ChevronRightIcon","SubContent","DropdownMenuContent","sideOffset","Portal","Content","DropdownMenuItem","Item","checked","CheckboxItem","ItemIndicator","CheckIcon","RadioItem","DotFilledIcon","Label","Separator","TooltipProvider","delayDuration","TooltipPrimitive","Provider","Tooltip","TooltipTrigger","TooltipContent","background","textColor","borderColor","backgroundColor","color","borderWidth","borderStyle","Suggestions","suggestions","onQuestionClick","title","suggestion","key","id","onClick","undefined","messageCount","question","programmingLanguages","javascript","python","java","c","cpp","ruby","php","swift","kotlin","typescript","go","perl","rust","scala","haskell","lua","shell","sql","html","HighlighterComponent","Prism","CodeBlock","memo","isCopied","setIsCopied","useState","navigator","clipboard","writeText","setTimeout","error","console","CheckCircle","Clipboard","fileExtension","fileName","lowercase","chars","charAt","Math","floor","random","toLowerCase","generateRandomString","blob","Blob","url","URL","createObjectURL","download","href","display","body","click","removeChild","revokeObjectURL","Download","a11yDark","PreTag","wrapLongLines","customStyle","margin","borderTopLeftRadius","borderTopRightRadius","Frame","src","border","width","height","isLoaded","setIsLoaded","iframeLoaded","setIframeLoaded","useEffect","mounted","sandbox","frameBorder","loading","allowFullScreen","onLoad","Loom","normalizedUrl","attrs","replace","Supademo","Typeform","Vimeo","matches","videoId","hId","embedUrl","Wistia","urlRegexes","regex","extractMatches","domain","YouTube","extractVideoId","isMatch","some","syncEmbedComponents","Youtube","EmbedComponent","matched","setMatched","syncMatch","Embed","Component","findMatch","matchedProps","MemoizedReactMarkdown","ReactMarkdown","prevProps","nextProps","config","startOnLoad","theme","securityLevel","fontFamily","MermaidDiagram","content","svg","setSvg","setError","containerRef","useRef","isInitialized","setIsInitialized","mermaid","initialize","err","initializeMermaid","toString","substr","render","dangerouslySetInnerHTML","__html","ZoomableImage","alt","isZoomed","setIsZoomed","showFullCaption","setShowFullCaption","imageError","setImageError","isLoading","setIsLoading","dimensions","setDimensions","imgRef","toggleZoom","maxHeight","onError","naturalWidth","naturalHeight","aspectRatio","min","Expand","onMouseEnter","onMouseLeave","AnimatePresence","motion","div","initial","opacity","animate","exit","scale","FormattedMessage","message","isStreaming","displayContent","setDisplayContent","uncertaintyFallbackText","strippedContent","remarkPlugins","remarkGfm","rehypePlugins","rehypeRaw","components","code","inline","exec","String","trim","marker","table","th","td","a","embedComponent","target","rel","pre","img","li","ul","ol","strong","h1","h2","h3","h4","h5","h6","Feedback","feedback","onFeedback","textConfig","disabled","showHearts","setShowHearts","handleFeedback","Array","from","_","x","y","cos","PI","sin","rotate","transition","duration","ease","times","delay","top","left","transformOrigin","Heart","strokeWidth","primary","ThumbsUp","positiveAnswerText","ThumbsDown","negativeAnswerText","GeneratingStar","viewBox","fill","xmlns","minWidth","minHeight","styles","d","stroke","strokeLinecap","strokeLinejoin","SearchResults","answer","searchResults","searchQueryId","disableFeedback","isSearchLoading","isExpanded","setIsExpanded","handleCopy","this","cardBackground","text","Check","feedbackPositive","Copy","iconColor","loadingSearchText","loadingAnswerText","borderBottom","surfaceBorder","FileText","ChevronDown","transform","ExternalLink","FollowUpQuestions","questions","surface","HelpCircle","button","ChevronRight","TimelineNavigation","activeIndex","onNavigate","offset","prevActiveIndex","setPrevActiveIndex","totalItems","visibleIndexes","indexes","lastAddedIndex","addIndex","push","max","getVisibleIndexes","role","stiffness","damping","indexOrEllipsis","arrayIndex","MoreVertical","layout","onKeyDown","buttonText","cursor","side","ScrollToBottomArrow","boxShadow","ArrowDown","defaultRetryOptions","maxRetries","baseDelay","shouldRetry","TypeError","apiError","status","globalRetryOptions","globalFallbackConfig","emptyResponse","errorResponse","ms","makeRequest","retry","headers","isStream","fallback","fetchConfig","retryOptions","fallbackOptions","attempt","fetch","JSON","stringify","ok","Error","data","json","keys","emptyError","name","catch","shouldAttemptRetry","warn","jitter","pow","searchRetryConfig","answerRetryConfig","searchApi","endpoint","query","collectionId","conversationId","payload","method","limit","results","searchQuery","fetchAnswer","getConversationId","Date","now","r","loadConversation","defaultTheme","surfaceHover","textSecondary","buttonBackground","loadingBackground","overlayBackground","overlayText","feedbackNegative","defaultTextConfig","headerText","searchPlaceholder","attachImageText","allDocumentsText","errorText","followUpPlaceholder","ChatSearch","collections","selectedCollectionId","onCollectionChange","searchEndpoint","answerEndpoint","feedbackEndpoint","loadConversationEndpoint","disableFollowUpQuestions","disableImageAttachment","siblingNode","followUpQuestionsEndpoint","searchPath","mergedTheme","mergedTextConfig","setQuery","followUpQuery","setFollowUpQuery","isSearching","setIsSearching","showResults","setShowResults","answers","setAnswers","showScrollArrow","setShowScrollArrow","activeAnswerIndex","setActiveAnswerIndex","attachedImages","setAttachedImages","currentCollectionId","setCurrentCollectionId","showFollowUp","setShowFollowUp","setConversationId","isLoadingConversation","setIsLoadingConversation","loadError","setLoadError","primaryTextareaRef","followUpInputRef","answerRefs","fileInputRef","stateSubscribersRef","urlConversationId","URLSearchParams","window","location","search","newId","newUrl","pathname","searchParams","delete","history","replaceState","finally","set","state","forEach","callback","scrollToLastAnswer","requestAnimationFrame","lastAnswer","rect","getBoundingClientRect","scrollTop","pageYOffset","documentElement","targetScroll","scrollTo","behavior","streamAnswer","_b","reader","getReader","prev","newAnswers","accumulatedAnswer","read","chunk","TextDecoder","decode","isUncertain","uncertaintyLanguage","fetchFollowUpQuestions","updatedAnswers","followUpQuestions","releaseLock","handleSearch","currentConversationId","newAnswer","newAnswerIndex","searchResponse","useImperativeHandle","createNewThread","firstQuery","showFollowUpThread","show","subscribeToStateChanges","cb","answerIndex","sendFeedback","handleFollowUpSearch","currentQuery","handleScroll","isNearBottom","innerHeight","scrollHeight","addEventListener","removeEventListener","image","preview","handleUrlChange","handleFollowUpQuestionClick","el","Search","placeholder","onChange","textarea","shiftKey","preventDefault","fontSize","rows","removeImage","X","CheckCircle2","Circle","collection","handleCollectionChange","accept","multiple","event","files","newImages","file","Image","ArrowRight","suggestionsTitle","scrollToAnswer","padding","paddingTop","paddingBottom","overflowY","lineHeight","borderTopColor","ArrowUp"],"mappings":"8xBAAA,SAASA,EAAYC,EAAKC,QACX,IAARA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAKF,GAA2B,oBAAbG,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,GAnBY,CAqB1D,CCiBO,SAASe,EAAOC,EAAGC,GACtB,IAAIC,EAAI,CAAA,EACR,IAAK,IAAIC,KAAKH,EAAOI,OAAOC,UAAUC,eAAeC,KAAKP,EAAGG,IAAMF,EAAEO,QAAQL,GAAK,IAC9ED,EAAEC,GAAKH,EAAEG,IACb,GAAS,MAALH,GAAqD,mBAAjCI,OAAOK,sBACtB,KAAIC,EAAI,EAAb,IAAgBP,EAAIC,OAAOK,sBAAsBT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