1import { p as prop, i as if_block, a as set_attribute, r as rest_props } from './i18n-CGlVUOvE.js'; 2import { M as push, N as first_child, a as append, O as pop, S as sibling, R as from_html, t as template_effect, a3 as comment, a4 as text, Z as get, a2 as user_derived, X as set_text, a5 as next } from './index-Bq2njFOY.js'; 3import { G as Gradio } from './utils.svelte-Bi9ASwv9.js'; 4import { s as snippet } from './snippet-BG7qkY_1.js'; 5import { B as Button } from './Button-By21KHDn.js'; 6import './Image-XuMqTTwB.js'; 7import './misc-D8a4ZbMA.js'; 8/* empty css */ 9import './ScrollFade.svelte_svelte_type_style_lang-D0JPkGar.js'; 10import './MarkdownCode.svelte_svelte_type_style_lang-B29zDiob.js'; 11import './prism-python-NrKIQnfs.js'; 12/* empty css */ 13 14var root_2 = from_html(`<img class="button-icon svelte-4ac0fl"/>`); 15var root_1 = from_html(`<!> <!>`, 1); 16 17function DownloadButton($$anchor, $$props) { 18 push($$props, true); 19 20 let elem_id = prop($$props, 'elem_id', 3, ""), 21 elem_classes = prop($$props, 'elem_classes', 19, () => []), 22 visible = prop($$props, 'visible', 3, true), 23 variant = prop($$props, 'variant', 3, "secondary"), 24 size = prop($$props, 'size', 3, "lg"), 25 disabled = prop($$props, 'disabled', 3, false), 26 scale = prop($$props, 'scale', 3, null), 27 min_width = prop($$props, 'min_width', 3, undefined); 28 29 function download_file() { 30 $$props.on_click?.(); 31 32 if (!$$props.value?.url) { 33 return; 34 } 35 36 let file_name; 37 38 if (!$$props.value.orig_name && $$props.value.url) { 39 const parts = $$props.value.url.split("/"); 40 41 file_name = parts[parts.length - 1]; 42 file_name = file_name.split("?")[0].split("#")[0]; 43 } else { 44 file_name = $$props.value.orig_name; 45 } 46 47 const a = document.createElement("a"); 48 49 a.href = $$props.value.url; 50 a.download = file_name || "file"; 51 document.body.appendChild(a); 52 a.click(); 53 document.body.removeChild(a); 54 } 55 56 Button($$anchor, { 57 get size() { 58 return size(); 59 }, 60 61 get variant() { 62 return variant(); 63 }, 64 65 get elem_id() { 66 return elem_id(); 67 }, 68 69 get elem_classes() { 70 return elem_classes(); 71 }, 72 73 get visible() { 74 return visible(); 75 }, 76 onclick: download_file, 77 get scale() { 78 return scale(); 79 }, 80 81 get min_width() { 82 return min_width(); 83 }, 84 85 get disabled() { 86 return disabled(); 87 }, 88 89 children: ($$anchor, $$slotProps) => { 90 var fragment_1 = root_1(); 91 var node = first_child(fragment_1); 92 93 { 94 var consequent = ($$anchor) => { 95 var img = root_2(); 96 97 template_effect(() => { 98 set_attribute(img, 'src', $$props.icon.url); 99 set_attribute(img, 'alt', `${$$props.value} icon`); 100 }); 101 102 append($$anchor, img); 103 }; 104 105 if_block(node, ($$render) => { 106 if ($$props.icon) $$render(consequent); 107 }); 108 } 109 110 var node_1 = sibling(node, 2); 111 112 { 113 var consequent_1 = ($$anchor) => { 114 var fragment_2 = comment(); 115 var node_2 = first_child(fragment_2); 116 117 snippet(node_2, () => $$props.children); 118 append($$anchor, fragment_2); 119 }; 120 121 if_block(node_1, ($$render) => { 122 if ($$props.children) $$render(consequent_1); 123 }); 124 } 125 126 append($$anchor, fragment_1); 127 }, 128 $$slots: { default: true } 129 }); 130 131 pop(); 132} 133 134function Index($$anchor, $$props) { 135 push($$props, true); 136 137 const props = rest_props($$props, ['$$slots', '$$events', '$$legacy']); 138 const gradio = new Gradio(props); 139 140 { 141 let $0 = user_derived(() => !gradio.shared.interactive); 142 143 DownloadButton($$anchor, { 144 get value() { 145 return gradio.props.value; 146 }, 147 148 get variant() { 149 return gradio.props.variant; 150 }, 151 152 get elem_id() { 153 return gradio.shared.elem_id; 154 }, 155 156 get elem_classes() { 157 return gradio.shared.elem_classes; 158 }, 159 160 get size() { 161 return gradio.props.size; 162 }, 163 164 get scale() { 165 return gradio.shared.scale; 166 }, 167 168 get icon() { 169 return gradio.props.icon; 170 }, 171 172 get min_width() { 173 return gradio.shared.min_width; 174 }, 175 176 get visible() { 177 return gradio.shared.visible; 178 }, 179 180 get disabled() { 181 return get($0); 182 }, 183 on_click: () => gradio.dispatch("click"), 184 children: ($$anchor, $$slotProps) => { 185 next(); 186 187 var text$1 = text(); 188 189 template_effect(() => set_text(text$1, gradio.shared.label ?? "")); 190 append($$anchor, text$1); 191 }, 192 $$slots: { default: true } 193 }); 194 } 195 196 pop(); 197} 198 199export { DownloadButton as BaseButton, Index as default }; 200//# sourceMappingURL=Index-B6aCVBT9.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.