import{defineProperty as e}from"../../../_virtual/_rollupPluginBabelHelpers.js";import{jsxs as r,jsx as i,Fragment as t}from"react/jsx-runtime";import{forwardRef as s,useCallback as o}from"react";import{isArrowUpEvent as n,isArrowRightEvent as l,isArrowDownEvent as a,isArrowLeftEvent as m,isPageUpEvent as d,isPageDownEvent as f,isHomeEvent as u,isEndEvent as p}from"../../../utils/dom-event-utils.js";import{useSliderUi as c,useSliderSelection as j,useSliderActions as v}from"../SliderContext.js";import{calcDimensions as b,moveToPx as h,getNearest as S,bem as T,calculatePageStep as g}from"../SliderHelpers.js";import{useSliderRail as x}from"../UseSliderHooks.js";import k from"./SliderRail.js";import D from"./SliderTrack.js";import M from"./SliderFilledTrack.js";import y from"./SliderThumb.js";import"./SliderBase.scss.js";import{SliderTextSize as C}from"../SliderConstants.js";import I from"../SliderInText.js";var X=s((function(s,X){var E,H=s.className,L=c(),O=L.color,R=L.disabled,V=L.size,w=L.shapeTestId,z=j(),A=z.min,B=z.max,F=z.ranged,K=z.step,N=z.value,P=v(),U=P.changeThumbValue,_=P.drugThumb,G=P.decreaseValue,q=P.increaseValue,J=x(),Q=J.railCoords,W=J.railRef,Y=b(B,A,F,N),Z=Y.dimension,$=Y.offset,ee=Y.positions,re=Y.thumbKeys,ie=o((function(e){var r=h(Math.round(e.clientX-Q.left),A,B,Q,K);_(r)}),[_,A,B,Q,K]),te=o((function(e){var r=h(e.clientX-Q.left,A,B,Q,K),i=S(r,F,N);U(r,i)}),[U,A,B,Q,F,K,N]);return r("div",Object.assign({style:{width:"100%"}},{children:[i("div",Object.assign({className:T("base",(E={},e(E,V,V),e(E,O,O),e(E,"disabled",R),E),H),"data-testid":w("base"),onKeyDown:function(e){return n(e)||l(e)?q():a(e)||m(e)?G():d(e)?(e.preventDefault(),q(g(B,A,K))):f(e)?(e.preventDefault(),G(g(B,A,K))):u(e)?(e.preventDefault(),U(A)):p(e)?(e.preventDefault(),U(B)):void 0}},{children:r(k,Object.assign({onClick:te,ref:W},{children:[i(D,{}),W.current&&r(t,{children:[i(M,{dimension:Z,offset:$}),ee.map((function(e,r){return i(y,{index:r,onMove:ie,position:e},re[r])}))]})]}))})),i(I,{kind:I.kinds.TEXTFIX,textSize:"small"===V?C.SMALL:"medium"===V?C.MEDIUM:C.LARGE})]}))}));export{X as default};
