import"./svelte/svelte_internal_flags_async.js";import*as e from"./svelte/svelte_internal_client.js";import"./i18n-BldJSFLV.js";import{G as k}from"./utils.svelte-Ceck75cM.js";import"./index-Ds2meNS5.js";import"./svelte/svelte_svelte.js";import{B as z}from"./Button-D-Ky-vOi.js";import"./svelte/svelte_internal_flags_legacy.js";import"./svelte/svelte_store.js";import"./svelte/svelte_animate.js";import"./svelte/svelte_attachments.js";import"./svelte/svelte_easing.js";import"./svelte/svelte_internal_flags_tracing.js";import"./svelte/svelte_internal_server.js";import"./svelte/svelte_legacy.js";import"./svelte/svelte_motion.js";import"./svelte/svelte_reactivity.js";import"./svelte/svelte_reactivity_window.js";import"./svelte/svelte_server.js";import"./svelte/svelte_transition.js";import"./svelte/svelte_events.js";import"./Image-Bdf4wQSw.js";import"./ImagePreview-Cx854cRW.js";import"./IconButtonWrapper-Cljb5D-5.js";import"./MarkdownCode-C2b9iIxl.js";import"./prism-python-CpYAgONt.js";import"./ShareButton-DCJS4lh5.js";import"./FullscreenButton-Cqzqqtq6.js";var B=e.from_html('<img class="button-icon svelte-4ac0fl"/>'),y=e.from_html("<!> <!>",1);function C(m,t){e.push(t,!0);let d=e.prop(t,"elem_id",3,""),r=e.prop(t,"elem_classes",19,()=>[]),u=e.prop(t,"visible",3,!0),c=e.prop(t,"variant",3,"secondary"),p=e.prop(t,"size",3,"lg"),s=e.prop(t,"disabled",3,!1),v=e.prop(t,"scale",3,null),f=e.prop(t,"min_width",3,void 0);function g(){if(t.on_click?.(),!t.value?.url)return;let i;if(!t.value.orig_name&&t.value.url){const o=t.value.url.split("/");i=o[o.length-1],i=i.split("?")[0].split("#")[0]}else i=t.value.orig_name;const a=document.createElement("a");a.href=t.value.url,a.download=i||"file",document.body.appendChild(a),a.click(),document.body.removeChild(a)}z(m,{get size(){return p()},get variant(){return c()},get elem_id(){return d()},get elem_classes(){return r()},get visible(){return u()},onclick:g,get scale(){return v()},get min_width(){return f()},get disabled(){return s()},children:(i,a)=>{var o=y(),_=e.first_child(o);{var h=l=>{var n=B();e.template_effect(()=>{e.set_attribute(n,"src",t.icon.url),e.set_attribute(n,"alt",`${t.value} icon`)}),e.append(l,n)};e.if(_,l=>{t.icon&&l(h)})}var b=e.sibling(_,2);{var w=l=>{var n=e.comment(),x=e.first_child(n);e.snippet(x,()=>t.children),e.append(l,n)};e.if(b,l=>{t.children&&l(w)})}e.append(i,o)},$$slots:{default:!0}}),e.pop()}function ee(m,t){e.push(t,!0);const d=e.rest_props(t,["$$slots","$$events","$$legacy"]),r=new k(d);{let u=e.derived(()=>!r.shared.interactive);C(m,{get value(){return r.props.value},get variant(){return r.props.variant},get elem_id(){return r.shared.elem_id},get elem_classes(){return r.shared.elem_classes},get size(){return r.props.size},get scale(){return r.shared.scale},get icon(){return r.props.icon},get min_width(){return r.shared.min_width},get visible(){return r.shared.visible},get disabled(){return e.get(u)},on_click:()=>r.dispatch("click"),children:(c,p)=>{e.next();var s=e.text();e.template_effect(()=>e.set_text(s,r.shared.label??"")),e.append(c,s)},$$slots:{default:!0}})}e.pop()}export{C as BaseButton,ee as default};
