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