1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ApiDocs-DQo31dam.js","./i18n-dpAHICcw.js","./index-CDZuCcOm.js","./index-DYz7DaJH.css","./i18n-UT_CQGRO.css","./misc-C2MjMwBX.js","./clear-BmkSFlMn.js","./Button-DxE-syeF.js","./snippet-DVkMfmSq.js","./Image-CJziNDBt.js","./Image-DQfoGqtb.css","./ScrollFade.svelte_svelte_type_style_lang-DUvCSfRk.js","./ScrollFade-DXC81vHi.css","./MarkdownCode.svelte_svelte_type_style_lang-GeNUGzep.js","./prism-python-C_fanlsZ.js","./MarkdownCode-Dptk5bYK.css","./Button-CoUFCYL9.css","./ImagePreview-CAbFrrhc.css","./index-DyDpuTN9.js","./StreamingBar.svelte_svelte_type_style_lang-BxBb9ZZb.js","./html-h_YSgefI.js","./StreamingBar-M0OJiclA.css","./Clear-tvJMRS4J.js","./Block-DntE23uJ.js","./input-UUW65DyE.js","./size-CuuZBRle.js","./state.svelte-C1bUJRNp.js","./utils.svelte-CyWLYi-B.js","./clone-dZfS06Ds.js","./index-TgpgEQ1v.js","./index-DnoGeqVF.js","./ApiDocs-CKt-ueZo.css","./ApiRecorder-CKeb98-b.js","./ApiRecorder-CY6I4tgj.css","./Settings-BzudOKzS.js","./Dropdown-BusLCoow.js","./window-DwfrWsjF.js","./BlockTitle-Xgz-MKYS.js","./Info-CLoErKII.js","./MarkdownCode-Q694H4-C.js","./DropdownArrow-BRSpwupS.js","./IconButtonWrapper-KjCt2Pl8.js","./Dropdown-_c0K7TyY.css","./Checkbox-DC-W5bhf.js","./Checkbox-CJBAs2gn.css","./Settings-BwGmMS8d.css","./Example-ml6sVHU8.css","./Index-BTvJwxZP.js","./Code-DOAk_c7w.js","./Code-DSw5753G.css","./Index.svelte_svelte_type_style_lang-BiEA8pBL.js","./actions-BTh6ZJJ8.js","./Check-4kogBHUX.js","./Copy-C8W4pNlO.js","./Index-BEAewkRY.css","./Index-Dm9eNXb9.css","./Example-ZgyKzkPU.css","./Example-CNix_cQb.css"])))=>i.map(i=>d[i]); 2import { aO as get_boundary, M as current_batch, aP as flatten, h as hydrating, as as set_hydrating, s as set_hydrate_node, i as hydrate_node, w as get, e as hydrate_next, aK as skip_nodes, ap as create_text, p as block, aQ as HEAD_EFFECT, C as COMMENT_NODE, j as get_next_sibling, g as get_first_child, R as push, aR as run, aS as async_derived, u as state, y as user_effect, aT as run_after_blockers, a as append, T as pop, W as from_html, x as set, a6 as comment, S as first_child, v as proxy, z as untrack, ab as onMount, X as sibling, t as template_effect, a5 as user_derived, ag as __vitePreload, V as child, a0 as set_text, Z as event, aU as deferred_template_effect, Y as reset, aV as $document, a7 as text } from './index-CDZuCcOm.js'; 3import { d as bind_this, k as each, u as index, i as if_block, g as spread_props, r as rest_props, O as derived, z as $format, j as get$1, P as AsyncFunction, p as prop, f as set_style, q as store_get, m as setup_stores, b as set_class, a as set_attribute, w as writable, A as prefix_css } from './i18n-dpAHICcw.js'; 4import { h as html } from './html-h_YSgefI.js'; 5import { c as component } from './ScrollFade.svelte_svelte_type_style_lang-DUvCSfRk.js'; 6import { b as bind_element_size } from './size-CuuZBRle.js'; 7import './StreamingBar.svelte_svelte_type_style_lang-BxBb9ZZb.js'; 8import './MarkdownCode.svelte_svelte_type_style_lang-GeNUGzep.js'; 9import { L as LoadingStatus, T as Toast } from './state.svelte-C1bUJRNp.js'; 10import { I as I18N_MARKER, t as translate_i18n_marker } from './utils.svelte-CyWLYi-B.js'; 11import { AppTree } from './index-TgpgEQ1v.js'; 12 13/** @import { TemplateNode, Value } from '#client' */ 14 15/** 16 * @param {TemplateNode} node 17 * @param {Array<Promise<void>>} blockers 18 * @param {Array<() => Promise<any>>} expressions 19 * @param {(anchor: TemplateNode, ...deriveds: Value[]) => void} fn 20 */ 21function async(node, blockers = [], expressions = [], fn) { 22 var boundary = get_boundary(); 23 var batch = /** @type {Batch} */ (current_batch); 24 var blocking = boundary.is_rendered(); 25 26 boundary.update_pending_count(1); 27 batch.increment(blocking); 28 29 var was_hydrating = hydrating; 30 31 if (was_hydrating) { 32 hydrate_next(); 33 34 var previous_hydrate_node = hydrate_node; 35 var end = skip_nodes(false); 36 set_hydrate_node(end); 37 } 38 39 flatten(blockers, [], expressions, (values) => { 40 if (was_hydrating) { 41 set_hydrating(true); 42 set_hydrate_node(previous_hydrate_node); 43 } 44 45 try { 46 // get values eagerly to avoid creating blocks if they reject 47 for (const d of values) get(d); 48 49 fn(node, ...values); 50 } finally { 51 if (was_hydrating) { 52 set_hydrating(false); 53 } 54 55 boundary.update_pending_count(-1);
56 batch.decrement(blocking); 57 } 58 }); 59} 60 61/** @import { TemplateNode } from '#client' */ 62 63/** 64 * @param {string} hash 65 * @param {(anchor: Node) => void} render_fn 66 * @returns {void} 67 */ 68function head(hash, render_fn) { 69 // The head function may be called after the first hydration pass and ssr comment nodes may still be present, 70 // therefore we need to skip that when we detect that we're not in hydration mode. 71 let previous_hydrate_node = null; 72 let was_hydrating = hydrating; 73 74 /** @type {Comment | Text} */ 75 var anchor; 76 77 if (hydrating) { 78 previous_hydrate_node = hydrate_node; 79 80 var head_anchor = get_first_child(document.head); 81 82 // There might be multiple head blocks in our app, and they could have been 83 // rendered in an arbitrary order â find one corresponding to this component 84 while ( 85 head_anchor !== null && 86 (head_anchor.nodeType !== COMMENT_NODE || /** @type {Comment} */ (head_anchor).data !== hash) 87 ) { 88 head_anchor = get_next_sibling(head_anchor); 89 } 90 91 // If we can't find an opening hydration marker, skip hydration (this can happen 92 // if a framework rendered body but not head content) 93 if (head_anchor === null) { 94 set_hydrating(false); 95 } else { 96 var start = /** @type {TemplateNode} */ (get_next_sibling(head_anchor)); 97 head_anchor.remove(); // in case this component is repeated 98 99 set_hydrate_node(start); 100 } 101 } 102 103 if (!hydrating) { 104 anchor = document.head.appendChild(create_text()); 105 } 106 107 try { 108 block(() => render_fn(anchor), HEAD_EFFECT); 109 } finally { 110 if (was_hydrating) { 111 set_hydrating(true); 112 set_hydrate_node(/** @type {TemplateNode} */ (previous_hydrate_node)); 113 } 114 } 115} 116 117var root$1 = from_html(`<span></span>`); 118 119function MountCustomComponent($$anchor, $$props) { 120 push($$props, true); 121 var component, runtime, el; 122 123 var $$promises = run([ 124 async () => component = await async_derived(() => $$props.node.component), 125 async () => runtime = await async_derived(() => $$props.node.runtime), 126 () => el = state(null), 127 () => void user_effect(() => { 128 if (!get(el) || !get(runtime) || !get(component)) return; 129 130 // Read prop references so the effect re-runs when the node is 131 // replaced during a dev reload (new objects are created by 132 // app_tree.reload). 133 const _shared_props = $$props.node.props.shared_props; 134 135 const _props = $$props.node.props.props; 136 const _runtime = get(runtime); 137 138 const mounted = _runtime.mount(get(component).default, { 139 target: get(el), 140 props: { 141 shared_props: _shared_props, 142 props: _props, 143 children: $$props.children 144 } 145 }); 146 147 return () => { 148 _runtime.unmount(mounted); 149 }; 150 }) 151 ]); 152 153 var span = root$1(); 154 155 run_after_blockers([$$promises[2]], () => { 156 bind_this(span, ($$value) => set(el, $$value), () => get(el)); 157 }); 158 159 append($$anchor, span); 160 pop(); 161} 162 163function MountComponents($$anchor, $$props) { 164 push($$props, true); 165 166 let rest = rest_props($$props, ['$$slots', '$$events', '$$legacy', 'node']); 167 var component$1; 168 169 var $$promises = run([ 170 async () => component$1 = await async_derived(() => $$props.node.component) 171 ]); 172 173 var fragment = comment(); 174 var node_1 = first_child(fragment); 175 176 async(node_1, [$$promises[0]], [() => $$props.node && get(component$1)], (node_1, $$condition) => { 177 var consequent_4 = ($$anchor) => { 178 var fragment_1 = comment(); 179 var node_2 = first_child(fragment_1); 180 181 async( 182 node_2, 183 [$$promises[0]], 184 [ 185 () => $$props.node.props.shared_props.visible && !$$props.node.runtime 186 ], 187 (node_2, $$condition) => { 188 var consequent_1 = ($$anchor) => { 189 var fragment_2 = comment(); 190 var node_3 = first_child(fragment_2); 191 192 async(node_3, [$$promises[0]], void 0, ($$anchor) => { 193 component(node_3, () => get(component$1).default, ($$anchor, $$component) => { 194 $$component($$anchor, { 195 get shared_props() { 196 return $$props.node.props.shared_props; 197 }, 198 199 get props() { 200 return $$props.node.props.props; 201 }, 202 203 children: ($$anchor, $$slotProps) => { 204 var fragment_3 = comment(); 205 var node_4 = first_child(fragment_3); 206
207 async(node_4, [$$promises[0]], [() => $$props.node.children && $$props.node.children.length], (node_4, $$condition) => { 208 var consequent = ($$anchor) => { 209 var fragment_4 = comment(); 210 var node_5 = first_child(fragment_4); 211 212 async(node_5, [$$promises[0]], [() => $$props.node.children], (node_5, $$collection) => { 213 each(node_5, 17, () => get($$collection), index, ($$anchor, _node) => { 214 MountComponents($$anchor, { 215 get node() { 216 return get(_node); 217 } 218 }); 219 }); 220 }); 221 222 append($$anchor, fragment_4); 223 }; 224 225 if_block(node_4, ($$render) => { 226 if (get($$condition)) $$render(consequent); 227 }); 228 }); 229 230 append($$anchor, fragment_3); 231 }, 232 $$slots: { default: true } 233 }); 234 }); 235 }); 236 237 append($$anchor, fragment_2); 238 }; 239 240 var alternate = ($$anchor) => { 241 var fragment_6 = comment(); 242 var node_6 = first_child(fragment_6); 243 244 async( 245 node_6, 246 [$$promises[0]], 247 [ 248 () => $$props.node.props.shared_props.visible && $$props.node.runtime 249 ], 250 (node_6, $$condition) => { 251 var consequent_3 = ($$anchor) => { 252 async($$anchor, [$$promises[0]], void 0, ($$anchor) => { 253 MountCustomComponent($$anchor, spread_props(() => rest, { 254 get node() { 255 return $$props.node; 256 }, 257 258 children: ($$anchor, $$slotProps) => { 259 var fragment_8 = comment(); 260 var node_7 = first_child(fragment_8); 261 262 async(node_7, [$$promises[0]], [() => $$props.node.children && $$props.node.children.length], (node_7, $$condition) => { 263 var consequent_2 = ($$anchor) => { 264 var fragment_9 = comment(); 265 var node_8 = first_child(fragment_9); 266 267 async(node_8, [$$promises[0]], [() => $$props.node.children], (node_8, $$collection) => { 268 each(node_8, 17, () => get($$collection), index, ($$anchor, _node) => { 269 MountComponents($$anchor, { 270 get node() { 271 return get(_node); 272 } 273 }); 274 }); 275 }); 276 277 append($$anchor, fragment_9); 278 }; 279 280 if_block(node_7, ($$render) => { 281 if (get($$condition)) $$render(consequent_2); 282 }); 283 }); 284 285 append($$anchor, fragment_8); 286 }, 287 $$slots: { default: true } 288 })); 289 }); 290 }; 291 292 if_block( 293 node_6, 294 ($$render) => { 295 if (get($$condition)) $$render(consequent_3); 296 }, 297 true 298 ); 299 } 300 ); 301 302 append($$anchor, fragment_6); 303 }; 304 305 if_block(node_2, ($$render) => { 306 if (get($$condition)) $$render(consequent_1); else $$render(alternate, false); 307 }); 308 } 309 ); 310 311 append($$anchor, fragment_1); 312 }; 313 314 if_block(node_1, ($$render) => { 315 if (get($$condition)) $$render(consequent_4); 316 }); 317 }); 318 319 append($$anchor, fragment); 320 pop(); 321} 322 323function formatter(value) { 324 if (value == null) { 325 return ""; 326 } 327 const string_value = String(value); 328 const translate = get$1($format); 329 if (string_value.includes(I18N_MARKER)) { 330 return translate_i18n_marker(string_value, translate); 331 } 332 const direct_translation = translate(string_value); 333 if (direct_translation !== string_value) { 334 return direct_translation; 335 } 336 return string_value; 337} 338const reactive_formatter = derived($format, () => formatter); 339 340const logo = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='576'%20height='576'%20viewBox='0%200%20576%20576'%20fill='none'%3e%3cpath%20d='M287.5%20229L86%20344.5L287.5%20460L489%20344.5L287.5%20229Z'%20stroke='url(%23paint0_linear_102_7)'%20stroke-width='59'%20stroke-linejoin='round'/%3e%3cpath%20d='M287.5%20116L86%20231.5L287.5%20347L489%20231.5L287.5%20116Z'%20stroke='url(%23paint1_linear_102_7)'%20stroke-width='59'%20stroke-linejoin='round'/%3e%3cpath%20d='M86%20344L288%20229'%20stroke='url(%23paint2_linear_102_7)'%20stroke-width='59'%20stroke-linejoin='bevel'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_102_7'%20x1='60'%20y1='341'%20x2='429.5'%20y2='344'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F9D100'/%3e%3cstop%20offset='1'%20stop-color='%23F97700'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint1_linear_102_7'%20x1='513.5'%20y1='231'%20x2='143.5'%20y2='231'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F9D100'/%3e%3cstop%20offset='1'%20stop-color='%23F97700'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear_102_7'%20x1='60'%20y1='344'%20x2='428.987'%20y2='341.811'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23F9D100'/%3e%3cstop%20offset='1'%20stop-color='%23F97700'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e"; 341 342const api_logo = "data:image/svg+xml,%3csvg%20width='28'%20height='28'%20viewBox='0%200%2028%2028'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M26.9425%202.94265C27.4632%202.42195%2027.4632%201.57773%2026.9425%201.05703C26.4218%200.536329%2025.5776%200.536329%2025.0569%201.05703L22.5713%203.54256C21.1213%202.59333%2019.5367%202.43378%2018.1753%202.64006C16.5495%202.88638%2015.1127%203.66838%2014.3905%204.39053L12.3905%206.39053C12.1405%206.64058%2012%206.97972%2012%207.33334C12%207.68697%2012.1405%208.0261%2012.3905%208.27615L19.7239%2015.6095C20.2446%2016.1302%2021.0888%2016.1302%2021.6095%2015.6095L23.6095%2013.6095C24.3316%2012.8873%2025.1136%2011.4505%2025.36%209.82475C25.5663%208.46312%2025.4066%206.87827%2024.4571%205.42807L26.9425%202.94265Z'%20fill='%233c4555'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12.276%2012.9426C12.7967%2012.4219%2012.7967%2011.5777%2012.276%2011.057C11.7553%2010.5363%2010.9111%2010.5363%2010.3904%2011.057L8.66651%2012.7809L8.27615%2012.3905C8.0261%2012.1405%207.68697%2012%207.33334%2012C6.97972%2012%206.64058%2012.1405%206.39053%2012.3905L4.39053%2014.3905C3.66838%2015.1127%202.88638%2016.5495%202.64006%2018.1753C2.43377%2019.5367%202.59333%2021.1214%203.54262%2022.5714L1.05703%2025.057C0.536329%2025.5777%200.536329%2026.4219%201.05703%2026.9426C1.57773%2027.4633%202.42195%2027.4633%202.94265%2026.9426L5.42817%2024.4571C6.87835%2025.4066%208.46315%2025.5663%209.82475%2025.36C11.4505%2025.1136%2012.8873%2024.3316%2013.6095%2023.6095L15.6095%2021.6095C16.1302%2021.0888%2016.1302%2020.2446%2015.6095%2019.7239L15.2188%2019.3332L16.9426%2017.6093C17.4633%2017.0886%2017.4633%2016.2444%2016.9426%2015.7237C16.4219%2015.203%2015.5777%2015.203%2015.057%2015.7237L13.3332%2017.4475L10.5521%2014.6665L12.276%2012.9426Z'%20fill='%23FF7C00'/%3e%3c/svg%3e"; 343 344const settings_logo = "data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3c!--%20Outer%20gear%20teeth%20(gray)%20--%3e%3cpath%20d='M19.14%2012.94c.04-.3.06-.61.06-.94%200-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24%200-.43.17-.47.41l-.36%202.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47%200-.59.22L2.74%208.87c-.12.21-.08.47.12.61l2.03%201.58c-.05.3-.07.62-.07.94s.02.64.07.94l-2.03%201.58c-.18.14-.23.41-.12.61l1.92%203.32c.12.22.37.29.59.22l2.39-.96c.5.38%201.03.7%201.62.94l.36%202.54c.05.24.24.41.48.41h3.84c.24%200%20.44-.17.47-.41l.36-2.54c.59-.24%201.13-.56%201.62-.94l2.39.96c.22.08.47%200%20.59
344-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12%2015.6c-1.98%200-3.6-1.62-3.6-3.6s1.62-3.6%203.6-3.6%203.6%201.62%203.6%203.6-1.62%203.6-3.6%203.6z'%20fill='%23808080'/%3e%3c!--%20Inner%20circle%20(now%20gray)%20--%3e%3ccircle%20cx='12'%20cy='12'%20r='2.5'%20fill='%23808080'/%3e%3c/svg%3e"; 345 346const record_stop = "data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20fill='%23000000'%3e%3cg%20id='SVGRepo_bgCarrier'%20stroke-width='0'%3e%3c/g%3e%3cg%20id='SVGRepo_tracerCarrier'%20stroke-linecap='round'%20stroke-linejoin='round'%3e%3c/g%3e%3cg%20id='SVGRepo_iconCarrier'%3e%3ctitle%3erecord%20[%23982]%3c/title%3e%3cdesc%3eCreated%20with%20Sketch.%3c/desc%3e%3cdefs%3e%3c/defs%3e%3cg%20id='Page-1'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cg%20id='Dribbble-Light-Preview'%20transform='translate(-380.000000,%20-3839.000000)'%20fill='%23FF0000'%3e%3cg%20id='icons'%20transform='translate(56.000000,%20160.000000)'%3e%3cpath%20d='M338,3689%20C338,3691.209%20336.209,3693%20334,3693%20C331.791,3693%20330,3691.209%20330,3689%20C330,3686.791%20331.791,3685%20334,3685%20C336.209,3685%20338,3686.791%20338,3689%20M334,3697%20C329.589,3697%20326,3693.411%20326,3689%20C326,3684.589%20329.589,3681%20334,3681%20C338.411,3681%20342,3684.589%20342,3689%20C342,3693.411%20338.411,3697%20334,3697%20M334,3679%20C328.477,3679%20324,3683.477%20324,3689%20C324,3694.523%20328.477,3699%20334,3699%20C339.523,3699%20344,3694.523%20344,3689%20C344,3683.477%20339.523,3679%20334,3679'%20id='record-[%23982]'%3e%3c/path%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e"; 347 348let isRecording = false; 349let mediaRecorder = null; 350let recordedChunks = []; 351let recordingStartTime = 0; 352let removeSegment = {}; 353let root; 354let add_message_callback; 355let onRecordingStateChange = null; 356let zoomEffects = []; 357async function startRecording() { 358 if (isRecording) { 359 return; 360 } 361 try { 362 const originalTitle = document.title; 363 document.title = "[Sharing] Gradio Tab"; 364 const stream = await navigator.mediaDevices.getDisplayMedia({ 365 video: { 366 width: { ideal: 1920 }, 367 height: { ideal: 1080 }, 368 frameRate: { ideal: 30 } 369 }, 370 audio: true, 371 selfBrowserSurface: "include" 372 }); 373 document.title = originalTitle; 374 const options = { 375 videoBitsPerSecond: 5e6 376 }; 377 mediaRecorder = new MediaRecorder(stream, options); 378 recordedChunks = []; 379 removeSegment = {}; 380 mediaRecorder.ondataavailable = handleDataAvailable; 381 mediaRecorder.onstop = handleStop; 382 mediaRecorder.start(1e3); 383 isRecording = true; 384 if (onRecordingStateChange) ; 385 recordingStartTime = Date.now(); 386 } catch (error) { 387 add_message_callback( 388 "Recording Error", 389 "Failed to start recording: " + error.message, 390 "error" 391 ); 392 } 393} 394function stopRecording() { 395 if (!isRecording || !mediaRecorder) { 396 return; 397 } 398 mediaRecorder.stop(); 399 isRecording = false; 400} 401function handleDataAvailable(event) { 402 if (event.data.size > 0) { 403 recordedChunks.push(event.data); 404 } 405} 406function handleStop() { 407 isRecording = false; 408 const blob = new Blob(recordedChunks, { 409 type: "video/mp4" 410 }); 411 handleRecordingComplete(blob); 412 const screenStream = mediaRecorder?.stream?.getTracks() || []; 413 screenStream.forEach((track) => track.stop()); 414} 415async function handleRecordingComplete(recordedBlob) { 416 try { 417 add_message_callback( 418 "Processing video", 419 "This may take a few seconds...", 420 "info" 421 ); 422 const formData = new FormData(); 423 formData.append("video", recordedBlob, "recording.mp4"); 424 if (removeSegment.start !== void 0 && removeSegment.end !== void 0) { 425 formData.append("remove_segment_start", removeSegment.start.toString()); 426 formData.append("remove_segment_end", removeSegment.end.toString()); 427 } 428 if (zoomEffects.length > 0) { 429 formData.append("zoom_effects", JSON.stringify(zoomEffects)); 430 } 431 const response = await fetch(root + "/gradio_api/process_recording", { 432 method: "POST", 433 body: formData 434 }); 435 if (!response.ok) { 436 throw new Error( 437 `Server returned ${response.status}: ${response.statusText}` 438 ); 439 } 440 const processedBlob = await response.blob(); 441 const defaultFilename = `gradio-screen-recording-${(/* @__PURE__ */ new Date()).toISOString().replace(/:/g, "-").replace(/\..+/, "")}.mp4`; 442 saveWithDownloadAttribute(processedBlob, defaultFilename); 443 zoomEffects = []; 444 } catch (error) { 445 add_message_callback( 446 "Processing Error", 447 "Failed to process recording. Saving original version.", 448 "warning" 449 ); 450 const defaultFilename = `gradio-screen-recording-${(/* @__PURE__ */ new Date()).toISOString().replace(/:/g, "-").replace(/\..+/, "")}.mp4`; 451 saveWithDownloadAttribute(recordedBlob, defaultFilename); 452 } 453} 454function saveWithDownloadAttribute(blob, suggestedName) { 455 const url = URL.createObjectURL(blob); 456 const a = document.createElement("a"); 457 a.style.display = "none"; 458 a.href = url; 459 a.download = suggestedName; 460 document.body.appendChild(a); 461 a.click(); 462 setTimeout(() => { 463 document.body.removeChild(a); 464 URL.revokeObjectURL(url); 465 }, 100); 466} 467 468const MESSAGE_QUOTE_RE = /^'([^]+)'$/; 469const NOVALUE = /* @__PURE__ */ Symbol("NOVALUE"); 470class Dependency { 471 id; 472 inputs; 473 outputs; 474 cancels; 475 pending = false;
476 trigger_modes; 477 event_args = {}; 478 targets = []; 479 connection_type; 480 // if this dependency has any then, success or failure triggers 481 triggers = []; 482 // the id of the original event_id that caused this dependency to run 483 // in the case of chained events, it would be the id of the initial trigger 484 original_trigger_id = null; 485 show_progress_on = null; 486 component_prop_inputs = []; 487 show_progress; 488 functions; 489 constructor(dep_config) { 490 this.id = dep_config.id; 491 this.original_trigger_id = dep_config.id; 492 this.inputs = dep_config.inputs; 493 this.outputs = dep_config.outputs; 494 this.connection_type = dep_config.connection; 495 this.show_progress = dep_config.show_progress; 496 this.functions = { 497 frontend: dep_config.js ? process_frontend_fn( 498 dep_config.js, 499 dep_config.backend_fn, 500 dep_config.inputs.length, 501 dep_config.outputs.length 502 ) : void 0, 503 backend: dep_config.backend_fn, 504 backend_js: dep_config.js_implementation ? new AsyncFunction( 505 `let result = await (${dep_config.js_implementation})(...arguments); 506 return (!Array.isArray(result)) ? [result] : result;` 507 ) : void 0 508 }; 509 this.targets = dep_config.targets; 510 this.cancels = dep_config.cancels; 511 this.trigger_modes = dep_config.trigger_mode; 512 this.show_progress_on = dep_config.show_progress_on || null; 513 this.component_prop_inputs = dep_config.component_prop_inputs || []; 514 for (let i = 0; i < dep_config.event_specific_args?.length || 0; i++) { 515 const key = dep_config.event_specific_args[i]; 516 this.event_args[key] = dep_config[key] ?? null; 517 } 518 } 519 async run(client, data_payload, event_data, target_id) { 520 let _data_payload = data_payload; 521 if (this.functions.backend_js) { 522 const data = await this.functions.backend_js(..._data_payload); 523 return { type: "data", data }; 524 } 525 if (this.functions.frontend) { 526 _data_payload = await this.functions.frontend(data_payload); 527 } 528 if (this.functions.backend) { 529 return { 530 type: "submit", 531 data: client.submit( 532 this.id, 533 _data_payload, 534 event_data, 535 target_id, 536 void 0, 537 { "x-gradio-user": "app" } 538 ) 539 }; 540 } else if (this.functions.frontend) { 541 return { type: "data", data: _data_payload }; 542 } 543 return { type: "void", data: null }; 544 } 545 add_trigger(dep_id, condition) { 546 this.triggers.push([dep_id, condition]); 547 } 548 get_triggers() { 549 return { 550 success: this.triggers.filter(([, condition]) => condition === "success").map(([id]) => id), 551 failure: this.triggers.filter(([, condition]) => condition === "failure").map(([id]) => id), 552 all: this.triggers.filter(([, condition]) => condition === "all").map(([id]) => id) 553 }; 554 } 555} 556class DependencyManager { 557 dependencies_by_fn = /* @__PURE__ */ new Map(); 558 dependencies_by_event = /* @__PURE__ */ new Map(); 559 render_id_deps = /* @__PURE__ */ new Map(); 560 submissions = /* @__PURE__ */ new Map(); 561 client; 562 queue = /* @__PURE__ */ new Set(); 563 add_to_api_calls; 564 update_state_cb; 565 get_state_cb; 566 rerender_cb; 567 log_cb; 568 on_connection_lost_cb; 569 loading_stati = new LoadingStatus(); 570 connection_lost = false; 571 constructor(dependencies, client, update_state_cb, get_state_cb, rerender_cb, log_cb, add_to_api_calls, on_connection_lost_cb) { 572 this.add_to_api_calls = add_to_api_calls; 573 this.log_cb = log_cb; 574 this.update_state_cb = update_state_cb; 575 this.get_state_cb = get_state_cb; 576 this.rerender_cb = rerender_cb; 577 this.on_connection_lost_cb = on_connection_lost_cb; 578 this.client = client; 579 this.reload( 580 dependencies, 581 update_state_cb, 582 get_state_cb, 583 rerender_cb, 584 client 585 ); 586 } 587 reload(dependencies, update_state, get_state, rerender, client) { 588 const { by_id, by_event } = this.create(dependencies); 589 this.dependencies_by_event = by_event; 590 this.dependencies_by_fn = by_id; 591 this.client = client; 592 this.update_state_cb = update_state; 593 this.get_state_cb = get_state; 594 this.rerender_cb = rerender; 595 for (const [dep_id, dep] of this.dependencies_by_fn) { 596 for (const [output_id] of dep.targets) { 597 this.set_event_args(output_id, dep.event_args); 598 } 599 } 600 this.register_loading_stati(by_id); 601 } 602 register_loading_stati(deps) { 603 for (const [_, dep] of deps) { 604 this.loading_stati.register( 605 dep.id, 606 dep.show_progress_on || dep.outputs, 607 dep.inputs, 608 dep.show_progress 609 ); 610 } 611 } 612 clear_loading_status(component_id) { 613 this.loading_stati.clear(component_id); 614 } 615 async update_loading_stati_state() { 616 for (const [component_id, loading_status] of Object.entries( 617 this.loading_stati.current 618 )) { 619 this.update_state_cb( 620 Number(component_id), 621 { 622 loading_status 623 }, 624 false 625 ); 626 } 627 } 628 dispatch_state_change_events(result) { 629 if (result.changed_state_ids) { 630 for (const changed_id of result.changed_state_ids) { 631 const change_dep = this.dependencies_by_event.get( 632 "change-" + changed_id 633 ); 634 change_dep?.forEach((dep) => { 635 this.dispatch({ 636 type: "fn", 637 fn_index: dep.id, 638 target_id: changed_id, 639 event_data: null 640 }); 641 }); 642 } 643 } 644 } 645 /** Dispatches an event to the appropriate dependency 646 * @param event_name the name of the event 647 * @param target_id the id of the component that triggered the event 648 * @param event_data any additional data to pass to the dependency 649 * @returns a value if there is no backend fn, a 'submission' if there is a backend fn, or null if there is no depen
649dency 650 */ 651 async dispatch(event_meta) { 652 if (this.connection_lost) return; 653 let deps; 654 if (event_meta.type === "fn") { 655 const dep = this.dependencies_by_fn.get(event_meta.fn_index); 656 if (dep) deps = [dep]; 657 } else { 658 deps = this.dependencies_by_event.get( 659 `${event_meta.event_name}-${event_meta.target_id}` 660 ); 661 } 662 for (let i = 0; i < (deps?.length || 0); i++) { 663 const dep = deps ? deps[i] : void 0; 664 if (dep) { 665 this.cancel(dep.cancels); 666 const dispatch_status = should_dispatch( 667 dep.trigger_modes, 668 this.submissions.has(dep.id) 669 ); 670 if (dispatch_status === "skip") { 671 continue; 672 } else if (dispatch_status === "defer") { 673 this.queue.add(dep.id); 674 continue; 675 } 676 if (dep.functions.backend) { 677 this.loading_stati.update({ 678 status: "pending", 679 fn_index: dep.id, 680 stream_state: null 681 }); 682 this.update_loading_stati_state(); 683 } 684 const data_payload = await this.gather_state( 685 dep.inputs, 686 dep.component_prop_inputs 687 ); 688 const unset_args = await Promise.all( 689 dep.targets.map( 690 ([output_id]) => this.set_event_args(output_id, dep.event_args) 691 ) 692 ); 693 const { success, failure, all } = dep.get_triggers(); 694 try { 695 let target_id = null; 696 if (event_meta.target_id !== void 0 || event_meta.type === "event") { 697 target_id = event_meta.target_id || null; 698 } else { 699 target_id = dep.original_trigger_id; 700 } 701 if (dep.connection_type === "stream" && this.submissions.has(dep.id)) { 702 const submission = this.submissions.get(dep.id); 703 let payload = { 704 fn_index: dep.id, 705 data: data_payload, 706 event_data: event_meta.event_data 707 }; 708 submission.send_chunk(payload); 709 unset_args.forEach((fn) => fn()); 710 continue; 711 } 712 this.add_to_api_calls({ 713 fn_index: dep.id, 714 data: data_payload, 715 event_data: event_meta.event_data, 716 trigger_id: target_id 717 }); 718 const dep_submission = await dep.run( 719 this.client, 720 data_payload, 721 event_meta.event_data, 722 target_id 723 ); 724 if (dep_submission.type === "void") { 725 unset_args.forEach((fn) => fn()); 726 } else if (dep_submission.type === "data") { 727 await this.handle_data(dep.outputs, dep_submission.data); 728 unset_args.forEach((fn) => fn()); 729 } else { 730 let stream_state = null; 731 if (dep.connection_type === "stream" && !this.submissions.has(dep.id)) { 732 stream_state = "waiting"; 733 } 734 this.submissions.set(dep.id, dep_submission.data); 735 let index = 0; 736 submit_loop: for await (const result of dep_submission.data) { 737 if (index === 0) { 738 dep.inputs.forEach((input_id) => { 739 this.update_state_cb( 740 input_id, 741 { 742 loading_status: { 743 validation_error: null 744 } 745 }, 746 false 747 ); 748 }); 749 } 750 index += 1; 751 if (result === null) continue; 752 if (result.type === "data") { 753 await this.handle_data(dep.outputs, result.data); 754 } 755 if (result.type === "status") { 756 if (result.original_msg === "process_starts" && dep.connection_type === "stream") { 757 stream_state = "open"; 758 } 759 const { fn_index, ...status } = result; 760 if (result.stage === "complete") { 761 stream_state = "closed"; 762 success.forEach((dep_id) => { 763 this.dispatch({ 764 type: "fn", 765 fn_index: dep_id, 766 event_data: null, 767 target_id 768 }); 769 }); 770 this.dispatch_state_change_events(result); 771 this.loading_stati.update({ 772 ...status, 773 status: status.stage, 774 fn_index: dep.id, 775 stream_state 776 }); 777 this.update_loading_stati_state(); 778 break submit_loop; 779 } else if (result.stage === "generating") { 780 this.dispatch_state_change_events(result); 781 this.loading_stati.update({ 782 ...status, 783 status: status.stage, 784 fn_index: dep.id, 785 stream_state 786 }); 787 this.update_loading_stati_state(); 788 } else if (result.stage === "error") { 789 if (result.broken || result.session_not_found) { 790 if (!this.connection_lost) { 791 this.connection_lost = true; 792 this.on_connection_lost_cb(); 793 } 794 this.loading_stati.update({ 795 status: "complete", 796 fn_index: dep.id, 797 stream_state: null 798 }); 799 this.update_loading_stati_state(); 800 break submit_loop; 801 } 802 if (Array.isArray(result?.message)) { 803 result.message.forEach((m, i2) => { 804 this.update_state_cb( 805 dep.inputs[i2], 806 { 807 loading_status: { 808 validation_error: !m.is_valid ? m.message : null, 809 show_validation_error: true 810 } 811 }, 812 false 813 ); 814 });
815 dep.outputs.forEach((output_id) => { 816 if (dep.inputs.includes(output_id)) return; 817 this.update_state_cb( 818 output_id, 819 { 820 loading_status: { 821 status: null 822 } 823 }, 824 false 825 ); 826 }); 827 unset_args.forEach((fn) => fn()); 828 this.submissions.delete(dep.id); 829 if (this.queue.has(dep.id)) { 830 this.queue.delete(dep.id); 831 this.dispatch(event_meta); 832 } 833 return; 834 } 835 const _message = result?.message?.replace( 836 MESSAGE_QUOTE_RE, 837 (_, b) => b 838 ); 839 this.log_cb( 840 //@ts-ignore 841 result?._title ?? "Error", 842 _message || "", 843 fn_index, 844 "error", 845 status.duration, 846 status.visible 847 ); 848 throw new Error("Dependency function failed"); 849 } else { 850 this.loading_stati.update({ 851 ...status, 852 status: status.stage, 853 fn_index: dep.id, 854 stream_state 855 }); 856 this.update_loading_stati_state(); 857 } 858 } 859 if (result.type === "render") { 860 this.loading_stati.update({ 861 status: "complete", 862 fn_index: dep.id, 863 stream_state: null 864 }); 865 this.update_loading_stati_state(); 866 const { layout, components, render_id, dependencies } = result.data; 867 this.rerender_cb(components, layout); 868 const { by_id, by_event } = this.create( 869 dependencies 870 ); 871 this.register_loading_stati(by_id); 872 by_id.forEach( 873 (dep2) => this.dependencies_by_fn.set(dep2.id, dep2) 874 ); 875 by_event.forEach( 876 (dep2, key) => this.dependencies_by_event.set(key, dep2) 877 ); 878 const current_deps = this.render_id_deps.get(render_id); 879 if (current_deps) { 880 current_deps.forEach((old_dep_id) => { 881 if (!by_id.has(old_dep_id)) { 882 this.dependencies_by_fn.delete(old_dep_id); 883 } 884 }); 885 } 886 this.render_id_deps.set( 887 render_id, 888 new Set(Array.from(by_id.keys())) 889 ); 890 this.register_loading_stati(by_id); 891 break submit_loop; 892 } 893 if (result.type === "log") { 894 this.handle_log(result); 895 } 896 } 897 all.forEach((dep_id) => { 898 this.dispatch({ 899 type: "fn", 900 fn_index: dep_id, 901 event_data: null, 902 target_id 903 }); 904 }); 905 unset_args.forEach((fn) => fn()); 906 this.submissions.delete(dep.id); 907 if (this.queue.has(dep.id)) { 908 this.queue.delete(dep.id); 909 this.dispatch(event_meta); 910 } 911 } 912 } catch (error) { 913 this.loading_stati.update({ 914 status: "error", 915 fn_index: dep.id, 916 eta: 0, 917 queue: false, 918 stream_state: null 919 }); 920 this.update_loading_stati_state(); 921 this.submissions.delete(dep.id); 922 failure.forEach((dep_id) => { 923 this.dispatch({ 924 type: "fn", 925 fn_index: dep_id, 926 event_data: null 927 }); 928 }); 929 } 930 } 931 } 932 return; 933 } 934 /** 935 * Creates a map of dependencies for easy lookup 936 * 937 * @param dependencies the list of dependencies from the backend 938 * @returns a map of dependencies keyed by `${event_name}-${target_id}` 939 * */ 940 create(dependencies) { 941 const _deps_by_id = /* @__PURE__ */ new Map(); 942 const _deps_by_event = /* @__PURE__ */ new Map(); 943 const then_triggers = []; 944 for (const dep_config of dependencies) { 945 const dependency = new Dependency(dep_config); 946 for (const [target_id, event_name] of dep_config.targets) { 947 if (!_deps_by_event.has(`${event_name}-${target_id}`)) { 948 _deps_by_event.set(`${event_name}-${target_id}`, []); 949 } 950 _deps_by_event.get(`${event_name}-${target_id}`)?.push(dependency); 951 } 952 _deps_by_id.set(dep_config.id, dependency); 953 if (dep_config.trigger_after !== void 0) { 954 const then_mode = dep_config.trigger_only_on_failure ? "failure" : dep_config.trigger_only_on_success ? "success" : "all"; 955 then_triggers.push([ 956 dep_config.id, 957 dep_config.trigger_after, 958 then_mode 959 ]); 960 } 961 } 962 for (const [dep_id, trigger_after, condition] of then_triggers) { 963 const dependency = _deps_by_id.get(trigger_after); 964 if (dependency) { 965 dependency.add_trigger(dep_id, condition); 966 dependency.original_trigger_id = walk_after_to_original( 967 dependencies, 968 trigger_after 969 ); 970 } 971 } 972 return { by_id: _deps_by_id, by_event: _deps_by_event }; 973 } 974 handle_log(msg) { 975 const { title, log, fn_index, level, duration, visible } = msg; 976 this.log_cb(title, log, fn_index, level, duration, visible); 977 } 978 /** 979 * Updates the state of the outputs based on the data received from the dependency 980 * 981 * @param outputs the ids of the output components 982 * @param data the data to update the components with 983 * */ 984 async handle_data(outputs, data) { 985 await Promise.all( 986 outputs.map(async (output_id, i) => { 987 const _data = data[i] === void 0 ? NOVALUE : data[i]; 988 if (_data === NOVALUE) return; 989 if (is_prop_update(_data)) { 990 let pending_visibility_update = false;
991 let pending_visibility_value = null; 992 for (const [update_key, update_value] of Object.entries(_data)) { 993 if (update_key === "__type__") continue; 994 if (update_key === "visible") { 995 pending_visibility_update = true; 996 pending_visibility_value = update_value; 997 continue; 998 } 999 await this.update_state_cb( 1000 outputs[i], 1001 { 1002 [update_key]: update_value 1003 }, 1004 false 1005 ); 1006 } 1007 if (pending_visibility_update) { 1008 await this.update_state_cb( 1009 outputs[i], 1010 { 1011 visible: pending_visibility_value 1012 }, 1013 true 1014 ); 1015 } 1016 } else { 1017 await this.update_state_cb(output_id, { value: _data }, false); 1018 } 1019 }) 1020 ); 1021 } 1022 /** 1023 * Gathers the current state of the inputs 1024 * 1025 * @param ids the ids of the components to gather state from 1026 * @param prop_indices the indices (relative to ids array) that should return all component props instead of just the value 1027 * @returns an array of the current state of the components, in the same order as the ids 1028 */ 1029 async gather_state(ids, prop_indices = []) { 1030 return (await Promise.all(ids.map((id) => this.get_state_cb(id)))).map( 1031 (state, index) => { 1032 if (prop_indices.includes(index)) { 1033 return state ?? null; 1034 } 1035 return state?.value ?? null; 1036 } 1037 ); 1038 } 1039 /** Sets the event arguments for a specific component 1040 * 1041 * @param id the id of the component to set the event arguments for 1042 * @param args the event arguments to set 1043 * @returns a function that can be called to reset the event arguments to their previous values 1044 */ 1045 async set_event_args(id, args) {
1046 let current_args = {}; 1047 const current_state = await this.get_state_cb?.(id); 1048 if (!current_state) return () => { 1049 }; 1050 for (const [key] of Object.entries(args)) { 1051 current_args[key] = current_state?.[key] ?? null; 1052 } 1053 if (Object.keys(args).length === 0) { 1054 return () => { 1055 }; 1056 } 1057 await this.update_state_cb(id, args, false); 1058 return () => { 1059 this.update_state_cb(id, current_args, false); 1060 }; 1061 } 1062 async cancel(ids) { 1063 if (!ids) return; 1064 for (const id of ids) { 1065 const submission = this.submissions.get(id); 1066 if (submission) { 1067 await submission.cancel(); 1068 this.loading_stati.update({ 1069 status: "complete", 1070 fn_index: id, 1071 eta: 0, 1072 queue: false, 1073 stream_state: null 1074 }); 1075 this.update_loading_stati_state(); 1076 this.submissions.delete(id); 1077 const { failure, all } = this.dependencies_by_fn.get(id)?.get_triggers() || { failure: [], all: [] }; 1078 failure.forEach((dep_id) => { 1079 this.dispatch({ 1080 type: "fn", 1081 fn_index: dep_id, 1082 event_data: null, 1083 target_id: id 1084 }); 1085 }); 1086 all.forEach((dep_id) => { 1087 this.dispatch({ 1088 type: "fn", 1089 fn_index: dep_id, 1090 event_data: null, 1091 target_id: id 1092 }); 1093 }); 1094 } 1095 } 1096 } 1097 dispatch_load_events() { 1098 this.dependencies_by_fn.forEach((dep) => { 1099 dep.targets.forEach(([target_id, event_name]) => { 1100 if (event_name === "load") { 1101 this.dispatch({ 1102 type: "fn", 1103 fn_index: dep.id, 1104 event_data: null, 1105 target_id 1106 }); 1107 } 1108 }); 1109 }); 1110 } 1111 get_fns_from_targets(target_id) { 1112 const fn_indices = []; 1113 this.dependencies_by_event.forEach((deps, key) => { 1114 const [, dep_target_id] = key.split("-"); 1115 if (Number(dep_target_id) === target_id) { 1116 deps.forEach((dep) => { 1117 fn_indices.push(dep.id); 1118 }); 1119 } 1120 }); 1121 return fn_indices; 1122 } 1123 close_stream(id) { 1124 const fn_ids = this.get_fns_from_targets(id); 1125 for (const fn_id of fn_ids) { 1126 const submission = this.submissions.get(fn_id); 1127 if (submission) { 1128 submission.close_stream(); 1129 this.submissions.delete(fn_id); 1130 } 1131 this.loading_stati.update({ 1132 status: "complete", 1133 fn_index: fn_id, 1134 eta: 0, 1135 queue: false, 1136 stream_state: "closed" 1137 }); 1138 } 1139 this.update_loading_stati_state(); 1140 } 1141} 1142function is_prop_update(payload) { 1143 return typeof payload === "object" && payload !== null && "__type__" in payload && payload?.__type__ === "update"; 1144} 1145function should_dispatch(mode, is_running) { 1146 if (!is_running) return "run"; 1147 if (mode === "always_last") { 1148 return "defer"; 1149 } else if (mode === "multiple") { 1150 return "run"; 1151 } else if (mode === "once") { 1152 return "skip"; 1153 } 1154 return "run"; 1155} 1156function process_frontend_fn(source, backend_fn, input_length, output_length) { 1157 const wrap = backend_fn ? input_length === 1 : output_length === 1; 1158 try { 1159 return new AsyncFunction( 1160 "__fn_args", 1161 ` let result = await (${source})(...__fn_args); 1162 if (typeof result === "undefined") return []; 1163 return (${wrap} && !Array.isArray(result)) ? [result] : result;` 1164 ); 1165 } catch (e) { 1166 throw e; 1167 } 1168} 1169function walk_after_to_original(dependency_map, dep_id) { 1170 let cache = /* @__PURE__ */ new Map(); 1171 let current_id = dep_id; 1172 let safety_counter = 0; 1173 while (safety_counter < 100) { 1174 const dep = cache.get(current_id) || dependency_map.find((d) => d.id === current_id); 1175 if (!dep) break; 1176 cache.set(dep.id, dep); 1177 if (dep.trigger_after === null || dep.trigger_after === void 0) break; 1178 current_id = dep.trigger_after; 1179 safety_counter += 1; 1180 } 1181 return current_id; 1182} 1183 1184var root_2 = from_html(`<!> <!>`, 1); 1185var root_6 = from_html(`<button class="show-api svelte-zxu34v"><!> <img class="svelte-zxu34v"/></button>`); 1186var root_9 = from_html(`<div class="divider show-api-divider svelte-zxu34v">·</div>
1186 <a href="https://gradio.app" class="built-with svelte-zxu34v" target="_blank" rel="noreferrer"> <img class="svelte-zxu34v"/></a>`, 1); 1187var root_10 = from_html(`<div>·</div> <button class="settings svelte-zxu34v"> <img class="svelte-zxu34v"/></button>`, 1); 1188var root_5 = from_html(`<footer aria-label="Gradio footer navigation" class="svelte-zxu34v"><!> <!> <button> <img class="svelte-zxu34v"/></button> <div class="divider svelte-zxu34v">·</div> <!></footer>`); 1189var root_11 = from_html(`<div id="api-recorder-container" class="svelte-zxu34v"><!></div>`); 1190var root_12 = from_html(`<div class="api-docs svelte-zxu34v" role="dialog" aria-modal="true"><div class="backdrop svelte-zxu34v"></div> <div class="api-docs-wrap svelte-zxu34v" role="document"><!></div></div>`); 1191var root_13 = from_html(`<div class="api-docs svelte-zxu34v" role="dialog" aria-modal="true"><div class="backdrop svelte-zxu34v"></div> <div class="api-docs-wrap svelte-zxu34v" role="document"><!></div></div>`); 1192var root_1 = from_html(`<div class="wrap svelte-zxu34v"><main class="contain svelte-zxu34v"><!></main> <!> <!> <!> <!> <!></div> <!>`, 1); 1193 1194function Blocks($$anchor, $$props) { 1195 push($$props, true); 1196 1197 const $reactive_formatter = () => store_get(reactive_formatter, '$reactive_formatter', $$stores); 1198 const $is_screen_recording = () => store_get(is_screen_recording, '$is_screen_recording', $$stores); 1199 const [$$stores, $$cleanup] = setup_stores(); 1200 1201 prop($$props, 'render_complete', 3, false); 1202 let ready = prop($$props, 'ready', 15, false), 1203 reload_count = prop($$props, 'reload_count', 11, 0), 1204 add_new_message = prop($$props, 'add_new_message', 15); 1205 1206 $$props.components.forEach((comp) => { 1207 if (!comp.props.i18n) { 1208 comp.props.i18n = $reactive_formatter(); 1209 } 1210 }); 1211 1212 let messages = state(proxy([])); 1213 let reconnect_interval = null; 1214 1215 function gradio_event_dispatcher(id, event, data) { 1216 if (event === "share") { 1217 const { title, description } = data; 1218 1219 // trigger_share(title, description); 1220 // TODO: lets combine all of the into a log type with levels 1221 } else if (event === "error") { 1222 new_message("Error", data, -1, event, 10, true); 1223 } else if (event === "warning") { 1224 new_message("Warning", data, -1, event, 10, true); 1225 } else if (event === "info") { 1226 new_message("Info", data, -1, event, 10, true); 1227 } else if (event === "gradio_expand" || event === "gradio_tab_select") { 1228 const id_ = event === "gradio_expand" ? id : data.component_id; 1229 1230 app_tree.render_previously_invisible_children(id_); 1231 } else if (event == "clear_status") { 1232 app_tree.update_state(id, { loading_status: {} }, false); 1233 dep_manager.clear_loading_status(id); 1234 1235 // TODO: the loading_status store should handle this via a method 1236 // update_status(id, "complete", data); 1237 } else if (event == "close_stream") { 1238 dep_manager.close_stream(id); 1239 } else if (event === "custom_button_click") { 1240 const button_id = data.id; 1241 1242 dispatch_to_target(button_id, "click", null); 1243 } else { 1244 // Tabs are a bit weird. The Tabs component dispatches 'select' events 1245 // but the target id corresponds to the child Tab component that was selected. 1246 // So the id we get from the dispatcher belongs to the Tabs, 1247 // so we need to pull out the correct id here. 1248 if (event === "select" && id in app_tree.initial_tabs) { 1249 // this is the id of the selected tab 1250 id = data.id; 1251 } 1252 1253 dep_manager.dispatch({ 1254 type: "event", 1255 event_name: event, 1256 target_id: id, 1257 event_data: data 1258 }); 1259 } 1260 } 1261 1262 let app_tree = new AppTree( 1263 $$props.components, 1264 $$props.layout, 1265 $$props.dependencies, 1266 { 1267 root: $$props.root, 1268 theme: $$props.theme_mode, 1269 version: $$props.version, 1270 api_prefix: $$props.api_prefix, 1271 max_file_size: $$props.max_file_size, 1272 autoscroll: $$props.autoscroll, 1273 fill_height: $$props.fill_height 1274 }, 1275 $$props.app, 1276 $reactive_formatter(), 1277 gradio_event_dispatcher 1278 ); 1279 1280 function dispatch_to_target(target_id, event, data) { 1281 dep_manager.dispatch({ 1282 type: "event", 1283 event_name: event, 1284 target_id, 1285 event_data: data 1286 }); 1287 } 1288 1289 let api_calls = state(proxy([])); 1290 let last_api_call = state(null); 1291 1292 // We need a callback to add to api_calls from the DependencyManager 1293 // We can't update a state variable from inside the DependencyManager because 1294 // svelte won't see it and won't update the UI. 1295 let add_to_api_calls = (payload) => { 1296 set(last_api_call, payload, true); 1297 1298 if (!get(api_recorder_visible)) return; 1299 1300 set(api_calls, [...get(api_calls), get(last_api_call)], true); 1301 }; 1302 1303 function handle_connection_lost() { 1304 set(messages, get(messages).filter((m) => m.type !== "error"), true); 1305 ++_error_id; 1306 1307 get(messages).push({ 1308 title: "Connection Lost", 1309 message: LOST_CONNECTION_MESSAGE, 1310 fn_index: -1, 1311 type: "error", 1312 id: _error_id, 1313 duration: null, 1314 visible: true 1315 }); 1316 1317 reconnect_interval = setInterval( 1318 async () => { 1319 try { 1320 const status = await $$props.app.reconnect(); 1321 1322 if (status === "connected" || status === "changed") { 1323 clearInterval(reconnect_interval); 1324 reconnect_interval = null; 1325 window.location.reload(); 1326 } 1327 } catch(e) { 1328 // server still unreachable 1329 console.debug(e); 1330 } 1331 }, 1332 2000 1333 ); 1334 } 1335 1336 let dep_manager = new DependencyManager($$props.dependencies, $$props.app, app_tree.update_state.bind(app_tree), app_tree.get_state.bind(app_tree), app_tree.rerender.bind(app_tree), new_message, add_to_api_calls, handle_connection_lost); 1337 1338 user_effect(() => { 1339 reload_count(); 1340 1341 untrack(() => { 1342 app_tree.reload($$props.components, $$props.layout, $$props.dependencies, { 1343 root: $$props.root, 1344 theme: $$props.theme_mode, 1345 version: $$props.version, 1346 api_prefix: $$props.api_prefix, 1347 max_file_size: $$props.max_file_size, 1348 autoscroll: $$props.autoscroll, 1349 fill_height: $$props.fill_height 1350 }); 1351 1352 dep_manager.reload($$props.dependencies, app_tree.update_state.bind(app_tree), app_tree.get_state.bind(app_tree), app_tree.rerender.bind(app_tree), $$props.app); 1353 }); 1354 }); 1355 1356 let vibe_editor_width = 350; 1357 1358 // export let 1359 let api_docs_visible = user_derived(() => $$props.search_params.get("view") === "api" && $$props.footer_links.includes("api")); 1360 1361 let settings_visible = user_derived(() => $$props.search_params.get("view") === "settings"); 1362 let api_recorder_visible = user_derived(() => $$props.search_params.get("view") === "api-recorder" && $$props.footer_links.includes("api")); 1363 let allow_zoom = true; 1364 let allow_video_trim = true; 1365 1366 // Lazy component loading state 1367 let ApiDocs = null; 1368 1369 let ApiRecorder = null; 1370 let Settings = null; 1371 let VibeEditor = state(null); 1372 1373 async function loadApiDocs() { 1374 if (!ApiDocs || !ApiRecorder) { 1375 const api_docs_module = await __vitePreload(() => import('./ApiDocs-DQo31dam.js'),true ?__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31]):void 0,import.meta.url); 1376 const api_recorder_module = await __vitePreload(() => import('./ApiRecorder-CKeb98-b.js'),true ?__vite__mapDeps([32,1,2,3,4,7,8,9,5,10,11,12,13,14,15,16,17,33]):void 0,import.meta.url); 1377 1378 if (!ApiDocs) ApiDocs = api_docs_module?.default; 1379 if (!ApiRecorder) ApiRecorder = api_recorder_module?.default; 1380 } 1381 } 1382 1383 async function loadApiRecorder() { 1384 if (!ApiRecorder) { 1385 const api_recorder_module = await __vitePreload(() => import('./ApiRecorder-CKeb98-b.js'),true ?__vite__mapDeps([32,1,2,3,4,7,8,9,5,10,11,12,13,14,15,16,17,33]):void 0,import.meta.url); 1386 1387 ApiRecorder = api_recorder_module.default; 1388 } 1389 } 1390 1391 async function loadSettings() { 1392 if (!Settings) { 1393 const settings_module = await __vitePreload(() => import('./Settings-BzudOKzS.js'),true ?__vite__mapDeps([34,1,2,3,4,6,11,8,12,13,14,15,35,24,19,20,21,36,37,38,39,40,41,42,43,28,44,25,26,18,22,27,29,30,45,46]):void 0,import.meta.url); 1394 1395 Settings = settings_module.default; 1396 } 1397 } 1398 1399 async function loadVibeEditor() { 1400 if (!get(VibeEditor)) { 1401 const vibe_editor_module = await __vitePreload(() =>
1401 import('./Index-BTvJwxZP.js'),true ?__vite__mapDeps([47,1,2,3,4,24,19,20,11,8,12,13,14,15,21,48,49,50,51,27,28,52,53,39,41,54,55,56,57]):void 0,import.meta.url); 1402 1403 set(VibeEditor, vibe_editor_module.default, true); 1404 } 1405 } 1406 1407 async function set_api_docs_visible(visible) { 1408 set(api_recorder_visible, false); 1409 1410 if (visible) { 1411 await loadApiDocs(); 1412 } 1413 1414 set(api_docs_visible, visible); 1415 1416 let params = new URLSearchParams(window.location.search); 1417 1418 if (visible) { 1419 params.set("view", "api"); 1420 } else { 1421 params.delete("view"); 1422 } 1423 1424 history.replaceState(null, "", "?" + params.toString()); 1425 } 1426 1427 async function set_settings_visible(visible) { 1428 if (visible) { 1429 await loadSettings(); 1430 } 1431 1432 let params = new URLSearchParams(window.location.search); 1433 1434 if (visible) { 1435 params.set("view", "settings"); 1436 } else { 1437 params.delete("view"); 1438 } 1439 1440 history.replaceState(null, "", "?" + params.toString()); 1441 set(settings_visible, !get(settings_visible)); 1442 } 1443 1444 // 1445 function new_message( 1446 title, 1447 message, 1448 fn_index, 1449 type, 1450 duration = 10, 1451 visible = false 1452 ) { 1453 if (!visible) return; 1454 1455 get(messages).push({ 1456 title, 1457 message, 1458 fn_index, 1459 type, 1460 id: ++_error_id, 1461 duration, 1462 visible 1463 }); 1464 } 1465 1466 add_new_message(new_message); 1467 1468 let _error_id = -1; 1469 $reactive_formatter()("blocks.long_requests_queue"); 1470 $reactive_formatter()("blocks.connection_can_break"); 1471 const LOST_CONNECTION_MESSAGE = "Connection to the server was lost. Attempting reconnection..."; 1472 $reactive_formatter()("blocks.waiting_for_inputs"); 1473 1474 // as state updates are not synchronous, we need to ensure updates are flushed before triggering any requests 1475 let is_screen_recording = writable(false); 1476 1477 let footer_height = 0; 1478 let root_container; 1479 1480 function handle_resize() { 1481 if ("parentIFrame" in window) { 1482 const box = root_container.children[0].getBoundingClientRect(); 1483 1484 if (!box) return; 1485 1486 window.parentIFrame?.size(box.bottom + footer_height + 32); 1487 } 1488 } 1489 1490 function screen_recording() { 1491 if ($is_screen_recording()) { 1492 stopRecording(); 1493 } else { 1494 startRecording(); 1495 } 1496 } 1497 1498 onMount(() => { 1499 1500 if ("parentIFrame" in window) { 1501 window.parentIFrame?.autoResize(false); 1502 } 1503 1504 const mut = new MutationObserver(handle_resize); 1505 const res = new ResizeObserver(handle_resize); 1506 1507 mut.observe(root_container, { childList: true, subtree: true, attributes: true }); 1508 res.observe(root_container); 1509 1510 app_tree.ready.then(() => { 1511 ready(true); 1512 dep_manager.dispatch_load_events(); 1513 }); 1514 1515 if ($$props.vibe_mode) { 1516 void loadVibeEditor(); 1517 } 1518 1519 return () => { 1520 mut.disconnect(); 1521 res.disconnect(); 1522 1523 if (reconnect_interval) clearInterval(reconnect_interval); 1524 }; 1525 }); 1526 1527 function handle_close(id) { 1528 set(messages, get(messages).filter((m) => m.id !== id), true); 1529 } 1530 1531 var fragment_2 = root_1(); 1532 1533 head('zxu34v', ($$anchor) => { 1534 var fragment = root_2(); 1535 var node = first_child(fragment); 1536 1537 { 1538 var consequent = ($$anchor) => { 1539 deferred_template_effect(() => { 1540 $document.title = $$props.title ?? ''; 1541 }); 1542 }; 1543 1544 if_block(node, ($$render) => { 1545 if ($$props.control_page_title) $$render(consequent); 1546 }); 1547 } 1548 1549 var node_1 = sibling(node, 2); 1550 1551 { 1552 var consequent_1 = ($$anchor) => { 1553 var fragment_1 = comment(); 1554 var node_2 = first_child(fragment_1); 1555 1556 html(node_2, () => `\<style\>${prefix_css($$props.css, $$props.version)}</style>`); 1557 append($$anchor, fragment_1); 1558 }; 1559 1560 if_block(node_1, ($$render) => { 1561 if ($$props.css) $$render(consequent_1); 1562 }); 1563 } 1564 1565 append($$anchor, fragment); 1566 }); 1567 1568 var div = first_child(fragment_2); 1569 let styles; 1570 var main = child(div); 1571 let styles_1; 1572 var node_3 = child(main); 1573 1574 MountComponents(node_3, { 1575 get node() { 1576 return app_tree.root; 1577 } 1578 }); 1579 1580 reset(main); 1581 bind_this(main, ($$value) => root_container = $$value, () => root_container); 1582 1583 var node_4 = sibling(main, 2); 1584 1585 { 1586 var consequent_6 = ($$anchor) => { 1587 var footer = root_5(); 1588 var node_5 = child(footer); 1589 1590 { 1591 var consequent_3 = ($$anchor) => { 1592 var button = root_6(); 1593 var node_6 = child(button); 1594 1595 { 1596 var consequent_2 = ($$anchor) => { 1597 var text$1 = text(); 1598 1599 template_effect(($0) => set_text(text$1, $0), [() => $reactive_formatter()("errors.use_via_api_or_mcp")]); 1600 append($$anchor, text$1); 1601 }; 1602 1603 var alternate = ($$anchor) => { 1604 var text_1 = text(); 1605 1606 template_effect(($0) => set_text(text_1, $0), [() => $reactive_formatter()("errors.use_via_api")]); 1607 append($$anchor, text_1); 1608 }; 1609 1610 if_block(node_6, ($$render) => {
1611 if ($$props.app.config?.mcp_server) $$render(consequent_2); else $$render(alternate, false); 1612 }); 1613 } 1614 1615 var img = sibling(node_6, 2); 1616 1617 reset(button); 1618 1619 template_effect( 1620 ($0) => { 1621 set_attribute(img, 'src', api_logo); 1622 set_attribute(img, 'alt', $0); 1623 }, 1624 [() => $reactive_formatter()("common.logo")] 1625 ); 1626 1627 event('click', button, () => { 1628 set_api_docs_visible(!get(api_docs_visible)); 1629 }); 1630 1631 event('mouseenter', button, () => { 1632 loadApiDocs(); 1633 loadApiRecorder(); 1634 }); 1635 1636 append($$anchor, button); 1637 }; 1638 1639 if_block(node_5, ($$render) => { 1640 if ($$props.footer_links.includes("api")) $$render(consequent_3); 1641 }); 1642 } 1643 1644 var node_7 = sibling(node_5, 2); 1645 1646 { 1647 var consequent_4 = ($$anchor) => { 1648 var fragment_5 = root_9(); 1649 var a = sibling(first_child(fragment_5), 2); 1650 var text_2 = child(a); 1651 var img_1 = sibling(text_2); 1652 1653 reset(a); 1654 1655 template_effect( 1656 ($0, $1) => { 1657 set_text(text_2, `${$0 ?? ''} `); 1658 set_attribute(img_1, 'src', logo); 1659 set_attribute(img_1, 'alt', $1); 1660 }, 1661 [ 1662 () => $reactive_formatter()("common.built_with_gradio"), 1663 () => $reactive_formatter()("common.logo") 1664 ] 1665 ); 1666 1667 append($$anchor, fragment_5); 1668 }; 1669 1670 if_block(node_7, ($$render) => { 1671 if ($$props.footer_links.includes("gradio")) $$render(consequent_4); 1672 }); 1673 } 1674 1675 var button_1 = sibling(node_7, 2); 1676 let classes; 1677 var text_3 = child(button_1); 1678 var img_2 = sibling(text_3); 1679 1680 reset(button_1); 1681 1682 var node_8 = sibling(button_1, 4); 1683 1684 { 1685 var consequent_5 = ($$anchor) => { 1686 var fragment_6 = root_10(); 1687 var div_1 = first_child(fragment_6); 1688 let classes_1; 1689 var button_2 = sibling(div_1, 2); 1690 var text_4 = child(button_2); 1691 var img_3 = sibling(text_4); 1692 1693 reset(button_2); 1694 1695 template_effect( 1696 ($0, $1) => { 1697 classes_1 = set_class(div_1, 1, 'divider svelte-zxu34v', null, classes_1, { hidden: !$is_screen_recording() }); 1698 set_text(text_4, `${$0 ?? ''} `); 1699 set_attribute(img_3, 'src', settings_logo); 1700 set_attribute(img_3, 'alt', $1); 1701 }, 1702 [ 1703 () => $reactive_formatter()("common.settings"), 1704 () => $reactive_formatter()("common.settings") 1705 ] 1706 ); 1707 1708 event('click', button_2, () => { 1709 set_settings_visible(!get(settings_visible)); 1710 }); 1711 1712 event('mouseenter', button_2, () => { 1713 loadSettings(); 1714 }); 1715 1716 append($$anchor, fragment_6); 1717 }; 1718 1719 if_block(node_8, ($$render) => { 1720 if ($$props.footer_links.includes("settings")) $$render(consequent_5); 1721 }); 1722 } 1723 1724 reset(footer); 1725 1726 template_effect( 1727 ($0, $1) => { 1728 classes = set_class(button_1, 1, 'record svelte-zxu34v', null, classes, { hidden: !$is_screen_recording() }); 1729 set_text(text_3, `${$0 ?? ''} `); 1730 set_attribute(img_2, 'src', record_stop); 1731 set_attribute(img_2, 'alt', $1); 1732 }, 1733 [ 1734 () => $reactive_formatter()("common.stop_recording"), 1735 () => $reactive_formatter()("common.stop_recording") 1736 ] 1737 ); 1738 1739 event('click', button_1, () => { 1740 screen_recording(); 1741 }); 1742 1743 bind_element_size(footer, 'clientHeight', ($$value) => footer_height = $$value); 1744 append($$anchor, footer); 1745 }; 1746 1747 if_block(node_4, ($$render) => { 1748 if ($$props.footer_links.length > 0) $$render(consequent_6); 1749 }); 1750 } 1751 1752 var node_9 = sibling(node_4, 2); 1753 1754 { 1755 var consequent_7 = ($$anchor) => { 1756 var div_2 = root_11(); 1757 var node_10 = child(div_2); 1758 1759 component(node_10, () => ApiRecorder, ($$anchor, $$component) => { 1760 $$component($$anchor, { 1761 get api_calls() { 1762 return get(api_calls); 1763 }, 1764 1765 get dependencies() { 1766 return $$props.dependencies; 1767 } 1768 }); 1769 }); 1770 1771 reset(div_2); 1772 1773 event('click', div_2, () => { 1774 set_api_docs_visible(true); 1775 set(api_recorder_visible, false); 1776 }); 1777 1778 append($$anchor, div_2); 1779 }; 1780 1781 if_block(node_9, ($$render) => { 1782 if (get(api_recorder_visible) && ApiRecorder) $$render(consequent_7); 1783 }); 1784 } 1785 1786 var node_11 = sibling(node_9, 2); 1787 1788 { 1789 var consequent_8 = ($$anchor) => { 1790 var div_3 = root_12(); 1791 var div_4 = child(div_3); 1792 var div_5 = sibling(div_4, 2);
1793 var node_12 = child(div_5); 1794 1795 component(node_12, () => ApiDocs, ($$anchor, $$component) => { 1796 $$component($$anchor, { 1797 get root_node() { 1798 return app_tree.root; 1799 }, 1800 1801 get dependencies() { 1802 return $$props.dependencies; 1803 }, 1804 1805 get root() { 1806 return $$props.root; 1807 }, 1808 1809 get app() { 1810 return $$props.app; 1811 }, 1812 1813 get space_id() { 1814 return $$props.space_id; 1815 }, 1816 1817 get api_calls() { 1818 return get(api_calls); 1819 }, 1820 1821 get username() { 1822 return $$props.username; 1823 }, 1824 1825 get last_api_call() { 1826 return get(last_api_call); 1827 }, 1828 1829 $$events: { 1830 close: (event) => { 1831 set_api_docs_visible(false); 1832 set(api_calls, [], true); 1833 set(api_recorder_visible, set(api_recorder_visible, event.detail?.api_recorder_visible)); 1834 } 1835 } 1836 }); 1837 }); 1838 1839 reset(div_5); 1840 reset(div_3); 1841 template_effect(($0) => set_attribute(div_3, 'aria-label', $0), [() => $reactive_formatter()("errors.use_via_api")]); 1842 1843 event('click', div_4, () => { 1844 set_api_docs_visible(false); 1845 }); 1846 1847 append($$anchor, div_3); 1848 }; 1849 1850 if_block(node_11, ($$render) => { 1851 if (get(api_docs_visible) && app_tree.root && ApiDocs) $$render(consequent_8); 1852 }); 1853 } 1854 1855 var node_13 = sibling(node_11, 2); 1856 1857 { 1858 var consequent_9 = ($$anchor) => { 1859 var div_6 = root_13(); 1860 var div_7 = child(div_6); 1861 var div_8 = sibling(div_7, 2); 1862 var node_14 = child(div_8); 1863 1864 component(node_14, () => Settings, ($$anchor, $$component) => { 1865 $$component($$anchor, { 1866 onclose: () => { 1867 set_settings_visible(false); 1868 }, 1869 1870 start_recording: () => { 1871 screen_recording(); 1872 }, 1873 1874 get pwa_enabled() { 1875 return $$props.app.config.pwa; 1876 }, 1877 1878 get root() { 1879 return $$props.root; 1880 }, 1881 1882 get space_id() { 1883 return $$props.space_id; 1884 }, 1885 1886 get i18n() { 1887 return $reactive_formatter(); 1888 }, 1889 1890 get allow_zoom() { 1891 return allow_zoom; 1892 }, 1893 1894 set allow_zoom($$value) { 1895 allow_zoom = $$value; 1896 }, 1897 1898 get allow_video_trim() { 1899 return allow_video_trim; 1900 }, 1901 1902 set allow_video_trim($$value) { 1903 allow_video_trim = $$value; 1904 } 1905 }); 1906 }); 1907 1908 reset(div_8); 1909 reset(div_6); 1910 template_effect(($0) => set_attribute(div_6, 'aria-label', $0), [() => $reactive_formatter()("common.settings")]); 1911 1912 event('click', div_7, () => { 1913 set_settings_visible(false); 1914 }); 1915 1916 append($$anchor, div_6); 1917 }; 1918 1919 if_block(node_13, ($$render) => { 1920 if (get(settings_visible) && $$props.app.config && app_tree.root && Settings) $$render(consequent_9); 1921 }); 1922 } 1923 1924 var node_15 = sibling(node_13, 2); 1925 1926 { 1927 var consequent_10 = ($$anchor) => { 1928 var fragment_7 = comment(); 1929 var node_16 = first_child(fragment_7); 1930 1931 component(node_16, () => get(VibeEditor), ($$anchor, $$component) => { 1932 $$component($$anchor, { 1933 get app() { 1934 return $$props.app; 1935 }, 1936 1937 get root() { 1938 return $$props.root; 1939 } 1940 }); 1941 }); 1942 1943 append($$anchor, fragment_7); 1944 }; 1945 1946 if_block(node_15, ($$render) => { 1947 if ($$props.vibe_mode && get(VibeEditor)) $$render(consequent_10); 1948 }); 1949 } 1950 1951 reset(div); 1952 1953 var node_17 = sibling(div, 2); 1954 1955 { 1956 var consequent_11 = ($$anchor) => { 1957 Toast($$anchor, { 1958 get messages() { 1959 return get(messages); 1960 }, 1961 on_close: handle_close 1962 }); 1963 }; 1964 1965 if_block(node_17, ($$render) => { 1966 if (get(messages)) $$render(consequent_11); 1967 }); 1968 } 1969 1970 template_effect(() => { 1971 styles = set_style(div, '', styles, { 'min-height': $$props.app_mode ? "100%" : "auto" }); 1972 1973 styles_1 = set_style(main, '', styles_1, { 1974 'flex-grow': $$props.app_mode ? "1" : "auto", 1975 'margin-right': $$props.vibe_mode ? `${vibe_editor_width}px` : "0" 1976 }); 1977 }); 1978 1979 append($$anchor, fragment_2); 1980 pop(); 1981 $$cleanup(); 1982} 1983 1984const Blocks$1 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({ 1985 __proto__: null, 1986 default: Blocks 1987}, Symbol.toStringTag, { value: 'Module' })); 1988 1989export { Blocks$1 as B, api_logo as a, settings_logo as s }; 1990//# sourceMappingURL=Blocks-C7G198oe.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.