import{m as S}from"./slider-B0ER1pJ5.js";import{u as $}from"./useFieldsExtraOptions-BAS3Fj_1.js";import{a as B,k as z,C as D,b as i,O as _,m,g as r,p as t,n as E,D as V,u as n,I as C,F as N,H as y,q as F,P as O}from"./convert-case-to-camel-case.utils-DDUpNI96.js";import"./widget-BUAABBRb.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./_commonjs-dynamic-modules-TDtrdbi3.js";import"./translationsStore-DBJu9sBR.js";const q={class:"slider-min-max"},H={class:"label"},I={class:"label"},L={class:"custom-ticks"},R={class:"custom-marks"},U=["onClick"],X=B({__name:"Modern",props:{field:{},modelValue:{}},emits:["update:modelValue"],setup(M,{emit:j}){const d=M,c=j,b=z(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)),w=i(()=>l.value.jump?1:Number(l.value.step||1)),g=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)}),P=a=>({left:`${(a-o.value)/(u.value-o.value)*100}%`}),f=a=>{g.value&&v.value.includes(a)&&c("update:modelValue",a)},h=a=>{const s=a.toFixed(2);return parseFloat(s).toString()};return _(()=>d.modelValue,a=>{b.value=a}),_(b,a=>{if(g.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)=>(r(),m("div",{class:C(["slider-wrapper ccb-modern-range-field",{jump:n(l).jump}])},[t("div",q,[t("div",{class:"slider-min-max-item first",onClick:s[0]||(s[0]=e=>f(o.value))},[t("span",H,V(n(x)(o.value)),1)]),t("div",{class:C(["slider-min-max-item",{done:p.value>=u.value}]),onClick:s[1]||(s[1]=e=>f(u.value))},[t("span",I,V(n(x)(u.value)),1)],2)]),E(n(S),{modelValue:p.value,"onUpdate:modelValue":s[2]||(s[2]=e=>p.value=e),min:o.value,max:u.value,step:w.value,disabled:n(l).disabled,"show-tooltip":"focus",class:"custom-slider",format:h},null,8,["modelValue","min","max","step","disabled"]),t("div",L,[(r(),m(N,null,y(25,e=>t("div",{key:e,class:"tick"})),64))]),t("div",R,[s[3]||(s[3]=t("div",{class:"stick-line"},[t("div",{class:"stick-line-item"})],-1)),n(l).scalePoints?(r(!0),m(N,{key:0},y(v.value,e=>(r(),m("div",{key:e,class:"mark",style:O(P(e))},[e!==o.value&&e!==u.value?(r(),m("div",{key:0,class:"label",onClick:k=>f(e)},V(e),9,U)):F("",!0)],4))),128)):F("",!0)])],2))}});export{X as default};
//# sourceMappingURL=Modern-O77Dnvju.js.map
