import"./svelte/svelte_internal_flags_async.js";import*as e from"./svelte/svelte_internal_client.js";import{tick as B}from"./svelte/svelte_svelte.js";import"./i18n-CqG9A4Dp.js";import{b as G,c as C,G as L,s as P}from"./utils.svelte-kG009vb9.js";import{e as F,j as W,k as q,I as A,B as D,u as H}from"./ScrollFade-DGw40oqj.js";import"./svelte/svelte_internal_flags_legacy.js";import{M as J}from"./MarkdownCode-VTUoaX6K.js";import{S as K}from"./StreamingBar-Hli-vaRZ.js";import{default as be}from"./Example-CzyVlH6V.js";import"./svelte/svelte_store.js";import"./index-aMLoRFR_.js";import"./svelte/svelte_animate.js";import"./svelte/svelte_attachments.js";import"./svelte/svelte_easing.js";import"./svelte/svelte_internal_flags_tracing.js";import"./svelte/svelte_internal_server.js";import"./svelte/svelte_legacy.js";import"./svelte/svelte_motion.js";import"./svelte/svelte_reactivity.js";import"./svelte/svelte_reactivity_window.js";import"./svelte/svelte_server.js";import"./svelte/svelte_transition.js";import"./svelte/svelte_events.js";import"./prism-python-BRxZ6l4O.js";var N=e.from_html('<div data-testid="markdown"><!> <!></div>');function O(m,r){e.push(r,!0);let g=e.prop(r,"elem_classes",19,()=>[]),t=e.prop(r,"visible",3,!0),o=e.prop(r,"min_height",3,void 0),c=e.prop(r,"rtl",3,!1),d=e.prop(r,"sanitize_html",3,!0),n=e.prop(r,"line_breaks",3,!1),k=e.prop(r,"latex_delimiters",19,()=>[]),h=e.prop(r,"header_links",3,!1),p=e.prop(r,"height",3,void 0),l=e.prop(r,"show_copy_button",3,!1),_=e.prop(r,"loading_status",3,void 0),f=e.prop(r,"onchange",3,()=>{}),v=e.prop(r,"oncopy",3,a=>{}),i=e.state(!1),u;e.user_effect(()=>{r.value&&f()()});async function I(){"clipboard"in navigator&&(await navigator.clipboard.writeText(r.value),v()({value:r.value}),M())}function M(){e.set(i,!0),u&&clearTimeout(u),u=setTimeout(()=>{e.set(i,!1)},1e3)}var s=N();let y,w;var x=e.child(s);{var j=a=>{F(a,{children:(b,z)=>{{let S=e.derived(()=>e.get(i)?W:q),T=e.derived(()=>e.get(i)?"Copied conversation":"Copy conversation");A(b,{get Icon(){return e.get(S)},onclick:I,get label(){return e.get(T)}})}},$$slots:{default:!0}})};e.if(x,a=>{l()&&a(j)})}var E=e.sibling(x,2);J(E,{get message(){return r.value},get latex_delimiters(){return k()},get sanitize_html(){return d()},get line_breaks(){return n()},chatbot:!1,get header_links(){return h()},get theme_mode(){return r.theme_mode}}),e.reset(s),e.action(s,a=>G?.(a)),e.template_effect((a,b,z)=>{y=e.set_class(s,1,`prose ${a??""}`,"svelte-1xjkzpp",y,{hide:!t()}),e.set_attribute(s,"dir",c()?"rtl":"ltr"),w=e.set_style(s,b,w,z),s.dir=s.dir},[()=>g()?.join(" ")||"",()=>p()?`max-height: ${C(p())}; overflow-y: auto;`:"",()=>({"min-height":o()&&_()?.status!=="pending"?C(o()):void 0})]),e.append(m,s),e.pop()}var Q=e.from_html("<!> <div><!></div> <!>",1);function ge(m,r){e.push(r,!0);let g=e.rest_props(r,["$$slots","$$events","$$legacy"]);const t=new L(g);let o,c=e.state(!1);function d(){t.props.height&&e.set(c,P(o?.closest(".block")),!0)}e.user_effect(()=>{const n=o?.closest(".block");if(!(!n||!t.props.height))return n.addEventListener("scroll",d),B().then(d),()=>n.removeEventListener("scroll",d)}),e.user_effect(()=>{t.props.value!==void 0&&B().then(d)}),D(m,{get visible(){return t.shared.visible},get elem_id(){return t.shared.elem_id},get elem_classes(){return t.shared.elem_classes},get container(){return t.shared.container},allow_overflow:!0,overflow_behavior:"auto",get height(){return t.props.height},get min_height(){return t.props.min_height},get max_height(){return t.props.max_height},get rtl(){return t.props.rtl},children:(n,k)=>{var h=Q(),p=e.first_child(h);K(p,e.spread_props({get autoscroll(){return t.shared.autoscroll},get i18n(){return t.i18n}},()=>t.shared.loading_status,{variant:"center",on_clear_status:()=>t.dispatch("clear_status",t.shared.loading_status)}));var l=e.sibling(p,2);let _;var f=e.child(l);{let i=e.derived(()=>t.props.buttons?.includes("copy"));O(f,{get value(){return t.props.value},get elem_classes(){return t.shared.elem_classes},get visible(){return t.shared.visible},get rtl(){return t.props.rtl},onchange:()=>t.dispatch("change"),oncopy:u=>t.dispatch("copy",u.detail),get latex_delimiters(){return t.props.latex_delimiters},get sanitize_html(){return t.props.sanitize_html},get line_breaks(){return t.props.line_breaks},get header_links(){return t.props.header_links},get show_copy_button(){return e.get(i)},get loading_status(){return t.shared.loading_status},get theme_mode(){return t.shared.theme_mode}})}e.reset(l),e.bind_this(l,i=>o=i,()=>o);var v=e.sibling(l,2);H(v,{get visible(){return e.get(c)}}),e.template_effect(()=>_=e.set_class(l,1,"svelte-16ln60g",null,_,{padding:t.props.padding,pending:t.shared.loading_status?.status==="pending"})),e.append(n,h)},$$slots:{default:!0}}),e.pop()}export{be as BaseExample,O as BaseMarkdown,ge as default};
