Spaces:
Runtime error
Runtime error
File size: 5,878 Bytes
5f5d58c |
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
import { r as resolve_wasm_src } from './file-url-a54881a3.js';
/* home/runner/work/gradio/gradio/js/wasm/svelte/DownloadLink.svelte generated by Svelte v4.2.2 */
const {
SvelteComponent,
append,
assign,
compute_rest_props,
create_slot,
detach,
element,
empty,
exclude_internal_props,
get_all_dirty_from_scope,
get_slot_changes,
get_spread_update,
handle_promise,
init,
insert,
listen,
noop,
safe_not_equal,
set_attributes,
set_data,
set_style,
text,
transition_in,
transition_out,
update_await_block_branch,
update_slot_base
} = window.__gradio__svelte__internal;
const { createEventDispatcher } = window.__gradio__svelte__internal;
function create_catch_block(ctx) {
let p;
let t_value = /*error*/ ctx[7].message + "";
let t;
return {
c() {
p = element("p");
t = text(t_value);
set_style(p, "color", "red");
},
m(target, anchor) {
insert(target, p, anchor);
append(p, t);
},
p(ctx, dirty) {
if (dirty & /*href*/ 1 && t_value !== (t_value = /*error*/ ctx[7].message + "")) set_data(t, t_value);
},
i: noop,
o: noop,
d(detaching) {
if (detaching) {
detach(p);
}
}
};
}
// (8:50) <a href={resolved_href}
function create_then_block(ctx) {
let a;
let a_href_value;
let a_target_value;
let current;
let mounted;
let dispose;
const default_slot_template = /*#slots*/ ctx[5].default;
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[4], null);
let a_levels = [
{
href: a_href_value = /*resolved_href*/ ctx[6]
},
{
target: a_target_value = window.__is_colab__ ? "_blank" : null
},
{ rel: "noopener noreferrer" },
{ download: /*download*/ ctx[1] },
/*$$restProps*/ ctx[3]
];
let a_data = {};
for (let i = 0; i < a_levels.length; i += 1) {
a_data = assign(a_data, a_levels[i]);
}
return {
c() {
a = element("a");
if (default_slot) default_slot.c();
set_attributes(a, a_data);
},
m(target, anchor) {
insert(target, a, anchor);
if (default_slot) {
default_slot.m(a, null);
}
current = true;
if (!mounted) {
dispose = listen(a, "click", /*dispatch*/ ctx[2].bind(null, "click"));
mounted = true;
}
},
p(ctx, dirty) {
if (default_slot) {
if (default_slot.p && (!current || dirty & /*$$scope*/ 16)) {
update_slot_base(
default_slot,
default_slot_template,
ctx,
/*$$scope*/ ctx[4],
!current
? get_all_dirty_from_scope(/*$$scope*/ ctx[4])
: get_slot_changes(default_slot_template, /*$$scope*/ ctx[4], dirty, null),
null
);
}
}
set_attributes(a, a_data = get_spread_update(a_levels, [
(!current || dirty & /*href*/ 1 && a_href_value !== (a_href_value = /*resolved_href*/ ctx[6])) && { href: a_href_value },
{ target: a_target_value },
{ rel: "noopener noreferrer" },
(!current || dirty & /*download*/ 2) && { download: /*download*/ ctx[1] },
dirty & /*$$restProps*/ 8 && /*$$restProps*/ ctx[3]
]));
},
i(local) {
if (current) return;
transition_in(default_slot, local);
current = true;
},
o(local) {
transition_out(default_slot, local);
current = false;
},
d(detaching) {
if (detaching) {
detach(a);
}
if (default_slot) default_slot.d(detaching);
mounted = false;
dispose();
}
};
}
// (1:0) <script lang="ts">import { createEventDispatcher }
function create_pending_block(ctx) {
return {
c: noop,
m: noop,
p: noop,
i: noop,
o: noop,
d: noop
};
}
function create_fragment(ctx) {
let await_block_anchor;
let promise;
let current;
let info = {
ctx,
current: null,
token: null,
hasCatch: true,
pending: create_pending_block,
then: create_then_block,
catch: create_catch_block,
value: 6,
error: 7,
blocks: [,,,]
};
handle_promise(promise = resolve_wasm_src(/*href*/ ctx[0]), info);
return {
c() {
await_block_anchor = empty();
info.block.c();
},
m(target, anchor) {
insert(target, await_block_anchor, anchor);
info.block.m(target, info.anchor = anchor);
info.mount = () => await_block_anchor.parentNode;
info.anchor = await_block_anchor;
current = true;
},
p(new_ctx, [dirty]) {
ctx = new_ctx;
info.ctx = ctx;
if (dirty & /*href*/ 1 && promise !== (promise = resolve_wasm_src(/*href*/ ctx[0])) && handle_promise(promise, info)) ; else {
update_await_block_branch(info, ctx, dirty);
}
},
i(local) {
if (current) return;
transition_in(info.block);
current = true;
},
o(local) {
for (let i = 0; i < 3; i += 1) {
const block = info.blocks[i];
transition_out(block);
}
current = false;
},
d(detaching) {
if (detaching) {
detach(await_block_anchor);
}
info.block.d(detaching);
info.token = null;
info = null;
}
};
}
function instance($$self, $$props, $$invalidate) {
const omit_props_names = ["href","download"];
let $$restProps = compute_rest_props($$props, omit_props_names);
let { $$slots: slots = {}, $$scope } = $$props;
let { href = undefined } = $$props;
let { download } = $$props;
const dispatch = createEventDispatcher();
$$self.$$set = $$new_props => {
$$props = assign(assign({}, $$props), exclude_internal_props($$new_props));
$$invalidate(3, $$restProps = compute_rest_props($$props, omit_props_names));
if ('href' in $$new_props) $$invalidate(0, href = $$new_props.href);
if ('download' in $$new_props) $$invalidate(1, download = $$new_props.download);
if ('$$scope' in $$new_props) $$invalidate(4, $$scope = $$new_props.$$scope);
};
return [href, download, dispatch, $$restProps, $$scope, slots];
}
class DownloadLink extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance, create_fragment, safe_not_equal, { href: 0, download: 1 });
}
}
export { DownloadLink as D };
//# sourceMappingURL=DownloadLink-6272d37b.js.map
|