@brainfish-ai/components 0.33.1 → 0.34.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/conversation.d.ts +55 -12
- package/dist/esm/chunks/{ChatSearch.EPCaUj3O.js → ChatSearch.D5EABw51.js} +2 -2
- package/dist/esm/chunks/{ChatSearch.EPCaUj3O.js.map → ChatSearch.D5EABw51.js.map} +1 -1
- package/dist/esm/chunks/Conversation.Dq66Znf4.js +33 -0
- package/dist/esm/chunks/Conversation.Dq66Znf4.js.map +1 -0
- package/dist/esm/chunks/{FormattedMessage.D_knqVl-.js → FormattedMessage.Djy5cn5F.js} +2 -2
- package/dist/esm/chunks/{FormattedMessage.D_knqVl-.js.map → FormattedMessage.Djy5cn5F.js.map} +1 -1
- package/dist/esm/chunks/ai-badge.Be0978vU.js +5 -0
- package/dist/esm/chunks/ai-badge.Be0978vU.js.map +1 -0
- package/dist/esm/chunks/{button.D_2SonNs.js → button.Cs1X8upM.js} +2 -2
- package/dist/esm/chunks/{button.D_2SonNs.js.map → button.Cs1X8upM.js.map} +1 -1
- package/dist/esm/chunks/{combobox.MyoPH18G.js → combobox.CLT9CXUV.js} +2 -2
- package/dist/esm/chunks/{combobox.MyoPH18G.js.map → combobox.CLT9CXUV.js.map} +1 -1
- package/dist/esm/chunks/{date-picker.C2VT_rZ9.js → date-picker.D9CRxYJf.js} +2 -2
- package/dist/esm/chunks/{date-picker.C2VT_rZ9.js.map → date-picker.D9CRxYJf.js.map} +1 -1
- package/dist/esm/chunks/{feedback.CLMuSvsg.js → feedback.CGFAP0XS.js} +2 -2
- package/dist/esm/chunks/{feedback.CLMuSvsg.js.map → feedback.CGFAP0XS.js.map} +1 -1
- package/dist/esm/chunks/{file-upload-status.D8RhMcbO.js → file-upload-status.ClQeoQQB.js} +2 -2
- package/dist/esm/chunks/{file-upload-status.D8RhMcbO.js.map → file-upload-status.ClQeoQQB.js.map} +1 -1
- package/dist/esm/chunks/{filters.BHp3ukNW.js → filters.BRlRsGlZ.js} +2 -2
- package/dist/esm/chunks/{filters.BHp3ukNW.js.map → filters.BRlRsGlZ.js.map} +1 -1
- package/dist/esm/chunks/{font-picker.B9GPXyK4.js → font-picker.Dwwe5av-.js} +2 -2
- package/dist/esm/chunks/{font-picker.B9GPXyK4.js.map → font-picker.Dwwe5av-.js.map} +1 -1
- package/dist/esm/chunks/header-nav.CtUIc9pI.js +12 -0
- package/dist/esm/chunks/header-nav.CtUIc9pI.js.map +1 -0
- package/dist/esm/chunks/{header-pane.eU7f_pim.js → header-pane.BBWfo7uv.js} +5 -5
- package/dist/esm/chunks/header-pane.BBWfo7uv.js.map +1 -0
- package/dist/esm/chunks/index.Ca2JkOFO.js +2 -0
- package/dist/esm/chunks/index.Ca2JkOFO.js.map +1 -0
- package/dist/esm/chunks/{input-with-tags.DLv9e0XI.js → input-with-tags.pmOKv67d.js} +2 -2
- package/dist/esm/chunks/{input-with-tags.DLv9e0XI.js.map → input-with-tags.pmOKv67d.js.map} +1 -1
- package/dist/esm/chunks/{sidebar.CcFsNjrN.js → sidebar.BhcrMAU3.js} +8 -8
- package/dist/esm/chunks/{sidebar.CcFsNjrN.js.map → sidebar.BhcrMAU3.js.map} +1 -1
- package/dist/esm/chunks/{suggestion-card.D-AsG_yB.js → suggestion-card.TDn-dEc0.js} +2 -2
- package/dist/esm/chunks/{suggestion-card.D-AsG_yB.js.map → suggestion-card.TDn-dEc0.js.map} +1 -1
- package/dist/esm/chunks/{two-level-combobox.BVZfsNSN.js → two-level-combobox.SDv7qc_m.js} +2 -2
- package/dist/esm/chunks/{two-level-combobox.BVZfsNSN.js.map → two-level-combobox.SDv7qc_m.js.map} +1 -1
- package/dist/esm/components/article-suggestions-banner.js +1 -1
- package/dist/esm/components/articles-coverage.js +3 -3
- package/dist/esm/components/articles-updated.js +2 -2
- package/dist/esm/components/chat-search.js +1 -1
- package/dist/esm/components/combobox.js +1 -1
- package/dist/esm/components/conversation.js +1 -1
- package/dist/esm/components/convos.js +11 -11
- package/dist/esm/components/date-picker.js +1 -1
- package/dist/esm/components/feedback.js +1 -1
- package/dist/esm/components/file-upload.js +1 -1
- package/dist/esm/components/filter.js +1 -1
- package/dist/esm/components/font-picker.js +1 -1
- package/dist/esm/components/input-with-tags.js +1 -1
- package/dist/esm/components/markdown.js +1 -1
- package/dist/esm/components/two-level-combobox.js +1 -1
- package/dist/esm/components/ui/alert-dialog.js +1 -1
- package/dist/esm/components/ui/breadcrumb.js +1 -1
- package/dist/esm/components/ui/button-group.js +1 -1
- package/dist/esm/components/ui/button.js +1 -1
- package/dist/esm/components/ui/combobox.js +1 -1
- package/dist/esm/components/ui/div-button.js +1 -1
- package/dist/esm/components/ui/item.js +1 -1
- package/dist/esm/components/ui/sheet.js +1 -1
- package/dist/esm/components/ui/tooltip.js +3 -3
- package/dist/esm/components/ui/tooltip.js.map +1 -1
- package/dist/esm/global.css +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/layouts/full-layout.js +1 -1
- package/dist/esm/layouts/header-nav.js +1 -1
- package/dist/esm/layouts/sidebar.js +1 -1
- package/dist/esm/scenes/knowledge-review.js +1 -1
- package/dist/esm/tailwind.preset.js +1 -1
- package/dist/esm/tailwind.preset.js.map +1 -1
- package/dist/full-layout.d.ts +1 -0
- package/dist/header-nav.d.ts +1 -0
- package/dist/index.d.ts +56 -12
- package/dist/stats.html +1 -1
- package/package.json +7 -7
- package/tailwind.preset.ts +1 -1
- package/dist/esm/chunks/Conversation.C2TpUr4-.js +0 -29
- package/dist/esm/chunks/Conversation.C2TpUr4-.js.map +0 -1
- package/dist/esm/chunks/header-nav.DmlIUqml.js +0 -14
- package/dist/esm/chunks/header-nav.DmlIUqml.js.map +0 -1
- package/dist/esm/chunks/header-pane.eU7f_pim.js.map +0 -1
- package/dist/esm/chunks/index.uF4ME3WQ.js +0 -4
- package/dist/esm/chunks/index.uF4ME3WQ.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brainfish-ai/components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.1",
|
|
4
4
|
"description": "Brainfish Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/esm/index.js",
|
|
@@ -101,12 +101,12 @@
|
|
|
101
101
|
},
|
|
102
102
|
"devDependencies": {
|
|
103
103
|
"@radix-ui/react-slot": "^1.2.4",
|
|
104
|
-
"@storybook/addon-docs": "^10.
|
|
105
|
-
"@storybook/addon-links": "^10.
|
|
106
|
-
"@storybook/addon-onboarding": "^10.
|
|
104
|
+
"@storybook/addon-docs": "^10.5.6",
|
|
105
|
+
"@storybook/addon-links": "^10.5.6",
|
|
106
|
+
"@storybook/addon-onboarding": "^10.5.6",
|
|
107
107
|
"@storybook/addon-styling": "^1.3.7",
|
|
108
|
-
"@storybook/addon-themes": "^10.
|
|
109
|
-
"@storybook/react-vite": "^10.
|
|
108
|
+
"@storybook/addon-themes": "^10.5.6",
|
|
109
|
+
"@storybook/react-vite": "^10.5.6",
|
|
110
110
|
"@tailwindcss/container-queries": "^0.1.1",
|
|
111
111
|
"@testing-library/jest-dom": "^6.1.4",
|
|
112
112
|
"@testing-library/react": "^14.0.0",
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
140
140
|
"rollup-plugin-postcss": "^4.0.2",
|
|
141
141
|
"rollup-plugin-visualizer": "^7.0.1",
|
|
142
|
-
"storybook": "^10.
|
|
142
|
+
"storybook": "^10.5.6",
|
|
143
143
|
"tailwind-merge": "^2.0.0",
|
|
144
144
|
"tailwindcss": "^3.4.1",
|
|
145
145
|
"tailwindcss-animate": "^1.0.7",
|
package/tailwind.preset.ts
CHANGED
|
@@ -64,7 +64,7 @@ const preset: Partial<Config> = {
|
|
|
64
64
|
pink,
|
|
65
65
|
red,
|
|
66
66
|
|
|
67
|
-
border: 'var(--bfc-
|
|
67
|
+
border: 'var(--bfc-v2-color-mono-300)',
|
|
68
68
|
'border-subtle': 'var(--bfc-border-subtle)',
|
|
69
69
|
input: 'var(--bfc-input)',
|
|
70
70
|
ring: 'color-mix(in srgb, var(--bfc-primary) 85%, transparent)',
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import e,{useRef as t,useLayoutEffect as n,useMemo as r,useContext as o,createContext as i,useCallback as s,useEffect as a,useState as l,Suspense as c,forwardRef as u,Component as d,createElement as f,useImperativeHandle as m}from"react";import{Tooltip as p,TooltipTrigger as g,TooltipContent as h,TooltipProvider as y}from"../components/ui/tooltip.js";import{c as v}from"./utils.C6Qu-kwd.js";import{ScrollArea as x}from"../components/ui/scroll-area.js";import{Copy as E,Browser as b,FileText as w,Folder as N,ChatsTeardrop as S,File as C,FileDoc as k,FilePdf as D,Video as _,Image as R,CircleNotch as O,X as T,Files as A,Plus as I,CaretRight as M,Stop as P,ArrowUp as F}from"@phosphor-icons/react";import{a as L,S as j}from"./ripple-status.C20jzXjF.js";import{F as z}from"./FormattedMessage.D_knqVl-.js";import{B as K}from"./button.D_2SonNs.js";import*as B from"@radix-ui/react-dialog";import{DropdownMenu as U,DropdownMenuTrigger as $,DropdownMenuContent as W,DropdownMenuItem as J}from"../components/ui/dropdown-menu.js";import{Popover as H,PopoverTrigger as V,PopoverContent as q}from"../components/ui/popover.js";import{Command as G,CommandInput as Z,CommandList as Y,CommandEmpty as X,CommandGroup as Q,CommandItem as ee}from"../components/ui/command.js";import{createEditor as te,$getRoot as ne,$createParagraphNode as re,$getSelection as oe,HISTORY_MERGE_TAG as ie,$caretFromPoint as se,$isExtendableTextPointCaret as ae,$extendCaretToRange as le,$isChildCaret as ce,$isElementNode as ue,$isDecoratorNode as de,$isRootNode as fe,$getEditor as me,$isTokenOrSegmented as pe,$getCharacterOffsets as ge,$cloneWithPropertiesEphemeral as he,$isRangeSelection as ye,$findMatchingParent as ve,mergeRegister as xe,DecoratorNode as Ee,addClassNamesToElement as be,shallowMergeConfig as we,$create as Ne,defineExtension as Se,safeCast as Ce,createState as ke,FORMAT_TEXT_COMMAND as De,$isNodeSelection as _e,COMMAND_PRIORITY_LOW as Re,RootNode as Oe,TextNode as Te,LineBreakNode as Ae,TabNode as Ie,ParagraphNode as Me,$isEditorState as Pe,createCommand as Fe,CLICK_COMMAND as Le,isDOMNode as je,$getNodeFromDOMNode as ze,$createNodeSelection as Ke,$setSelection as Be,$getState as Ue,toggleTextFormatType as $e,TEXT_TYPE_TO_FORMAT as We,$setState as Je,$getNodeByKey as He,removeClassNamesFromElement as Ve,CLEAR_EDITOR_COMMAND as qe,COMMAND_PRIORITY_EDITOR as Ge,KEY_TAB_COMMAND as Ze,$isBlockElementNode as Ye,$createRangeSelection as Xe,$normalizeSelection__EXPERIMENTAL as Qe,OUTDENT_CONTENT_COMMAND as et,INDENT_CONTENT_COMMAND as tt,INSERT_TAB_COMMAND as nt,COMMAND_PRIORITY_CRITICAL as rt,$isParagraphNode as ot,$isTextNode as it,isDOMDocumentNode as st,ArtificialNode__DO_NOT_USE as at,$createLineBreakNode as lt,$isRootOrShadowRoot as ct,isBlockDomNode as ut,isInlineDomNode as dt,getRegisteredNode as ft,isHTMLElement as mt,isDocumentFragment as pt,$createTabNode as gt,getDOMSelection as ht,COPY_COMMAND as yt,SELECTION_INSERT_CLIPBOARD_NODES_COMMAND as vt,$isTextPointCaret as xt,$getCaretRange as Et,$getChildCaret as bt,$parseSerializedNode as wt,isSelectionWithinEditor as Nt,DELETE_CHARACTER_COMMAND as St,DELETE_WORD_COMMAND as Ct,DELETE_LINE_COMMAND as kt,CONTROLLED_TEXT_INSERTION_COMMAND as Dt,REMOVE_TEXT_COMMAND as _t,FORMAT_ELEMENT_COMMAND as Rt,INSERT_LINE_BREAK_COMMAND as Ot,INSERT_PARAGRAPH_COMMAND as Tt,$insertNodes as At,KEY_ARROW_UP_COMMAND as It,$getAdjacentNode as Mt,KEY_ARROW_DOWN_COMMAND as Pt,KEY_ARROW_LEFT_COMMAND as Ft,KEY_ARROW_RIGHT_COMMAND as Lt,KEY_BACKSPACE_COMMAND as jt,KEY_DELETE_COMMAND as zt,KEY_ENTER_COMMAND as Kt,KEY_ESCAPE_COMMAND as Bt,DROP_COMMAND as Ut,$getNearestNodeFromDOMNode as $t,DRAGSTART_COMMAND as Wt,DRAGOVER_COMMAND as Jt,SELECT_ALL_COMMAND as Ht,$selectAll as Vt,CUT_COMMAND as qt,PASTE_COMMAND as Gt,isSelectionCapturedInDecoratorInput as Zt,PASTE_TAG as Yt,KEY_SPACE_COMMAND as Xt,ElementNode as Qt,setNodeIndentFromDOM as en,$applyNodeReplacement as tn,COMMAND_PRIORITY_HIGH as nn}from"lexical";import{jsx as rn,jsxs as on,Fragment as sn}from"react/jsx-runtime";import{flushSync as an,createPortal as ln}from"react-dom";import{createEmptyHistoryState as cn,registerHistory as un}from"@lexical/history";import{ListNode as dn,ListItemNode as fn,registerList as mn,registerListStrictIndentTransform as pn,$isListItemNode as gn}from"@lexical/list";import{LinkNode as hn,registerLink as yn,AutoLinkNode as vn}from"@lexical/link";import{registerMarkdownShortcuts as xn,TRANSFORMERS as En,ORDERED_LIST as bn,UNORDERED_LIST as wn,LINK as Nn,INLINE_CODE as Sn,CODE as Cn,$convertToMarkdownString as kn,$convertFromMarkdownString as Dn}from"@lexical/markdown";import{CodeNode as _n,CodeHighlightNode as Rn,$isCodeNode as On}from"@lexical/code";import{L as Tn}from"./logo.DtwFGMBj.js";const An="brainfish-conversation-used",In="welcome";function Mn(e,t,n){const r=t.slice(0,n);return{id:e,role:"ai",content:r?[{type:"text",text:r}]:[],status:n>=t.length?"completed":"streaming"}}function Pn(e,t){return function(e,t,n,r=3){let o=r;const i=setInterval(()=>{o+=3;const r=o>=t.length;n(Mn(e,t,r?t.length:o)),r&&clearInterval(i)},30);return()=>clearInterval(i)}(In,e,t)}const Fn=i(null),Ln={onCopy:(e,t)=>{navigator.clipboard.writeText(t)}};function jn(){const e=o(Fn);if(!e)throw new Error("useConversation must be used within a <Conversation> provider");return e}function zn({messages:o,callbacks:i,children:s}){const a=o.some(e=>"streaming"===e.status&&e.id!==In),l=t({...Ln,...i});n(()=>{l.current={...Ln,...i}});const c=r(()=>({onSend:(...e)=>l.current.onSend?.(...e),onStop:(...e)=>l.current.onStop?.(...e),onSuggestionClick:(...e)=>l.current.onSuggestionClick?.(...e),onActionClick:(...e)=>l.current.onActionClick?.(...e),onCitationClick:(...e)=>l.current.onCitationClick?.(...e),onAttachmentAdd:(...e)=>l.current.onAttachmentAdd?.(...e),onAttachmentRemove:(...e)=>l.current.onAttachmentRemove?.(...e),onCopy:(...e)=>l.current.onCopy?.(...e)}),[]),u=r(()=>({messages:o,callbacks:c,isStreaming:a}),[o,c,a]);/* @__PURE__ */
|
|
2
|
-
return e.createElement(Fn.Provider,{value:u},s)}const Kn=({block:t,isStreaming:n})=>/* @__PURE__ */e.createElement(z,{message:{content:t.text},isStreaming:n}),Bn=({citations:t,onCitationClick:n})=>/* @__PURE__ */e.createElement("span",{className:"inline-flex flex-wrap gap-1"},t.map(t=>/* @__PURE__ */e.createElement(Un,{key:t.id,citation:t,onClick:n}))),Un=({citation:t,onClick:n})=>/* @__PURE__ */e.createElement(p,null,/* @__PURE__ */e.createElement(g,{asChild:!0},/* @__PURE__ */e.createElement(K,{size:"xs",variant:"ghost",className:"size-5 text-xs text-muted-foreground",onClick:()=>n?.(t)},t.index)),/* @__PURE__ */e.createElement(h,{side:"top",className:"max-w-xs"},/* @__PURE__ */e.createElement("p",{className:"text-sm font-medium"},t.title),/* @__PURE__ */e.createElement("p",{className:"text-xs truncate"},t.url))),$n=({block:t,isStreaming:n,onCitationClick:r})=>"text"===t.type?/* @__PURE__ */e.createElement(e.Fragment,null,/* @__PURE__ */e.createElement(Kn,{block:t,isStreaming:n}),t.citations&&t.citations.length>0&&/* @__PURE__ */e.createElement(Bn,{citations:t.citations,onCitationClick:r})):null,Wn="Working",Jn={keyword_search:"Searching knowledge base",get_document:"Reading document",create_document:"Creating document",update_document:"Updating document"};function Hn(e){const t=e.name.replace(/([a-z])([A-Z])/g,"$1_$2").replace(/[\s-]+/g,"_").toLowerCase();return Jn[t]??Wn}function Vn(e){const t=e.content;if(0===t.length)return Wn;const n=t[t.length-1];switch(n.type){case"tool_use":return Hn(n);case"tool_result":{const e=t.findLast(e=>"tool_use"===e.type&&e.id===n.toolUseId);return e?Hn(e):Wn}case"thinking":return"Thinking";case"text":return n.text.length>0?null:Wn;default:return Wn}}const qn=({message:t,className:n})=>{const{callbacks:r}=jn(),o="streaming"===t.status,i="pending"===t.status,a="completed"===t.status,l=s(()=>{const e=t.content.filter(e=>"text"===e.type).map(e=>e.text).join("\n");r.onCopy?.(t.id,e)},[t,r]),c=t.content.some(e=>"text"===e.type&&e.text.length>0),u="error"===t.status,d=o||i?Vn(t):null;return!c&&d?/* @__PURE__ */e.createElement(L,{text:d,className:n}):/* @__PURE__ */e.createElement("div",{className:v("flex gap-3",n)},/* @__PURE__ */e.createElement("div",{className:"flex-1 min-w-0"},/* @__PURE__ */e.createElement("div",{className:"space-y-1"},u?/* @__PURE__ */e.createElement($n,{block:{type:"text",text:"Sorry, something went wrong. Please try again."}}):t.content.map((t,n)=>/* @__PURE__ */e.createElement($n,{key:n,block:t,isStreaming:o,onCitationClick:r.onCitationClick}))),d&&/* @__PURE__ */e.createElement(L,{text:d,className:"mt-2"}),a&&/* @__PURE__ */e.createElement("div",{className:"mt-3 flex items-center gap-1"},/* @__PURE__ */e.createElement(Gn,{tooltip:"Copy",onClick:l},/* @__PURE__ */e.createElement(E,{className:"h-4 w-4"})))))};qn.displayName="ConversationMessageAssistant";const Gn=({children:t,tooltip:n,active:r,onClick:o})=>/* @__PURE__ */e.createElement(p,null,/* @__PURE__ */e.createElement(g,{asChild:!0},/* @__PURE__ */e.createElement("button",{type:"button",className:v("inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",r&&"text-primary"),onClick:o},t)),/* @__PURE__ */e.createElement(h,{side:"bottom"},/* @__PURE__ */e.createElement("p",{className:"text-xs"},n)));Gn.displayName="ActionBarButton";const Zn={image:R,video:_,pdf:D,doc:k,file:C,channel:S,collection:N,article:w,page:b},Yn=({pill:t,onRemove:n})=>{const r=t.iconType?Zn[t.iconType]:null,o=t.loading?t.progress??0:100;/* @__PURE__ */
|
|
3
|
-
return e.createElement("span",{className:"relative inline-flex items-center gap-0.5 overflow-hidden rounded-full border border-muted px-2 py-1 text-xs text-muted-foreground"},/* @__PURE__ */e.createElement("span",{className:"absolute inset-0 bg-muted transition-[width] duration-300 ease-out",style:{width:`${o}%`}}),/* @__PURE__ */e.createElement("span",{className:"relative flex items-center gap-0.5"},t.loading?/* @__PURE__ */e.createElement(O,{className:"h-3 w-3 shrink-0 mr-0.5 animate-spin"}):r&&/* @__PURE__ */e.createElement(r,{className:"h-3 w-3 shrink-0 mr-0.5"}),t.label,n&&/* @__PURE__ */e.createElement("button",{type:"button",className:"ml-0.5 inline-flex h-3.5 w-3.5 items-center justify-center rounded-full hover:bg-muted-foreground/20",onClick:()=>n(t)},
|
|
4
|
-
/* @__PURE__ */e.createElement(T,{className:"h-2.5 w-2.5"}))))};function Xn({src:t,alt:n,open:r,onClose:o}){/* @__PURE__ */
|
|
5
|
-
return e.createElement(B.Root,{open:r,onOpenChange:e=>{e||o()}},
|
|
6
|
-
/* @__PURE__ */e.createElement(B.Portal,null,/* @__PURE__ */e.createElement(B.Overlay,{className:"fixed inset-0 z-50 bg-black/80 cursor-zoom-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"}),/* @__PURE__ */e.createElement(B.Content,{className:"fixed left-1/2 top-1/2 z-50 max-w-[calc(100vw-4rem)] max-h-[calc(100vh-4rem)] outline-none 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",style:{translate:"-50% -50%"},"aria-describedby":void 0,onPointerDownOutside:o},
|
|
7
|
-
/* @__PURE__ */e.createElement(B.Title,{className:"sr-only"},n??"Image preview"),
|
|
8
|
-
/* @__PURE__ */e.createElement("img",{src:t,alt:n??"Attachment",className:"max-w-full max-h-full object-contain rounded-lg ring-1 ring-white/10"}))))}function Qn({file:t,url:n,alt:r,loading:o,onRemove:i}){const[s,a]=e.useState(),[l,c]=e.useState(!1);e.useEffect(()=>{if(!t)return;const e=URL.createObjectURL(t);return a(e),()=>URL.revokeObjectURL(e)},[t]);const u=n??s;return u?/* @__PURE__ */e.createElement(e.Fragment,null,/* @__PURE__ */e.createElement("div",{className:"relative group size-16 rounded-lg overflow-hidden flex-shrink-0 ring-1 ring-black/10 dark:ring-white/10"},/* @__PURE__ */e.createElement("button",{type:"button",className:"w-full h-full cursor-zoom-in",onClick:()=>c(!0),disabled:o},
|
|
9
|
-
/* @__PURE__ */e.createElement("img",{src:u,alt:r??"Attachment",className:"w-full h-full object-cover"})),o&&/* @__PURE__ */e.createElement("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40 pointer-events-none"},/* @__PURE__ */e.createElement("div",{className:"animate-spin rounded-full size-4 border-[2.5px] border-black/30 border-t-white"})),i&&/* @__PURE__ */e.createElement("button",{type:"button",onClick:i,className:"absolute top-0.5 right-0.5 p-0.5 rounded-full opacity-0 group-hover:opacity-100 transition-opacity bg-black/50 hover:bg-black/70"},
|
|
10
|
-
/* @__PURE__ */e.createElement(T,{className:"size-2.5 text-white","aria-label":"Remove"}))),/* @__PURE__ */e.createElement(Xn,{src:u,alt:r,open:l,onClose:()=>c(!1)})):null}function er({attachments:t,onRemove:n,className:r}){const o=t.filter(e=>e.file.mimeType.startsWith("image/"));return 0===o.length?null:/* @__PURE__ */e.createElement("div",{className:v("flex flex-wrap gap-2",r)},o.map(t=>/* @__PURE__ */e.createElement(Qn,{key:t.id,file:t.raw,url:t.file.url,alt:t.file.name,loading:t.loading,onRemove:n?()=>n(t):void 0})))}function tr({blocks:t,className:n}){const r=t.filter(e=>e.mimeType.startsWith("image/"));return 0===r.length?null:/* @__PURE__ */e.createElement("div",{className:v("flex flex-wrap gap-2",n)},r.map(t=>/* @__PURE__ */e.createElement(Qn,{key:t.attachmentId,url:t.url,alt:t.fileName})))}function nr(e){return e.startsWith("image/")?"image":e.startsWith("video/")?"video":"application/pdf"===e?"pdf":"application/msword"===e||e.includes("wordprocessingml")?"doc":"file"}function rr(e){switch(e.type){case"file":return`file:${e.attachmentId}`;case"page":return`page:${e.url}`;case"entity":return`entity:${e.entity.type}:${e.entity.id}`}}function or(e){switch(e.type){case"file":return{id:e.attachmentId,label:e.fileName,iconType:nr(e.mimeType)};case"page":return{id:e.url,label:e.title,iconType:"page"};case"entity":return{id:e.entity.id,label:e.entity.title,iconType:e.entity.type}}}const ir=({message:t,className:n})=>{const r=t.content.filter(e=>"text"===e.type),o=t.content.filter(e=>"file"===e.type&&e.mimeType.startsWith("image/")),i=t.content.filter(e=>"text"!==e.type&&("file"!==e.type||!e.mimeType.startsWith("image/"))),s=r.map(e=>e.text).join("\n").split(/\n\n+/).filter(e=>e.trim().length>0);/* @__PURE__ */
|
|
11
|
-
return e.createElement("div",{className:v("flex justify-end",n)},/* @__PURE__ */e.createElement("div",{className:"max-w-[85%] rounded bg-dark-200 px-4 py-2.5 text-foreground flex flex-col gap-3"},/* @__PURE__ */e.createElement(tr,{blocks:o}),i.length>0&&/* @__PURE__ */e.createElement("div",{className:"flex flex-wrap gap-1.5"},i.map(t=>/* @__PURE__ */e.createElement(Yn,{key:rr(t),pill:or(t)}))),s.length>0&&/* @__PURE__ */e.createElement("div",null,s.map((t,n)=>/* @__PURE__ */e.createElement("p",{key:n,className:"m-0 mb-4 whitespace-pre-wrap last:mb-0"},t)))))};ir.displayName="ConversationMessageUser";const sr=({message:t,className:n})=>{switch(t.role){case"ai":/* @__PURE__ */
|
|
12
|
-
return e.createElement(qn,{message:t,className:n});case"user":/* @__PURE__ */
|
|
13
|
-
return e.createElement(ir,{message:t,className:n});default:return null}},ar=({className:n,bottomPadding:r=0,onContentBehind:o})=>{const{messages:i}=jn(),s=t(null),l=t(null);return a(()=>{const e=s.current;e&&(e.scrollTop=e.scrollHeight)},[i]),a(()=>{const e=l.current,t=s.current;if(!e||!t||!o)return;const n=new IntersectionObserver(([e])=>{e&&o(!e.isIntersecting)},{root:t,threshold:0,rootMargin:`0px 0px -${r}px 0px`});return n.observe(e),()=>n.disconnect()},[o,r]),/* @__PURE__ */e.createElement(x,{ref:s,className:v("h-full",n)},/* @__PURE__ */e.createElement("div",{className:"py-4 px-6 flex flex-col gap-4"},i.map(t=>/* @__PURE__ */e.createElement(sr,{key:t.id,message:t})),/* @__PURE__ */e.createElement("div",{ref:l,className:"h-px -mt-4"})),/* @__PURE__ */e.createElement("div",{style:{height:r+8}}))},lr=i(null);function cr(){const e=o(lr);return null==e&&function(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const o of t)r.append("v",o);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(8),e}const ur="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,dr=ur?n:a,fr={tag:ie};function mr({initialConfig:e,children:t}){const n=r(()=>{const{theme:t,namespace:n,nodes:r,onError:o,editorState:i,html:s}=e,a=(c=t,{getTheme:function(){return null!=c?c:null}}),l=te({editable:e.editable,html:s,namespace:n,nodes:r,onError:e=>o(e,l),theme:t});var c;return function(e,t){if(null!==t)if(void 0===t)e.update(()=>{const t=ne();if(t.isEmpty()){const n=re();t.append(n);const r=ur?document.activeElement:null;(null!==oe()||null!==r&&r===e.getRootElement())&&n.select()}},fr);else if(null!==t)switch(typeof t){case"string":{const n=e.parseEditorState(t);e.setEditorState(n,fr);break}case"object":e.setEditorState(t,fr);break;case"function":e.update(()=>{ne().isEmpty()&&t(e)},fr)}}(l,i),[l,a]},[]);return dr(()=>{const t=e.editable,[r]=n;r.setEditable(void 0===t||t)},[]),rn(lr.Provider,{value:n,children:t})}const pr="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?n:a;function gr(e){return{initialValueFn:()=>e.isEditable(),subscribe:t=>e.registerEditableListener(t)}}const hr=new Map;function yr(e){const t=me().getElementByKey(e.getKey());if(null===t)return null;const n=t.ownerDocument.defaultView;return null===n?null:n.getComputedStyle(t)}function vr(e){return yr(fe(e)?e:e.getParentOrThrow())}function xr(e){const t=vr(e);return null!==t&&"rtl"===t.direction}function Er(e,t,n="self"){const r=e.getStartEndPoints();if(t.isSelected(e)&&!pe(t)&&null!==r){const[o,i]=r,s=e.isBackward(),a=o.getNode(),l=i.getNode(),c=t.is(a),u=t.is(l);if(c||u){const[r,o]=ge(e),i=a.is(l),c=t.is(s?l:a),u=t.is(s?a:l);let d,f=0;i?(f=r>o?o:r,d=r>o?r:o):c?(f=s?o:r,d=void 0):u&&(f=0,d=s?r:o);const m=t.__text.slice(f,d);m!==t.__text&&("clone"===n&&(t=he(t)),t.__text=m)}}return t}function br(e){const t=e.getStyle(),n=function(e){const t={};if(!e)return t;const n=e.split(";");for(const r of n)if(""!==r){const[e,n]=r.split(/:([^]+)/);e&&n&&(t[e.trim()]=n.trim())}return t}(t);hr.set(t,n)}function wr(e){const t=Nr(e);return null!==t&&"vertical-rl"===t.writingMode}function Nr(e){const t=e.anchor.getNode();return ue(t)?yr(t):vr(t)}function Sr(e,t){let n=wr(e)?!t:t;Cr(e)&&(n=!n);const r=se(e.focus,n?"previous":"next");if(ae(r))return!1;for(const o of le(r)){if(ce(o))return!o.origin.isInline();if(!ue(o.origin)){if(de(o.origin))return!0;break}}return!1}function Cr(e){const t=Nr(e);return null!==t&&"rtl"===t.direction}function kr(e,t,n){const r=Cr(e);let o;o=wr(e)||r?!n:n,function(e,t,n,r){e.modify(t?"extend":"move",n,r)}(e,t,o,"character")}const Dr="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,_r=Dr&&"documentMode"in document?document.documentMode:null;function Rr(e){const t=ve(e,e=>ue(e)&&!e.isInline());return ue(t)||function(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const o of t)r.append("v",o);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(4,e.__key),t}function Or(e,t){return null!==e&&Object.getPrototypeOf(e).constructor.name===t.name}function Tr(e){const t=oe();if(!ye(t))return!1;const n=new Set,r=t.getNodes();for(let o=0;o<r.length;o++){const t=r[o],i=t.getKey();if(n.has(i))continue;const s=ve(t,e=>ue(e)&&!e.isInline());if(null===s)continue;const a=s.getKey();s.canIndent()&&!n.has(a)&&(n.add(a),e(s))}return n.size>0}Dr&&"InputEvent"in window&&!_r&&new window.InputEvent("input");const Ar=Symbol.for("preact-signals");function Ir(){if(Lr>1)return void Lr--;let e,t=!1;for(;void 0!==Pr;){let n=Pr;for(Pr=void 0,jr++;void 0!==n;){const r=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&$r(n))try{n.c()}catch(zi){t||(e=zi,t=!0)}n=r}}if(jr=0,Lr--,t)throw e}let Mr,Pr;function Fr(e){const t=Mr;Mr=void 0;try{return e()}finally{Mr=t}}let Lr=0,jr=0,zr=0;function Kr(e){if(void 0===Mr)return;let t=e.n;return void 0===t||t.t!==Mr?(t={i:0,S:e,p:Mr.s,n:void 0,t:Mr,e:void 0,x:void 0,r:t},void 0!==Mr.s&&(Mr.s.n=t),Mr.s=t,e.n=t,32&Mr.f&&e.S(t),t):-1===t.i?(t.i=0,void 0!==t.n&&(t.n.p=t.p,void 0!==t.p&&(t.p.n=t.n),t.p=Mr.s,t.n=void 0,Mr.s.n=t,Mr.s=t),t):void 0}function Br(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function Ur(e,t){return new Br(e,t)}function $r(e){for(let t=e.s;void 0!==t;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function Wr(e){for(let t=e.s;void 0!==t;t=t.n){const n=t.S.n;if(void 0!==n&&(t.r=n),t.S.n=t,t.i=-1,void 0===t.n){e.s=t;break}}}function Jr(e){let t,n=e.s;for(;void 0!==n;){const e=n.p;-1===n.i?(n.S.U(n),void 0!==e&&(e.n=n.n),void 0!==n.n&&(n.n.p=e)):t=n,n.S.n=n.r,void 0!==n.r&&(n.r=void 0),n=e}e.s=t}function Hr(e,t){Br.call(this,void 0),this.x=e,this.s=void 0,this.g=zr-1,this.f=4,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function Vr(e){const t=e.u;if(e.u=void 0,"function"==typeof t){Lr++;const n=Mr;Mr=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,qr(e),t}finally{Mr=n,Ir()}}}function qr(e){for(let t=e.s;void 0!==t;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Vr(e)}function Gr(e){if(Mr!==this)throw new Error("Out-of-order effect");Jr(this),Mr=e,this.f&=-2,8&this.f&&qr(this),Ir()}function Zr(e,t){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32,this.name=null==t?void 0:t.name}function Yr(e,t){const n=new Zr(e,t);try{n.c()}catch(e){throw n.d(),e}const r=n.d.bind(n);return r[Symbol.dispose]=r,r}function Xr(e,t={}){const n={};for(const r in e){const o=t[r],i=Ur(void 0===o?e[r]:o);n[r]=i}return n}function Qr(){const e=ne(),t=oe(),n=re();e.clear(),e.append(n),null!==t&&n.select(),ye(t)&&(t.format=0)}function eo(e){return("function"==typeof e.nodes?e.nodes():e.nodes)||[]}Br.prototype.brand=Ar,Br.prototype.h=function(){return!0},Br.prototype.S=function(e){const t=this.t;t!==e&&void 0===e.e&&(e.x=t,this.t=e,void 0!==t?t.e=e:Fr(()=>{var e;null==(e=this.W)||e.call(this)}))},Br.prototype.U=function(e){if(void 0!==this.t){const t=e.e,n=e.x;void 0!==t&&(t.x=n,e.e=void 0),void 0!==n&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n,void 0===n&&Fr(()=>{var e;null==(e=this.Z)||e.call(this)}))}},Br.prototype.subscribe=function(e){return Yr(()=>{const t=this.value,n=Mr;Mr=void 0;try{e(t)}finally{Mr=n}},{name:"sub"})},Br.prototype.valueOf=function(){return this.value},Br.prototype.toString=function(){return this.value+""},Br.prototype.toJSON=function(){return this.value},Br.prototype.peek=function(){const e=Mr;Mr=void 0;try{return this.value}finally{Mr=e}},Object.defineProperty(Br.prototype,"value",{get(){const e=Kr(this);return void 0!==e&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(jr>100)throw new Error("Cycle detected");this.v=e,this.i++,zr++,Lr++;try{for(let e=this.t;void 0!==e;e=e.x)e.t.N()}finally{Ir()}}}}),Hr.prototype=new Br,Hr.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===zr)return!0;if(this.g=zr,this.f|=1,this.i>0&&!$r(this))return this.f&=-2,!0;const e=Mr;try{Wr(this),Mr=this;const e=this.x();(16&this.f||this.v!==e||0===this.i)&&(this.v=e,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return Mr=e,Jr(this),this.f&=-2,!0},Hr.prototype.S=function(e){if(void 0===this.t){this.f|=36;for(let e=this.s;void 0!==e;e=e.n)e.S.S(e)}Br.prototype.S.call(this,e)},Hr.prototype.U=function(e){if(void 0!==this.t&&(Br.prototype.U.call(this,e),void 0===this.t)){this.f&=-33;for(let e=this.s;void 0!==e;e=e.n)e.S.U(e)}},Hr.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let e=this.t;void 0!==e;e=e.x)e.t.N()}},Object.defineProperty(Hr.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const e=Kr(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),Zr.prototype.c=function(){const e=this.S();try{if(8&this.f)return;if(void 0===this.x)return;const e=this.x();"function"==typeof e&&(this.u=e)}finally{e()}},Zr.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Vr(this),Wr(this),Lr++;const e=Mr;return Mr=this,Gr.bind(this,e)},Zr.prototype.N=function(){2&this.f||(this.f|=2,this.o=Pr,Pr=this)},Zr.prototype.d=function(){this.f|=8,1&this.f||qr(this)},Zr.prototype.dispose=function(){this.d()},Se({build:(e,t,n)=>Xr(t),config:Ce({defaultSelection:"rootEnd",disabled:!1}),name:"@lexical/extension/AutoFocus",register(e,t,n){const r=n.getOutput();return Yr(()=>r.disabled.value?void 0:e.registerRootListener(t=>{e.focus(()=>{const e=document.activeElement;null===t||null!==e&&t.contains(e)||t.focus({preventScroll:!0})},{defaultSelection:r.defaultSelection.peek()})}))}}),Se({build:(e,t,n)=>Xr(t),config:Ce({$onClear:Qr}),name:"@lexical/extension/ClearEditor",register(e,t,n){const{$onClear:r}=n.getOutput();return Yr(()=>function(e,t=Qr){return e.registerCommand(qe,n=>(e.update(t),!0),Ge)}(e,r.value))}});const to=ke("format",{parse:e=>"number"==typeof e?e:0});let no=class extends Ee{$config(){return this.config("decorator-text",{extends:Ee,stateConfigs:[{flat:!0,stateConfig:to}]})}getFormat(){return Ue(this,to)}getFormatFlags(e,t){return $e(this.getFormat(),e,t)}hasFormat(e){const t=We[e];return 0!==(this.getFormat()&t)}setFormat(e){return Je(this,to,e)}toggleFormat(e){const t=this.getFormat(),n=$e(t,e,null);return this.setFormat(n)}isInline(){return!0}createDOM(){return document.createElement("span")}updateDOM(){return!1}};function ro(e){return e instanceof no}function oo(e,t){let n;return Ur(e(),{unwatched(){n&&(n(),n=void 0)},watched(){this.value=e(),n=t(this)}})}Se({name:"@lexical/extension/DecoratorText",nodes:()=>[no],register:(e,t,n)=>e.registerCommand(De,e=>{const t=oe();if(_e(t)||ye(t))for(const n of t.getNodes())ro(n)&&n.toggleFormat(e);return!1},Re)});const io=Se({build:e=>oo(()=>e.getEditorState(),t=>e.registerUpdateListener(e=>{t.value=e.editorState})),name:"@lexical/extension/EditorState"});function so(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const o of t)r.append("v",o);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function ao(e,t){if(e&&t&&!Array.isArray(t)&&"object"==typeof e&&"object"==typeof t){const n=e,r=t;for(const e in r)n[e]=ao(n[e],r[e]);return e}return t}function lo(e){return 0===e.id}function co(e){return 2===e.id}const uo=new Set;class fo{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(e,t){this.builder=e,this.extension=t,this.configs=new Set,this.state={id:0}}mergeConfigs(){let e=this.extension.config||{};const t=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):we;for(const n of this.configs)e=t(e,n);return e}init(e){const t=this.state;co(t)||so(306,String(t.id));const n={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},r={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},o=function(e,t,n){return Object.assign(e,{config:t,id:3,registerState:n})}(t,this.mergeConfigs(),n);let i;this.state=o,this.extension.init&&(i=this.extension.init(e,o.config,n)),this.state=function(e,t,n){return Object.assign(e,{id:4,initResult:t,registerState:n})}(o,i,r)}build(e){const t=this.state;let n;4!==t.id&&so(307,String(t.id),String(5)),this.extension.build&&(n=this.extension.build(e,t.config,t.registerState));const r={...t.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=function(e,t,n){return Object.assign(e,{id:5,output:t,registerState:n})}(t,n,r)}register(e,t){this._signal=t;const n=this.state;5!==n.id&&so(308,String(n.id),String(5));const r=this.extension.register&&this.extension.register(e,n.config,n.registerState);return this.state=function(e){return Object.assign(e,{id:6})}(n),()=>{const e=this.state;7!==e.id&&so(309,String(n.id),String(7)),this.state=function(e){return Object.assign(e,{id:5})}(e),r&&r()}}afterRegistration(e){const t=this.state;let n;return 6!==t.id&&so(310,String(t.id),String(6)),this.extension.afterRegistration&&(n=this.extension.afterRegistration(e,t.config,t.registerState)),this.state=function(e){return Object.assign(e,{id:7})}(t),n}getSignal(){return void 0===this._signal&&so(311),this._signal}getInitResult(){void 0===this.extension.init&&so(312,this.extension.name);const e=this.state;return function(e){return e.id>=4}(e)||so(313,String(e.id),String(4)),e.initResult}getInitPeer(e){const t=this.builder.extensionNameMap.get(e);return t?t.getExtensionInitDependency():void 0}getExtensionInitDependency(){const e=this.state;return function(e){return e.id>=3}(e)||so(314,String(e.id),String(3)),{config:e.config}}getPeer(e){const t=this.builder.extensionNameMap.get(e);return t?t.getExtensionDependency():void 0}getInitDependency(e){const t=this.builder.getExtensionRep(e);return void 0===t&&so(315,this.extension.name,e.name),t.getExtensionInitDependency()}getDependency(e){const t=this.builder.getExtensionRep(e);return void 0===t&&so(315,this.extension.name,e.name),t.getExtensionDependency()}getState(){const e=this.state;return function(e){return e.id>=7}(e)||so(316,String(e.id),String(7)),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||uo}getPeerNameSet(){let e=this._peerNameSet;return e||(e=new Set((this.extension.peerDependencies||[]).map(([e])=>e)),this._peerNameSet=e),e}getExtensionDependency(){if(!this._dependency){const e=this.state;(function(e){return e.id>=5})(e)||so(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}}const mo={tag:ie};function po(){const e=ne();e.isEmpty()&&e.append(re())}const go=Se({config:Ce({setOptions:mo,updateOptions:mo}),init:({$initialEditorState:e=po})=>({$initialEditorState:e,initialized:!1}),afterRegistration(e,{updateOptions:t,setOptions:n},r){const o=r.getInitResult();if(!o.initialized){o.initialized=!0;const{$initialEditorState:r}=o;if(Pe(r))e.setEditorState(r,n);else if("function"==typeof r)e.update(()=>{r(e)},t);else if(r&&("string"==typeof r||"object"==typeof r)){const t=e.parseEditorState(r);e.setEditorState(t,n)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[Oe,Te,Ae,Ie,Me]}),ho=Symbol.for("@lexical/extension/LexicalBuilder");function yo(){}function vo(e){throw e}function xo(e){return Array.isArray(e)?e:[e]}const Eo="0.41.0+prod.esm";class bo{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(e){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=Eo,this.roots=e;for(const t of e)this.addExtension(t)}static fromExtensions(e){const t=[xo(go)];for(const n of e)t.push(xo(n));return new bo(t)}static maybeFromEditor(e){const t=e[ho];return t&&(t.PACKAGE_VERSION!==Eo&&so(292,t.PACKAGE_VERSION,Eo),t instanceof bo||so(293)),t}static fromEditor(e){const t=bo.maybeFromEditor(e);return void 0===t&&so(294),t}constructEditor(){const{$initialEditorState:e,onError:t,...n}=this.buildCreateEditorArgs(),r=Object.assign(te({...n,...t?{onError:e=>{t(e,r)}}:{}}),{[ho]:this});for(const o of this.sortedExtensionReps())o.build(r);return r}buildEditor(){let e=yo;function t(){try{e()}finally{e=yo}}const n=Object.assign(this.constructEditor(),{dispose:t,[Symbol.dispose]:t});return e=xe(this.registerEditor(n),()=>n.setRootElement(null)),n}hasExtensionByName(e){return this.extensionNameMap.has(e)}getExtensionRep(e){const t=this.extensionNameMap.get(e.name);if(t)return t.extension!==e&&so(295,e.name),t}addEdge(e,t,n){const r=this.outgoingConfigEdges.get(e);r?r.set(t,n):this.outgoingConfigEdges.set(e,new Map([[t,n]]));const o=this.incomingEdges.get(t);o?o.add(e):this.incomingEdges.set(t,new Set([e]))}addExtension(e){void 0!==this._sortedExtensionReps&&so(296);const t=xo(e),[n]=t;"string"!=typeof n.name&&so(297,typeof n.name);let r=this.extensionNameMap.get(n.name);if(void 0!==r&&r.extension!==n&&so(298,n.name),!r){r=new fo(this,n),this.extensionNameMap.set(n.name,r);const e=this.conflicts.get(n.name);"string"==typeof e&&so(299,n.name,e);for(const t of n.conflictsWith||[])this.extensionNameMap.has(t)&&so(299,n.name,t),this.conflicts.set(t,n.name);for(const t of n.dependencies||[]){const e=xo(t);this.addEdge(n.name,e[0].name,e.slice(1)),this.addExtension(e)}for(const[t,r]of n.peerDependencies||[])this.addEdge(n.name,t,r?[r]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;const e=[],t=(n,r)=>{let o=n.state;if(co(o))return;const i=n.extension.name;var s;lo(o)||so(300,i,r||"[unknown]"),lo(s=o)||so(304,String(s.id),String(0)),o=Object.assign(s,{id:1}),n.state=o;const a=this.outgoingConfigEdges.get(i);if(a)for(const e of a.keys()){const n=this.extensionNameMap.get(e);n&&t(n,i)}o=function(e){return function(e){return 1===e.id}(e)||so(305,String(e.id),String(1)),Object.assign(e,{id:2})}(o),n.state=o,e.push(n)};for(const n of this.extensionNameMap.values())lo(n.state)&&t(n);for(const n of e)for(const[e,t]of this.outgoingConfigEdges.get(n.extension.name)||[])if(t.length>0){const n=this.extensionNameMap.get(e);if(n)for(const e of t)n.configs.add(e)}for(const[n,...r]of this.roots)if(r.length>0){const e=this.extensionNameMap.get(n.name);void 0===e&&so(301,n.name);for(const t of r)e.configs.add(t)}return this._sortedExtensionReps=e,this._sortedExtensionReps}registerEditor(e){const t=this.sortedExtensionReps(),n=new AbortController,r=[()=>n.abort()],o=n.signal;for(const i of t){const t=i.register(e,o);t&&r.push(t)}for(const i of t){const t=i.afterRegistration(e);t&&r.push(t)}return xe(...r)}buildCreateEditorArgs(){const e={},t=new Set,n=new Map,r=new Map,o={},i={},s=this.sortedExtensionReps();for(const c of s){const{extension:s}=c;if(void 0!==s.onError&&(e.onError=s.onError),void 0!==s.disableEvents&&(e.disableEvents=s.disableEvents),void 0!==s.parentEditor&&(e.parentEditor=s.parentEditor),void 0!==s.editable&&(e.editable=s.editable),void 0!==s.namespace&&(e.namespace=s.namespace),void 0!==s.$initialEditorState&&(e.$initialEditorState=s.$initialEditorState),s.nodes)for(const e of eo(s)){if("function"!=typeof e){const t=n.get(e.replace);t&&so(302,s.name,e.replace.name,t.extension.name),n.set(e.replace,c)}t.add(e)}if(s.html){if(s.html.export)for(const[e,t]of s.html.export.entries())r.set(e,t);s.html.import&&Object.assign(o,s.html.import)}s.theme&&ao(i,s.theme)}Object.keys(i).length>0&&(e.theme=i),t.size&&(e.nodes=[...t]);const a=Object.keys(o).length>0,l=r.size>0;(a||l)&&(e.html={},a&&(e.html.import=o),l&&(e.html.export=r));for(const c of s)c.init(e);return e.onError||(e.onError=vo),e}}const wo=new Set,No=Se({build(e,t,n){const r=n.getDependency(io).output,o=Ur({watchedNodeKeys:new Map}),i=oo(()=>{},()=>Yr(()=>{const e=i.peek(),{watchedNodeKeys:t}=o.value;let n,s=!1;r.value.read(()=>{if(oe())for(const[r,o]of t.entries()){if(0===o.size){t.delete(r);continue}const i=He(r),a=i&&i.isSelected()||!1;s=s||a!==(!!e&&e.has(r)),a&&(n=n||new Set,n.add(r))}}),!s&&n&&e&&n.size===e.size||(i.value=n)}));return{watchNodeKey:function(e){const t=function(e,t){return new Hr(e,t)}(()=>(i.value||wo).has(e)),{watchedNodeKeys:n}=o.peek();let r=n.get(e);const s=void 0!==r;return r=r||new Set,r.add(t),s||(n.set(e,r),o.value={watchedNodeKeys:n}),t}}},dependencies:[io],name:"@lexical/extension/NodeSelection"});Fe("INSERT_HORIZONTAL_RULE_COMMAND");class So extends Ee{static getType(){return"horizontalrule"}static clone(e){return new So(e.__key)}static importJSON(e){return ko().updateFromJSON(e)}static importDOM(){return{hr:()=>({conversion:Co,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(e){const t=document.createElement("hr");return be(t,e.theme.hr),t}getTextContent(){return"\n"}isInline(){return!1}updateDOM(){return!1}}function Co(){return{node:ko()}}function ko(){return Ne(So)}function Do(e){return e instanceof So}function _o(e){return e.canBeEmpty()}Se({dependencies:[io,No],name:"@lexical/extension/HorizontalRule",nodes:()=>[So],register(e,t,n){const{watchNodeKey:r}=n.getDependency(No).output,o=Ur({nodeSelections:new Map}),i=e._config.theme.hrSelected??"selected";return xe(e.registerCommand(Le,e=>{if(je(e.target)){const t=ze(e.target);if(Do(t))return function(e,t=!1){const n=oe(),r=e.isSelected(),o=e.getKey();let i;t&&_e(n)?i=n:(i=Ke(),Be(i)),r?i.delete(o):i.add(o)}(t,e.shiftKey),!0}return!1},Re),e.registerMutationListener(So,(t,n)=>{!function(e){if(Lr>0)return e();Lr++;try{return e()}finally{Ir()}}(()=>{let n=!1;const{nodeSelections:i}=o.peek();for(const[o,s]of t.entries())if("destroyed"===s)i.delete(o),n=!0;else{const t=i.get(o),s=e.getElementByKey(o);t?t.domNode.value=s:(n=!0,i.set(o,{domNode:Ur(s),selectedSignal:r(o)}))}n&&(o.value={nodeSelections:i})})}),Yr(()=>{const e=[];for(const{domNode:t,selectedSignal:n}of o.value.nodeSelections.values())e.push(Yr(()=>{const e=t.value;e&&(n.value?be(e,i):Ve(e,i))}));return xe(...e)}))}}),Se({build:(e,t,n)=>Xr(t),config:Ce({$canIndent:_o,disabled:!1,maxIndent:null}),name:"@lexical/extension/TabIndentation",register(e,t,n){const{disabled:r,maxIndent:o,$canIndent:i}=n.getOutput();return Yr(()=>{if(!r.value)return function(e,t,n=_o){return xe(e.registerCommand(Ze,t=>{const n=oe();if(!ye(n))return!1;t.preventDefault();const r=function(e){if(e.getNodes().filter(e=>Ye(e)&&e.canIndent()).length>0)return!0;const t=e.anchor,n=e.focus,r=n.isBefore(t)?n:t,o=Rr(r.getNode());if(o.canIndent()){const e=o.getKey();let t=Xe();if(t.anchor.set(e,0,"element"),t.focus.set(e,0,"element"),t=Qe(t),t.anchor.is(r))return!0}return!1}(n)?t.shiftKey?et:tt:nt;return e.dispatchCommand(r,void 0)},Ge),e.registerCommand(tt,()=>{const e="number"==typeof t?t:t?t.peek():null,r=oe();if(!ye(r))return!1;const o="function"==typeof n?n:n.peek();return Tr(t=>{if(o(t)){const n=t.getIndent()+1;(!e||n<e)&&t.setIndent(n)}})},rt))}(e,o,i)})}});const Ro=Se({name:"@lexical/react/ReactProvider"});function Oo(e,t=!0){if(e)return!1;let n=ne().getTextContent();return t&&(n=n.trim()),""===n}function To(e){return()=>function(e){if(!Oo(e,!1))return!1;const t=ne().getChildren(),n=t.length;if(n>1)return!1;for(let r=0;r<n;r++){const e=t[r];if(de(e))return!1;if(ue(e)){if(!ot(e))return!1;if(0!==e.__indent)return!1;const t=e.getChildren(),n=t.length;for(let e=0;e<n;e++){const e=t[r];if(!it(e))return!1}}}return!0}(e)}function Ao(e){const t=window.location.origin,n=n=>{if(n.origin!==t)return;const r=e.getRootElement();if(document.activeElement!==r)return;const o=n.data;if("string"==typeof o){let t;try{t=JSON.parse(o)}catch(e){return}if(t&&"nuanria_messaging"===t.protocol&&"request"===t.type){const r=t.payload;if(r&&"makeChanges"===r.functionId){const t=r.args;if(t){const[r,o,i,s,a]=t;e.update(()=>{const e=oe();if(ye(e)){const t=e.anchor;let l=t.getNode(),c=0,u=0;if(it(l)&&r>=0&&o>=0&&(c=r,u=r+o,e.setTextNodeRange(l,c,l,u)),c===u&&""===i||(e.insertRawText(i),l=t.getNode()),it(l)){c=s,u=s+a;const t=l.getTextContentSize();c=c>t?t:c,u=u>t?t:u,e.setTextNodeRange(l,c,l,u)}n.stopImmediatePropagation()}})}}}}};return window.addEventListener("message",n,!0),()=>{window.removeEventListener("message",n,!0)}}const Io=Se({build:(e,t,n)=>Xr(t),config:Ce({disabled:"undefined"==typeof window}),name:"@lexical/dragon",register:(e,t,n)=>Yr(()=>n.getOutput().disabled.value?void 0:Ao(e))});function Mo(e,t,n,r=null){let o=null===r||t.isSelected(r);const i=ue(t)&&t.excludeFromCopy("html");let s=t;null!==r&&it(t)&&(s=Er(r,t,"clone"));const a=ue(s)?s.getChildren():[],l=ft(e,s.getType());let c;c=l&&void 0!==l.exportDOM?l.exportDOM(e,s):s.exportDOM(e);const{element:u,after:d}=c;if(!u)return!1;const f=document.createDocumentFragment();for(let m=0;m<a.length;m++){const n=a[m],i=Mo(e,n,f,r);!o&&ue(t)&&i&&t.extractWithChild(n,r,"html")&&(o=!0)}if(o&&!i){if((mt(u)||pt(u))&&u.append(f),n.append(u),d){const e=d.call(s,u);e&&(pt(u)?u.replaceChildren(e):u.replaceWith(e))}}else n.append(f);return o}const Po=new Set(["STYLE","SCRIPT"]);function Fo(e,t,n,r,o=new Map,i){let s=[];if(Po.has(e.nodeName))return s;let a=null;const l=function(e,t){const{nodeName:n}=e,r=t._htmlConversions.get(n.toLowerCase());let o=null;if(void 0!==r)for(const i of r){const t=i(e);null!==t&&(null===o||(o.priority||0)<=(t.priority||0))&&(o=t)}return null!==o?o.conversion:null}(e,t),c=l?l(e):null;let u=null;if(null!==c){u=c.after;const t=c.node;if(a=Array.isArray(t)?t[t.length-1]:t,null!==a){for(const[,e]of o)if(a=e(a,i),!a)break;a&&s.push(...Array.isArray(t)?t:[a])}null!=c.forChild&&o.set(e.nodeName,c.forChild)}const d=e.childNodes;let f=[];const m=(null==a||!ct(a))&&(null!=a&&Ye(a)||r);for(let p=0;p<d.length;p++)f.push(...Fo(d[p],t,n,m,new Map(o),a));return null!=u&&(f=u(f)),ut(e)&&(f=function(e,t,n){const r=e.style.textAlign,o=[];let i=[];for(let s=0;s<t.length;s++){const e=t[s];if(Ye(e))r&&!e.getFormat()&&e.setFormat(r),o.push(e);else if(i.push(e),s===t.length-1||s<t.length-1&&Ye(t[s+1])){const e=n();e.setFormat(r),e.append(...i),o.push(e),i=[]}}return o}(e,f,m?()=>{const e=new at;return n.push(e),e}:re)),null==a?f.length>0?s=s.concat(f):ut(e)&&function(e){return null!=e.nextSibling&&null!=e.previousSibling&&(dt(e.nextSibling)&&dt(e.previousSibling))}(e)&&(s=s.concat(lt())):ue(a)&&a.append(...f),s}function Lo(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const o of t)r.append("v",o);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function jo(e,t,n){const r=e.getData("application/x-lexical-editor");if(r)try{const e=JSON.parse(r);if(e.namespace===n._config.namespace&&Array.isArray(e.nodes))return zo(n,function(e){const t=[];for(let n=0;n<e.length;n++){const r=e[n],o=wt(r);it(o)&&br(o),t.push(o)}return t}(e.nodes),t)}catch(e){console.error(e)}const o=e.getData("text/html"),i=e.getData("text/plain");if(o&&i!==o)try{return zo(n,function(e,t){const n=st(t)?t.body.childNodes:t.childNodes;let r=[];const o=[];for(const i of n)if(!Po.has(i.nodeName)){const t=Fo(i,e,o,!1);null!==t&&(r=r.concat(t))}return function(e){for(const t of e)t.getNextSibling()instanceof at&&t.insertAfter(lt());for(const t of e){const e=t.getChildren();for(const n of e)t.insertBefore(n);t.remove()}}(o),r}(n,(new DOMParser).parseFromString(function(e){return window.trustedTypes&&window.trustedTypes.createPolicy?window.trustedTypes.createPolicy("lexical",{createHTML:e=>e}).createHTML(e):e}(o),"text/html")),t)}catch(e){console.error(e)}const s=i||e.getData("text/uri-list");if(null!=s)if(ye(t)){const e=s.split(/(\r?\n|\t)/);""===e[e.length-1]&&e.pop();for(let t=0;t<e.length;t++){const n=oe();if(ye(n)){const r=e[t];"\n"===r||"\r\n"===r?n.insertParagraph():"\t"===r?n.insertNodes([gt()]):n.insertText(r)}}}else t.insertRawText(s)}function zo(e,t,n){e.dispatchCommand(vt,{nodes:t,selection:n})||(n.insertNodes(t),function(e){if(ye(e)&&e.isCollapsed()){const t=e.anchor;let n=null;const r=se(t,"previous");if(r)if(xt(r))n=r.origin;else{const e=Et(r,bt(ne(),"next").getFlipped());for(const t of e){if(it(t.origin)){n=t.origin;break}if(ue(t.origin)&&!t.origin.isInline())break}}if(n&&it(n)){const t=n.getFormat(),r=n.getStyle();e.format===t&&e.style===r||(e.format=t,e.style=r,e.dirty=!0)}}}(n))}function Ko(e,t,n,r=[]){let o=null===t||n.isSelected(t);const i=ue(n)&&n.excludeFromCopy("html");let s=n;null!==t&&it(s)&&(s=Er(t,s,"clone"));const a=ue(s)?s.getChildren():[],l=function(e){const t=e.exportJSON(),n=e.constructor;if(t.type!==n.getType()&&Lo(58,n.name),ue(e)){const e=t.children;Array.isArray(e)||Lo(59,n.name)}return t}(s);it(s)&&0===s.getTextContentSize()&&(o=!1);for(let c=0;c<a.length;c++){const r=a[c],i=Ko(e,t,r,l.children);!o&&ue(n)&&i&&n.extractWithChild(r,t,"clone")&&(o=!0)}if(o&&!i)r.push(l);else if(Array.isArray(l.children))for(let c=0;c<l.children.length;c++){const e=l.children[c];r.push(e)}return o}let Bo=null;async function Uo(e,t,n){if(null!==Bo)return!1;if(null!==t)return new Promise((r,o)=>{e.update(()=>{r($o(e,t,n))})});const r=e.getRootElement(),o=e._window||window,i=o.document,s=ht(o);if(null===r||null===s)return!1;const a=i.createElement("span");a.style.cssText="position: fixed; top: -1000px;",a.append(i.createTextNode("#")),r.append(a);const l=new Range;return l.setStart(a,0),l.setEnd(a,1),s.removeAllRanges(),s.addRange(l),new Promise((t,r)=>{const s=e.registerCommand(yt,r=>(Or(r,ClipboardEvent)&&(s(),null!==Bo&&(o.clearTimeout(Bo),Bo=null),t($o(e,r,n))),!0),rt);Bo=o.setTimeout(()=>{s(),Bo=null,t(!1)},50),i.execCommand("copy"),a.remove()})}function $o(e,t,n){if(void 0===n){const t=ht(e._window),r=oe();if(!r||r.isCollapsed())return!1;if(!t)return!1;const o=t.anchorNode,i=t.focusNode;if(null!==o&&null!==i&&!Nt(e,o,i))return!1;n=function(e=oe()){const t={"text/plain":e?e.getTextContent():""};if(e){const n=me();for(const[r,o]of Wo){const i=o(n,e);null!==i&&(t[r]=i)}}return t}(r)}t.preventDefault();const r=t.clipboardData;return null!==r&&(function(e,t){for(const[n]of Wo)void 0===t[n]&&e.setData(n,"");for(const n in t){const r=t[n];void 0!==r&&e.setData(n,r)}}(r,n),!0)}const Wo=[["text/html",function(e,t=oe()){return null==t&&Lo(166),ye(t)&&t.isCollapsed()||0===t.getNodes().length?"":function(e,t){if("undefined"==typeof document||"undefined"==typeof window&&void 0===global.window)throw new Error("To use $generateHtmlFromNodes in headless mode please initialize a headless browser implementation such as JSDom before calling this function.");const n=document.createElement("div"),r=ne().getChildren();for(let o=0;o<r.length;o++)Mo(e,r[o],n,t);return n.innerHTML}(e,t)}],["application/x-lexical-editor",function(e,t=oe()){return null==t&&Lo(166),ye(t)&&t.isCollapsed()||0===t.getNodes().length?null:JSON.stringify(function(e,t){const n=[],r=ne().getChildren();for(let o=0;o<r.length;o++)Ko(e,t,r[o],n);return{namespace:e._config.namespace,nodes:n}}(e,t))}]];function Jo(e,t){if(void 0!==document.caretRangeFromPoint){const n=document.caretRangeFromPoint(e,t);return null===n?null:{node:n.startContainer,offset:n.startOffset}}if("undefined"!==document.caretPositionFromPoint){const n=document.caretPositionFromPoint(e,t);return null===n?null:{node:n.offsetNode,offset:n.offset}}return null}const Ho="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,Vo=Ho&&"documentMode"in document?document.documentMode:null,qo=Ho&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Go=!(!Ho||!("InputEvent"in window)||Vo)&&"getTargetRanges"in new window.InputEvent("input"),Zo=Ho&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),Yo=Ho&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Xo=Ho&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Qo=Ho&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&qo&&!Xo,ei=Fe("DRAG_DROP_PASTE_FILE");class ti extends Qt{static getType(){return"quote"}static clone(e){return new ti(e.__key)}createDOM(e){const t=document.createElement("blockquote");return be(t,e.theme.quote),t}updateDOM(e,t){return!1}static importDOM(){return{blockquote:e=>({conversion:si,priority:0})}}exportDOM(e){const{element:t}=super.exportDOM(e);if(mt(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();e&&(t.style.textAlign=e);const n=this.getDirection();n&&(t.dir=n)}return{element:t}}static importJSON(e){return ni().updateFromJSON(e)}insertNewAfter(e,t){const n=re(),r=this.getDirection();return n.setDirection(r),this.insertAfter(n,t),n}collapseAtStart(){const e=re();return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}canMergeWhenEmpty(){return!0}}function ni(){return tn(new ti)}class ri extends Qt{__tag;static getType(){return"heading"}static clone(e){return new ri(e.__tag,e.__key)}constructor(e,t){super(t),this.__tag=e}getTag(){return this.__tag}setTag(e){const t=this.getWritable();return this.__tag=e,t}createDOM(e){const t=this.__tag,n=document.createElement(t),r=e.theme.heading;if(void 0!==r){const e=r[t];be(n,e)}return n}updateDOM(e,t,n){return e.__tag!==this.__tag}static importDOM(){return{h1:e=>({conversion:ii,priority:0}),h2:e=>({conversion:ii,priority:0}),h3:e=>({conversion:ii,priority:0}),h4:e=>({conversion:ii,priority:0}),h5:e=>({conversion:ii,priority:0}),h6:e=>({conversion:ii,priority:0}),p:e=>{const t=e.firstChild;return null!==t&&oi(t)?{conversion:()=>({node:null}),priority:3}:null},span:e=>oi(e)?{conversion:e=>({node:ai("h1")}),priority:3}:null}}exportDOM(e){const{element:t}=super.exportDOM(e);if(mt(t)){this.isEmpty()&&t.append(document.createElement("br"));const e=this.getFormatType();e&&(t.style.textAlign=e);const n=this.getDirection();n&&(t.dir=n)}return{element:t}}static importJSON(e){return ai(e.tag).updateFromJSON(e)}updateFromJSON(e){return super.updateFromJSON(e).setTag(e.tag)}exportJSON(){return{...super.exportJSON(),tag:this.getTag()}}insertNewAfter(e,t=!0){const n=e?e.anchor.offset:0,r=this.getLastDescendant(),o=!r||e&&e.anchor.key===r.getKey()&&n===r.getTextContentSize()||!e?re():ai(this.getTag()),i=this.getDirection();if(o.setDirection(i),this.insertAfter(o,t),0===n&&!this.isEmpty()&&e){const e=re();e.select(),this.replace(e,!0)}return o}collapseAtStart(){const e=this.isEmpty()?re():ai(this.getTag());return this.getChildren().forEach(t=>e.append(t)),this.replace(e),!0}extractWithChild(){return!0}}function oi(e){return"span"===e.nodeName.toLowerCase()&&"26pt"===e.style.fontSize}function ii(e){const t=e.nodeName.toLowerCase();let n=null;return"h1"!==t&&"h2"!==t&&"h3"!==t&&"h4"!==t&&"h5"!==t&&"h6"!==t||(n=ai(t),null!==e.style&&(en(e,n),n.setFormat(e.style.textAlign))),{node:n}}function si(e){const t=ni();return null!==e.style&&(t.setFormat(e.style.textAlign),en(e,t)),{node:t}}function ai(e="h1"){return tn(new ri(e))}function li(e){let t=null;if(Or(e,DragEvent)?t=e.dataTransfer:Or(e,ClipboardEvent)&&(t=e.clipboardData),null===t)return[!1,[],!1];const n=t.types,r=n.includes("Files"),o=n.includes("text/html")||n.includes("text/plain");return[r,Array.from(t.files),o]}function ci(e){const t=$t(e);return de(t)}function ui(e){for(const t of["lowercase","uppercase","capitalize"])e.hasFormat(t)&&e.toggleFormat(t)}function di(e){return xe(e.registerCommand(Le,e=>{const t=oe();return!!_e(t)&&(t.clear(),!0)},Ge),e.registerCommand(St,e=>{const t=oe();return ye(t)?(t.deleteCharacter(e),!0):!!_e(t)&&(t.deleteNodes(),!0)},Ge),e.registerCommand(Ct,e=>{const t=oe();return!!ye(t)&&(t.deleteWord(e),!0)},Ge),e.registerCommand(kt,e=>{const t=oe();return!!ye(t)&&(t.deleteLine(e),!0)},Ge),e.registerCommand(Dt,t=>{const n=oe();if("string"==typeof t)null!==n&&n.insertText(t);else{if(null===n)return!1;const r=t.dataTransfer;if(null!=r)jo(r,n,e);else if(ye(n)){const e=t.data;return e&&n.insertText(e),!0}}return!0},Ge),e.registerCommand(_t,()=>{const e=oe();return!!ye(e)&&(e.removeText(),!0)},Ge),e.registerCommand(De,e=>{const t=oe();return!!ye(t)&&(t.formatText(e),!0)},Ge),e.registerCommand(Rt,e=>{const t=oe();if(!ye(t)&&!_e(t))return!1;const n=t.getNodes();for(const r of n){const t=ve(r,e=>ue(e)&&!e.isInline());null!==t&&t.setFormat(e)}return!0},Ge),e.registerCommand(Ot,e=>{const t=oe();return!!ye(t)&&(t.insertLineBreak(e),!0)},Ge),e.registerCommand(Tt,()=>{const e=oe();return!!ye(e)&&(e.insertParagraph(),!0)},Ge),e.registerCommand(nt,()=>{const e=gt(),t=oe();return ye(t)&&(e.setFormat(t.format),e.setStyle(t.style)),At([e]),!0},Ge),e.registerCommand(tt,()=>Tr(e=>{const t=e.getIndent();e.setIndent(t+1)}),Ge),e.registerCommand(et,()=>Tr(e=>{const t=e.getIndent();t>0&&e.setIndent(Math.max(0,t-1))}),Ge),e.registerCommand(It,e=>{const t=oe();if(_e(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectPrevious(),!0}else if(ye(t)){const n=Mt(t.focus,!0);if(!e.shiftKey&&de(n)&&!n.isIsolated()&&!n.isInline())return n.selectPrevious(),e.preventDefault(),!0}return!1},Ge),e.registerCommand(Pt,e=>{const t=oe();if(_e(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),n[0].selectNext(0,0),!0}else if(ye(t)){if(function(e){const t=e.focus;return"root"===t.key&&t.offset===ne().getChildrenSize()}(t))return e.preventDefault(),!0;const n=Mt(t.focus,!1);if(!e.shiftKey&&de(n)&&!n.isIsolated()&&!n.isInline())return n.selectNext(),e.preventDefault(),!0}return!1},Ge),e.registerCommand(Ft,e=>{const t=oe();if(_e(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),xr(n[0])?n[0].selectNext(0,0):n[0].selectPrevious(),!0}if(!ye(t))return!1;if(Sr(t,!0)){const n=e.shiftKey;return e.preventDefault(),kr(t,n,!0),!0}return!1},Ge),e.registerCommand(Lt,e=>{const t=oe();if(_e(t)){const n=t.getNodes();if(n.length>0)return e.preventDefault(),xr(n[0])?n[0].selectPrevious():n[0].selectNext(0,0),!0}if(!ye(t))return!1;const n=e.shiftKey;return!!Sr(t,!1)&&(e.preventDefault(),kr(t,n,!1),!0)},Ge),e.registerCommand(jt,t=>{if(ci(t.target))return!1;const n=oe();if(ye(n)){if(function(e){if(!e.isCollapsed())return!1;const{anchor:t}=e;if(0!==t.offset)return!1;const n=t.getNode();if(fe(n))return!1;const r=Rr(n);return r.getIndent()>0&&(r.is(n)||n.is(r.getFirstDescendant()))}(n))return t.preventDefault(),e.dispatchCommand(et,void 0);if(Yo&&"ko-KR"===navigator.language)return!1}else if(!_e(n))return!1;return t.preventDefault(),e.dispatchCommand(St,!0)},Ge),e.registerCommand(zt,t=>{if(ci(t.target))return!1;const n=oe();return!(!ye(n)&&!_e(n))&&(t.preventDefault(),e.dispatchCommand(St,!1))},Ge),e.registerCommand(Kt,t=>{const n=oe();if(!ye(n))return!1;if(ui(n),null!==t){if((Yo||Zo||Qo)&&Go)return!1;if(t.preventDefault(),t.shiftKey)return e.dispatchCommand(Ot,!1)}return e.dispatchCommand(Tt,void 0)},Ge),e.registerCommand(Bt,()=>{const t=oe();return!!ye(t)&&(e.blur(),!0)},Ge),e.registerCommand(Ut,t=>{const[,n]=li(t);if(n.length>0){const r=Jo(t.clientX,t.clientY);if(null!==r){const{offset:t,node:o}=r,i=$t(o);if(null!==i){const e=Xe();if(it(i))e.anchor.set(i.getKey(),t,"text"),e.focus.set(i.getKey(),t,"text");else{const t=i.getParentOrThrow().getKey(),n=i.getIndexWithinParent()+1;e.anchor.set(t,n,"element"),e.focus.set(t,n,"element")}const n=Qe(e);Be(n)}e.dispatchCommand(ei,n)}return t.preventDefault(),!0}const r=oe();return!!ye(r)},Ge),e.registerCommand(Wt,e=>{const[t]=li(e),n=oe();return!(t&&!ye(n))},Ge),e.registerCommand(Jt,e=>{const[t]=li(e),n=oe();if(t&&!ye(n))return!1;const r=Jo(e.clientX,e.clientY);if(null!==r){const t=$t(r.node);de(t)&&e.preventDefault()}return!0},Ge),e.registerCommand(Ht,()=>(Vt(),!0),Ge),e.registerCommand(yt,t=>(Uo(e,Or(t,ClipboardEvent)?t:null),!0),Ge),e.registerCommand(qt,t=>(async function(e,t){await Uo(t,Or(e,ClipboardEvent)?e:null),t.update(()=>{const e=oe();ye(e)?e.removeText():_e(e)&&e.getNodes().forEach(e=>e.remove())})}(t,e),!0),Ge),e.registerCommand(Gt,t=>{const[,n,r]=li(t);return n.length>0&&!r?(e.dispatchCommand(ei,n),!0):(!je(t.target)||!Zt(t.target))&&(null!==oe()&&(function(e,t){e.preventDefault(),t.update(()=>{const n=oe(),r=Or(e,InputEvent)||Or(e,KeyboardEvent)?null:e.clipboardData;null!=r&&null!==n&&jo(r,n,t)},{tag:Yt})}(t,e),!0))},Ge),e.registerCommand(Xt,e=>{const t=oe();return ye(t)&&ui(t),!1},Ge),e.registerCommand(Ze,e=>{const t=oe();return ye(t)&&ui(t),!1},Ge))}function fi(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const o of t)r.append("v",o);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}Se({conflictsWith:["@lexical/plain-text"],dependencies:[Io],name:"@lexical/rich-text",nodes:()=>[ri,ti],register:di});const mi="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?n:a;function pi({editor:e,ErrorBoundary:t}){return function(e,t){const[n,o]=l(()=>e.getDecorators());return mi(()=>e.registerDecoratorListener(e=>{an(()=>{o(e)})}),[e]),a(()=>{o(e.getDecorators())},[e]),r(()=>{const r=[],o=Object.keys(n);for(let i=0;i<o.length;i++){const s=o[i],a=rn(t,{onError:t=>e._onError(t),children:rn(c,{fallback:null,children:n[s]})}),l=e.getElementByKey(s);null!==l&&r.push(ln(a,l,s))}return r},[t,n,e])}(e,t)}function gi({editor:e,ErrorBoundary:t}){return function(e){const t=bo.maybeFromEditor(e);if(t&&t.hasExtensionByName(Ro.name)){for(const e of["@lexical/plain-text","@lexical/rich-text"])t.hasExtensionByName(e)&&fi(320,e);return!0}return!1}(e)?null:rn(pi,{editor:e,ErrorBoundary:t})}function hi(e){return e.getEditorState().read(To(e.isComposing()))}function yi({contentEditable:e,placeholder:t=null,ErrorBoundary:n}){const[r]=cr();return function(e){mi(()=>xe(di(e),Ao(e)),[e])}(r),on(sn,{children:[e,rn(vi,{content:t}),rn(gi,{editor:r,ErrorBoundary:n})]})}function vi({content:e}){const[n]=cr(),o=function(e){const[t,n]=l(()=>hi(e));return mi(()=>{function t(){const t=hi(e);n(t)}return t(),xe(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),t}(n),i=function(e){const[n]=cr(),o=r(()=>e(n),[n,e]),[i,s]=l(()=>o.initialValueFn()),a=t(i);return pr(()=>{const{initialValueFn:e,subscribe:t}=o,n=e();return a.current!==n&&(a.current=n,s(n)),t(e=>{a.current=e,s(e)})},[o,e]),i}(gr);return o?"function"==typeof e?e(i):e:null}const xi="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?n:a;const Ei=u(function({editor:e,ariaActiveDescendant:t,ariaAutoComplete:n,ariaControls:o,ariaDescribedBy:i,ariaErrorMessage:a,ariaExpanded:c,ariaInvalid:u,ariaLabel:d,ariaLabelledBy:f,ariaMultiline:m,ariaOwns:p,ariaRequired:g,autoCapitalize:h,className:y,id:v,role:x="textbox",spellCheck:E=!0,style:b,tabIndex:w,"data-testid":N,...S},C){const[k,D]=l(e.isEditable()),_=s(t=>{t&&t.ownerDocument&&t.ownerDocument.defaultView?e.setRootElement(t):e.setRootElement(null)},[e]),R=r(()=>function(...e){return t=>{for(const n of e)"function"==typeof n?n(t):null!=n&&(n.current=t)}}(C,_),[_,C]);return xi(()=>(D(e.isEditable()),e.registerEditableListener(e=>{D(e)})),[e]),rn("div",{"aria-activedescendant":k?t:void 0,"aria-autocomplete":k?n:"none","aria-controls":k?o:void 0,"aria-describedby":i,...null!=a?{"aria-errormessage":a}:{},"aria-expanded":k&&"combobox"===x?!!c:void 0,...null!=u?{"aria-invalid":u}:{},"aria-label":d,"aria-labelledby":f,"aria-multiline":m,"aria-owns":k?p:void 0,"aria-readonly":!k||void 0,"aria-required":g,autoCapitalize:h,className:y,contentEditable:k,"data-testid":N,id:v,ref:R,role:x,spellCheck:E,style:b,tabIndex:w,...S})});function bi(e){return e.getEditorState().read(To(e.isComposing()))}const wi=u(function(e,t){const{placeholder:n,...r}=e,[o]=cr();return on(sn,{children:[rn(Ei,{editor:o,...r,ref:t}),null!=n&&rn(Ni,{editor:o,content:n})]})});function Ni({content:e,editor:t}){const r=function(e){const[t,n]=l(()=>bi(e));return xi(()=>{function t(){const t=bi(e);n(t)}return t(),xe(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),t}(t),[o,i]=l(t.isEditable());if(n(()=>(i(t.isEditable()),t.registerEditableListener(e=>{i(e)})),[t]),!r)return null;let s=null;return"function"==typeof e?s=e(o):null!==e&&(s=e),null===s?null:rn("div",{"aria-hidden":!0,children:s})}function Si({delay:e,externalHistoryState:t}){const[n]=cr();return function(e,t,n=1e3){const o=r(()=>t||cn(),[t]);a(()=>un(e,o,n),[n,e,o])}(n,t,e),null}function Ci({hasStrictIndent:e=!1,shouldPreserveNumbering:t=!1}){const[n]=cr();return a(()=>{if(!n.hasNodes([dn,fn]))throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor")},[n]),a(()=>xe(mn(n,{restoreNumbering:t}),e?pn(n):()=>{}),[n,e,t]),a(()=>mn(r),[r=n]),null;var r}function ki({validateUrl:e,attributes:t}){const[n]=cr();return a(()=>{if(!n.hasNodes([hn]))throw new Error("LinkPlugin: LinkNode not registered on editor")}),a(()=>yn(n,Xr({attributes:t,validateUrl:e})),[n,e,t]),null}const Di="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?n:a;function _i({ignoreHistoryMergeTagChange:e=!0,ignoreSelectionChange:t=!1,onChange:n}){const[r]=cr();return Di(()=>{if(n)return r.registerUpdateListener(({editorState:o,dirtyElements:i,dirtyLeaves:s,prevEditorState:a,tags:l})=>{t&&0===i.size&&0===s.size||e&&l.has(ie)||a.isEmpty()||n(o,r,l)})},[r,e,t,n]),null}function Ri(e,t){return e.getEditorState().read(()=>{const e=He(t);return null!==e&&e.isSelected()})}function Oi({nodeKey:e}){const[t]=cr(),[n,r,o]=function(e){const[t]=cr(),[n,r]=l(()=>Ri(t,e));return a(()=>{let n=!0;const o=t.registerUpdateListener(()=>{n&&r(Ri(t,e))});return()=>{n=!1,o()}},[t,e]),[n,s(n=>{t.update(()=>{let t=oe();_e(t)||(t=Ke(),Be(t)),_e(t)&&(n?t.add(e):t.delete(e))})},[t,e]),s(()=>{t.update(()=>{const e=oe();_e(e)&&e.clear()})},[t])]}(e);return a(()=>xe(t.registerCommand(Le,i=>{const s=t.getElementByKey(e);return i.target===s&&(i.shiftKey||o(),r(!n),!0)},Re)),[o,t,n,e,r]),a(()=>{const r=t.getElementByKey(e),o=t._config.theme.hrSelected??"selected";null!==r&&(n?be(r,o):Ve(r,o))},[t,n,e]),null}class Ti extends So{static getType(){return"horizontalrule"}static clone(e){return new Ti(e.__key)}static importJSON(e){return Ii().updateFromJSON(e)}static importDOM(){return{hr:()=>({conversion:Ai,priority:0})}}decorate(){return rn(Oi,{nodeKey:this.__key})}}function Ai(){return{node:Ii()}}function Ii(){return tn(new Ti)}const Mi=[{dependencies:[Ti],export:e=>Do(e)?"***":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(e,t,n,r)=>{const o=Ii();r||null!=e.getNextSibling()?e.replace(o):e.insertBefore(o),o.selectNext()},type:"element"},...En];function Pi({transformers:e=Mi}){const[t]=cr();return a(()=>xn(t,e),[t,e]),null}const Fi=i(null),Li={didCatch:!1,error:null};class ji extends d{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Li}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(...e){const{error:t}=this.state;null!==t&&(this.props.onReset?.({args:e,reason:"imperative-api"}),this.setState(Li))}componentDidCatch(e,t){this.props.onError?.(e,t)}componentDidUpdate(e,t){const{didCatch:n}=this.state,{resetKeys:r}=this.props;n&&null!==t.error&&function(e=[],t=[]){return e.length!==t.length||e.some((e,n)=>!Object.is(e,t[n]))}(e.resetKeys,r)&&(this.props.onReset?.({next:r,prev:e.resetKeys,reason:"keys"}),this.setState(Li))}render(){const{children:e,fallbackRender:t,FallbackComponent:n,fallback:r}=this.props,{didCatch:o,error:i}=this.state;let s=e;if(o){const e={error:i,resetErrorBoundary:this.resetErrorBoundary};if("function"==typeof t)s=t(e);else if(n)s=f(n,e);else{if(void 0===r)throw i;s=r}}return f(Fi.Provider,{value:{didCatch:o,error:i,resetErrorBoundary:this.resetErrorBoundary}},s)}}function zi({children:e,onError:t}){return rn(ji,{fallback:rn("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:t,children:e})}const Ki=[bn,wn,Nn,Sn,Cn];function Bi({editorRef:e}){const[t]=cr();return a(()=>(e.current=t,()=>{e.current=null}),[t,e]),null}function Ui({onSubmit:e}){const[t]=cr();return a(()=>t.registerCommand(Kt,n=>{if(n.shiftKey)return!1;const r=oe();if(ye(r)){const e=r.anchor.getNode();if(gn(e)||gn(e.getParent()))return!1;if(On(e)||On(e.getParent()))return!1}return n.preventDefault(),t.read(()=>{e?.(kn(Ki))}),!0},nn),[t,e]),null}function $i({defaultValue:n,onChange:r,onSubmit:o,placeholder:i,disabled:s,className:a,autoFocus:l,forwardedRef:c}){const u=t(null);m(c,()=>({clear(){u.current?.update(()=>{const e=ne();e.clear(),e.append(re())})},focus(){u.current?.focus()}}));const d={namespace:"RichTextInput",nodes:[dn,fn,hn,vn,_n,Rn],editable:!s,editorState:n?()=>Dn(n,Ki):void 0,onError:e=>console.error("[RichTextInput]",e)};/* @__PURE__ */
|
|
14
|
-
return e.createElement(mr,{initialConfig:d},/* @__PURE__ */e.createElement("div",{className:a},/* @__PURE__ */e.createElement("div",{className:"relative"},/* @__PURE__ */e.createElement(yi,{contentEditable:/* @__PURE__ */e.createElement(wi,{autoFocus:l,className:"outline-none w-full max-h-[7.5rem] overflow-y-auto [&_ul]:list-disc [&_ul]:pl-5 [&_ol]:list-decimal [&_ol]:pl-5 [&_p]:my-0 [&_ul]:my-0 [&_ol]:my-0 [&_pre]:my-0 [&_blockquote]:my-0"}),placeholder:i?/* @__PURE__ */e.createElement("div",{className:"pointer-events-none absolute top-0 left-0 select-none text-muted-foreground"},i):null,ErrorBoundary:zi}))),/* @__PURE__ */e.createElement(Si,null),/* @__PURE__ */e.createElement(Ci,null),/* @__PURE__ */e.createElement(ki,null),/* @__PURE__ */e.createElement(Pi,{transformers:Ki}),r&&/* @__PURE__ */e.createElement(_i,{onChange:e=>{e.read(()=>{r(kn(Ki))})}}),/* @__PURE__ */e.createElement(Ui,{onSubmit:o}),/* @__PURE__ */e.createElement(Bi,{editorRef:u}))}const Wi=u((t,n)=>/* @__PURE__ */e.createElement($i,{...t,forwardedRef:n}));Wi.displayName="RichTextInput";function Ji(e,t){return!t||0===t.length||t.some(t=>t.startsWith(".")?e.name.toLowerCase().endsWith(t.toLowerCase()):t.endsWith("/*")?e.type.startsWith(t.slice(0,-1)):e.type===t)}function Hi(e){switch(e.type){case"file":return{id:e.id,label:e.file.name,iconType:nr(e.file.mimeType),loading:e.loading,progress:e.progress};case"page":return{id:e.id,label:e.page.title,iconType:"page"};case"entity":return{id:e.id,label:e.entity.title,iconType:e.entity.type}}}const Vi=({placeholder:n="Ask anything…",attachments:r=[],collections:o=[],pages:i=[],acceptedFileTypes:a,disabled:c=!1,isElevated:u=!1,className:d})=>{const{callbacks:f,isStreaming:m}=jn(),[p,g]=l(!1),h=t(""),y=t(null),x=t(null),[E,b]=l(!1),w=t(0),[N,S]=l(!1),[C,k]=l(!1),D=t(null),_=t(!1),R=s(()=>{D.current&&(clearTimeout(D.current),D.current=null),k(!0)},[]),O=s(()=>{D.current=setTimeout(()=>{_.current||k(!1)},150)},[]),T=r.filter(e=>"file"===e.type&&e.file.mimeType.startsWith("image/")),L=r.filter(e=>!("file"===e.type&&e.file.mimeType.startsWith("image/"))),j=L.map(Hi),z=r.some(e=>"file"===e.type&&e.loading),K=c||m||z,B=o.length>0||i.length>0,te=s(e=>{const t=(e??h.current).trim();t&&!K&&(f.onSend?.(t,r.length>0?r:void 0),y.current?.clear(),y.current?.focus())},[K,f,r]),ne=s(()=>{f.onStop?.()},[f]),re=s(e=>{k(!1),S(!1),f.onAttachmentAdd?.({type:"select-entity",entity:{id:e.id,type:"collection",title:e.title,url:e.url}})},[f]),oe=s(()=>{i[0]&&(S(!1),f.onAttachmentAdd?.({type:"select-page",page:i[0]}))},[i,f]),ie=r.filter(e=>"file"===e.type).length,se=s(e=>{const t=e.slice(0,10-ie);t.length<e.length&&alert("You can only attach up to 10 files at a time."),t.length>0&&f.onAttachmentAdd?.({type:"add-files",files:t})},[ie,f]),ae=s(e=>{const t=Array.from(e.target.files??[]);e.target.value="",t.length>0&&se(t)},[se]),le=s(e=>{e.preventDefault(),w.current++,b(!0)},[]),ce=s(e=>{e.preventDefault(),w.current--,0===w.current&&b(!1)},[]),ue=s(e=>{e.preventDefault(),e.dataTransfer.dropEffect="copy"},[]),de=s(e=>{if(e.preventDefault(),w.current=0,b(!1),c||m)return;const t=Array.from(e.dataTransfer.files),n=t.filter(e=>Ji(e,a));t.length>0&&0===n.length?alert("That file type isn't supported. Please try a different format."):n.length>0&&se(n)},[c,m,a,se]),fe=s(e=>{if(c||m)return;const t=[];if(e.clipboardData.files.length>0)t.push(...Array.from(e.clipboardData.files));else for(const r of Array.from(e.clipboardData.items))if("file"===r.kind){const e=r.getAsFile();e&&t.push(e)}const n=t.filter(e=>Ji(e,a));if(t.length>0&&0===n.length)return e.preventDefault(),e.stopPropagation(),void alert("That file type isn't supported. Please try a different format.");n.length>0&&(e.preventDefault(),e.stopPropagation(),se(n))},[c,m,a,se]);/* @__PURE__ */
|
|
15
|
-
return e.createElement("div",{className:v("w-full",d)},/* @__PURE__ */e.createElement("input",{ref:x,type:"file",multiple:!0,accept:a?.join(","),className:"sr-only",onChange:ae}),/* @__PURE__ */e.createElement("div",{className:v("relative w-full rounded-t-2xl rounded-b-lg bg-gradient-yellowfin p-2 transition-shadow duration-300",u&&"shadow-[0_-20px_25px_-5px_rgba(0,0,0,0.1),0_-8px_10px_-6px_rgba(0,0,0,0.1)]")},
|
|
16
|
-
/* @__PURE__ */e.createElement("div",{className:"relative w-full rounded-t-lg rounded-b bg-surface shadow-md",onDragEnter:le,onDragLeave:ce,onDragOver:ue,onDrop:de,onPasteCapture:fe},E&&/* @__PURE__ */e.createElement("div",{className:"absolute inset-0 z-10 flex items-center justify-center rounded-t-lg rounded-b pointer-events-none",style:{backgroundColor:"color-mix(in srgb, var(--bfc-surface) 90%, transparent)"}},
|
|
17
|
-
/* @__PURE__ */e.createElement("div",{className:"flex flex-col items-center gap-1.5"},/* @__PURE__ */e.createElement(A,{className:"h-5 w-5 text-muted-foreground"}),/* @__PURE__ */e.createElement("span",{className:"text-sm text-muted-foreground"},"Drop files here"))),
|
|
18
|
-
/* @__PURE__ */e.createElement(er,{attachments:T,onRemove:e=>f.onAttachmentRemove?.(e),className:"px-3 pt-3"}),j.length>0&&/* @__PURE__ */e.createElement("div",{className:"flex flex-wrap gap-1.5 px-3 pt-3"},j.map(t=>{const n=L.find(e=>e.id===t.id);/* @__PURE__ */
|
|
19
|
-
return e.createElement(Yn,{key:t.id,pill:t,onRemove:n?()=>f.onAttachmentRemove?.(n):void 0})})),
|
|
20
|
-
/* @__PURE__ */e.createElement(Wi,{ref:y,placeholder:n,disabled:c,autoFocus:!0,className:"w-full bg-transparent p-4 text-sm disabled:cursor-not-allowed disabled:opacity-50",onChange:e=>{h.current=e,g(e.trim().length>0)},onSubmit:te}),
|
|
21
|
-
/* @__PURE__ */e.createElement("div",{className:"flex items-center justify-between px-2 pb-2"},/* @__PURE__ */e.createElement("div",{className:"flex items-center gap-1"},B?/* @__PURE__ */e.createElement(U,{open:N,onOpenChange:S},/* @__PURE__ */e.createElement($,{asChild:!0,disabled:c||m},/* @__PURE__ */e.createElement("button",{type:"button",className:v("inline-flex h-6 w-6 items-center justify-center rounded text-default hover:bg-muted transition-all",N&&"shadow-md dark:shadow-md"),disabled:c||m},
|
|
22
|
-
/* @__PURE__ */e.createElement(I,{className:v("h-4 w-4 transition-transform duration-200",N&&"-rotate-45")}))),/* @__PURE__ */e.createElement(W,{align:"end",side:"right",className:"rounded border-none shadow-md bg-surface p-2 min-w-[200px] dark:border-none dark:shadow-md"},o.length>0&&/* @__PURE__ */e.createElement(H,{open:C,onOpenChange:k},/* @__PURE__ */e.createElement(V,{asChild:!0},/* @__PURE__ */e.createElement(J,{className:"p-2",onSelect:e=>e.preventDefault(),onMouseEnter:R,onMouseLeave:O,onFocus:R},"Collection",
|
|
23
|
-
/* @__PURE__ */e.createElement(M,{className:"ml-auto h-4 w-4"}))),/* @__PURE__ */e.createElement(q,{className:"w-[200px] rounded border-none p-0 shadow-md dark:border-none dark:shadow-md",side:"right",align:"start",onMouseEnter:R,onMouseLeave:O,onFocusCapture:()=>{_.current=!0},onBlurCapture:()=>{_.current=!1,O()}},
|
|
24
|
-
/* @__PURE__ */e.createElement(G,null,o.length>5&&/* @__PURE__ */e.createElement(Z,{placeholder:"Search collections..."}),/* @__PURE__ */e.createElement(Y,null,/* @__PURE__ */e.createElement(X,null,"No collections found."),/* @__PURE__ */e.createElement(Q,null,o.map(t=>/* @__PURE__ */e.createElement(ee,{key:t.id,value:t.title,onSelect:()=>re(t)},t.title))))))),i.length>0&&/* @__PURE__ */e.createElement(J,{className:"p-2",onSelect:oe},"Attach page"),
|
|
25
|
-
/* @__PURE__ */e.createElement(J,{className:"p-2",onSelect:()=>x.current?.click()},"Add image or file"))):/* @__PURE__ */e.createElement("button",{type:"button",className:"inline-flex h-6 w-6 items-center justify-center rounded text-default hover:bg-muted transition-all",disabled:c||m,onClick:()=>x.current?.click()},
|
|
26
|
-
/* @__PURE__ */e.createElement(I,{className:"h-4 w-4"}))),m?/* @__PURE__ */e.createElement("button",{type:"button",className:"inline-flex h-6 w-6 items-center justify-center rounded transition-colors bg-input text-primary-foreground hover:bg-input/90",onClick:ne,disabled:c},
|
|
27
|
-
/* @__PURE__ */e.createElement(P,{className:"h-4 w-4",weight:"fill"})):/* @__PURE__ */e.createElement("button",{type:"button",className:v("inline-flex h-6 w-6 items-center justify-center rounded transition-colors",p&&!z?"bg-input text-primary-foreground hover:bg-input/90":"bg-muted text-muted-foreground"),onClick:()=>te(),disabled:K||!p},
|
|
28
|
-
/* @__PURE__ */e.createElement(F,{className:"h-4 w-4",weight:"bold"}))))))},qi=({items:t,className:n})=>{const{callbacks:r}=jn();return 0===t.length?null:/* @__PURE__ */e.createElement("div",{className:v("flex flex-wrap justify-end gap-2 px-4 py-2",n)},t.map(t=>/* @__PURE__ */e.createElement("button",{key:t.id,type:"button",className:"rounded-full border border-border px-4 py-2 text-sm text-foreground hover:bg-muted transition-colors",onClick:()=>r.onSuggestionClick?.(t)},t.text)))},Gi=({actions:t,onActionClick:n,className:r})=>0===t.length?null:/* @__PURE__ */e.createElement("div",{className:v("flex flex-wrap gap-2 px-4 py-2",r)},t.map(t=>/* @__PURE__ */e.createElement("button",{key:t.id,type:"button",className:"inline-flex items-center gap-2 rounded-full border border-border px-4 py-2 text-sm text-foreground hover:bg-muted transition-colors",onClick:()=>n?.(t)},t.label,t.description&&/* @__PURE__ */e.createElement("span",{className:"text-muted-foreground"},t.description)))),Zi=({className:t,children:n="Working",variant:r="yellowfin"})=>/* @__PURE__ */e.createElement(j,{className:t,variant:r},n),Yi=()=>/* @__PURE__ */e.createElement("div",{className:"flex items-center justify-center gap-1 text-[0.625rem] text-subtle"},/* @__PURE__ */e.createElement("span",null,"Powered by"),/* @__PURE__ */e.createElement(Tn,{variant:"full",color:"outline",className:"h-2.5 w-auto"})),Xi=Object.assign(({messages:r,callbacks:o,children:i,suggestions:s=[],actions:c=[],placeholder:u,attachments:d,collections:f,pages:m,acceptedFileTypes:p,showBranding:g=!1,className:h})=>{const x=!!i,E=t(null),[b,w]=l(0),[N,S]=l(!1),[C]=l(()=>"undefined"==typeof window||!function(){try{return"true"===localStorage.getItem(An)}catch{return!1}}()),k=function(e){return e?"G’day! I'm Ask Brainfish. I answer questions about your product and business with citations, draft new articles from notes, files, videos, or our chat, and edit existing ones for review. Consider me your business’ SME, and co-pilot to be more affective in the Brainfish platform.\n\nHow can I help today?":"Hello! How can I help today?"}(C),[D,_]=l(()=>Mn(In,k,3)),R=r.length>0?r:[D];return a(()=>{C&&function(){try{localStorage.setItem(An,"true")}catch{}}()},[C]),n(()=>{if(!(r.length>0))return Pn(k,_)},[r.length,k]),a(()=>{const e=E.current;if(!e)return;const t=new ResizeObserver(([e])=>{e&&w(e.borderBoxSize[0]?.blockSize??e.contentRect.height)});return t.observe(e),()=>t.disconnect()},[]),/* @__PURE__ */e.createElement(y,null,/* @__PURE__ */e.createElement(zn,{messages:R,callbacks:o},/* @__PURE__ */e.createElement("div",{className:v("flex h-full flex-col pb-4",h)},x?i:/* @__PURE__ */e.createElement(e.Fragment,null,/* @__PURE__ */e.createElement("div",{className:"relative min-h-0 flex-1 grid grid-rows-[1fr] grid-cols-[1fr]"},/* @__PURE__ */e.createElement("div",{className:"row-start-1 col-start-1 min-h-0"},/* @__PURE__ */e.createElement(ar,{bottomPadding:b,onContentBehind:S})),/* @__PURE__ */e.createElement("div",{ref:E,className:"row-start-1 col-start-1 self-end z-10 pointer-events-none px-4"},/* @__PURE__ */e.createElement("div",{className:"pointer-events-auto"},s.length>0&&/* @__PURE__ */e.createElement(qi,{items:s}),c.length>0&&/* @__PURE__ */e.createElement(Gi,{actions:c,onActionClick:e=>o.onActionClick?.(e,"")}),/* @__PURE__ */e.createElement(Vi,{placeholder:u,attachments:d,collections:f,pages:m,acceptedFileTypes:p,isElevated:N})))),g&&/* @__PURE__ */e.createElement("div",{className:"relative z-10 pt-2"},/* @__PURE__ */e.createElement(Yi,null))))))},{Messages:ar,Input:Vi,Suggestions:qi,Actions:Gi,Loading:Zi});export{Yn as C,Xi as a,Gi as b,Vi as c,qn as d,ir as e,ar as f,zn as g,Zi as h,qi as i,Vn as j,jn as u};
|
|
29
|
-
//# sourceMappingURL=Conversation.C2TpUr4-.js.map
|