import"./svelte/svelte_internal_flags_async.js";import*as t from"./svelte/svelte_internal_client.js";import"./i18n-BldJSFLV.js";import{G as I}from"./utils.svelte-Ceck75cM.js";import{B as N,e as P,c as S}from"./IconButtonWrapper-Cljb5D-5.js";import"./svelte/svelte_internal_flags_legacy.js";import{tick as D}from"./svelte/svelte_svelte.js";import{S as E}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=t.from_html('<div class="validation-error svelte-16ty2ow"> </div>'),W=t.from_html(" <!>",1),j=t.from_html('<!> <label><!> <!> <input type="number"/></label>',1);function it(g,p){t.push(p,!0);const $=t.rest_props(p,["$$slots","$$events","$$legacy"]),e=new I($);e.props.value??=0;let n=t.state(t.proxy(e.props.value));t.user_effect(()=>{t.get(n)!=e.props.value&&(t.set(n,e.props.value,!0),e.dispatch("change"))});async function w(a){await D(),a.key==="Enter"&&(a.preventDefault(),e.dispatch("submit"))}const x=t.derived(()=>!e.shared.interactive);N(g,{get visible(){return e.shared.visible},get elem_id(){return e.shared.elem_id},get elem_classes(){return e.shared.elem_classes},get padding(){return e.shared.container},allow_overflow:!1,get scale(){return e.shared.scale},get min_width(){return e.shared.min_width},children:(a,q)=>{var d=j(),u=t.first_child(d);E(u,t.spread_props({get autoscroll(){return e.shared.autoscroll},get i18n(){return e.i18n}},()=>e.shared.loading_status,{show_validation_error:!1,on_clear_status:()=>{e.dispatch("clear_status",e.shared.loading_status)}}));var o=t.sibling(u,2);let _;var m=t.child(o);{var y=s=>{S(s,{get buttons(){return e.props.buttons},on_custom_button_click:h=>{e.dispatch("custom_button_click",{id:h})}})};t.if(m,s=>{e.shared.show_label&&e.props.buttons&&e.props.buttons.length>0&&s(y)})}var c=t.sibling(m,2);P(c,{get show_label(){return e.shared.show_label},get info(){return e.props.info},children:(s,h)=>{t.next();var f=W(),b=t.first_child(f),k=t.sibling(b);{var B=i=>{var l=T(),G=t.child(l,!0);t.reset(l),t.template_effect(()=>t.set_text(G,e.shared.loading_status?.validation_error)),t.append(i,l)};t.if(k,i=>{e.shared.loading_status?.validation_error&&i(B)})}t.template_effect(()=>t.set_text(b,`${(e.shared.label||"Number")??""} `)),t.append(s,f)},$$slots:{default:!0}});var r=t.sibling(c,2);t.remove_input_defaults(r);let v;t.reset(o),t.template_effect(()=>{_=t.set_class(o,1,"block svelte-16ty2ow",null,_,{container:e.shared.container}),t.set_attribute(r,"aria-label",e.shared.label||"Number"),t.set_attribute(r,"min",e.props.minimum),t.set_attribute(r,"max",e.props.maximum),t.set_attribute(r,"step",e.props.step),t.set_attribute(r,"placeholder",e.props.placeholder),r.disabled=t.get(x),v=t.set_class(r,1,"svelte-16ty2ow",null,v,{"validation-error":e.shared.loading_status?.validation_error})}),t.bind_value(r,()=>e.props.value,s=>e.props.value=s),t.event("keypress",r,w),t.event("input",r,()=>e.dispatch("input")),t.event("blur",r,()=>e.dispatch("blur")),t.event("focus",r,()=>e.dispatch("focus")),t.append(a,d)},$$slots:{default:!0}}),t.pop()}export{it as default};
