@katechat/ui 1.0.39 → 1.0.40

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/esm/index.js CHANGED
@@ -88,7 +88,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),Se=H,ae=X),ee===void 0
88
88
  <path d="M6 4v16a1 1 0 0 0 1.524 .852l13 -8a1 1 0 0 0 0 -1.704l-13 -8a1 1 0 0 0 -1.524 .852z" />
89
89
  </svg>
90
90
  <span class="action-btn-label">${ze.label}</span>
91
- </div>`:"";ct.innerHTML=fe.replaceAll("<LANG>",Et).replace("<EXECUTE_BTN>",Le).replace("<DOWNLOAD_TITLE>",H).replace("<COPY_TITLE>",X),_t.appendChild(ct),Ie.parentNode?.insertBefore(_t,Ie),_t.appendChild(Ie)}}),V.current.querySelectorAll("img").forEach(Ie=>{if(!Ie?.classList?.contains("message-image")){Ie.classList.add("message-image");let ct=Ie.src.split("/").pop()||"";Ie.setAttribute("data-file-name",ct)}}))},ti+10),[H,X,d]);bm(()=>{if(!k&&V.current){let Ie=new MutationObserver(ee);return Ie.observe(V.current,{childList:!0,subtree:!0}),ee(),()=>Ie.disconnect()}},[u,k,ee]);let ae=()=>se(Ie=>!Ie),Se=Vr(()=>s?s(t):null,[s,t]),ge=Vr(()=>{let Ie=o?o(t):null,ct=c?.find(dt=>dt.modelId===t?.modelId);return ve.createElement(ve.Fragment,null,ve.createElement(jl,{align:"center",pt:"sm"},ve.createElement(l1,{color:"gray",radius:"xl",size:"md",src:xe?t?.user?.avatarUrl:void 0},xe?ve.createElement(S1,null):ct?ve.createElement(ni,{apiProvider:ct.apiProvider,provider:ct.provider}):ve.createElement(vm,null)),ve.createElement(jl,{gap:"sm"},ve.createElement(Jl,{size:"sm",fw:500,c:xe?"blue":"teal"},Te),ve.createElement(Jl,{size:"sm",c:"dimmed"},be),Y&&ve.createElement(Oo,{status:Y}),F&&ve.createElement(Jl,{size:"sm",c:"dimmed"},F))),ve.createElement("div",{className:"katechat-message-content"},k&&!v&&ve.createElement(d1,{size:"md",mb:"md"}),R?R.map((dt,Et)=>ve.createElement("div",{key:Et,dangerouslySetInnerHTML:{__html:dt}})):ve.createElement("div",null,v),ve.createElement("div",{className:"katechat-message-footer"},ve.createElement(yo,{messageId:p,messageIndex:n}),Se&&ve.createElement(Tm,{label:Z("Details"),position:"top",withArrow:!0},ve.createElement(ec,{className:"edit-message-btn","data-message-id":p,size:"sm",variant:"subtle",color:"gray",disabled:a,onClick:ae},K?ve.createElement(E1,null):ve.createElement(g1,null))),Ie),ve.createElement(u1,{in:K},ve.createElement("div",{className:"katechat-message-content-details"},Se))))},[u,Te,be,v,R,p,E,h,c,n,G,Se,K,k,de.language]),[he,Ue]=ve.useState(0),[Ge,Ye]=ve.useState("idle"),[st,lt]=ve.useState(!1);bm(()=>{if(!D||D.length===0)return;let Ie=D.findIndex(ct=>ct.streaming);Ie>=0&&Ue(Ie)},[D]);let Tt=Vr(()=>!D||D.length===0?[]:D.map(Ie=>ve.createElement(nc,{key:Ie.id,message:Ie,parentIndex:n,index:he,models:c,plugins:o?.(Ie)})),[D,c,n,de.language]),yt=Vr(()=>{if(!D||D.length===0)return null;let Ie=D.length,ct=_t=>{_t.stopPropagation(),!st&&(lt(!0),Ye("exit-right"),setTimeout(()=>{Ue(ze=>(ze-1+Ie)%Ie),Ye("enter-left"),setTimeout(()=>{Ye("idle"),lt(!1)},ti)},ti))},dt=_t=>{_t.stopPropagation(),!st&&(lt(!0),Ye("exit-left"),setTimeout(()=>{Ue(ze=>(ze+1)%Ie),Ye("enter-right"),setTimeout(()=>{Ye("idle"),lt(!1)},ti)},ti))},Et=Tt[he];return ve.createElement("div",{className:"katechat-message-carousel"},ve.createElement("div",{className:"message-carousel-header"},ve.createElement("div",{className:"message-carousel-controls"},Ie>1&&ve.createElement(ve.Fragment,null,ve.createElement(ec,{onClick:ct,"aria-label":"Previous",radius:"xl",variant:"light"},ve.createElement(m1,null)),ve.createElement(ec,{onClick:dt,"aria-label":"Next",radius:"xl",variant:"light"},ve.createElement(p1,null))))),ve.createElement("div",{className:`carousel-message-content animation-${Ge}`},Et),Ie>1&&ve.createElement(jl,{className:"carousel-model-icons"},D.map((_t,ze)=>{let Le=c?.find(me=>me.modelId===_t.modelId),kt=ze===he;return ve.createElement(Tm,{key:_t.id,label:Le?.name||Z("AI"),position:"top"},ve.createElement(_1,{key:_t.id,c:kt?void 0:"dimmed",onClick:()=>Ue(ze)},Le?ve.createElement(ni,{apiProvider:Le.apiProvider,provider:Le.provider,size:20}):ve.createElement(vm,{size:20})))})))},[Tt,de.language,he,Ge,st]);return yt?ve.createElement("div",{className:["katechat-message",`katechat-message__${u||""}`].join(" "),ref:V},ve.createElement("div",{className:"katechat-message-linked-toggle"},ve.createElement(c1,{checked:W,onChange:Ie=>te(Ie.currentTarget.checked),label:Z(W?"Main":"Others"),size:"sm"})),ve.createElement("div",{className:["katechat-message-main",W?"":"hidden"].join(" ")},ge),ve.createElement("div",{className:["katechat-message-linked",W?"hidden":""].join(" ")},yt)):ve.createElement("div",{className:["katechat-message",`katechat-message__${u||""}`].join(" "),ref:V},ve.createElement("div",{className:"katechat-message-main"},ge))});tc.displayName="ChatMessage";import ri from"react";import{ScrollArea as h1}from"@mantine/core";var BP=({html:e,text:t})=>ri.createElement(h1,{type:"hover",offsetScrollbars:!0,className:["katechat-message-content","katechat-message-preview"].join(" ")},t?ri.createElement(ri.Fragment,null,e?e.map((n,a)=>ri.createElement("div",{key:a,dangerouslySetInnerHTML:{__html:n}})):ri.createElement("div",null,t)):"...");import tn,{useMemo as A1}from"react";import{Text as Im,Group as Nm,Avatar as O1,Box as y1}from"@mantine/core";import{IconRobot as x1}from"@tabler/icons-react";import rr from"react";import{IconBrandOpenai as b1,IconBrandAws as Rm,IconBrandYandex as T1,IconMessageChatbot as v1,IconAi as C1,IconBrandMeta as R1,IconBrandMedium as I1,IconBrandGoogle as N1}from"@tabler/icons-react";var ni=({apiProvider:e,provider:t,size:n=24})=>{switch(e){case"OPEN_AI":return rr.createElement(b1,{size:n});case"AWS_BEDROCK":switch(t?.toLowerCase()){case"amazon":return rr.createElement(Rm,{size:n});case"anthropic":return rr.createElement(C1,{size:n});case"mistral ai":return rr.createElement(I1,{size:n});case"meta":return rr.createElement(R1,{size:n});default:return rr.createElement(Rm,{size:n})}case"YANDEX_FM":return rr.createElement(T1,{size:n});case"GOOGLE_VERTEX_AI":return rr.createElement(N1,{size:n});default:return rr.createElement(v1,{size:n})}};var nc=({message:e,parentIndex:t,index:n,plugins:a,models:o})=>{let s=A1(()=>o?.find(c=>c.modelId===e.modelId),[o,e.modelId]);return tn.createElement(y1,{key:e.id},tn.createElement(Nm,{align:"center",pt:"sm"},tn.createElement(O1,{radius:"xl",size:"md"},s?tn.createElement(ni,{apiProvider:s.apiProvider,provider:s.provider}):tn.createElement(x1,null)),tn.createElement(Nm,{gap:"xs"},tn.createElement(Im,{size:"sm",fw:500,c:"teal"},e.modelName),e.status&&tn.createElement(Oo,{status:e.status}),e.statusInfo&&tn.createElement(Im,{size:"xs",c:"dimmed"},e.statusInfo))),tn.createElement("div",{className:"katechat-message-content"},e.html?e.html.map((c,d)=>tn.createElement("div",{key:d,dangerouslySetInnerHTML:{__html:c}})):tn.createElement("div",null,e.content),tn.createElement("div",{className:"katechat-message-footer"},tn.createElement(yo,{messageId:e.id,messageIndex:t,linkedMessageIndex:n}),a)))};nc.displayName="LinkedChatMessage";import et,{forwardRef as z1,useCallback as oc,useEffect as xm,useImperativeHandle as H1,useMemo as V1,useRef as W1,useState as wo}from"react";import{Text as sc,Textarea as q1,Button as Dm,Group as wm,ActionIcon as Mm,Stack as Q1,Tooltip as $1,Menu as lc}from"@mantine/core";import{IconCirclePlus as K1,IconPlayerStopFilled as X1,IconSend as Z1,IconX as J1}from"@tabler/icons-react";import{notifications as ha}from"@mantine/notifications";import ar,{useState as D1,useCallback as xo,useRef as Om,useEffect as w1}from"react";import{Group as M1,Tooltip as L1,Box as ym,ActionIcon as k1}from"@mantine/core";import{IconFileUpload as P1}from"@tabler/icons-react";var Am={};Wy(Am,{notEmpty:()=>ai,ok:()=>rc});function rc(e,t){if(!e)throw t instanceof Error?t:new Error(t||"No value argument passed to `assert.ok()`")}function ai(e){return e!=null}import{useTranslation as B1}from"react-i18next";var ii={dropzone:"_dropzone_16zca_1",dragging:"_dragging_16zca_8",disabled:"_disabled_16zca_12"};var U1=["image/jpeg","image/png","image/webp"],ac=({onFilesAdd:e,disabled:t,uploadFormats:n=U1})=>{let[a,o]=D1(!1),s=Om(null),c=Om(null),{t:d}=B1();w1(()=>{let R=I=>{if(!t&&I.clipboardData&&I.clipboardData.items){let A=Array.from(I.clipboardData.items).map(k=>k.getAsFile()).filter(ai);A.length>0&&(I.preventDefault(),I.stopPropagation(),e(A))}};return document.addEventListener("paste",R),()=>{document.removeEventListener("paste",R)}},[e,t]);let u=xo(R=>{R.preventDefault(),R.stopPropagation(),o(!0)},[]),p=xo(R=>{R.preventDefault(),R.stopPropagation(),o(!1)},[]),E=xo(R=>{if(R.preventDefault(),R.stopPropagation(),o(!1),t)return;let I=R.dataTransfer.files&&R.dataTransfer.files.length>0?Array.from(R.dataTransfer.files).filter(A=>A.size>0):[];e(I)},[e]),h=xo(R=>{if(R.target.files&&R.target.files.length>0){let I=Array.from(R.target.files).filter(A=>A.size>0);I.length&&e(I),c.current&&(c.current.value="")}},[e]),v=()=>{t||c.current?.click()};return ar.createElement(ar.Fragment,null,ar.createElement(ym,{ref:s,className:`drop-zone ${ii.dropzone} ${a?ii.dragging:""} ${t?ii.disabled:""}`,onDragOver:u,onDragLeave:p,onDrop:E,onClick:v},ar.createElement(M1,{justify:"start",className:"drop-zone-control",gap:"xs"},ar.createElement(L1,{label:d("Click or drop an image/document here to upload"),position:"top"},ar.createElement(k1,{variant:"subtle",size:"lg",color:"dark"},ar.createElement(P1,{size:"24"}))),ar.createElement(ym,{hiddenFrom:"xs",pe:"sm"},d("Upload File")),ar.createElement("input",{ref:c,type:"file",multiple:!0,accept:n?.join(","),onChange:h,className:ii.fileInput,style:{display:"none"},disabled:t}))))};import Do from"react";import{Text as F1}from"@mantine/core";import{IconFileUpload as G1}from"@tabler/icons-react";var ic={overlay:"_overlay_vjudp_1",content:"_content_vjudp_16"};import{useTranslation as Y1}from"react-i18next";var C5=({visible:e,message:t,onDragOver:n,onDragLeave:a,onDrop:o})=>{let{t:s}=Y1();return e?Do.createElement("div",{className:ic.overlay,onDragOver:n,onDragLeave:a,onDrop:o},Do.createElement("div",{className:ic.content},Do.createElement(G1,{size:48,color:"var(--mantine-color-blue-4)"}),Do.createElement(F1,{size:"lg",fw:500,c:"blue.4"},t||s("Drop files here to upload")))):null};import{useTranslation as j1}from"react-i18next";var Ft={chatControlsContainer:"_chatControlsContainer_7rkwy_1",chatInputContainer:"_chatInputContainer_7rkwy_1",chatInputGroup:"_chatInputGroup_7rkwy_5",chatInput:"_chatInput_7rkwy_1",hidden:"_hidden_7rkwy_9",promptMode:"_promptMode_7rkwy_21",promptModeText:"_promptModeText_7rkwy_28",promptFadeInUp:"_promptFadeInUp_7rkwy_1",promptShimmer:"_promptShimmer_7rkwy_1",headerRow:"_headerRow_7rkwy_58",documentsInput:"_documentsInput_7rkwy_76",columned:"_columned_7rkwy_82",imagesList:"_imagesList_7rkwy_90",previewImage:"_previewImage_7rkwy_95",removeButton:"_removeButton_7rkwy_107"};var Y5=z1(({loadCompleted:e=!1,disabled:t=!1,promptMode:n=!1,promptText:a,uploadAllowed:o=!0,streaming:s,setSending:c,previousMessages:d=[],header:u,inputPlugins:p,uploadFormats:E,maxUploadFileSize:h=64*1024*1024,maxImagesCount:v=0,onSendMessage:R,onStopRequest:I,onDocumentsUpload:A},k)=>{let[D,Y]=wo(""),[F,V]=wo([]),[G,W]=wo(0),[te,K]=wo(!1),se=W1(null),{t:Z}=j1();H1(k,()=>({handleAddFiles:X=>fe(X)})),xm(()=>{se.current?.focus()},[e,t]),xm(()=>{W(d?.length?d.length:0)},[e,d]);let de=async()=>{if(!(!D?.trim()&&!F.length)){c(!0);try{Y(""),V([]),await R(D,F)}catch(X){ha.show({title:"Error",message:X instanceof Error?X.message:Z("Failed to send message"),color:"red"})}finally{c(!1)}}},be=oc(X=>{let ee=!D?.trim();if(X.key==="Enter"&&!X.shiftKey&&!X.altKey)X.preventDefault(),de(),K(!1);else if(X.key==="ArrowUp"&&(ee||te)){let ae=Math.max(0,G-1);Y(d[ae]),W(ae),K(!0)}else if(X.key==="ArrowDown"&&(ee||te)){let ae=Math.min(d.length-1,G+1);Y(d[ae]),W(ae),K(!0)}else K(!1)},[de,D,d,G]),xe=oc(X=>{Y(X.currentTarget.value)},[]),Te=V1(()=>t||s||!D?.trim()&&!F.length,[D,F,s,t]),fe=oc(X=>{let ee=X.filter(ge=>ge.size<h);ee.length<X.length&&ha.show({title:Z("Warning"),message:Z("Some files are too large and were not added (max size: {{size}} MB)",{size:h/(1024*1024)}),color:"yellow"});let ae=ee.filter(ge=>ge.type?.startsWith("image/")),Se=ee.filter(ge=>!ge.type?.startsWith("image/"));ae.length&&v<=0&&(ha.show({title:Z("Warning"),message:Z("Image uploads are not allowed in this chat."),color:"yellow"}),ae=[]),ae.length+F.length>v&&(ha.show({title:Z("Warning"),message:Z("You can only add up to {{count}} images at a time",{count:v}),color:"yellow"}),ae=ae.slice(0,v-F.length)),ae.length&&Promise.all(ae.map(ge=>new Promise((he,Ue)=>{let Ge=new FileReader;Ge.onload=Ye=>{if(Ye.target?.result){let st=Ye.target.result;he({fileName:ge.name,mimeType:ge.type,bytesBase64:st})}else Ue(new Error(Z("Failed to read file: {{fileName}}",{fileName:ge.name})))},Ge.onerror=Ye=>{Ue(new Error(Z("Failed to read file: {{fileName}}, error: {{error}}",{fileName:ge.name,error:Ye})))},Ge.readAsDataURL(ge)}))).then(ge=>{V(he=>[...he,...ge])}).catch(ge=>{ha.show({title:Z("Error"),message:ge.message||Z("Failed to read image files"),color:"red"})}),Se.length&&A?A(Se):Se.length&&ha.show({title:Z("Warning"),message:Z("Document upload is not available in this chat."),color:"orange"})},[F,A,v,h]),H=X=>ee=>{ee.stopPropagation(),V(ae=>ae.filter(Se=>Se.fileName!==X))};return et.createElement("div",{className:[Ft.chatControlsContainer,n?Ft.promptMode:"",e?"":Ft.hidden].join(" ")},n?et.createElement(Q1,{align:"center",justify:"center",gap:"md",mb:"lg"},et.createElement(sc,{c:"dimmed",size:"lg",ta:"center",className:Ft.promptModeText},a||Z("Start the conversation by sending a message"))):null,et.createElement("div",{className:Ft.chatControls},u&&et.createElement(wm,{align:"center",gap:"xs",className:Ft.headerRow},u),et.createElement("div",{className:[Ft.chatInputContainer,F.length?Ft.columned:""].join(" ")},o&&et.createElement("div",{className:Ft.documentsInput},et.createElement(wm,{visibleFrom:"xs",gap:"0"},et.createElement(ac,{onFilesAdd:fe,uploadFormats:E}),p),F?.length>0&&et.createElement("div",{className:Ft.imagesList},F.map(X=>et.createElement("div",{key:X.fileName,className:Ft.previewImage},et.createElement("img",{src:X.bytesBase64,alt:X.fileName}),et.createElement(Mm,{className:Ft.removeButton,color:"red.9",size:"xs",onClick:H(X.fileName)},et.createElement(J1,{size:16})))))),et.createElement("div",{className:Ft.chatInputGroup},o&&et.createElement(lc,{shadow:"md",width:"content"},et.createElement(lc.Target,null,et.createElement(Mm,{size:"lg",variant:"subtle",hiddenFrom:"xs",color:"dark"},et.createElement($1,{label:Z("More..."),position:"right",withArrow:!0},et.createElement(K1,{size:"24"})))),et.createElement(lc.Dropdown,null,et.createElement(ac,{onFilesAdd:fe,uploadFormats:E}),p)),et.createElement(q1,{ref:se,className:Ft.chatInput,placeholder:Z("Type your message..."),value:D||"",autosize:!0,minRows:1,maxRows:7,onChange:xe,onKeyDown:be,disabled:t}),I&&s?et.createElement(Dm,{onClick:I,disabled:t},et.createElement(X1,{size:24})," ",et.createElement(sc,{visibleFrom:"md"},Z("Stop"))):et.createElement(Dm,{onClick:de,disabled:Te,className:I&&s?Ft.hidden:"",color:"blue",radius:"md"},et.createElement(Z1,{size:24})," ",et.createElement(sc,{visibleFrom:"md",ml:"xs"},Z("Send")))))))});import pr,{useCallback as Ni,useRef as x3,useState as Id}from"react";import{Stack as D3}from"@mantine/core";import{notifications as Nd}from"@mantine/notifications";import{useTranslation as w3}from"react-i18next";import mn,{useEffect as sx,useCallback as Ym}from"react";import{Image as lx,Text as Mo,Group as zm,Stack as cx,ActionIcon as dx,Modal as ux,Tooltip as _x}from"@mantine/core";import{useDisclosure as mx}from"@mantine/hooks";import{IconExternalLink as px}from"@tabler/icons-react";var Fm=Kl(Zl(),1);import Um from"i18next";import{initReactI18next as ax}from"react-i18next";import ix from"i18next-browser-languagedetector";var Lm={AI:"AI","Are you sure you want to delete this item? This action cannot be undone.":"Are you sure you want to delete this item? This action cannot be undone.",Cancel:"Cancel",Cancelled:"Cancelled","Click or drop an image/document here to upload":"Click or drop an image/document here to upload","Code block is empty":"Code block is empty","Code Interpreter":"Code Interpreter",Completed:"Completed","Confirm Deletion":"Confirm Deletion",Copy:"Copy","Copy message":"Copy message",Details:"Details",Delete:"Delete","Document upload is not available in this chat.":"Document upload is not available in this chat.",Download:"Download","Drop files here to upload":"Drop files here to upload",Error:"Error","Failed to copy message":"Failed to copy message","Failed to read file: {{fileName}}":"Failed to read file: {{fileName}}","Failed to read file: {{fileName}}, error: {{error}}":"Failed to read file: {{fileName}}, error: {{error}}","Failed to read image files":"Failed to read image files","Failed to send message":"Failed to send message","Image Preview":"Image Preview","Image uploads are not allowed in this chat.":"Image uploads are not allowed in this chat.","In Progress":"In Progress","Language is not specified for this code block":"Language is not specified for this code block",Main:"Main","More...":"More...","Open image source":"Open image source",Others:"Others","RAG Search":"RAG Search",Reasoning:"Reasoning",Send:"Send","Some files are too large and were not added (max size: {{size}} MB)":"Some files are too large and were not added (max size: {{size}} MB)",source:"source","Start the conversation by sending a message":"Start the conversation by sending a message",Started:"Started",Stop:"Stop","Tool Call":"Tool Call","Tool Call Completed":"Tool Call Completed","Type your message...":"Type your message...","Upload File":"Upload File",Warning:"Warning","Web Search":"Web Search",You:"You","You can only add up to {{count}} images at a time":"You can only add up to {{count}} images at a time"};var km={AI:"KI","Are you sure you want to delete this item? This action cannot be undone.":"M\xF6chten Sie dieses Element wirklich l\xF6schen? Diese Aktion kann nicht r\xFCckg\xE4ngig gemacht werden.",Cancel:"Abbrechen",Cancelled:"Abgebrochen","Click or drop an image/document here to upload":"Klicken oder Bild/Dokument hierher ziehen zum Hochladen","Code block is empty":"Codeblock ist leer","Code Interpreter":"Code-Interpreter",Completed:"Abgeschlossen","Confirm Deletion":"L\xF6schen best\xE4tigen",Copy:"Kopieren","Copy message":"Nachricht kopieren",Delete:"L\xF6schen",Details:"Details","Document upload is not available in this chat.":"Dokumenten-Upload ist in diesem Chat nicht verf\xFCgbar.",Download:"Herunterladen","Drop files here to upload":"Dateien zum Hochladen hier ablegen",Error:"Fehler","Failed to copy message":"Nachricht konnte nicht kopiert werden","Failed to read file: {{fileName}}":"Datei konnte nicht gelesen werden: {{fileName}}","Failed to read file: {{fileName}}, error: {{error}}":"Datei konnte nicht gelesen werden: {{fileName}}, Fehler: {{error}}","Failed to read image files":"Bilddateien konnten nicht gelesen werden","Failed to send message":"Nachricht konnte nicht gesendet werden","Image Preview":"Bildvorschau","Image uploads are not allowed in this chat.":"Bild-Uploads sind in diesem Chat nicht erlaubt.","In Progress":"In Bearbeitung","Language is not specified for this code block":"F\xFCr diesen Codeblock ist keine Sprache angegeben",Main:"Haupt","More...":"Mehr...","Open image source":"Bildquelle \xF6ffnen",Others:"Andere","RAG Search":"RAG-Suche",Reasoning:"Argumentation",Send:"Senden","Some files are too large and were not added (max size: {{size}} MB)":"Einige Dateien sind zu gro\xDF und wurden nicht hinzugef\xFCgt (max. Gr\xF6\xDFe: {{size}} MB)",source:"Quelle","Start the conversation by sending a message":"Beginnen Sie das Gespr\xE4ch, indem Sie eine Nachricht senden",Started:"Gestartet",Stop:"Stopp","Tool Call":"Tool-Aufruf","Tool Call Completed":"Tool-Aufruf abgeschlossen","Type your message...":"Nachricht eingeben...","Upload File":"Datei hochladen",Warning:"Warnung","Web Search":"Websuche",You:"Sie","You can only add up to {{count}} images at a time":"Sie k\xF6nnen nur bis zu {{count}} Bilder gleichzeitig hinzuf\xFCgen"};var Pm={AI:"\u0418\u0418","Are you sure you want to delete this item? This action cannot be undone.":"\u0412\u044B \u0443\u0432\u0435\u0440\u0435\u043D\u044B, \u0447\u0442\u043E \u0445\u043E\u0442\u0438\u0442\u0435 \u0443\u0434\u0430\u043B\u0438\u0442\u044C \u044D\u0442\u043E\u0442 \u044D\u043B\u0435\u043C\u0435\u043D\u0442? \u042D\u0442\u043E \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043D\u0435\u043B\u044C\u0437\u044F \u043E\u0442\u043C\u0435\u043D\u0438\u0442\u044C.",Cancel:"\u041E\u0442\u043C\u0435\u043D\u0430",Cancelled:"\u041E\u0442\u043C\u0435\u043D\u0435\u043D\u043E","Click or drop an image/document here to upload":"\u041D\u0430\u0436\u043C\u0438\u0442\u0435 \u0438\u043B\u0438 \u043F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435/\u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442 \u0441\u044E\u0434\u0430 \u0434\u043B\u044F \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0438","Code block is empty":"\u0411\u043B\u043E\u043A \u043A\u043E\u0434\u0430 \u043F\u0443\u0441\u0442","Code Interpreter":"\u0418\u043D\u0442\u0435\u0440\u043F\u0440\u0435\u0442\u0430\u0442\u043E\u0440 \u043A\u043E\u0434\u0430",Completed:"\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u043E","Confirm Deletion":"\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C \u0443\u0434\u0430\u043B\u0435\u043D\u0438\u0435",Copy:"\u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C","Copy message":"\u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435",Delete:"\u0423\u0434\u0430\u043B\u0438\u0442\u044C",Details:"\u041F\u043E\u0434\u0440\u043E\u0431\u043D\u043E\u0441\u0442\u0438","Document upload is not available in this chat.":"\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u043E\u0432 \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u0432 \u044D\u0442\u043E\u043C \u0447\u0430\u0442\u0435.",Download:"\u0421\u043A\u0430\u0447\u0430\u0442\u044C","Drop files here to upload":"\u041F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0444\u0430\u0439\u043B\u044B \u0441\u044E\u0434\u0430 \u0434\u043B\u044F \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0438",Error:"\u041E\u0448\u0438\u0431\u043A\u0430","Failed to copy message":"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0441\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435","Failed to read file: {{fileName}}":"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u0440\u043E\u0447\u0438\u0442\u0430\u0442\u044C \u0444\u0430\u0439\u043B: {{fileName}}","Failed to read file: {{fileName}}, error: {{error}}":"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u0440\u043E\u0447\u0438\u0442\u0430\u0442\u044C \u0444\u0430\u0439\u043B: {{fileName}}, \u043E\u0448\u0438\u0431\u043A\u0430: {{error}}","Failed to read image files":"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u0440\u043E\u0447\u0438\u0442\u0430\u0442\u044C \u0444\u0430\u0439\u043B\u044B \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439","Failed to send message":"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435","Image Preview":"\u041F\u0440\u0435\u0434\u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F","Image uploads are not allowed in this chat.":"\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439 \u0432 \u044D\u0442\u043E\u043C \u0447\u0430\u0442\u0435 \u0437\u0430\u043F\u0440\u0435\u0449\u0435\u043D\u0430.","In Progress":"\u0412 \u043F\u0440\u043E\u0446\u0435\u0441\u0441\u0435","Language is not specified for this code block":"\u042F\u0437\u044B\u043A \u043D\u0435 \u0443\u043A\u0430\u0437\u0430\u043D \u0434\u043B\u044F \u044D\u0442\u043E\u0433\u043E \u0431\u043B\u043E\u043A\u0430 \u043A\u043E\u0434\u0430",Main:"\u041E\u0441\u043D\u043E\u0432\u043D\u043E\u0439","More...":"\u0415\u0449\u0451...","Open image source":"\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0438\u0441\u0442\u043E\u0447\u043D\u0438\u043A \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F",Others:"\u0414\u0440\u0443\u0433\u0438\u0435","RAG Search":"RAG-\u043F\u043E\u0438\u0441\u043A",Reasoning:"\u0420\u0430\u0441\u0441\u0443\u0436\u0434\u0435\u043D\u0438\u0435",Send:"\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C","Some files are too large and were not added (max size: {{size}} MB)":"\u041D\u0435\u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u0444\u0430\u0439\u043B\u044B \u0441\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u0438\u0435 \u0438 \u043D\u0435 \u0431\u044B\u043B\u0438 \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u044B (\u043C\u0430\u043A\u0441. \u0440\u0430\u0437\u043C\u0435\u0440: {{size}} \u041C\u0411)",source:"\u0438\u0441\u0442\u043E\u0447\u043D\u0438\u043A","Start the conversation by sending a message":"\u041D\u0430\u0447\u043D\u0438\u0442\u0435 \u0434\u0438\u0430\u043B\u043E\u0433, \u043E\u0442\u043F\u0440\u0430\u0432\u0438\u0432 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435",Started:"\u041D\u0430\u0447\u0430\u0442\u043E",Stop:"\u0421\u0442\u043E\u043F","Tool Call":"\u0412\u044B\u0437\u043E\u0432 \u0438\u043D\u0441\u0442\u0440\u0443\u043C\u0435\u043D\u0442\u0430","Tool Call Completed":"\u0412\u044B\u0437\u043E\u0432 \u0438\u043D\u0441\u0442\u0440\u0443\u043C\u0435\u043D\u0442\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0451\u043D","Type your message...":"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435...","Upload File":"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0444\u0430\u0439\u043B",Warning:"\u041F\u0440\u0435\u0434\u0443\u043F\u0440\u0435\u0436\u0434\u0435\u043D\u0438\u0435","Web Search":"\u0412\u0435\u0431-\u043F\u043E\u0438\u0441\u043A",You:"\u0412\u044B","You can only add up to {{count}} images at a time":"\u0412\u044B \u043C\u043E\u0436\u0435\u0442\u0435 \u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043D\u0435 \u0431\u043E\u043B\u0435\u0435 {{count}} \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439 \u0437\u0430 \u0440\u0430\u0437"};var Bm={AI:"AI","Are you sure you want to delete this item? This action cannot be undone.":"\u60A8\u786E\u5B9A\u8981\u5220\u9664\u6B64\u9879\u5417\uFF1F\u6B64\u64CD\u4F5C\u65E0\u6CD5\u64A4\u6D88\u3002",Cancel:"\u53D6\u6D88",Cancelled:"\u5DF2\u53D6\u6D88","Click or drop an image/document here to upload":"\u70B9\u51FB\u6216\u62D6\u653E\u56FE\u7247/\u6587\u6863\u5230\u6B64\u5904\u4E0A\u4F20","Code block is empty":"\u4EE3\u7801\u5757\u4E3A\u7A7A","Code Interpreter":"\u4EE3\u7801\u89E3\u91CA\u5668",Completed:"\u5DF2\u5B8C\u6210","Confirm Deletion":"\u786E\u8BA4\u5220\u9664",Copy:"\u590D\u5236","Copy message":"\u590D\u5236\u6D88\u606F",Delete:"\u5220\u9664",Details:"\u8BE6\u60C5","Document upload is not available in this chat.":"\u6B64\u804A\u5929\u4E0D\u652F\u6301\u6587\u6863\u4E0A\u4F20\u3002",Download:"\u4E0B\u8F7D","Drop files here to upload":"\u5C06\u6587\u4EF6\u62D6\u653E\u5230\u6B64\u5904\u4E0A\u4F20",Error:"\u9519\u8BEF","Failed to copy message":"\u590D\u5236\u6D88\u606F\u5931\u8D25","Failed to read file: {{fileName}}":"\u8BFB\u53D6\u6587\u4EF6\u5931\u8D25\uFF1A{{fileName}}","Failed to read file: {{fileName}}, error: {{error}}":"\u8BFB\u53D6\u6587\u4EF6\u5931\u8D25\uFF1A{{fileName}}\uFF0C\u9519\u8BEF\uFF1A{{error}}","Failed to read image files":"\u8BFB\u53D6\u56FE\u7247\u6587\u4EF6\u5931\u8D25","Failed to send message":"\u53D1\u9001\u6D88\u606F\u5931\u8D25","Image Preview":"\u56FE\u7247\u9884\u89C8","Image uploads are not allowed in this chat.":"\u6B64\u804A\u5929\u4E0D\u5141\u8BB8\u4E0A\u4F20\u56FE\u7247\u3002","In Progress":"\u8FDB\u884C\u4E2D","Language is not specified for this code block":"\u6B64\u4EE3\u7801\u5757\u672A\u6307\u5B9A\u8BED\u8A00",Main:"\u4E3B\u8981","More...":"\u66F4\u591A...","Open image source":"\u6253\u5F00\u56FE\u7247\u6765\u6E90",Others:"\u5176\u4ED6","RAG Search":"RAG \u641C\u7D22",Reasoning:"\u63A8\u7406",Send:"\u53D1\u9001","Some files are too large and were not added (max size: {{size}} MB)":"\u90E8\u5206\u6587\u4EF6\u8FC7\u5927\uFF0C\u672A\u88AB\u6DFB\u52A0\uFF08\u6700\u5927\uFF1A{{size}} MB\uFF09",source:"\u6765\u6E90","Start the conversation by sending a message":"\u53D1\u9001\u6D88\u606F\u5F00\u59CB\u5BF9\u8BDD",Started:"\u5DF2\u5F00\u59CB",Stop:"\u505C\u6B62","Tool Call":"\u5DE5\u5177\u8C03\u7528","Tool Call Completed":"\u5DE5\u5177\u8C03\u7528\u5B8C\u6210","Type your message...":"\u8F93\u5165\u6D88\u606F...","Upload File":"\u4E0A\u4F20\u6587\u4EF6",Warning:"\u8B66\u544A","Web Search":"\u7F51\u7EDC\u641C\u7D22",You:"\u4F60","You can only add up to {{count}} images at a time":"\u4E00\u6B21\u6700\u591A\u53EA\u80FD\u6DFB\u52A0 {{count}} \u5F20\u56FE\u7247"};var cc=["en","de","ru","zh"],dc="ui-language";function ox(e={}){return(0,Fm.merge)({en:{translation:Lm},de:{translation:km},ru:{translation:Pm},zh:{translation:Bm}},e)}async function r7({lookupLocalStorage:e=dc,supportedLngs:t=cc,fallbackLng:n="en",resources:a={}}={}){return Um.use(ix).use(ax).init({resources:ox(a),fallbackLng:n,supportedLngs:t,interpolation:{escapeValue:!1},detection:{order:["localStorage","navigator","htmlTag"],lookupLocalStorage:e,caches:["localStorage"]}})}function Gm(e){return new Date(e).toLocaleDateString(Um.language||"ru-RU",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}import{useTranslation as gx}from"react-i18next";var Hm=({fileName:e,fileUrl:t,mimeType:n,createdAt:a,onOpenSource:o,sourceTitle:s,onClose:c})=>{let[d,{open:u,close:p}]=mx(!1);sx(()=>{t&&u()},[t,u]);let E=Ym(()=>{c(),p()},[c,p]),h=Ym(()=>{o?.(),E()},[o,E]),{t:v}=gx();return mn.createElement(ux,{opened:d,onClose:E,size:"xl",title:v("Image Preview"),centered:!0},t&&mn.createElement(cx,{gap:"md"},mn.createElement(lx,{src:t,alt:e,fit:"contain",mah:"70vh"}),mn.createElement(zm,{justify:"space-between"},mn.createElement("div",null,mn.createElement(Mo,{size:"sm",fw:500},e),mn.createElement(Mo,{size:"xs",c:"dimmed"},a?Gm(a)+" \u2022":""," ",n)),o&&mn.createElement(zm,{gap:"xs"},mn.createElement(_x,{label:v("Open image source")},mn.createElement(dx,{variant:"light",onClick:h},mn.createElement(px,{size:16}))))),o&&mn.createElement(Mo,{size:"sm",c:"dimmed"},"From:"," ",mn.createElement(Mo,{span:!0,c:"blue",style:{cursor:"pointer"},onClick:h},s||v("source")))))};var zb=Kl(Yb(),1);var di=zb.default;function Nc(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Kr=Nc();function $b(e){Kr=e}var mi={exec:()=>null};function Je(e,t=""){let n=typeof e=="string"?e:e.source,a={replace:(o,s)=>{let c=typeof s=="string"?s:s.source;return c=c.replace(Wt.caret,"$1"),n=n.replace(o,c),a},getRegex:()=>new RegExp(n,t)};return a}var Wt={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},Y2=/^(?:[ \t]*(?:\n|$))+/,z2=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,H2=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,pi=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,V2=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ac=/(?:[*+-]|\d{1,9}[.)])/,Kb=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Xb=Je(Kb).replace(/bull/g,Ac).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),W2=Je(Kb).replace(/bull/g,Ac).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Oc=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,q2=/^[^\n]+/,yc=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Q2=Je(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",yc).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),$2=Je(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ac).getRegex(),Ko="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",xc=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,K2=Je("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",xc).replace("tag",Ko).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Zb=Je(Oc).replace("hr",pi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ko).getRegex(),X2=Je(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Zb).getRegex(),Dc={blockquote:X2,code:z2,def:Q2,fences:H2,heading:V2,hr:pi,html:K2,lheading:Xb,list:$2,newline:Y2,paragraph:Zb,table:mi,text:q2},Hb=Je("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",pi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ko).getRegex(),Z2={...Dc,lheading:W2,table:Hb,paragraph:Je(Oc).replace("hr",pi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Hb).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ko).getRegex()},J2={...Dc,html:Je(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",xc).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:mi,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Je(Oc).replace("hr",pi).replace("heading",` *#{1,6} *[^
91
+ </div>`:"";ct.innerHTML=fe.replaceAll("<LANG>",Et).replace("<EXECUTE_BTN>",Le).replace("<DOWNLOAD_TITLE>",H).replace("<COPY_TITLE>",X),_t.appendChild(ct),Ie.parentNode?.insertBefore(_t,Ie),_t.appendChild(Ie)}}),V.current.querySelectorAll("img").forEach(Ie=>{if(!Ie?.classList?.contains("message-image")){Ie.classList.add("message-image");let ct=Ie.src.split("/").pop()||"";Ie.setAttribute("data-file-name",ct)}}))},ti+10),[H,X,d]);bm(()=>{if(!k&&V.current){let Ie=new MutationObserver(ee);return Ie.observe(V.current,{childList:!0,subtree:!0}),ee(),()=>Ie.disconnect()}},[u,k,ee]);let ae=()=>se(Ie=>!Ie),Se=Vr(()=>s?s(t):null,[s,t]),ge=Vr(()=>{let Ie=o?o(t):null,ct=c?.find(dt=>dt.modelId===t?.modelId);return ve.createElement(ve.Fragment,null,ve.createElement(jl,{align:"center",pt:"sm"},ve.createElement(l1,{color:"gray",radius:"xl",size:"md",src:xe?t?.user?.avatarUrl:void 0},xe?ve.createElement(S1,null):ct?ve.createElement(ni,{apiProvider:ct.apiProvider,provider:ct.provider}):ve.createElement(vm,null)),ve.createElement(jl,{gap:"sm"},ve.createElement(Jl,{size:"sm",fw:500,c:xe?"blue":"teal"},Te),ve.createElement(Jl,{size:"sm",c:"dimmed"},be),Y&&ve.createElement(Oo,{status:Y}),F&&ve.createElement(Jl,{size:"sm",c:"dimmed"},F))),ve.createElement("div",{className:"katechat-message-content"},k&&!v&&ve.createElement(d1,{size:"md",mb:"md"}),R?R.map((dt,Et)=>ve.createElement("div",{key:Et,dangerouslySetInnerHTML:{__html:dt}})):ve.createElement("div",null,v),ve.createElement("div",{className:"katechat-message-footer"},ve.createElement(yo,{messageId:p,messageIndex:n}),Se&&ve.createElement(Tm,{label:Z("Details"),position:"top",withArrow:!0},ve.createElement(ec,{className:"edit-message-btn","data-message-id":p,size:"sm",variant:"subtle",color:"gray",disabled:a,onClick:ae},K?ve.createElement(E1,null):ve.createElement(g1,null))),Ie),ve.createElement(u1,{in:K},ve.createElement("div",{className:"katechat-message-content-details"},Se))))},[u,Te,be,v,R,p,E,h,c,n,G,Se,K,k,de.language]),[he,Ue]=ve.useState(0),[Ge,Ye]=ve.useState("idle"),[st,lt]=ve.useState(!1);bm(()=>{if(!D||D.length===0)return;let Ie=D.findIndex(ct=>ct.streaming);Ie>=0&&Ue(Ie)},[D]);let Tt=Vr(()=>!D||D.length===0?[]:D.map(Ie=>ve.createElement(nc,{key:Ie.id,message:Ie,parentIndex:n,index:he,models:c,plugins:o?.(Ie)})),[D,c,n,de.language]),yt=Vr(()=>{if(!D||D.length===0)return null;let Ie=D.length,ct=_t=>{_t.stopPropagation(),!st&&(lt(!0),Ye("exit-right"),setTimeout(()=>{Ue(ze=>(ze-1+Ie)%Ie),Ye("enter-left"),setTimeout(()=>{Ye("idle"),lt(!1)},ti)},ti))},dt=_t=>{_t.stopPropagation(),!st&&(lt(!0),Ye("exit-left"),setTimeout(()=>{Ue(ze=>(ze+1)%Ie),Ye("enter-right"),setTimeout(()=>{Ye("idle"),lt(!1)},ti)},ti))},Et=Tt[he];return ve.createElement("div",{className:"katechat-message-carousel"},ve.createElement("div",{className:"message-carousel-header"},ve.createElement("div",{className:"message-carousel-controls"},Ie>1&&ve.createElement(ve.Fragment,null,ve.createElement(ec,{onClick:ct,"aria-label":"Previous",radius:"xl",variant:"light"},ve.createElement(m1,null)),ve.createElement(ec,{onClick:dt,"aria-label":"Next",radius:"xl",variant:"light"},ve.createElement(p1,null))))),ve.createElement("div",{className:`carousel-message-content animation-${Ge}`},Et),Ie>1&&ve.createElement(jl,{className:"carousel-model-icons"},D.map((_t,ze)=>{let Le=c?.find(me=>me.modelId===_t.modelId),kt=ze===he;return ve.createElement(Tm,{key:_t.id,label:Le?.name||Z("AI"),position:"top"},ve.createElement(_1,{key:_t.id,c:kt?void 0:"dimmed",onClick:()=>Ue(ze)},Le?ve.createElement(ni,{apiProvider:Le.apiProvider,provider:Le.provider,size:20}):ve.createElement(vm,{size:20})))})))},[Tt,de.language,he,Ge,st]);return yt?ve.createElement("div",{className:["katechat-message",`katechat-message__${u||""}`].join(" "),ref:V},ve.createElement("div",{className:"katechat-message-linked-toggle"},ve.createElement(c1,{checked:W,onChange:Ie=>te(Ie.currentTarget.checked),label:Z(W?"Main":"Others"),size:"sm"})),ve.createElement("div",{className:["katechat-message-main",W?"":"hidden"].join(" ")},ge),ve.createElement("div",{className:["katechat-message-linked",W?"hidden":""].join(" ")},yt)):ve.createElement("div",{className:["katechat-message",`katechat-message__${u||""}`].join(" "),ref:V},ve.createElement("div",{className:"katechat-message-main"},ge))});tc.displayName="ChatMessage";import ri from"react";import{ScrollArea as h1}from"@mantine/core";var BP=({html:e,text:t})=>ri.createElement(h1,{type:"hover",offsetScrollbars:!0,className:["katechat-message-content","katechat-message-preview"].join(" ")},t?ri.createElement(ri.Fragment,null,e?e.map((n,a)=>ri.createElement("div",{key:a,dangerouslySetInnerHTML:{__html:n}})):ri.createElement("div",null,t)):"...");import tn,{useMemo as A1}from"react";import{Text as Im,Group as Nm,Avatar as O1,Box as y1}from"@mantine/core";import{IconRobot as x1}from"@tabler/icons-react";import rr from"react";import{IconBrandOpenai as b1,IconBrandAws as Rm,IconBrandYandex as T1,IconMessageChatbot as v1,IconAi as C1,IconBrandMeta as R1,IconBrandMedium as I1,IconBrandGoogle as N1}from"@tabler/icons-react";var ni=({apiProvider:e,provider:t,size:n=24})=>{switch(e){case"OPEN_AI":return rr.createElement(b1,{size:n});case"AWS_BEDROCK":switch(t?.toLowerCase()){case"amazon":return rr.createElement(Rm,{size:n});case"anthropic":return rr.createElement(C1,{size:n});case"mistral ai":return rr.createElement(I1,{size:n});case"meta":return rr.createElement(R1,{size:n});default:return rr.createElement(Rm,{size:n})}case"YANDEX_FM":return rr.createElement(T1,{size:n});case"GOOGLE_VERTEX_AI":return rr.createElement(N1,{size:n});default:return rr.createElement(v1,{size:n})}};var nc=({message:e,parentIndex:t,index:n,plugins:a,models:o})=>{let s=A1(()=>o?.find(c=>c.modelId===e.modelId),[o,e.modelId]);return tn.createElement(y1,{key:e.id},tn.createElement(Nm,{align:"center",pt:"sm"},tn.createElement(O1,{radius:"xl",size:"md"},s?tn.createElement(ni,{apiProvider:s.apiProvider,provider:s.provider}):tn.createElement(x1,null)),tn.createElement(Nm,{gap:"xs"},tn.createElement(Im,{size:"sm",fw:500,c:"teal"},e.modelName),e.status&&tn.createElement(Oo,{status:e.status}),e.statusInfo&&tn.createElement(Im,{size:"xs",c:"dimmed"},e.statusInfo))),tn.createElement("div",{className:"katechat-message-content"},e.html?e.html.map((c,d)=>tn.createElement("div",{key:d,dangerouslySetInnerHTML:{__html:c}})):tn.createElement("div",null,e.content),tn.createElement("div",{className:"katechat-message-footer"},tn.createElement(yo,{messageId:e.id,messageIndex:t,linkedMessageIndex:n}),a)))};nc.displayName="LinkedChatMessage";import et,{forwardRef as z1,useCallback as oc,useEffect as xm,useImperativeHandle as H1,useMemo as V1,useRef as W1,useState as wo}from"react";import{Text as sc,Textarea as q1,Button as Dm,Group as wm,ActionIcon as Mm,Stack as Q1,Tooltip as $1,Menu as lc}from"@mantine/core";import{IconCirclePlus as K1,IconPlayerStopFilled as X1,IconSend as Z1,IconX as J1}from"@tabler/icons-react";import{notifications as ha}from"@mantine/notifications";import ar,{useState as D1,useCallback as xo,useRef as Om,useEffect as w1}from"react";import{Group as M1,Tooltip as L1,Box as ym,ActionIcon as k1}from"@mantine/core";import{IconFileUpload as P1}from"@tabler/icons-react";var Am={};Wy(Am,{notEmpty:()=>ai,ok:()=>rc});function rc(e,t){if(!e)throw t instanceof Error?t:new Error(t||"No value argument passed to `assert.ok()`")}function ai(e){return e!=null}import{useTranslation as B1}from"react-i18next";var ii={dropzone:"_dropzone_16zca_1",dragging:"_dragging_16zca_8",disabled:"_disabled_16zca_12"};var U1=["image/jpeg","image/png","image/webp"],ac=({onFilesAdd:e,disabled:t,uploadFormats:n=U1})=>{let[a,o]=D1(!1),s=Om(null),c=Om(null),{t:d}=B1();w1(()=>{let R=I=>{if(!t&&I.clipboardData&&I.clipboardData.items){let A=Array.from(I.clipboardData.items).map(k=>k.getAsFile()).filter(ai);A.length>0&&(I.preventDefault(),I.stopPropagation(),e(A))}};return document.addEventListener("paste",R),()=>{document.removeEventListener("paste",R)}},[e,t]);let u=xo(R=>{R.preventDefault(),R.stopPropagation(),o(!0)},[]),p=xo(R=>{R.preventDefault(),R.stopPropagation(),o(!1)},[]),E=xo(R=>{if(R.preventDefault(),R.stopPropagation(),o(!1),t)return;let I=R.dataTransfer.files&&R.dataTransfer.files.length>0?Array.from(R.dataTransfer.files).filter(A=>A.size>0):[];e(I)},[e]),h=xo(R=>{if(R.target.files&&R.target.files.length>0){let I=Array.from(R.target.files).filter(A=>A.size>0);I.length&&e(I),c.current&&(c.current.value="")}},[e]),v=()=>{t||c.current?.click()};return ar.createElement(ar.Fragment,null,ar.createElement(ym,{ref:s,className:`drop-zone ${ii.dropzone} ${a?ii.dragging:""} ${t?ii.disabled:""}`,onDragOver:u,onDragLeave:p,onDrop:E,onClick:v},ar.createElement(M1,{justify:"start",className:"drop-zone-control",gap:"xs"},ar.createElement(L1,{label:d("Click or drop an image/document here to upload"),position:"top"},ar.createElement(k1,{variant:"subtle",size:"lg",color:"dark"},ar.createElement(P1,{size:"24"}))),ar.createElement(ym,{hiddenFrom:"xs",pe:"sm"},d("Upload File")),ar.createElement("input",{ref:c,type:"file",multiple:!0,accept:n?.join(","),onChange:h,className:ii.fileInput,style:{display:"none"},disabled:t}))))};import Do from"react";import{Text as F1}from"@mantine/core";import{IconFileUpload as G1}from"@tabler/icons-react";var ic={overlay:"_overlay_vjudp_1",content:"_content_vjudp_16"};import{useTranslation as Y1}from"react-i18next";var C5=({visible:e,message:t,onDragOver:n,onDragLeave:a,onDrop:o})=>{let{t:s}=Y1();return e?Do.createElement("div",{className:ic.overlay,onDragOver:n,onDragLeave:a,onDrop:o},Do.createElement("div",{className:ic.content},Do.createElement(G1,{size:48,color:"var(--mantine-color-blue-4)"}),Do.createElement(F1,{size:"lg",fw:500,c:"blue.4"},t||s("Drop files here to upload")))):null};import{useTranslation as j1}from"react-i18next";var Ft={chatControlsContainer:"_chatControlsContainer_7rkwy_1",chatInputContainer:"_chatInputContainer_7rkwy_1",chatInputGroup:"_chatInputGroup_7rkwy_5",chatInput:"_chatInput_7rkwy_1",hidden:"_hidden_7rkwy_9",promptMode:"_promptMode_7rkwy_21",promptModeText:"_promptModeText_7rkwy_28",promptFadeInUp:"_promptFadeInUp_7rkwy_1",promptShimmer:"_promptShimmer_7rkwy_1",headerRow:"_headerRow_7rkwy_58",documentsInput:"_documentsInput_7rkwy_76",columned:"_columned_7rkwy_82",imagesList:"_imagesList_7rkwy_90",previewImage:"_previewImage_7rkwy_95",removeButton:"_removeButton_7rkwy_107"};var Y5=z1(({loadCompleted:e=!1,disabled:t=!1,promptMode:n=!1,promptText:a,uploadAllowed:o=!0,streaming:s,setSending:c,previousMessages:d=[],header:u,inputPlugins:p,uploadFormats:E,maxUploadFileSize:h=64*1024*1024,maxImagesCount:v=0,onSendMessage:R,onStopRequest:I,onDocumentsUpload:A},k)=>{let[D,Y]=wo(""),[F,V]=wo([]),[G,W]=wo(0),[te,K]=wo(!1),se=W1(null),{t:Z}=j1();H1(k,()=>({handleAddFiles:X=>fe(X)})),xm(()=>{se.current?.focus()},[e,t]),xm(()=>{W(d?.length?d.length:0)},[e,d]);let de=async()=>{if(!(!D?.trim()&&!F.length)){c(!0);try{Y(""),V([]),await R(D,F)}catch(X){ha.show({title:"Error",message:X instanceof Error?X.message:Z("Failed to send message"),color:"red"})}finally{c(!1)}}},be=oc(X=>{let ee=!D?.trim();if(X.key==="Enter"&&!X.shiftKey&&!X.altKey)X.preventDefault(),de(),K(!1);else if(X.key==="ArrowUp"&&(ee||te)){let ae=Math.max(0,G-1);Y(d[ae]),W(ae),K(!0)}else if(X.key==="ArrowDown"&&(ee||te)){let ae=Math.min(d.length-1,G+1);Y(d[ae]),W(ae),K(!0)}else K(!1)},[de,D,d,G]),xe=oc(X=>{Y(X.currentTarget.value)},[]),Te=V1(()=>t||s||!D?.trim()&&!F.length,[D,F,s,t]),fe=oc(X=>{let ee=X.filter(ge=>ge.size<h);ee.length<X.length&&ha.show({title:Z("Warning"),message:Z("Some files are too large and were not added (max size: {{size}} MB)",{size:h/(1024*1024)}),color:"yellow"});let ae=ee.filter(ge=>ge.type?.startsWith("image/")),Se=ee.filter(ge=>!ge.type?.startsWith("image/"));ae.length&&v<=0&&(ha.show({title:Z("Warning"),message:Z("Image uploads are not allowed in this chat."),color:"yellow"}),ae=[]),ae.length+F.length>v&&(ha.show({title:Z("Warning"),message:Z("You can only add up to {{count}} images at a time",{count:v}),color:"yellow"}),ae=ae.slice(0,v-F.length)),ae.length&&Promise.all(ae.map(ge=>new Promise((he,Ue)=>{let Ge=new FileReader;Ge.onload=Ye=>{if(Ye.target?.result){let st=Ye.target.result;he({fileName:ge.name,mimeType:ge.type,bytesBase64:st})}else Ue(new Error(Z("Failed to read file: {{fileName}}",{fileName:ge.name})))},Ge.onerror=Ye=>{Ue(new Error(Z("Failed to read file: {{fileName}}, error: {{error}}",{fileName:ge.name,error:Ye})))},Ge.readAsDataURL(ge)}))).then(ge=>{V(he=>[...he,...ge])}).catch(ge=>{ha.show({title:Z("Error"),message:ge.message||Z("Failed to read image files"),color:"red"})}),Se.length&&A?A(Se):Se.length&&ha.show({title:Z("Warning"),message:Z("Document upload is not available in this chat."),color:"orange"})},[F,A,v,h]),H=X=>ee=>{ee.stopPropagation(),V(ae=>ae.filter(Se=>Se.fileName!==X))};return et.createElement("div",{className:[Ft.chatControlsContainer,n?Ft.promptMode:"",e?"":Ft.hidden].join(" ")},n?et.createElement(Q1,{align:"center",justify:"center",gap:"md",mb:"lg"},et.createElement(sc,{c:"dimmed",size:"lg",ta:"center",className:Ft.promptModeText},a||Z("Start the conversation by sending a message"))):null,et.createElement("div",{className:Ft.chatControls},u&&et.createElement(wm,{align:"center",gap:"xs",className:Ft.headerRow},u),et.createElement("div",{className:[Ft.chatInputContainer,F.length?Ft.columned:""].join(" ")},o&&et.createElement("div",{className:Ft.documentsInput},et.createElement(wm,{visibleFrom:"xs",gap:"0"},et.createElement(ac,{onFilesAdd:fe,uploadFormats:E}),p),F?.length>0&&et.createElement("div",{className:Ft.imagesList},F.map(X=>et.createElement("div",{key:X.fileName,className:Ft.previewImage},et.createElement("img",{src:X.bytesBase64,alt:X.fileName}),et.createElement(Mm,{className:Ft.removeButton,color:"red.9",size:"xs",onClick:H(X.fileName)},et.createElement(J1,{size:16})))))),et.createElement("div",{className:Ft.chatInputGroup},o&&et.createElement(lc,{shadow:"md",width:"content"},et.createElement(lc.Target,null,et.createElement(Mm,{size:"lg",variant:"subtle",hiddenFrom:"xs",color:"dark"},et.createElement($1,{label:Z("More..."),position:"right",withArrow:!0},et.createElement(K1,{size:"24"})))),et.createElement(lc.Dropdown,null,et.createElement(ac,{onFilesAdd:fe,uploadFormats:E}),p)),et.createElement(q1,{ref:se,className:Ft.chatInput,placeholder:Z("Type your message..."),value:D||"",autosize:!0,minRows:1,maxRows:7,onChange:xe,onKeyDown:be,disabled:t}),I&&s?et.createElement(Dm,{onClick:I,disabled:t},et.createElement(X1,{size:24})," ",et.createElement(sc,{visibleFrom:"md"},Z("Stop"))):et.createElement(Dm,{onClick:de,disabled:Te,className:I&&s?Ft.hidden:"",color:"blue",radius:"md"},et.createElement(Z1,{size:24})," ",et.createElement(sc,{visibleFrom:"md",ml:"xs"},Z("Send")))))))});import pr,{useCallback as Ni,useRef as x3,useState as Id}from"react";import{Stack as D3}from"@mantine/core";import{notifications as Nd}from"@mantine/notifications";import{useTranslation as w3}from"react-i18next";import mn,{useEffect as sx,useCallback as Ym}from"react";import{Image as lx,Text as Mo,Group as zm,Stack as cx,ActionIcon as dx,Modal as ux,Tooltip as _x}from"@mantine/core";import{useDisclosure as mx}from"@mantine/hooks";import{IconExternalLink as px}from"@tabler/icons-react";var Fm=Kl(Zl(),1);import Um from"i18next";import{initReactI18next as ax}from"react-i18next";import ix from"i18next-browser-languagedetector";var Lm={AI:"AI","Are you sure you want to delete this item? This action cannot be undone.":"Are you sure you want to delete this item? This action cannot be undone.",Cancel:"Cancel",Cancelled:"Cancelled","Click or drop an image/document here to upload":"Click or drop an image/document here to upload","Code block is empty":"Code block is empty","Code Interpreter":"Code Interpreter",Completed:"Completed","Confirm Deletion":"Confirm Deletion",Copy:"Copy","Copy message":"Copy message",Delete:"Delete",Details:"Details","Document upload is not available in this chat.":"Document upload is not available in this chat.",Download:"Download","Drop files here to upload":"Drop files here to upload",Error:"Error","Failed to copy message":"Failed to copy message","Failed to read file: {{fileName}}":"Failed to read file: {{fileName}}","Failed to read file: {{fileName}}, error: {{error}}":"Failed to read file: {{fileName}}, error: {{error}}","Failed to read image files":"Failed to read image files","Failed to send message":"Failed to send message","Image Preview":"Image Preview","Image uploads are not allowed in this chat.":"Image uploads are not allowed in this chat.","In Progress":"In Progress",language:{de:"Deutsch",en:"English",label:"Language",ru:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439",zh:"\u4E2D\u6587"},"Language is not specified for this code block":"Language is not specified for this code block",Main:"Main","More...":"More...","Open image source":"Open image source",Others:"Others","RAG Search":"RAG Search",Reasoning:"Reasoning",Send:"Send","Some files are too large and were not added (max size: {{size}} MB)":"Some files are too large and were not added (max size: {{size}} MB)",source:"source","Start the conversation by sending a message":"Start the conversation by sending a message",Started:"Started",Stop:"Stop","Tool Call":"Tool Call","Tool Call Completed":"Tool Call Completed","Type your message...":"Type your message...","Upload File":"Upload File",Warning:"Warning","Web Search":"Web Search",You:"You","You can only add up to {{count}} images at a time":"You can only add up to {{count}} images at a time"};var km={AI:"KI","Are you sure you want to delete this item? This action cannot be undone.":"M\xF6chten Sie dieses Element wirklich l\xF6schen? Diese Aktion kann nicht r\xFCckg\xE4ngig gemacht werden.",Cancel:"Abbrechen",Cancelled:"Abgebrochen","Click or drop an image/document here to upload":"Klicken oder Bild/Dokument hierher ziehen zum Hochladen","Code block is empty":"Codeblock ist leer","Code Interpreter":"Code-Interpreter",Completed:"Abgeschlossen","Confirm Deletion":"L\xF6schen best\xE4tigen",Copy:"Kopieren","Copy message":"Nachricht kopieren",Delete:"L\xF6schen",Details:"Details","Document upload is not available in this chat.":"Dokumenten-Upload ist in diesem Chat nicht verf\xFCgbar.",Download:"Herunterladen","Drop files here to upload":"Dateien zum Hochladen hier ablegen",Error:"Fehler","Failed to copy message":"Nachricht konnte nicht kopiert werden","Failed to read file: {{fileName}}":"Datei konnte nicht gelesen werden: {{fileName}}","Failed to read file: {{fileName}}, error: {{error}}":"Datei konnte nicht gelesen werden: {{fileName}}, Fehler: {{error}}","Failed to read image files":"Bilddateien konnten nicht gelesen werden","Failed to send message":"Nachricht konnte nicht gesendet werden","Image Preview":"Bildvorschau","Image uploads are not allowed in this chat.":"Bild-Uploads sind in diesem Chat nicht erlaubt.","In Progress":"In Bearbeitung",language:{de:"Deutsch",en:"English",label:"Sprache",ru:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439",zh:"\u4E2D\u6587"},"Language is not specified for this code block":"F\xFCr diesen Codeblock ist keine Sprache angegeben",Main:"Haupt","More...":"Mehr...","Open image source":"Bildquelle \xF6ffnen",Others:"Andere","RAG Search":"RAG-Suche",Reasoning:"Argumentation",Send:"Senden","Some files are too large and were not added (max size: {{size}} MB)":"Einige Dateien sind zu gro\xDF und wurden nicht hinzugef\xFCgt (max. Gr\xF6\xDFe: {{size}} MB)",source:"Quelle","Start the conversation by sending a message":"Beginnen Sie das Gespr\xE4ch, indem Sie eine Nachricht senden",Started:"Gestartet",Stop:"Stopp","Tool Call":"Tool-Aufruf","Tool Call Completed":"Tool-Aufruf abgeschlossen","Type your message...":"Nachricht eingeben...","Upload File":"Datei hochladen",Warning:"Warnung","Web Search":"Websuche",You:"Sie","You can only add up to {{count}} images at a time":"Sie k\xF6nnen nur bis zu {{count}} Bilder gleichzeitig hinzuf\xFCgen"};var Pm={AI:"\u0418\u0418","Are you sure you want to delete this item? This action cannot be undone.":"\u0412\u044B \u0443\u0432\u0435\u0440\u0435\u043D\u044B, \u0447\u0442\u043E \u0445\u043E\u0442\u0438\u0442\u0435 \u0443\u0434\u0430\u043B\u0438\u0442\u044C \u044D\u0442\u043E\u0442 \u044D\u043B\u0435\u043C\u0435\u043D\u0442? \u042D\u0442\u043E \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043D\u0435\u043B\u044C\u0437\u044F \u043E\u0442\u043C\u0435\u043D\u0438\u0442\u044C.",Cancel:"\u041E\u0442\u043C\u0435\u043D\u0430",Cancelled:"\u041E\u0442\u043C\u0435\u043D\u0435\u043D\u043E","Click or drop an image/document here to upload":"\u041D\u0430\u0436\u043C\u0438\u0442\u0435 \u0438\u043B\u0438 \u043F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435/\u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442 \u0441\u044E\u0434\u0430 \u0434\u043B\u044F \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0438","Code block is empty":"\u0411\u043B\u043E\u043A \u043A\u043E\u0434\u0430 \u043F\u0443\u0441\u0442","Code Interpreter":"\u0418\u043D\u0442\u0435\u0440\u043F\u0440\u0435\u0442\u0430\u0442\u043E\u0440 \u043A\u043E\u0434\u0430",Completed:"\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u043E","Confirm Deletion":"\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044C \u0443\u0434\u0430\u043B\u0435\u043D\u0438\u0435",Copy:"\u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C","Copy message":"\u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435",Delete:"\u0423\u0434\u0430\u043B\u0438\u0442\u044C",Details:"\u041F\u043E\u0434\u0440\u043E\u0431\u043D\u043E\u0441\u0442\u0438","Document upload is not available in this chat.":"\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u043E\u0432 \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u0432 \u044D\u0442\u043E\u043C \u0447\u0430\u0442\u0435.",Download:"\u0421\u043A\u0430\u0447\u0430\u0442\u044C","Drop files here to upload":"\u041F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0444\u0430\u0439\u043B\u044B \u0441\u044E\u0434\u0430 \u0434\u043B\u044F \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0438",Error:"\u041E\u0448\u0438\u0431\u043A\u0430","Failed to copy message":"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0441\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435","Failed to read file: {{fileName}}":"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u0440\u043E\u0447\u0438\u0442\u0430\u0442\u044C \u0444\u0430\u0439\u043B: {{fileName}}","Failed to read file: {{fileName}}, error: {{error}}":"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u0440\u043E\u0447\u0438\u0442\u0430\u0442\u044C \u0444\u0430\u0439\u043B: {{fileName}}, \u043E\u0448\u0438\u0431\u043A\u0430: {{error}}","Failed to read image files":"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u0440\u043E\u0447\u0438\u0442\u0430\u0442\u044C \u0444\u0430\u0439\u043B\u044B \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439","Failed to send message":"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435","Image Preview":"\u041F\u0440\u0435\u0434\u043F\u0440\u043E\u0441\u043C\u043E\u0442\u0440 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F","Image uploads are not allowed in this chat.":"\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439 \u0432 \u044D\u0442\u043E\u043C \u0447\u0430\u0442\u0435 \u0437\u0430\u043F\u0440\u0435\u0449\u0435\u043D\u0430.","In Progress":"\u0412 \u043F\u0440\u043E\u0446\u0435\u0441\u0441\u0435",language:{de:"Deutsch",en:"English",label:"\u042F\u0437\u044B\u043A",ru:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439",zh:"\u4E2D\u6587"},"Language is not specified for this code block":"\u042F\u0437\u044B\u043A \u043D\u0435 \u0443\u043A\u0430\u0437\u0430\u043D \u0434\u043B\u044F \u044D\u0442\u043E\u0433\u043E \u0431\u043B\u043E\u043A\u0430 \u043A\u043E\u0434\u0430",Main:"\u041E\u0441\u043D\u043E\u0432\u043D\u043E\u0439","More...":"\u0415\u0449\u0451...","Open image source":"\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0438\u0441\u0442\u043E\u0447\u043D\u0438\u043A \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F",Others:"\u0414\u0440\u0443\u0433\u0438\u0435","RAG Search":"RAG-\u043F\u043E\u0438\u0441\u043A",Reasoning:"\u0420\u0430\u0441\u0441\u0443\u0436\u0434\u0435\u043D\u0438\u0435",Send:"\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C","Some files are too large and were not added (max size: {{size}} MB)":"\u041D\u0435\u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u0444\u0430\u0439\u043B\u044B \u0441\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u0438\u0435 \u0438 \u043D\u0435 \u0431\u044B\u043B\u0438 \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u044B (\u043C\u0430\u043A\u0441. \u0440\u0430\u0437\u043C\u0435\u0440: {{size}} \u041C\u0411)",source:"\u0438\u0441\u0442\u043E\u0447\u043D\u0438\u043A","Start the conversation by sending a message":"\u041D\u0430\u0447\u043D\u0438\u0442\u0435 \u0434\u0438\u0430\u043B\u043E\u0433, \u043E\u0442\u043F\u0440\u0430\u0432\u0438\u0432 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435",Started:"\u041D\u0430\u0447\u0430\u0442\u043E",Stop:"\u0421\u0442\u043E\u043F","Tool Call":"\u0412\u044B\u0437\u043E\u0432 \u0438\u043D\u0441\u0442\u0440\u0443\u043C\u0435\u043D\u0442\u0430","Tool Call Completed":"\u0412\u044B\u0437\u043E\u0432 \u0438\u043D\u0441\u0442\u0440\u0443\u043C\u0435\u043D\u0442\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0451\u043D","Type your message...":"\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435...","Upload File":"\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u0444\u0430\u0439\u043B",Warning:"\u041F\u0440\u0435\u0434\u0443\u043F\u0440\u0435\u0436\u0434\u0435\u043D\u0438\u0435","Web Search":"\u0412\u0435\u0431-\u043F\u043E\u0438\u0441\u043A",You:"\u0412\u044B","You can only add up to {{count}} images at a time":"\u0412\u044B \u043C\u043E\u0436\u0435\u0442\u0435 \u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043D\u0435 \u0431\u043E\u043B\u0435\u0435 {{count}} \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0439 \u0437\u0430 \u0440\u0430\u0437"};var Bm={AI:"AI","Are you sure you want to delete this item? This action cannot be undone.":"\u60A8\u786E\u5B9A\u8981\u5220\u9664\u6B64\u9879\u5417\uFF1F\u6B64\u64CD\u4F5C\u65E0\u6CD5\u64A4\u6D88\u3002",Cancel:"\u53D6\u6D88",Cancelled:"\u5DF2\u53D6\u6D88","Click or drop an image/document here to upload":"\u70B9\u51FB\u6216\u62D6\u653E\u56FE\u7247/\u6587\u6863\u5230\u6B64\u5904\u4E0A\u4F20","Code block is empty":"\u4EE3\u7801\u5757\u4E3A\u7A7A","Code Interpreter":"\u4EE3\u7801\u89E3\u91CA\u5668",Completed:"\u5DF2\u5B8C\u6210","Confirm Deletion":"\u786E\u8BA4\u5220\u9664",Copy:"\u590D\u5236","Copy message":"\u590D\u5236\u6D88\u606F",Delete:"\u5220\u9664",Details:"\u8BE6\u60C5","Document upload is not available in this chat.":"\u6B64\u804A\u5929\u4E0D\u652F\u6301\u6587\u6863\u4E0A\u4F20\u3002",Download:"\u4E0B\u8F7D","Drop files here to upload":"\u5C06\u6587\u4EF6\u62D6\u653E\u5230\u6B64\u5904\u4E0A\u4F20",Error:"\u9519\u8BEF","Failed to copy message":"\u590D\u5236\u6D88\u606F\u5931\u8D25","Failed to read file: {{fileName}}":"\u8BFB\u53D6\u6587\u4EF6\u5931\u8D25\uFF1A{{fileName}}","Failed to read file: {{fileName}}, error: {{error}}":"\u8BFB\u53D6\u6587\u4EF6\u5931\u8D25\uFF1A{{fileName}}\uFF0C\u9519\u8BEF\uFF1A{{error}}","Failed to read image files":"\u8BFB\u53D6\u56FE\u7247\u6587\u4EF6\u5931\u8D25","Failed to send message":"\u53D1\u9001\u6D88\u606F\u5931\u8D25","Image Preview":"\u56FE\u7247\u9884\u89C8","Image uploads are not allowed in this chat.":"\u6B64\u804A\u5929\u4E0D\u5141\u8BB8\u4E0A\u4F20\u56FE\u7247\u3002","In Progress":"\u8FDB\u884C\u4E2D",language:{de:"Deutsch",en:"English",label:"\u8BED\u8A00",ru:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439",zh:"\u4E2D\u6587"},"Language is not specified for this code block":"\u6B64\u4EE3\u7801\u5757\u672A\u6307\u5B9A\u8BED\u8A00",Main:"\u4E3B\u8981","More...":"\u66F4\u591A...","Open image source":"\u6253\u5F00\u56FE\u7247\u6765\u6E90",Others:"\u5176\u4ED6","RAG Search":"RAG \u641C\u7D22",Reasoning:"\u63A8\u7406",Send:"\u53D1\u9001","Some files are too large and were not added (max size: {{size}} MB)":"\u90E8\u5206\u6587\u4EF6\u8FC7\u5927\uFF0C\u672A\u88AB\u6DFB\u52A0\uFF08\u6700\u5927\uFF1A{{size}} MB\uFF09",source:"\u6765\u6E90","Start the conversation by sending a message":"\u53D1\u9001\u6D88\u606F\u5F00\u59CB\u5BF9\u8BDD",Started:"\u5DF2\u5F00\u59CB",Stop:"\u505C\u6B62","Tool Call":"\u5DE5\u5177\u8C03\u7528","Tool Call Completed":"\u5DE5\u5177\u8C03\u7528\u5B8C\u6210","Type your message...":"\u8F93\u5165\u6D88\u606F...","Upload File":"\u4E0A\u4F20\u6587\u4EF6",Warning:"\u8B66\u544A","Web Search":"\u7F51\u7EDC\u641C\u7D22",You:"\u4F60","You can only add up to {{count}} images at a time":"\u4E00\u6B21\u6700\u591A\u53EA\u80FD\u6DFB\u52A0 {{count}} \u5F20\u56FE\u7247"};var cc=["en","de","ru","zh"],dc="ui-language";function ox(e={}){return(0,Fm.merge)({en:{translation:Lm},de:{translation:km},ru:{translation:Pm},zh:{translation:Bm}},e)}async function r7({lookupLocalStorage:e=dc,supportedLngs:t=cc,fallbackLng:n="en",resources:a={}}={}){return Um.use(ix).use(ax).init({resources:ox(a),fallbackLng:n,supportedLngs:t,interpolation:{escapeValue:!1},detection:{order:["localStorage","navigator","htmlTag"],lookupLocalStorage:e,caches:["localStorage"]}})}function Gm(e){return new Date(e).toLocaleDateString(Um.language||"ru-RU",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}import{useTranslation as gx}from"react-i18next";var Hm=({fileName:e,fileUrl:t,mimeType:n,createdAt:a,onOpenSource:o,sourceTitle:s,onClose:c})=>{let[d,{open:u,close:p}]=mx(!1);sx(()=>{t&&u()},[t,u]);let E=Ym(()=>{c(),p()},[c,p]),h=Ym(()=>{o?.(),E()},[o,E]),{t:v}=gx();return mn.createElement(ux,{opened:d,onClose:E,size:"xl",title:v("Image Preview"),centered:!0},t&&mn.createElement(cx,{gap:"md"},mn.createElement(lx,{src:t,alt:e,fit:"contain",mah:"70vh"}),mn.createElement(zm,{justify:"space-between"},mn.createElement("div",null,mn.createElement(Mo,{size:"sm",fw:500},e),mn.createElement(Mo,{size:"xs",c:"dimmed"},a?Gm(a)+" \u2022":""," ",n)),o&&mn.createElement(zm,{gap:"xs"},mn.createElement(_x,{label:v("Open image source")},mn.createElement(dx,{variant:"light",onClick:h},mn.createElement(px,{size:16}))))),o&&mn.createElement(Mo,{size:"sm",c:"dimmed"},"From:"," ",mn.createElement(Mo,{span:!0,c:"blue",style:{cursor:"pointer"},onClick:h},s||v("source")))))};var zb=Kl(Yb(),1);var di=zb.default;function Nc(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Kr=Nc();function $b(e){Kr=e}var mi={exec:()=>null};function Je(e,t=""){let n=typeof e=="string"?e:e.source,a={replace:(o,s)=>{let c=typeof s=="string"?s:s.source;return c=c.replace(Wt.caret,"$1"),n=n.replace(o,c),a},getRegex:()=>new RegExp(n,t)};return a}var Wt={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},Y2=/^(?:[ \t]*(?:\n|$))+/,z2=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,H2=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,pi=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,V2=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ac=/(?:[*+-]|\d{1,9}[.)])/,Kb=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Xb=Je(Kb).replace(/bull/g,Ac).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),W2=Je(Kb).replace(/bull/g,Ac).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Oc=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,q2=/^[^\n]+/,yc=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Q2=Je(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",yc).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),$2=Je(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ac).getRegex(),Ko="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",xc=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,K2=Je("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",xc).replace("tag",Ko).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Zb=Je(Oc).replace("hr",pi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ko).getRegex(),X2=Je(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Zb).getRegex(),Dc={blockquote:X2,code:z2,def:Q2,fences:H2,heading:V2,hr:pi,html:K2,lheading:Xb,list:$2,newline:Y2,paragraph:Zb,table:mi,text:q2},Hb=Je("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",pi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ko).getRegex(),Z2={...Dc,lheading:W2,table:Hb,paragraph:Je(Oc).replace("hr",pi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Hb).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ko).getRegex()},J2={...Dc,html:Je(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",xc).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:mi,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Je(Oc).replace("hr",pi).replace("heading",` *#{1,6} *[^
92
92
  ]`).replace("lheading",Xb).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},j2=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,e4=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Jb=/^( {2,}|\\)\n(?!\s*$)/,t4=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Xo=/[\p{P}\p{S}]/u,wc=/[\s\p{P}\p{S}]/u,jb=/[^\s\p{P}\p{S}]/u,n4=Je(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,wc).getRegex(),eT=/(?!~)[\p{P}\p{S}]/u,r4=/(?!~)[\s\p{P}\p{S}]/u,a4=/(?:[^\s\p{P}\p{S}]|~)/u,i4=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,tT=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,o4=Je(tT,"u").replace(/punct/g,Xo).getRegex(),s4=Je(tT,"u").replace(/punct/g,eT).getRegex(),nT="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",l4=Je(nT,"gu").replace(/notPunctSpace/g,jb).replace(/punctSpace/g,wc).replace(/punct/g,Xo).getRegex(),c4=Je(nT,"gu").replace(/notPunctSpace/g,a4).replace(/punctSpace/g,r4).replace(/punct/g,eT).getRegex(),d4=Je("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,jb).replace(/punctSpace/g,wc).replace(/punct/g,Xo).getRegex(),u4=Je(/\\(punct)/,"gu").replace(/punct/g,Xo).getRegex(),_4=Je(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),m4=Je(xc).replace("(?:-->|$)","-->").getRegex(),p4=Je("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",m4).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Qo=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,g4=Je(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Qo).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),rT=Je(/^!?\[(label)\]\[(ref)\]/).replace("label",Qo).replace("ref",yc).getRegex(),aT=Je(/^!?\[(ref)\](?:\[\])?/).replace("ref",yc).getRegex(),E4=Je("reflink|nolink(?!\\()","g").replace("reflink",rT).replace("nolink",aT).getRegex(),Mc={_backpedal:mi,anyPunctuation:u4,autolink:_4,blockSkip:i4,br:Jb,code:e4,del:mi,emStrongLDelim:o4,emStrongRDelimAst:l4,emStrongRDelimUnd:d4,escape:j2,link:g4,nolink:aT,punctuation:n4,reflink:rT,reflinkSearch:E4,tag:p4,text:t4,url:mi},S4={...Mc,link:Je(/^!?\[(label)\]\((.*?)\)/).replace("label",Qo).getRegex(),reflink:Je(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Qo).getRegex()},Cc={...Mc,emStrongRDelimAst:c4,emStrongLDelim:s4,url:Je(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},f4={...Cc,br:Je(Jb).replace("{2,}","*").getRegex(),text:Je(Cc.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Wo={normal:Dc,gfm:Z2,pedantic:J2},ui={normal:Mc,gfm:Cc,breaks:f4,pedantic:S4},h4={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Vb=e=>h4[e];function Gn(e,t){if(t){if(Wt.escapeTest.test(e))return e.replace(Wt.escapeReplace,Vb)}else if(Wt.escapeTestNoEncode.test(e))return e.replace(Wt.escapeReplaceNoEncode,Vb);return e}function Wb(e){try{e=encodeURI(e).replace(Wt.percentDecode,"%")}catch{return null}return e}function qb(e,t){let n=e.replace(Wt.findPipe,(s,c,d)=>{let u=!1,p=c;for(;--p>=0&&d[p]==="\\";)u=!u;return u?"|":" |"}),a=n.split(Wt.splitPipe),o=0;if(a[0].trim()||a.shift(),a.length>0&&!a.at(-1)?.trim()&&a.pop(),t)if(a.length>t)a.splice(t);else for(;a.length<t;)a.push("");for(;o<a.length;o++)a[o]=a[o].trim().replace(Wt.slashPipe,"|");return a}function _i(e,t,n){let a=e.length;if(a===0)return"";let o=0;for(;o<a;){let s=e.charAt(a-o-1);if(s===t&&!n)o++;else if(s!==t&&n)o++;else break}return e.slice(0,a-o)}function b4(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let a=0;a<e.length;a++)if(e[a]==="\\")a++;else if(e[a]===t[0])n++;else if(e[a]===t[1]&&(n--,n<0))return a;return n>0?-2:-1}function Qb(e,t,n,a,o){let s=t.href,c=t.title||null,d=e[1].replace(o.other.outputLinkReplace,"$1");a.state.inLink=!0;let u={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:s,title:c,text:d,tokens:a.inlineTokens(d)};return a.state.inLink=!1,u}function T4(e,t,n){let a=e.match(n.other.indentCodeCompensation);if(a===null)return t;let o=a[1];return t.split(`
93
93
  `).map(s=>{let c=s.match(n.other.beginningSpace);if(c===null)return s;let[d]=c;return d.length>=o.length?s.slice(o.length):s}).join(`
94
94
  `)}var $o=class{options;rules;lexer;constructor(e){this.options=e||Kr}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:_i(n,`