import"./svelte/svelte_internal_flags_async.js";import*as e from"./svelte/svelte_internal_client.js";import"./i18n-BldJSFLV.js";import{G as g}from"./utils.svelte-Ceck75cM.js";import{B as k,c as x,k as w}from"./IconButtonWrapper-Cljb5D-5.js";import"./svelte/svelte_internal_flags_legacy.js";import"./svelte/svelte_svelte.js";import{S as y}from"./StreamingBar-b2qVLPYU.js";import"./svelte/svelte_store.js";import"./index-Ds2meNS5.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"./MarkdownCode-C2b9iIxl.js";import"./prism-python-CpYAgONt.js";var T=e.from_html('<span class="label-text svelte-1q8xtp9"> </span>'),B=e.from_html('<label><input type="checkbox" name="test" data-testid="checkbox" class="svelte-1q8xtp9"/> <!></label>');function q(d,r){e.push(r,!0);let h=e.prop(r,"label",3,"Checkbox"),t=e.prop(r,"value",15),_=e.prop(r,"interactive",3,!0),v=e.prop(r,"show_label",3,!0),i=e.derived(()=>!_()),c=e.state(e.proxy(t()));e.user_effect(()=>{e.get(c)!==t()&&(e.set(c,t(),!0),r.on_change?.(e.snapshot(t())))});async function p(o){o.key==="Enter"&&(t(!t()),r.on_select?.({index:0,value:o.currentTarget.checked,selected:o.currentTarget.checked}))}async function m(o){t(o.currentTarget.checked),r.on_select?.({index:0,value:o.currentTarget.checked,selected:o.currentTarget.checked}),r.on_input?.()}var n=B();let u;var l=e.child(n);e.remove_input_defaults(l);var a=e.sibling(l,2);{var s=o=>{var b=T(),f=e.child(b,!0);e.reset(b),e.template_effect(()=>e.set_text(f,h())),e.append(o,b)};e.if(a,o=>{v()&&o(s)})}e.reset(n),e.template_effect(()=>{u=e.set_class(n,1,"checkbox-container svelte-1q8xtp9",null,u,{disabled:e.get(i)}),l.disabled=e.get(i)}),e.bind_checked(l,t),e.event("keydown",l,p),e.event("input",l,m),e.append(d,n),e.pop()}var C=e.from_html("<!> <!> <!> <!>",1);function Y(d,r){e.push(r,!0);let h=e.rest_props(r,["$$slots","$$events","$$legacy"]);const t=new g(h);k(d,{get visible(){return t.shared.visible},get elem_id(){return t.shared.elem_id},get elem_classes(){return t.shared.elem_classes},children:(_,v)=>{var i=C(),c=e.first_child(i);y(c,e.spread_props({get autoscroll(){return t.shared.autoscroll},get i18n(){return t.i18n}},()=>t.shared.loading_status,{on_clear_status:()=>t.dispatch("clear_status",t.shared.loading_status)}));var p=e.sibling(c,2);{var m=a=>{x(a,{get buttons(){return t.props.buttons},on_custom_button_click:s=>{t.dispatch("custom_button_click",{id:s})}})};e.if(p,a=>{t.shared.show_label&&t.props.buttons&&t.props.buttons.length>0&&a(m)})}var n=e.sibling(p,2);{let a=e.derived(()=>t.shared.label||t.i18n("checkbox.checkbox"));q(n,{get label(){return e.get(a)},get interactive(){return t.shared.interactive},get show_label(){return t.shared.show_label},on_change:s=>t.dispatch("change",s),on_input:()=>t.dispatch("input"),on_select:s=>t.dispatch("select",s),get value(){return t.props.value},set value(s){t.props.value=s}})}var u=e.sibling(n,2);{var l=a=>{w(a,{get info(){return t.props.info}})};e.if(u,a=>{t.props.info&&a(l)})}e.append(_,i)},$$slots:{default:!0}}),e.pop()}export{q as BaseCheckbox,Y as default};
