import{m as M}from"./vendor-vueform-slider-CCH9_7pb.js";import{u as P}from"./useFieldsExtraOptions-BNwbfzEK.js";import{d as S,e as u,w as N,f as v,i as p,x as r,j as $,t as C,F as B,r as z}from"./vendor-vue-runtime-core-DwK6Ry68.js";import{r as E,t as D,u as m}from"./vendor-vue-reactivity-CheHbvBM.js";import{t as b,a as k,b as L}from"./vendor-vue-shared-DrzsEcag.js";import"./settingsStore-8bwiLMEn.js";import"./vendor-pinia-BSPefQhS.js";import"./convert-case-to-camel-case.utils-CK5dBN7n.js";const O={class:"slider-min-max"},R={class:"label"},U={class:"label"},q={class:"custom-marks"},A=["onClick"],X=S({__name:"Flat",props:{field:{},modelValue:{}},emits:["update:modelValue"],setup(y,{emit:F}){const i=y,n=F,x=E(i.modelValue),{field:s}=D(i),{formatMinMax:_}=P(s),d=u({get:()=>i.modelValue,set:a=>n("update:modelValue",a)}),t=u(()=>Number(s.value.min)),o=u(()=>Number(s.value.max)),j=u(()=>s.value.jump?1:Number(s.value.step||1)),g=u(()=>s.value.jump),c=u(()=>{var l;return(((l=s.value.scalePoints)==null?void 0:l.trim())||"").split(",").map(e=>Number(e.trim())).filter(e=>!isNaN(e)&&e>=t.value&&e<=o.value)}),w=a=>({left:`${(a-t.value)/(o.value-t.value)*100}%`}),f=a=>{s.value.disabled||g.value&&c.value.includes(a)&&n("update:modelValue",a)},h=a=>{const l=a.toFixed(2);return parseFloat(l).toString()};return N(()=>i.modelValue,a=>{x.value=a}),N(x,a=>{if(g.value){const l=c.value.reduce((e,V)=>Math.abs(V-a)<Math.abs(e-a)?V:e,c.value[0]);n("update:modelValue",l)}else n("update:modelValue",a)}),(a,l)=>(p(),v("div",{class:k(["slider-wrapper ccb-flat-range-field",{jump:m(s).jump}])},[r("div",O,[r("div",{class:"slider-min-max-item first",onClick:l[0]||(l[0]=e=>f(t.value))},[r("span",R,b(m(_)(t.value)),1)]),r("div",{class:k(["slider-min-max-item",{done:d.value>=o.value}]),onClick:l[1]||(l[1]=e=>f(o.value))},[r("span",U,b(m(_)(o.value)),1)],2)]),$(m(M),{modelValue:d.value,"onUpdate:modelValue":l[2]||(l[2]=e=>d.value=e),min:t.value,max:o.value,step:j.value,disabled:m(s).disabled,"show-tooltip":"focus",class:"custom-slider",format:h},null,8,["modelValue","min","max","step","disabled"]),r("div",q,[m(s).scalePoints?(p(!0),v(B,{key:0},z(c.value,e=>(p(),v("div",{key:e,class:"mark",style:L(w(e))},[e!==t.value&&e!==o.value?(p(),v("div",{key:0,class:k(["label",{"label-passed":e<=d.value}]),onClick:V=>f(e)},b(e),11,A)):C("",!0)],4))),128)):C("",!0)])],2))}});export{X as default};
//# sourceMappingURL=Flat-luAWZFVr.js.map
