import{g as M}from"./DownloadLink.svelte_svelte_type_style_lang-C_5UIfol.js";import{s as S,g as T}from"./file-url-DoxvUUVV.js";const{SvelteComponent:V,assign:h,check_outros:C,compute_rest_props:D,create_slot:y,detach:k,element:N,empty:O,exclude_internal_props:z,flush:W,get_all_dirty_from_scope:E,get_slot_changes:L,get_spread_update:P,group_outros:B,init:A,insert:w,listen:F,prevent_default:I,safe_not_equal:J,set_attributes:p,set_style:j,toggle_class:b,transition_in:d,transition_out:m,update_slot_base:R}=window.__gradio__svelte__internal,{createEventDispatcher:K,onMount:te}=window.__gradio__svelte__internal;function Q(f){let e,t,o,r,u;const i=f[8].default,s=y(i,f,f[7],null);let a=[{class:"download-link"},{href:f[0]},{target:t=typeof window<"u"&&window.__is_colab__?"_blank":null},{rel:"noopener noreferrer"},{download:f[1]},f[6]],l={};for(let n=0;n{i[n]=null}),C(),t=i[e],t?t.p(a,l):(t=i[e]=u[e](a),t.c()),d(t,1),t.m(o.parentNode,o))},i(a){r||(d(t),r=!0)},o(a){m(t),r=!1},d(a){a&&k(o),i[e].d(a)}}}function Y(f){let e,t,o,r;const u=f[8].default,i=y(u,f,f[7],null);let s=[f[6],{href:f[0]}],a={};for(let l=0;l{s[_]=null}),C(),o=s[t],o?o.p(l,n):(o=s[t]=i[t](l),o.c()),d(o,1),o.m(r.parentNode,r))},i(l){u||(d(o),u=!0)},o(l){m(o),u=!1},d(l){l&&k(r),s[t].d(l)}}}function x(f,e,t){const o=["href","download"];let r=D(e,o),{$$slots:u={},$$scope:i}=e,{href:s=void 0}=e,{download:a}=e;const l=K();let n=!1;const _=M();async function G(){if(n)return;if(l("click"),s==null)throw new Error("href is not defined.");if(_==null)throw new Error("Wasm worker proxy is not available.");const U=new URL(s,window.location.href).pathname;t(2,n=!0),_.httpRequest({method:"GET",path:U,headers:{},query_string:""}).then(g=>{if(g.status!==200)throw new Error(`Failed to get file ${U} from the Wasm worker.`);const H=new Blob([g.body],{type:T(g.headers,"content-type")}),q=URL.createObjectURL(H),v=document.createElement("a");v.href=q,v.download=a,v.click(),URL.revokeObjectURL(q)}).finally(()=>{t(2,n=!1)})}return f.$$set=c=>{e=h(h({},e),z(c)),t(6,r=D(e,o)),"href"in c&&t(0,s=c.href),"download"in c&&t(1,a=c.download),"$$scope"in c&&t(7,i=c.$$scope)},[s,a,n,l,_,G,r,i,u]}class oe extends V{constructor(e){super(),A(this,e,x,$,J,{href:0,download:1})}get href(){return this.$$.ctx[0]}set href(e){this.$$set({href:e}),W()}get download(){return this.$$.ctx[1]}set download(e){this.$$set({download:e}),W()}}export{oe as D}; //# sourceMappingURL=DownloadLink-QIttOhoR.js.map