(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[77927],{63322:(e,t,n)=>{"use strict";n.d(t,{A:()=>c});var r=n(52751),o=n(68852),s=n(99460);let u=e=>e instanceof MouseEvent,c=function(e){let{buffer:t=0,throttleBy:n=18,excludeTouchEvents:c,onEnterBox:a,onLeaveBox:l}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},d=(0,s.A)(e),[i,p]=r.useState({x:null,y:null}),f=r.useRef(!1),h=r.useRef(a),w=r.useRef(l);return h.current=a,w.current=l,r.useEffect(()=>{let e=h.current,r=w.current,s=n=>{u(n)&&(n.preventDefault(),n.stopPropagation());let{clientX:o,clientY:s}=n;if(!d)return;if(!(o>=d.left-t&&o<=d.left+d.width+t&&s>=d.top-t&&s<=d.top+d.height+t)){f.current&&"function"==typeof r&&r(),f.current=!1;return}f.current||("function"==typeof e&&e(),f.current=!0);let c={x:o-d.left,y:s-d.top};f.current=!0,p(c)},[a,l]=(0,o.Pd)(s,n),[i,m]=(0,o.Pd)(e=>{s(e.touches[0])},n);return window.addEventListener("mousemove",a),c||window.addEventListener("touchmove",i),()=>{window.removeEventListener("mousemove",a),l(),c||(window.removeEventListener("touchmove",i),m())}},[d,t,n,c]),[i,d]}},77927:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>E});var r=n(87687),o=n(52751),s=n(31928),u=n(68852),c=n(63322);function a(e){let[t,n,r]=e.toUpperCase().match(/[0-9A-F]{2}/g);return{r:t,g:n,b:r}}let l=e=>parseInt(e,16),d=e=>{let t=e.toString(16);return e<16&&(t="0".concat(t)),1===t.length&&(t="".concat(t).concat(t)),t},i=e=>{let{r:t,g:n,b:r}=e;return"#".concat(t).concat(n).concat(r)},p=e=>"linear-gradient(0deg, ".concat(e.join(", "),")"),f=(0,s.I)("div")({name:"Wrapper",class:"wk99p5d",propsAsIs:!1}),h=(0,s.I)("button")({name:"SliderButton",class:"s1ifpwuy",propsAsIs:!1}),w=(0,s.I)("span")({name:"HandleWrapper",class:"hjgdu10",propsAsIs:!1}),m=(0,s.I)("span")({name:"Handle",class:"h1g0qwxd",propsAsIs:!1}),v=o.memo(function(e){let{value:t,channel:n,color:s,dynamicGradients:a,onChange:v}=e,g=o.useRef(),E=o.useId(),[y,x]=(0,c.A)(g,{buffer:128}),[j,I]=o.useState(!1);o.useEffect(()=>{if(!j||!y||!x)return;let e=y.y/x.height*255;v(n,e=255-Math.round((0,u.qE)(e,0,255)))},[j,y,x,n,v]),o.useEffect(()=>{function e(){I(!1)}return window.addEventListener("mouseup",e),window.addEventListener("touchend",e),document.addEventListener("mouseleave",e),()=>{window.removeEventListener("mouseup",e),window.removeEventListener("touchend",e),document.removeEventListener("mouseleave",e)}},[j]);let k=l(t),A=(0,u.S8)(k,0,255,100,0),b=o.useMemo(()=>(0,u.y1)(10).map(e=>{let t=a?{...s}:{r:"00",g:"00",b:"00"};return t[n]=d(Math.round((0,u.S8)(e,0,9,0,255))),i(t)}),[n,s,a]);return(0,r.jsxs)(f,{children:[t,(0,r.jsx)(h,{ref:g,id:"slider-".concat(E),style:{background:p(b)},onMouseDown:()=>I(!0),onTouchStart:()=>I(!0),onKeyDown:function(e){switch(e.key){case"ArrowUp":e.preventDefault(),v(n,(0,u.qE)(k+10,0,255));break;case"ArrowDown":e.preventDefault(),v(n,(0,u.qE)(k-10,0,255))}},children:(0,r.jsx)(w,{children:(0,r.jsx)(m,{style:{top:"".concat(A,"%")}})})})]})});n(22228);let g=(0,s.I)("div")({name:"Wrapper",class:"w1puqmho",propsAsIs:!1}),E=o.memo(function(e){let{dynamicGradients:t=!1}=e,[n,s]=o.useState("FF0000"),{r:u,g:c,b:l}=a(n),i=o.useCallback((e,t)=>{s(n=>{let r=a(n);return r[e]=d(t),"".concat(r.r).concat(r.g).concat(r.b)})},[]);return(0,r.jsxs)(g,{style:{color:"#".concat(n)},children:["#",(0,r.jsx)(v,{value:u,channel:"r",color:n,dynamicGradients:t,onChange:i}),(0,r.jsx)(v,{value:c,channel:"g",color:n,dynamicGradients:t,onChange:i}),(0,r.jsx)(v,{value:l,channel:"b",color:n,dynamicGradients:t,onChange:i})]})});n(51622)},51622:e=>{e.exports={w1puqmho:"w1puqmho"}},22228:e=>{e.exports={wk99p5d:"wk99p5d",s1ifpwuy:"s1ifpwuy",hjgdu10:"hjgdu10",h1g0qwxd:"h1g0qwxd"}}}]); //# sourceMappingURL=77927.44805325751cd89f.js.map