import"./svelte/svelte_internal_flags_legacy.js";import"./svelte/svelte_internal_flags_async.js";import*as e from"./svelte/svelte_internal_client.js";import{onDestroy as w}from"./svelte/svelte_svelte.js";var j=e.from_html('<div class="gradio-bokeh svelte-dz29a8"></div>');function C(b,a){e.push(a,!1);const i=e.mutable_source();let r=e.prop(a,"value",12),o=e.prop(a,"bokeh_version",12);const n=`bokehDiv-${Math.random().toString(5).substring(2)}`;async function f(t){if(document&&document.getElementById(n)&&(document.getElementById(n).innerHTML=""),window.Bokeh){u();let l=JSON.parse(t);await window.Bokeh.embed.embed_item(l,n)}}const p=`https://cdn.bokeh.org/bokeh/release/bokeh-${o()}.min.js`,k=[`https://cdn.pydata.org/bokeh/release/bokeh-widgets-${o()}.min.js`,`https://cdn.pydata.org/bokeh/release/bokeh-tables-${o()}.min.js`,`https://cdn.pydata.org/bokeh/release/bokeh-gl-${o()}.min.js`,`https://cdn.pydata.org/bokeh/release/bokeh-api-${o()}.min.js`];let d=e.mutable_source(!1);async function g(){await Promise.all(k.map((t,l)=>new Promise(y=>{const s=document.createElement("script");return s.onload=y,s.src=t,document.head.appendChild(s),s}))),e.set(d,!0)}let h=[];function m(){h=g()}function u(){const t=document.createElement("script");return t.onload=m,t.src=p,document.head.querySelector(`script[src="${p}"]`)?m():document.head.appendChild(t),t}const _=o()?u():null;w(()=>{_ in document.children&&(document.removeChild(_),h.forEach(t=>document.removeChild(t)))}),e.legacy_pre_effect(()=>e.deep_read_state(r()),()=>{e.set(i,r()?.plot)}),e.legacy_pre_effect(()=>(e.get(d),e.get(i)),()=>{e.get(d)&&f(e.get(i))}),e.legacy_pre_effect_reset();var v={get value(){return r()},set value(t){r(t),e.flush()},get bokeh_version(){return o()},set bokeh_version(t){o(t),e.flush()}};e.init();var c=j();return e.set_attribute(c,"data-testid","bokeh"),e.template_effect(()=>e.set_attribute(c,"id",n)),e.append(b,c),e.pop(v)}export{C as default};
