1import { i as if_block, g as spread_props, b as set_class, f as set_style, r as rest_props } from './i18n-CGlVUOvE.js'; 2import { M as push, ab as state, ac as proxy, ad as user_effect, Z as get, $ as set, N as first_child, t as template_effect, a as append, S as sibling, Q as child, O as pop, a2 as user_derived, at as prepare_files, R as from_html, T as reset } from './index-Bq2njFOY.js'; 3import { G as Gradio, c as css_units } from './utils.svelte-Bi9ASwv9.js'; 4import HTML from './HTML-DlbkPABy.js'; 5import { S as Static } from './index-1GCmrSlD.js'; 6import './StreamingBar.svelte_svelte_type_style_lang-DWGn5tT_.js'; 7import { B as Block } from './Block-DNK-JdLJ.js'; 8import './MarkdownCode.svelte_svelte_type_style_lang-B29zDiob.js'; 9import './ScrollFade.svelte_svelte_type_style_lang-D0JPkGar.js'; 10import { B as BlockLabel } from './BlockLabel-VpI11pHf.js'; 11import { C as Code } from './Code-CxRgOnU2.js'; 12import { I as IconButtonWrapper } from './IconButtonWrapper-DAsvkfJg.js'; 13export { default as BaseExample } from './Example-DU6ARnKW.js'; 14import './snippet-BG7qkY_1.js'; 15import './Clear-C8Tfa7QP.js'; 16import './html-Bwif0JPw.js'; 17import './prism-python-NrKIQnfs.js'; 18 19var root_1 = from_html(`<!> <!> <!> <div><!></div>`, 1); 20 21function Index($$anchor, $$props) { 22 push($$props, true); 23 24 let props = rest_props($$props, ['$$slots', '$$events', '$$legacy']); 25 let children = $$props.children; 26 const gradio = new Gradio(props); 27 28 let _props = user_derived(() => ({ 29 value: gradio.props.value || "", 30 label: gradio.shared.label, 31 visible: gradio.shared.visible, 32 ...gradio.props.props 33 })); 34 35 let old_value = state(proxy(gradio.props.value)); 36 37 user_effect(() => { 38 if (JSON.stringify(get(old_value)) !== JSON.stringify(gradio.props.value)) { 39 set(old_value, gradio.props.value, true); 40 gradio.dispatch("change"); 41 } 42 }); 43 44 async function upload(file) { 45 try { 46 const file_data = await prepare_files([file]); 47 const result = await gradio.shared.client.upload(file_data, gradio.shared.root, undefined, gradio.shared.max_file_size ?? undefined); 48 49 if (result && result[0]) { 50 return { path: result[0].path, url: result[0].url }; 51 } 52 53 throw new Error("Upload failed"); 54 } catch(e) { 55 gradio.dispatch("error", e instanceof Error ? e.message : String(e)); 56 57 throw e; 58 } 59 } 60 61 { 62 let $0 = user_derived(() => gradio.props.padding !== false); 63 64 Block($$anchor, { 65 get visible() { 66 return gradio.shared.visible; 67 }, 68 69 get elem_id() { 70 return gradio.shared.elem_id; 71 }, 72 73 get elem_classes() { 74 return gradio.shared.elem_classes; 75 }, 76 77 get container() { 78 return gradio.shared.container; 79 }, 80 81 get padding() { 82 return get($0); 83 }, 84 overflow_behavior: 'visible', 85 children: ($$anchor, $$slotProps) => { 86 var fragment_1 = root_1(); 87 var node = first_child(fragment_1); 88 89 { 90 var consequent = ($$anchor) => { 91 IconButtonWrapper($$anchor, { 92 get buttons() { 93 return gradio.props.buttons; 94 }, 95 96 on_custom_button_click: (id) => { 97 gradio.dispatch("custom_button_click", { id }); 98 } 99 }); 100 }; 101 102 if_block(node, ($$render) => { 103 if (gradio.shared.show_label && gradio.props.buttons && gradio.props.buttons.length > 0) $$render(consequent); 104 }); 105 } 106
107 var node_1 = sibling(node, 2); 108 109 { 110 var consequent_1 = ($$anchor) => { 111 BlockLabel($$anchor, { 112 get Icon() { 113 return Code; 114 }, 115 116 get show_label() { 117 return gradio.shared.show_label; 118 }, 119 120 get label() { 121 return gradio.shared.label; 122 }, 123 float: true 124 }); 125 }; 126 127 if_block(node_1, ($$render) => { 128 if (gradio.shared.show_label) $$render(consequent_1); 129 }); 130 } 131 132 var node_2 = sibling(node_1, 2); 133 134 Static(node_2, spread_props( 135 { 136 get autoscroll() { 137 return gradio.shared.autoscroll; 138 }, 139 140 get i18n() { 141 return gradio.i18n; 142 } 143 }, 144 () => gradio.shared.loading_status, 145 { 146 variant: 'center', 147 on_clear_status: () => gradio.dispatch("clear_status", gradio.shared.loading_status) 148 } 149 )); 150 151 var div = sibling(node_2, 2); 152 let classes; 153 let styles; 154 var node_3 = child(div); 155 156 HTML(node_3, { 157 get props() { 158 return get(_props); 159 }, 160 161 get html_template() { 162 return gradio.props.html_template; 163 }, 164 165 get css_template() { 166 return gradio.props.css_template; 167 }, 168 169 get js_on_load() { 170 return gradio.props.js_on_load; 171 }, 172 173 get elem_classes() { 174 return gradio.shared.elem_classes; 175 }, 176 177 get visible() { 178 return gradio.shared.visible; 179 }, 180 181 get autoscroll() { 182 return gradio.shared.autoscroll; 183 }, 184 185 get apply_default_css() { 186 return gradio.props.apply_default_css; 187 }, 188 189 get component_class_name() { 190 return gradio.props.component_class_name; 191 }, 192 upload, 193 get server() { 194 return gradio.shared.server; 195 }, 196 197 $$events: { 198 event: (e) => { 199 gradio.dispatch(e.detail.type, e.detail.data); 200 }, 201 202 update_value: (e) => { 203 if (e.detail.property === "value") { 204 gradio.props.value = e.detail.data; 205 } else if (e.detail.property === "label") { 206 gradio.shared.label = e.detail.data; 207 } else if (e.detail.property === "visible") { 208 gradio.shared.visible = e.detail.data; 209 } 210 } 211 }, 212 213 children: ($$anchor, $$slotProps) => { 214 children?.($$anchor); 215 }, 216 $$slots: { default: true } 217 }); 218 219 reset(div); 220 221 template_effect( 222 ($0) => { 223 classes = set_class(div, 1, 'html-container svelte-1jts93g', null, classes, { 224 pending: gradio.shared.loading_status?.status === "pending" && gradio.shared.loading_status?.show_progress !== "hidden", 225 'label-padding': gradio.shared.show_label ?? undefined 226 }); 227 228 styles = set_style(div, '', styles, $0); 229 }, 230 [ 231 () => ({ 232 'min-height': gradio.props.min_height && gradio.shared.loading_status?.status !== "pending" ? css_units(gradio.props.min_height) : undefined, 233 'max-height': gradio.props.max_height ? css_units(gradio.props.max_height) : undefined, 234 'overflow-y': gradio.props.max_height ? "auto" : undefined 235 }) 236 ] 237 ); 238 239 append($$anchor, fragment_1); 240 }, 241 $$slots: { default: true } 242 }); 243 } 244 245 pop(); 246} 247 248export { HTML as BaseHTML, Index as default }; 249//# sourceMappingURL=Index-8RVq3tR4.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.