import { f as fallback } from './async-Djx13DAD.js';
import { c as bind_props, d as attr_class, k as clsx, e as ensure_array_like, j as stringify, g as attr_style, a as attr, b as spread_props } from './index-B7gr0Dsc.js';
import './2-CeYbpaU1.js';
import { g, d, w as w$1 } from './utils.svelte-D8Xdzglu.js';
import { c } from './Image-Bw5_tidM.js';
import { c as createEventDispatcher, o as onDestroy } from './index-server-lqjMX237.js';
import './MarkdownCode.svelte_svelte_type_style_lang-DJRtJayx.js';
import { w } from './IconButton-7VBZdgpA.js';
import { e } from './Check-THd8EJll.js';
import { h } from './Copy-DNPvPwdp.js';
import { o } from './Clear-CiR-WD8W.js';
import { l } from './Download-rAXPPveZ.js';
import { r as r$2 } from './Edit-DVsun1ou.js';
import { r as r$1 } from './Undo-DlTKhhuO.js';
import { u as u$1 } from './DownloadLink-BLkRTIUs.js';
import { u, y as y$1 } from './ShareButton-B1Vd_e6T.js';
import { y } from './IconButtonWrapper-DlgTGGi-.js';
import { i } from './File-CWWp_-I1.js';
import { P } from './MarkdownCode-zMHESTz4.js';
import { u as u$2 } from './index9-7JZOG94_.js';
import { r } from './Trash-D-m4iX81.js';
import { t } from './Music-CFRjVwjy.js';
import { G } from './Block-2-03Azgw.js';
import { k } from './BlockLabel-DYKzuObf.js';
import { R } from './index3-DONAw0dG.js';
import { e as escape_html } from './escaping-CBnpiEl5.js';
import './context-BZS6UlnY.js';
import './uneval-DjLoL4oF.js';
import './clone-BLo8hHdj.js';
import './index5-BoOEKc6P.js';
import './dev-fallback-Bc5Ork7Y.js';
import './prism-python-BaDPvmdn.js';
import './index35-D6cyUa2I.js';
import 'path';
import 'url';
import 'fs';
import './spring-DyDQVd5U.js';

function Jt(e){e.push('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--carbon" width="100%" height="100%" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path fill="currentColor" d="M17.74 30L16 29l4-7h6a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h9v2H6a4 4 0 0 1-4-4V8a4 4 0 0 1 4-4h20a4 4 0 0 1 4 4v12a4 4 0 0 1-4 4h-4.84Z"></path><path fill="currentColor" d="M8 10h16v2H8zm0 6h10v2H8z"></path></svg>');}function Yt(e){e.push('<svg class="dropdown-arrow svelte-1w1fnc7" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 18 18"><circle cx="9" cy="9" r="8" class="circle svelte-1w1fnc7"></circle><path d="M5 8l4 4 4-4z"></path></svg>');}function Kt(e){e.push('<svg width="100%" height="100%" stroke-width="1.5" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" color="currentColor"><path d="M19.1679 9C18.0247 6.46819 15.3006 4.5 11.9999 4.5C8.31459 4.5 5.05104 7.44668 4.54932 11" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M16 9H19.4C19.7314 9 20 8.73137 20 8.4V5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M4.88146 15C5.92458 17.5318 8.64874 19.5 12.0494 19.5C15.7347 19.5 18.9983 16.5533 19.5 13" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path><path d="M8.04932 15H4.64932C4.31795 15 4.04932 15.2686 4.04932 15.6V19" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg>');}const Qt=async(e,l=1800)=>{let t=[...e],o=await ht(t);if(o.length>l&&t.length>2){const u=t[0],n=t[t.length-1];t=[u,n],o=await ht(t);}return o.length>l&&t.length>0&&(t=t.map(n=>{if(n.type==="text"){const s=Math.floor(l/t.length)-20;if(n.content.length>s)return {...n,content:n.content.substring(0,s)+"..."}}return n}),o=await ht(t)),o},ht=async e=>(await Promise.all(e.map(async t=>{if(t.role==="system")return "";let o=t.role==="user"?"😃":"🤖",u="";if(t.type==="text"){const n={audio:/<audio.*?src="(\/file=.*?)"/g,video:/<video.*?src="(\/file=.*?)"/g,image:/<img.*?src="(\/file=.*?)".*?\/>|!\[.*?\]\((\/file=.*?)\)/g};u=t.content;for(let[s,h]of Object.entries(n)){let c;for(;(c=h.exec(t.content))!==null;){const i=c[1]||c[2],p=await w$1(i);u=u.replace(i,p);}}}else {if(!t.content.value)return "";const n=t.content.component==="video"?t.content.value?.video.path:t.content.value,s=await w$1(n);t.content.component==="audio"?u=`<audio controls src="${s}"></audio>`:t.content.component==="video"?u=s:t.content.component==="image"&&(u=`<img src="${s}" />`);}return `${o}: ${u}`}))).filter(t=>t!=="").join(`
`),Xt=(e,l)=>e.replace('src="/file',`src="${l}file`);function $t(e,l){if(!e){const t=l?.path;if(t){const o=t.toLowerCase();if(o.endsWith(".glb")||o.endsWith(".gltf")||o.endsWith(".obj")||o.endsWith(".stl")||o.endsWith(".splat")||o.endsWith(".ply"))return "model3d"}return "file"}return e.includes("audio")?"audio":e.includes("video")?"video":e.includes("image")?"image":e.includes("model")?"model3d":"file"}function tl(e){const l=Array.isArray(e.file)?e.file[0]:e.file,t=$t(l?.mime_type,l);return {component:t,value:t==="file"?Array.isArray(e.file)?e.file:[e.file]:e.file,alt_text:e.alt_text,constructor_args:{},props:{}}}function ll(e,l,t,o){let u;return l.type==="text"?u={role:e.role,metadata:e.metadata,content:Xt(l.text,t),type:"text",index:o,options:e.options}:l.type==="file"?u={role:e.role,metadata:e.metadata,content:tl(l),type:"component",index:o,options:e.options}:u={role:e.role,metadata:e.metadata,content:l,type:"component",index:o,options:e.options},u}function al(e,l){if(e===null)return e;const t=new Map;return e.flatMap((o,u)=>{const n=o.content.map(s=>ll(o,s,l,u));for(const s of n){const{id:h,title:c,parent_id:i}=o.metadata||{};if(i){const p=t.get(String(i));if(p){const _={...s,children:[]};return p.children.push(_),h&&c&&t.set(String(h),_),null}}if(h&&c){const p={...s,children:[]};return t.set(String(h),p),p}}return n}).filter(o=>o!==null)}function sl(e){return e.type==="component"}function yt(e,l){const t=e[e.length-1].role==="assistant",o=e[e.length-1].index;return JSON.stringify(o)===JSON.stringify(l[l.length-1].index)&&t}function el(e,l=true){const t=[];let o=[],u=null;for(const n of e)if(n.role==="assistant"||n.role==="user"){if(!l){t.push([n]);continue}n.role===u?o.push(n):(o.length>0&&t.push(o),o=[n],u=n.role);}return o.length>0&&t.push(o),t}async function ol(e,l,t){for(const o of e){if(l[o]||o==="file")continue;const n=await t(o,o==="dataframe"?"component":"base");l[o]=n.default;}return l}function kt(e){if(!e)return [];let l=new Set;return e.forEach(t=>{t.type==="component"&&l.add(t.content.component);}),Array.from(l)}function ft(e,l=0){let t="";const o="  ".repeat(l);e.metadata?.title&&(t+=`${o}${l>0?"- ":""}${e.metadata.title}
`),typeof e.content=="string"&&(t+=`${o}  ${e.content}
`);const u=e;return u.children?.length>0&&(t+=u.children.map(n=>ft(n,l+1)).join("")),t}function il(e){return Array.isArray(e)?e.map(l=>l.metadata?.title?ft(l):l.content).join(`
`):e.metadata?.title?ft(e):e.content}function xt(e){return Array.isArray(e)&&e.every(l=>typeof l.content=="string")||!Array.isArray(e)&&typeof e.content=="string"}function nl(e){e.push('<svg width="100%" height="100%" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M11.25 6.61523H9.375V1.36523H11.25V6.61523ZM3.375 1.36523H8.625V6.91636L7.48425 8.62748L7.16737 10.8464C7.14108 11.0248 7.05166 11.1879 6.91535 11.3061C6.77904 11.4242 6.60488 11.4896 6.4245 11.4902H6.375C6.07672 11.4899 5.79075 11.3713 5.57983 11.1604C5.36892 10.9495 5.2503 10.6635 5.25 10.3652V8.11523H2.25C1.85233 8.11474 1.47109 7.95654 1.18989 7.67535C0.908691 7.39415 0.750496 7.01291 0.75 6.61523V3.99023C0.750992 3.29435 1.02787 2.62724 1.51994 2.13517C2.01201 1.64311 2.67911 1.36623 3.375 1.36523Z" fill="currentColor"></path></svg>');}function ul(e){e.push('<svg width="100%" height="100%" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2.25 8.11523H4.5V10.3652C4.5003 10.6635 4.61892 10.9495 4.82983 11.1604C5.04075 11.3713 5.32672 11.4899 5.625 11.4902H6.42488C6.60519 11.4895 6.77926 11.4241 6.91549 11.3059C7.05172 11.1878 7.14109 11.0248 7.16737 10.8464L7.48425 8.62748L8.82562 6.61523H11.25V1.36523H3.375C2.67911 1.36623 2.01201 1.64311 1.51994 2.13517C1.02787 2.62724 0.750992 3.29435 0.75 3.99023V6.61523C0.750496 7.01291 0.908691 7.39415 1.18989 7.67535C1.47109 7.95654 1.85233 8.11474 2.25 8.11523ZM9 2.11523H10.5V5.86523H9V2.11523ZM1.5 3.99023C1.5006 3.49314 1.69833 3.01657 2.04983 2.66507C2.40133 2.31356 2.8779 2.11583 3.375 2.11523H8.25V6.12661L6.76575 8.35298L6.4245 10.7402H5.625C5.52554 10.7402 5.43016 10.7007 5.35983 10.6304C5.28951 10.5601 5.25 10.4647 5.25 10.3652V7.36523H2.25C2.05118 7.36494 1.86059 7.28582 1.72 7.14524C1.57941 7.00465 1.5003 6.81406 1.5 6.61523V3.99023Z" fill="currentColor"></path></svg>');}function cl(e){e.push('<svg width="100%" height="100%" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0.75 6.24023H2.625V11.4902H0.75V6.24023ZM8.625 11.4902H3.375V5.93911L4.51575 4.22798L4.83263 2.00911C4.85892 1.83065 4.94834 1.66754 5.08465 1.5494C5.22096 1.43125 5.39512 1.36591 5.5755 1.36523H5.625C5.92328 1.36553 6.20925 1.48415 6.42017 1.69507C6.63108 1.90598 6.7497 2.19196 6.75 2.49023V4.74023H9.75C10.1477 4.74073 10.5289 4.89893 10.8101 5.18012C11.0913 5.46132 11.2495 5.84256 11.25 6.24023V8.86523C11.249 9.56112 10.9721 10.2282 10.4801 10.7203C9.98799 11.2124 9.32089 11.4892 8.625 11.4902Z" fill="currentColor"></path></svg>');}function hl(e){e.push('<svg width="100%" height="100%" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9.75 4.74023H7.5V2.49023C7.4997 2.19196 7.38108 1.90598 7.17017 1.69507C6.95925 1.48415 6.67328 1.36553 6.375 1.36523H5.57512C5.39481 1.366 5.22074 1.43138 5.08451 1.54952C4.94828 1.66766 4.85891 1.83072 4.83262 2.00911L4.51575 4.22798L3.17438 6.24023H0.75V11.4902H8.625C9.32089 11.4892 9.98799 11.2124 10.4801 10.7203C10.9721 10.2282 11.249 9.56112 11.25 8.86523V6.24023C11.2495 5.84256 11.0913 5.46132 10.8101 5.18012C10.5289 4.89893 10.1477 4.74073 9.75 4.74023ZM3 10.7402H1.5V6.99023H3V10.7402ZM10.5 8.86523C10.4994 9.36233 10.3017 9.8389 9.95017 10.1904C9.59867 10.5419 9.1221 10.7396 8.625 10.7402H3.75V6.72886L5.23425 4.50248L5.5755 2.11523H6.375C6.47446 2.11523 6.56984 2.15474 6.64017 2.22507C6.71049 2.2954 6.75 2.39078 6.75 2.49023V5.49023H9.75C9.94882 5.49053 10.1394 5.56965 10.28 5.71023C10.4206 5.85082 10.4997 6.04141 10.5 6.24023V8.86523Z" fill="currentColor"></path></svg>');}function pl(e){e.push('<svg id="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" fill="none"><path fill="currentColor" d="M6,30H4V2H28l-5.8,9L28,20H6ZM6,18H24.33L19.8,11l4.53-7H6Z"></path></svg>');}function _l(e){e.push('<svg id="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" fill="none"><path fill="currentColor" d="M4,2H28l-5.8,9L28,20H6v10H4V2z"></path></svg>');}function fl(e,l){e.component(t=>{let o,u=l.i18n,n=l.handle_action,s$1=l.feedback_options,h=fallback(l.selected,null);function c(i){h=h===i?null:i,n(h);}if(o=s$1.filter(i=>i!=="Like"&&i!=="Dislike"),s$1.includes("Like")||s$1.includes("Dislike")?(t.push("<!--[-->"),s$1.includes("Dislike")?(t.push("<!--[-->"),w(t,{Icon:h==="Dislike"?nl:ul,label:h==="Dislike"?"Disliked":u("chatbot.dislike"),color:h==="Dislike"?"var(--color-accent)":"var(--block-label-text-color)",onclick:()=>c("Dislike")})):t.push("<!--[!-->"),t.push("<!--]--> "),s$1.includes("Like")?(t.push("<!--[-->"),w(t,{Icon:h==="Like"?cl:hl,label:h==="Like"?"Liked":u("chatbot.like"),color:h==="Like"?"var(--color-accent)":"var(--block-label-text-color)",onclick:()=>c("Like")})):t.push("<!--[!-->"),t.push("<!--]-->")):t.push("<!--[!-->"),t.push("<!--]--> "),o.length>0){t.push("<!--[-->"),t.push('<div class="extra-feedback no-border svelte-fvat56">'),w(t,{Icon:h&&o.includes(h)?_l:pl,label:"Feedback",color:h&&o.includes(h)?"var(--color-accent)":"var(--block-label-text-color)"}),t.push('<!----> <div class="extra-feedback-options svelte-fvat56"><!--[-->');const i=ensure_array_like(o);for(let p=0,_=i.length;p<_;p++){let v=i[p];t.push(`<button class="extra-feedback-option svelte-fvat56"${attr_style("",{"font-weight":h===v?"bold":"normal"})}>${escape_html(v)}</button>`);}t.push("<!--]--></div></div>");}else t.push("<!--[!-->");t.push("<!--]-->"),bind_props(l,{i18n:u,handle_action:n,feedback_options:s$1,selected:h});});}function ml(e$1,l){e$1.component(t=>{let u=false,n=l.value,s$1=fallback(l.watermark,null),h$1=l.i18n,c;function i(){u=true,c&&clearTimeout(c),c=setTimeout(()=>{u=false;},2e3);}async function p(){if("clipboard"in navigator){const _=s$1?`${n}

${s$1}`:n;await navigator.clipboard.writeText(_),i();}else {const _=document.createElement("textarea"),v=s$1?`${n}

${s$1}`:n;_.value=v,_.style.position="absolute",_.style.left="-999999px",document.body.prepend(_),_.select();try{document.execCommand("copy"),i();}catch(y){console.error(y);}finally{_.remove();}}}onDestroy(()=>{c&&clearTimeout(c);}),w(t,{onclick:p,label:h$1(u?"chatbot.copied_message":"chatbot.copy_message"),Icon:u?e:h}),bind_props(l,{value:n,watermark:s$1,i18n:h$1});});}function rt(e$1,l$1){e$1.component(t=>{let o$1,u,n=l$1.i18n,s$1=l$1.likeable,h=l$1.feedback_options,c=l$1.show_retry,i=l$1.show_undo,p=l$1.show_edit,_=l$1.in_edit_mode,v=l$1.show_copy_button,y$2=fallback(l$1.watermark,null),r=l$1.message,L=l$1.position,z=l$1.avatar,M=l$1.generating,k=l$1.current_feedback,x=fallback(l$1.file,null),V=fallback(l$1.show_download_button,false),B=fallback(l$1.show_share_button,false),A=l$1.handle_action,j=l$1.layout,U=l$1.dispatch;o$1=xt(r)?il(r):"",u=v&&r&&xt(r),u||c||i||p||s$1||V&&x?.url||B&&x?(t.push("<!--[-->"),t.push(`<div${attr_class(`message-buttons-${stringify(L)} ${stringify(j)} message-buttons ${stringify(z!==null&&"with-avatar")}`,"svelte-704d7y")}>`),y(t,{top_panel:false,children:f=>{_?(f.push("<!--[-->"),w(f,{label:n("chatbot.submit"),Icon:e,onclick:()=>A("edit_submit"),disabled:M}),f.push("<!----> "),w(f,{label:n("chatbot.cancel"),Icon:o,onclick:()=>A("edit_cancel"),disabled:M}),f.push("<!---->")):(f.push("<!--[!-->"),u?(f.push("<!--[-->"),ml(f,{value:o$1,watermark:y$2,i18n:n})):f.push("<!--[!-->"),f.push("<!--]--> "),V&&x?.url?(f.push("<!--[-->"),u$1(f,{href:x.is_stream?x.url?.replace("playlist.m3u8","playlist-file"):x.url,download:x.orig_name||x.path||"file",children:S=>{w(S,{Icon:l,label:n("common.download")});},$$slots:{default:true}})):f.push("<!--[!-->"),f.push("<!--]--> "),B&&x?(f.push("<!--[-->"),y$1(f,{i18n:n,formatter:async S=>{if(!S)return "";let W=await w$1(S.url);const T=S.mime_type||"";return T.startsWith("audio/")?`<audio controls src="${W}"></audio>`:T.startsWith("video/")?`<video controls src="${W}"></video>`:T.startsWith("image/")?`<img src="${W}" />`:""},value:x})):f.push("<!--[!-->"),f.push("<!--]--> "),c?(f.push("<!--[-->"),w(f,{Icon:Kt,label:n("chatbot.retry"),onclick:()=>A("retry"),disabled:M})):f.push("<!--[!-->"),f.push("<!--]--> "),i?(f.push("<!--[-->"),w(f,{label:n("chatbot.undo"),Icon:r$1,onclick:()=>A("undo"),disabled:M})):f.push("<!--[!-->"),f.push("<!--]--> "),p?(f.push("<!--[-->"),w(f,{label:n("chatbot.edit"),Icon:r$2,onclick:()=>A("edit"),disabled:M})):f.push("<!--[!-->"),f.push("<!--]--> "),s$1?(f.push("<!--[-->"),fl(f,{handle_action:A,feedback_options:h,selected:k,i18n:n})):f.push("<!--[!-->"),f.push("<!--]-->")),f.push("<!--]-->");}}),t.push("<!----></div>")):t.push("<!--[!-->"),t.push("<!--]-->"),bind_props(l$1,{i18n:n,likeable:s$1,feedback_options:h,show_retry:c,show_undo:i,show_edit:p,in_edit_mode:_,show_copy_button:v,watermark:y$2,message:r,position:L,avatar:z,generating:M,current_feedback:k,file:x,show_download_button:V,show_share_button:B,handle_action:A,layout:j,dispatch:U});});}function dl(e,l){e.component(t=>{let o=l.type,u=l.components,n=l.value,s$1=l.target,h=l.theme_mode,c=l.props,i=l.i18n,p=l.upload,_=l._fetch,v=l.allow_file_downloads,y=fallback(l.display_icon_button_wrapper_top_corner,false);o==="gallery"?(t.push("<!--[-->"),t.push("<!---->"),u[o]?.(t,spread_props([c,{value:n,display_icon_button_wrapper_top_corner:false,show_label:!!c.label,i18n:i,_fetch:_,allow_preview:false,interactive:false,mode:"minimal",fixed_height:1}])),t.push("<!---->")):(t.push("<!--[!-->"),o==="dataframe"?(t.push("<!--[-->"),t.push("<!---->"),u[o]?.(t,spread_props([c,{value:n,show_label:!!c.label,i18n:i,interactive:false,line_breaks:c.line_breaks,wrap:true,root:"",gradio:{dispatch:()=>{},i18n:i},datatype:c.datatype,latex_delimiters:c.latex_delimiters,col_count:c.col_count,row_count:c.row_count}])),t.push("<!---->")):(t.push("<!--[!-->"),o==="plot"?(t.push("<!--[-->"),t.push("<!---->"),u[o]?.(t,spread_props([c,{value:n,target:s$1,theme_mode:h,on_change:()=>{},bokeh_version:c.bokeh_version,caption:c.caption||"",show_actions_button:true}])),t.push("<!---->")):(t.push("<!--[!-->"),o==="audio"?(t.push("<!--[-->"),t.push("<!---->"),u[o]?.(t,spread_props([c,{value:n,show_label:!!c.label,show_share_button:false,i18n:i,waveform_settings:{...c.waveform_settings,autoplay:c.autoplay},show_download_button:false,display_icon_button_wrapper_top_corner:false,minimal:true}])),t.push("<!---->")):(t.push("<!--[!-->"),o==="video"?(t.push("<!--[-->"),t.push("<!---->"),u[o]?.(t,spread_props([c,{autoplay:c.autoplay,value:n.video||n,show_label:!!c.label,show_share_button:false,i18n:i,upload:p,display_icon_button_wrapper_top_corner:false,show_download_button:false,children:L=>{L.push('<track kind="captions"/>');},$$slots:{default:true}}])),t.push("<!---->")):(t.push("<!--[!-->"),o==="image"?(t.push("<!--[-->"),t.push("<div><!---->"),u[o]?.(t,spread_props([c,{value:n,show_label:!!c.label,display_icon_button_wrapper_top_corner:false,buttons:["fullscreen"],fullscreen:false,show_button_background:false,i18n:i}])),t.push("<!----></div>")):(t.push("<!--[!-->"),o==="html"?(t.push("<!--[-->"),t.push("<!---->"),u[o]?.(t,spread_props([c,{props:{value:n}}])),t.push("<!---->")):(t.push("<!--[!-->"),o==="model3d"?(t.push("<!--[-->"),t.push("<!---->"),u[o]?.(t,spread_props([c,{value:n,clear_color:c.clear_color,display_mode:c.display_mode,zoom_speed:c.zoom_speed,pan_speed:c.pan_speed},c.camera_position!==void 0&&{camera_position:c.camera_position},{has_change_history:true,show_label:!!c.label,root:"",interactive:false,show_share_button:false,gradio:{dispatch:()=>{},i18n:i},i18n:i}])),t.push("<!---->")):t.push("<!--[!-->"),t.push("<!--]-->")),t.push("<!--]-->")),t.push("<!--]-->")),t.push("<!--]-->")),t.push("<!--]-->")),t.push("<!--]-->")),t.push("<!--]-->")),t.push("<!--]-->"),bind_props(l,{type:o,components:u,value:n,target:s$1,theme_mode:h,props:c,i18n:i,upload:p,_fetch:_,allow_file_downloads:v,display_icon_button_wrapper_top_corner:y});});}function vl(e,l){e.component(t=>{let o=l.latex_delimiters,u=l.sanitize_html,n=l._fetch,s$1=l.i18n,h=l.line_breaks,c=l.upload,i$1=l.target,p=l.theme_mode,_=l._components,v=l.render_markdown,y=l.scroll,r=l.allow_file_downloads,L=l.display_consecutive_in_same_bubble,z=l.thought_index,M=fallback(l.allow_tags,false),k=l.message;if(k.type==="text")t.push("<!--[-->"),t.push('<div class="message-content">'),P(t,{message:k.content,latex_delimiters:o,sanitize_html:u,render_markdown:v,line_breaks:h,allow_tags:M,theme_mode:p}),t.push("<!----></div>");else {if(t.push("<!--[!-->"),k.type==="component"&&k.content.component in _)t.push("<!--[-->"),dl(t,{target:i$1,theme_mode:p,props:k.content.props,type:k.content.component,components:_,value:k.content.value,display_icon_button_wrapper_top_corner:z>0&&L,i18n:s$1,upload:c,_fetch:n,allow_file_downloads:r});else {if(t.push("<!--[!-->"),k.type==="component"&&k.content.component==="file"){t.push("<!--[-->"),t.push("<!--[-->");const x=ensure_array_like(k.content.value);for(let V=0,B=x.length;V<B;V++){const j=x[V];t.push('<div class="file-container svelte-e5gd5s"><div class="file-icon svelte-e5gd5s">'),i(t),t.push(`<!----></div> <div class="file-info svelte-e5gd5s"><a data-testid="chatbot-file" class="file-link svelte-e5gd5s"${attr("href",j.url)} target="_blank"${attr("download",window.__is_colab__?null:j?.orig_name||j?.path.split("/").pop()||"file")}><span class="file-name svelte-e5gd5s">${escape_html(j?.orig_name||j?.path.split("/").pop()||"file")}</span></a> <span class="file-type svelte-e5gd5s">${escape_html((j.orig_name||j.path||"").split(".").pop().toUpperCase())}</span></div></div>`);}t.push("<!--]-->");}else t.push("<!--[!-->");t.push("<!--]-->");}t.push("<!--]-->");}t.push("<!--]-->"),bind_props(l,{latex_delimiters:o,sanitize_html:u,_fetch:n,i18n:s$1,line_breaks:h,upload:c,target:i$1,theme_mode:p,_components:_,render_markdown:v,scroll:y,allow_file_downloads:r,display_consecutive_in_same_bubble:L,thought_index:z,allow_tags:M,message:k});});}function gl(e,l){e.component(t=>{let{thought:o,sanitize_html:u,latex_delimiters:n,render_markdown:s$1,allow_tags:h}=l;function c(_){return "children"in _}let i={...o,children:c(o)?o.children:[]};t.push(`<div class="thought-group svelte-18cn3o3"><div${attr_class("title svelte-18cn3o3",void 0,{expanded:false})}${attr("aria-busy",i.content===""||i.content===null)} role="button" tabindex="0"><span class="arrow svelte-18cn3o3"${attr_style("",{transform:"rotate(0deg)"})}>`),w(t,{Icon:Yt}),t.push("<!----></span> "),P(t,{message:i.metadata?.title||"",render_markdown:s$1,latex_delimiters:n,sanitize_html:u,allow_tags:h||false}),t.push("<!----> "),i.metadata?.status==="pending"?(t.push("<!--[-->"),t.push('<span class="loading-spinner svelte-18cn3o3"></span>')):t.push("<!--[!-->"),t.push("<!--]--> "),i?.metadata?.log||i?.metadata?.duration?(t.push("<!--[-->"),t.push('<span class="duration svelte-18cn3o3">'),i.metadata.log?(t.push("<!--[-->"),t.push(`${escape_html(i.metadata.log)}`)):t.push("<!--[!-->"),t.push("<!--]--> "),i.metadata.duration!==void 0?(t.push("<!--[-->"),t.push("("),Number.isInteger(i.metadata.duration)?(t.push("<!--[-->"),t.push(`${escape_html(i.metadata.duration)}s`)):(t.push("<!--[!-->"),i.metadata.duration>=.1?(t.push("<!--[-->"),t.push(`${escape_html(i.metadata.duration.toFixed(1))}s`)):(t.push("<!--[!-->"),t.push(`${escape_html((i.metadata.duration*1e3).toFixed(1))}ms`)),t.push("<!--]-->")),t.push("<!--]-->)")):t.push("<!--[!-->"),t.push("<!--]--></span>")):t.push("<!--[!-->"),t.push("<!--]--></div> "),t.push("<!--[!-->"),t.push("<!--]--></div>");});}function bl(e,l){e.component(t=>{let o=l.value,u=l.avatar_img,n=fallback(l.opposite_avatar_img,null),s$1=fallback(l.role,"user"),h=fallback(l.messages,()=>[],true),c$1=l.layout,i=l.render_markdown,p=l.latex_delimiters,_=l.sanitize_html,v=l.selectable,y=l._fetch,r=l.rtl,L=l.dispatch,z=l.i18n,M=l.line_breaks,k=l.upload,x=l.target,V=l.theme_mode,B=l._components,A=l.i,j=l.show_copy_button,U=l.generating,f=l.feedback_options,S=l.show_like,W=l.show_edit,T=l.show_retry,K=l.show_undo,Q=l.handle_action,X=l.scroll,O=l.allow_file_downloads,P=l.in_edit_mode,R=l.edit_messages,Z=l.display_consecutive_in_same_bubble,q=fallback(l.current_feedback,null),J=fallback(l.allow_tags,false),Y=fallback(l.watermark,null),G=[],$=Array(h.length).fill(160),tt=Array(h.length).fill(0);function ot(d){return d.type==="text"?d.content:d.type==="component"&&d.content.component==="file"?Array.isArray(d.content.value)?`file of extension type: ${d.content.value[0].orig_name?.split(".").pop()}`:`file of extension type: ${d.content.value?.orig_name?.split(".").pop()}`+(d.content.value?.orig_name??""):`a component of type ${d.content.component??"unknown"}`}function lt(d){for(const b of d)if(b.type==="component"&&(b.content.component==="audio"||b.content.component==="video"||b.content.component==="image"||b.content.component==="file")&&b.content.value)return b.content.value;return null}let N;if(P){const d=G.length-h.length;for(let b=d;b<G.length;b++)b>=0&&($[b-d]=G[b]?.clientWidth,tt[b-d]=G[b]?.clientHeight);}N={handle_action:Q,likeable:S,feedback_options:f,show_retry:T,show_undo:K,show_edit:W,in_edit_mode:P,generating:U,show_copy_button:j,message:h,position:s$1==="user"?"right":"left",avatar:u,layout:c$1,dispatch:L,current_feedback:q,watermark:Y,file:lt(h),show_download_button:O,show_share_button:true},t.push(`<div${attr_class(`message-row ${stringify(c$1)} ${stringify(s$1)}-row`,"svelte-1nr59td",{with_avatar:u!==null,with_opposite_avatar:n!==null})}>`),u!==null?(t.push("<!--[-->"),t.push('<div class="avatar-container svelte-1nr59td">'),c(t,{src:u?.url}),t.push("<!----></div>")):t.push("<!--[!-->"),t.push(`<!--]--> <div${attr_class("flex-wrap svelte-1nr59td",void 0,{role:s$1,"component-wrap":h[0].type==="component"})}><div${attr_class(clsx(Z?s$1:""),"svelte-1nr59td",{message:Z})}><!--[-->`);const at=ensure_array_like(h);for(let d=0,b=at.length;d<b;d++){let C=at[d];if(t.push(`<div${attr_class(`message ${stringify(Z?"":s$1)}`,"svelte-1nr59td",{"panel-full-width":true,"message-markdown-disabled":!i,component:C.type==="component",html:sl(C)&&C.content.component==="html",thought:d>0})}>`),P&&C.type==="text"){t.push("<!--[-->"),t.push(`<textarea class="edit-textarea svelte-1nr59td" autofocus${attr_style("",{width:`max(${$[d]}px, 160px)`,"min-height":`${tt[d]}px`})}>`);const st=escape_html(R[d]);st&&t.push(`${st}`),t.push("</textarea>");}else t.push("<!--[!-->"),t.push(`<div${attr("data-testid",s$1)}${attr("dir",r?"rtl":"ltr")}${attr("aria-label",s$1+"'s message: "+ot(C))}${attr_class("svelte-1nr59td",void 0,{latest:A===o.length-1,"message-markdown-disabled":!i,selectable:v})}${attr_style("",{"user-select":"text",cursor:v?"pointer":"auto","text-align":r?"right":"left"})}>`),C?.metadata?.title?(t.push("<!--[-->"),gl(t,{thought:C,sanitize_html:_,allow_tags:J,latex_delimiters:p,render_markdown:i})):(t.push("<!--[!-->"),vl(t,{message:C,sanitize_html:_,allow_tags:J,latex_delimiters:p,render_markdown:i,_components:B,upload:k,thought_index:d,target:x,theme_mode:V,_fetch:y,scroll:X,allow_file_downloads:O,display_consecutive_in_same_bubble:Z,i18n:z,line_breaks:M})),t.push("<!--]--></div>");t.push("<!--]--></div> "),c$1==="panel"?(t.push("<!--[-->"),rt(t,spread_props([N,{current_feedback:q,watermark:Y,i18n:z}]))):t.push("<!--[!-->"),t.push("<!--]-->");}t.push("<!--]--></div></div></div> "),c$1==="bubble"?(t.push("<!--[-->"),rt(t,spread_props([N,{i18n:z}]))):t.push("<!--[!-->"),t.push("<!--]-->"),bind_props(l,{value:o,avatar_img:u,opposite_avatar_img:n,role:s$1,messages:h,layout:c$1,render_markdown:i,latex_delimiters:p,sanitize_html:_,selectable:v,_fetch:y,rtl:r,dispatch:L,i18n:z,line_breaks:M,upload:k,target:x,theme_mode:V,_components:B,i:A,show_copy_button:j,generating:U,feedback_options:f,show_like:S,show_edit:W,show_retry:T,show_undo:K,handle_action:Q,scroll:X,allow_file_downloads:O,in_edit_mode:P,edit_messages:R,display_consecutive_in_same_bubble:Z,current_feedback:q,allow_tags:J,watermark:Y});});}function Ct(e,l){e.component(t=>{let o=fallback(l.layout,"bubble"),u=fallback(l.avatar_images,()=>[null,null],true);t.push('<div class="container svelte-stpvyx">'),u[1]!==null?(t.push("<!--[-->"),t.push('<div class="avatar-container svelte-stpvyx">'),c(t,{src:u[1].url}),t.push("<!----></div>")):t.push("<!--[!-->"),t.push(`<!--]--> <div${attr_class(`message bot pending ${stringify(o)}`,"svelte-stpvyx",{with_avatar:u[1]!==null,with_opposite_avatar:u[0]!==null})} role="status" aria-label="Loading response" aria-live="polite"><div class="message-content svelte-stpvyx"><span class="sr-only svelte-stpvyx">Loading content</span> <div class="dots svelte-stpvyx"><div class="dot svelte-stpvyx"></div> <div class="dot svelte-stpvyx"></div> <div class="dot svelte-stpvyx"></div></div></div></div></div>`),bind_props(l,{layout:o,avatar_images:u});});}function wl(e,l){e.component(t$1=>{let o=fallback(l.examples,null),u=fallback(l.placeholder,null),n=l.latex_delimiters;if(t$1.push('<div class="placeholder-content svelte-1rn3hyj" role="complementary">'),u!==null?(t$1.push("<!--[-->"),t$1.push('<div class="placeholder svelte-1rn3hyj">'),P(t$1,{message:u,latex_delimiters:n}),t$1.push("<!----></div>")):t$1.push("<!--[!-->"),t$1.push("<!--]--> "),o!==null){t$1.push("<!--[-->"),t$1.push('<div class="examples svelte-1rn3hyj" role="list"><!--[-->');const s$1=ensure_array_like(o);for(let h=0,c$1=s$1.length;h<c$1;h++){let i$1=s$1[h];if(t$1.push(`<button class="example svelte-1rn3hyj"${attr("aria-label",`Select example ${h+1}: ${i$1.display_text||i$1.text}`)}><div class="example-content svelte-1rn3hyj">`),i$1?.icon?.url)t$1.push("<!--[-->"),t$1.push('<div class="example-image-container svelte-1rn3hyj">'),c(t$1,{src:i$1.icon.url}),t$1.push("<!----></div>");else {if(t$1.push("<!--[!-->"),i$1?.icon?.mime_type==="text")t$1.push("<!--[-->"),t$1.push('<div class="example-icon svelte-1rn3hyj" aria-hidden="true"><span class="text-icon-aa svelte-1rn3hyj">Aa</span></div>');else {if(t$1.push("<!--[!-->"),i$1.files!==void 0&&i$1.files.length>0){if(t$1.push("<!--[-->"),i$1.files.length>1){t$1.push("<!--[-->"),t$1.push('<div class="example-icons-grid svelte-1rn3hyj" role="group" aria-label="Example attachments"><!--[-->');const p=ensure_array_like(i$1.files.slice(0,4));for(let _=0,v=p.length;_<v;_++){let y=p[_];y.mime_type?.includes("image")?(t$1.push("<!--[-->"),t$1.push('<div class="example-image-container svelte-1rn3hyj">'),c(t$1,{src:y.url,alt:y.orig_name||`Example image ${_+1}`}),t$1.push("<!----> "),_===3&&i$1.files.length>4?(t$1.push("<!--[-->"),t$1.push(`<div class="image-overlay svelte-1rn3hyj" role="status"${attr("aria-label",`${i$1.files.length-4} more files`)}>+${escape_html(i$1.files.length-4)}</div>`)):t$1.push("<!--[!-->"),t$1.push("<!--]--></div>")):(t$1.push("<!--[!-->"),y.mime_type?.includes("video")?(t$1.push("<!--[-->"),t$1.push(`<div class="example-image-container svelte-1rn3hyj"><video class="example-image"${attr("src",y.url)} aria-hidden="true"></video> `),_===3&&i$1.files.length>4?(t$1.push("<!--[-->"),t$1.push(`<div class="image-overlay svelte-1rn3hyj" role="status"${attr("aria-label",`${i$1.files.length-4} more files`)}>+${escape_html(i$1.files.length-4)}</div>`)):t$1.push("<!--[!-->"),t$1.push("<!--]--></div>")):(t$1.push("<!--[!-->"),t$1.push(`<div class="example-icon svelte-1rn3hyj"${attr("aria-label",`File: ${y.orig_name}`)}>`),y.mime_type?.includes("audio")?(t$1.push("<!--[-->"),t(t$1)):(t$1.push("<!--[!-->"),i(t$1)),t$1.push("<!--]--></div>")),t$1.push("<!--]-->")),t$1.push("<!--]-->");}t$1.push("<!--]--> "),i$1.files.length>4?(t$1.push("<!--[-->"),t$1.push(`<div class="example-icon svelte-1rn3hyj"><div class="file-overlay svelte-1rn3hyj" role="status"${attr("aria-label",`${i$1.files.length-4} more files`)}>+${escape_html(i$1.files.length-4)}</div></div>`)):t$1.push("<!--[!-->"),t$1.push("<!--]--></div>");}else t$1.push("<!--[!-->"),i$1.files[0].mime_type?.includes("image")?(t$1.push("<!--[-->"),t$1.push('<div class="example-image-container svelte-1rn3hyj">'),c(t$1,{src:i$1.files[0].url,alt:i$1.files[0].orig_name||"Example image"}),t$1.push("<!----></div>")):(t$1.push("<!--[!-->"),i$1.files[0].mime_type?.includes("video")?(t$1.push("<!--[-->"),t$1.push(`<div class="example-image-container svelte-1rn3hyj"><video class="example-image"${attr("src",i$1.files[0].url)} aria-hidden="true"></video></div>`)):(t$1.push("<!--[!-->"),i$1.files[0].mime_type?.includes("audio")?(t$1.push("<!--[-->"),t$1.push(`<div class="example-icon svelte-1rn3hyj"${attr("aria-label",`File: ${i$1.files[0].orig_name}`)}>`),t(t$1),t$1.push("<!----></div>")):(t$1.push("<!--[!-->"),t$1.push(`<div class="example-icon svelte-1rn3hyj"${attr("aria-label",`File: ${i$1.files[0].orig_name}`)}>`),i(t$1),t$1.push("<!----></div>")),t$1.push("<!--]-->")),t$1.push("<!--]-->")),t$1.push("<!--]-->");t$1.push("<!--]-->");}else t$1.push("<!--[!-->");t$1.push("<!--]-->");}t$1.push("<!--]-->");}t$1.push(`<!--]--> <div class="example-text-content svelte-1rn3hyj"><span class="example-text svelte-1rn3hyj">${escape_html(i$1.display_text||i$1.text)}</span></div></div></button>`);}t$1.push("<!--]--></div>");}else t$1.push("<!--[!-->");t$1.push("<!--]--></div>"),bind_props(l,{examples:o,placeholder:u,latex_delimiters:n});});}function yl(e$1,l){e$1.component(t=>{let o=false,u=l.value,n=fallback(l.watermark,null),s$1;function h$1(){o=true,s$1&&clearTimeout(s$1),s$1=setTimeout(()=>{o=false;},1e3);}const c=()=>{if(u){const p=u.map(v=>v.type==="text"?`${v.role}: ${v.content}`:`${v.role}: ${v.content.value.url}`).join(`

`),_=n?`${p}

${n}`:p;navigator.clipboard.writeText(_).catch(v=>{console.error("Failed to copy conversation: ",v);});}};async function i(){"clipboard"in navigator&&(c(),h$1());}onDestroy(()=>{s$1&&clearTimeout(s$1);}),w(t,{Icon:o?e:h,onclick:i,label:o?"Copied conversation":"Copy conversation"}),bind_props(l,{value:u,watermark:n});});}function kl(e,l){e.component(t=>{let o,u$1,n=fallback(l.value,()=>[],true),s$1=null,h=l._fetch,c=l.load_component,i=l.allow_file_downloads,p=l.display_consecutive_in_same_bubble,_={};const v=typeof window<"u";async function y$1(){_=await ol(kt(n),_,c);}let r$1=l.latex_delimiters,L=fallback(l.pending_message,false),z=fallback(l.generating,false),M=fallback(l.selectable,false),k=fallback(l.likeable,false),x=l.feedback_options,V=fallback(l.feedback_value,null),B=fallback(l.editable,null),A=fallback(l.show_share_button,false),j=fallback(l.show_copy_all_button,false),U=fallback(l.rtl,false),f=fallback(l.show_copy_button,false),S=fallback(l.buttons,null),W=fallback(l.on_custom_button_click,null),T=fallback(l.avatar_images,()=>[null,null],true),K=fallback(l.sanitize_html,true),Q=fallback(l.render_markdown,true),X=fallback(l.line_breaks,true),O=fallback(l.autoscroll,true),P=l.theme_mode,R=l.i18n,Z=fallback(l.layout,"bubble"),q=fallback(l.placeholder,null),J=l.upload,Y=fallback(l.examples,null),G=fallback(l._retryable,false),$=fallback(l._undoable,false),tt=fallback(l.like_user_message,false),ot=fallback(l.allow_tags,false),lt=fallback(l.watermark,null),N=fallback(l.show_progress,"full"),at=null,d$1=null,b=[];const C=createEventDispatcher();async function st(){}function gt(m,H,g){if(g==="undo"||g==="retry"){const I=n;let w=I.length-1;for(;I[w].role==="assistant";)w--;C(g,{index:I[w].index,value:I[w].content});}else if(g=="edit")d$1=m,b.push(H.content);else if(g=="edit_cancel")d$1=null;else if(g=="edit_submit")d$1=null,C("edit",{index:H.index,_dispatch_value:[{type:"text",text:b[m].slice()}],value:b[m].slice(),previous_value:H.content});else {let I=g==="Like"?true:g==="Dislike"?false:g||"";if(!o)return;const w=o[m],[E]=[w[0],w[w.length-1]];C("like",{index:E.index,value:w.map(ut=>ut.content),liked:I});}}function Vt(){if(!n||!o||o.length===0)return;const m=o[o.length-1];if(m[0].role==="assistant")return m[m.length-1].options}kt(n).sort().join(", "),y$1(),(n||L||_)&&st(),u$2(n,s$1)||(s$1=n,C("change")),o=n&&el(n,p),u$1=n&&Vt();let it=true,nt;function Lt(m){if(n!==null&&n.length>0?(m.push("<!--[-->"),y(m,{buttons:S,on_custom_button_click:W,children:H=>{A?(H.push("<!--[-->"),w(H,{Icon:u,onclick:async()=>{try{const g=await Qt(n);C("share",{description:g});}catch(g){console.error(g);g instanceof d?g.message:"Share failed.";}}})):H.push("<!--[!-->"),H.push("<!--]--> "),w(H,{Icon:r,onclick:()=>C("clear"),label:R("chatbot.clear")}),H.push("<!----> "),j?(H.push("<!--[-->"),yl(H,{value:n,watermark:lt})):H.push("<!--[!-->"),H.push("<!--]-->");}})):m.push("<!--[!-->"),m.push(`<!--]--> <div${attr_class(clsx(Z==="bubble"?"bubble-wrap":"panel-wrap"),"svelte-kpz1")} role="log" aria-label="chatbot conversation" aria-live="polite">`),n!==null&&n.length>0&&o!==null){m.push("<!--[-->"),m.push('<div class="message-wrap svelte-kpz1"><!--[-->');const H=ensure_array_like(o);for(let g=0,I=H.length;g<I;g++){let w=H[g];const E=w[0].role==="user"?"user":"bot",ut=T[E==="user"?0:1],zt=T[E==="user"?0:1],bt=o.slice(0,g).filter(F=>F[0].role==="assistant").length,At=E==="bot"&&V&&V[bt]?V[bt]:null;bl(m,{messages:w,display_consecutive_in_same_bubble:p,opposite_avatar_img:zt,avatar_img:ut,role:E,layout:Z,dispatch:C,i18n:R,_fetch:h,line_breaks:X,theme_mode:P,target:at,upload:J,selectable:M,sanitize_html:K,render_markdown:Q,rtl:U,i:g,value:n,latex_delimiters:r$1,_components:_,generating:z,feedback_options:x,current_feedback:At,allow_tags:ot,watermark:lt,show_like:E==="user"?k&&tt:k,show_retry:G&&yt(w,n),show_undo:$&&yt(w,n),show_edit:B==="all"||B=="user"&&E==="user"&&w.length>0&&w[w.length-1].type=="text",in_edit_mode:d$1===g,show_copy_button:f,handle_action:F=>{F=="edit"&&b.splice(0,b.length),F==="edit"||F==="edit_submit"?w.forEach((It,Dt)=>{gt(F==="edit"?g:Dt,It,F);}):gt(g,w[0],F);},scroll:v?scroll:()=>{},allow_file_downloads:i,get edit_messages(){return b},set edit_messages(F){b=F,it=false;}}),m.push("<!----> "),N!=="hidden"&&z&&w[w.length-1].role==="assistant"&&w[w.length-1].metadata?.status==="done"?(m.push("<!--[-->"),Ct(m,{layout:Z,avatar_images:T})):m.push("<!--[!-->"),m.push("<!--]-->");}if(m.push("<!--]--> "),N!=="hidden"&&L)m.push("<!--[-->"),Ct(m,{layout:Z,avatar_images:T});else {if(m.push("<!--[!-->"),u$1){m.push("<!--[-->"),m.push('<div class="options svelte-kpz1"><!--[-->');const g=ensure_array_like(u$1);for(let I=0,w=g.length;I<w;I++){let E=g[I];m.push(`<button class="option svelte-kpz1">${escape_html(E.label||E.value)}</button>`);}m.push("<!--]--></div>");}else m.push("<!--[!-->");m.push("<!--]-->");}m.push("<!--]--></div>");}else m.push("<!--[!-->"),wl(m,{examples:Y,placeholder:q,latex_delimiters:r$1});m.push("<!--]--></div> "),m.push("<!--[!-->"),m.push("<!--]-->");}do it=true,nt=t.copy(),Lt(nt);while(!it);t.subsume(nt),bind_props(l,{value:n,_fetch:h,load_component:c,allow_file_downloads:i,display_consecutive_in_same_bubble:p,latex_delimiters:r$1,pending_message:L,generating:z,selectable:M,likeable:k,feedback_options:x,feedback_value:V,editable:B,show_share_button:A,show_copy_all_button:j,rtl:U,show_copy_button:f,buttons:S,on_custom_button_click:W,avatar_images:T,sanitize_html:K,render_markdown:Q,line_breaks:X,autoscroll:O,theme_mode:P,i18n:R,layout:Z,placeholder:q,upload:J,examples:Y,_retryable:G,_undoable:$,like_user_message:tt,allow_tags:ot,watermark:lt,show_progress:N});});}function Ql(e,l){e.component(t=>{let{$$slots:o,$$events:u,...n}=l;const s$1=new g(n);let h=al(s$1.props.value,s$1.shared.root),c=s$1.shared.loading_status.status==="error"?"full":s$1.shared.loading_status.show_progress==="hidden"?"hidden":"minimal";G(t,{elem_id:s$1.shared.elem_id,elem_classes:s$1.shared.elem_classes,visible:s$1.shared.visible,padding:false,scale:s$1.shared.scale,min_width:s$1.shared.min_width,height:s$1.props.height,resizable:s$1.props.resizable,min_height:s$1.props.min_height,max_height:s$1.props.max_height,allow_overflow:true,flex:true,overflow_behavior:"auto",rtl:s$1.props.rtl,children:i=>{s$1.shared.loading_status?(i.push("<!--[-->"),R(i,spread_props([{autoscroll:s$1.shared.autoscroll,i18n:s$1.i18n},s$1.shared.loading_status,{show_progress:c,on_clear_status:()=>s$1.dispatch("clear_status",s$1.shared.loading_status)}]))):i.push("<!--[!-->"),i.push('<!--]--> <div class="wrapper svelte-1wizwbi">'),s$1.shared.show_label?(i.push("<!--[-->"),k(i,{show_label:s$1.shared.show_label,Icon:Jt,float:true,label:s$1.shared.label||"Chatbot"})):i.push("<!--[!-->"),i.push("<!--]--> "),kl(i,{i18n:s$1.i18n,selectable:s$1.props._selectable,likeable:s$1.props.likeable,feedback_options:s$1.props.feedback_options,feedback_value:s$1.props.feedback_value,show_share_button:(s$1.props.buttons??["share"]).some(p=>typeof p=="string"&&p==="share"),show_copy_all_button:(s$1.props.buttons??["copy_all"]).some(p=>typeof p=="string"&&p==="copy_all"),value:h,latex_delimiters:s$1.props.latex_delimiters,display_consecutive_in_same_bubble:s$1.props.group_consecutive_messages,render_markdown:s$1.props.render_markdown,theme_mode:s$1.shared.theme_mode,editable:s$1.props.editable,pending_message:s$1.shared.loading_status?.status==="pending",generating:s$1.shared.loading_status?.status==="generating",rtl:s$1.props.rtl,show_copy_button:(s$1.props.buttons??["copy"]).some(p=>typeof p=="string"&&p==="copy"),buttons:s$1.props.buttons,on_custom_button_click:p=>{s$1.dispatch("custom_button_click",{id:p});},like_user_message:s$1.props.like_user_message,show_progress:s$1.shared.loading_status?.show_progress||"full",avatar_images:s$1.props.avatar_images,sanitize_html:s$1.props.sanitize_html,line_breaks:s$1.props.line_breaks,autoscroll:s$1.props.autoscroll,layout:s$1.props.layout,placeholder:s$1.props.placeholder,examples:s$1.props.examples,_retryable:s$1.props._retryable,_undoable:s$1.props._undoable,upload:(...p)=>s$1.shared.client.upload(...p),_fetch:(...p)=>s$1.shared.client.fetch(...p),load_component:s$1.shared.load_component,allow_file_downloads:s$1.props.allow_file_downloads,allow_tags:s$1.props.allow_tags,watermark:s$1.props.watermark}),i.push("<!----></div>");},$$slots:{default:true}});});}

export { kl as BaseChatBot, Ql as default };
//# sourceMappingURL=Index57-BoU81WXK.js.map
