import"./svelte/svelte_internal_flags_async.js";import*as e from"./svelte/svelte_internal_client.js";import"./i18n-BldJSFLV.js";import{G as j}from"./utils.svelte-Ceck75cM.js";import{B as q,e as C}from"./IconButtonWrapper-Cljb5D-5.js";import"./svelte/svelte_internal_flags_legacy.js";import{tick as c}from"./svelte/svelte_svelte.js";import{S as D}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";let F=0;var H=e.from_html('<button class="reset-button svelte-8epfm4" aria-label="Reset to default value" data-testid="reset-button">↺</button>'),J=e.from_html('<!> <div class="wrap svelte-8epfm4"><div class="head svelte-8epfm4"><label class="svelte-8epfm4"><!></label> <div class="tab-like-container svelte-8epfm4"><input data-testid="number-input" type="number" class="svelte-8epfm4"/> <!></div></div> <div class="slider_input_container svelte-8epfm4"><span class="min_value svelte-8epfm4"> </span> <input type="range" name="cowbell" class="svelte-8epfm4"/> <span class="max_value svelte-8epfm4"> </span></div></div>',1);function fe(S,_){e.push(_,!0);let B=e.rest_props(_,["$$slots","$$events","$$legacy"]),t=new j(B);const P=t.props.value;let l,f;const b=`range_id_${F++}`;let z=e.derived(()=>t.props.minimum??0),A=e.derived(()=>{const i=t.props.minimum,m=t.props.maximum,p=t.props.value;return p>m?100:p<i?0:(p-i)/(m-i)*100});e.user_effect(()=>{t.props.value!=null&&(l.style.setProperty("--range_progress",`${e.get(A)}%`),l.value=t.props.value.toString())});async function G(){await c(),t.dispatch("change")}async function h(i){await c(),t.dispatch("release",t.props.value)}function L(){t.dispatch("release",t.props.value),t.props.value=Math.min(Math.max(t.props.value,t.props.minimum),t.props.maximum)}let u=e.derived(()=>!t.shared.interactive);e.user_effect(()=>{t.props.value&&G()});function M(){}function T(){t.props.value=P,t.dispatch("change"),t.dispatch("release",t.props.value)}async function g(){await c(),t.dispatch("input")}e.event("resize",e.window,M),q(S,{get visible(){return t.shared.visible},get elem_id(){return t.shared.elem_id},get elem_classes(){return t.shared.elem_classes},get container(){return t.shared.container},get scale(){return t.shared.scale},get min_width(){return t.shared.min_width},children:(i,m)=>{var p=J(),x=e.first_child(p);D(x,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 $=e.sibling(x,2),d=e.child($),n=e.child(d),E=e.child(n);C(E,{get show_label(){return t.shared.show_label},get info(){return t.props.info},children:(r,o)=>{e.next();var I=e.text();e.template_effect(()=>e.set_text(I,t.shared.label||"Slider")),e.append(r,I)},$$slots:{default:!0}}),e.reset(n);var w=e.sibling(n,2),a=e.child(w);e.remove_input_defaults(a),e.bind_this(a,r=>f=r,()=>f);var N=e.sibling(a,2);{var R=r=>{var o=H();e.template_effect(()=>o.disabled=e.get(u)),e.event("click",o,T),e.append(r,o)};e.if(N,r=>{(t.props.buttons?.includes("reset")??!0)&&r(R)})}e.reset(w),e.reset(d);var y=e.sibling(d,2),v=e.child(y),U=e.child(v,!0);e.reset(v);var s=e.sibling(v,2);e.remove_input_defaults(s),e.bind_this(s,r=>l=r,()=>l);var k=e.sibling(s,2),V=e.child(k,!0);e.reset(k),e.reset(y),e.reset($),e.template_effect(()=>{e.set_attribute(n,"for",b),e.set_attribute(a,"aria-label",`number input for ${t.shared.label}`),e.set_attribute(a,"min",t.props.minimum),e.set_attribute(a,"max",t.props.maximum),e.set_attribute(a,"step",t.props.step),a.disabled=e.get(u),e.set_text(U,e.get(z)),e.set_attribute(s,"id",b),e.set_attribute(s,"min",t.props.minimum),e.set_attribute(s,"max",t.props.maximum),e.set_attribute(s,"step",t.props.step),s.disabled=e.get(u),e.set_attribute(s,"aria-label",`range slider for ${t.shared.label}`),e.set_text(V,t.props.maximum)}),e.bind_value(a,()=>t.props.value,r=>t.props.value=r),e.event("input",a,g),e.event("blur",a,L),e.event("pointerup",a,h),e.bind_value(s,()=>t.props.value,r=>t.props.value=r),e.event("input",s,g),e.event("pointerup",s,h),e.append(i,p)},$$slots:{default:!0}}),e.pop()}export{fe as default};
