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