@uiw/react-color
Version:
Color Picker component for React.
2 lines • 46.4 kB
JavaScript
/*! For license information please see color.min.js.LICENSE.txt */
!function(e,r){"object"===typeof exports&&"object"===typeof module?module.exports=r(require("react")):"function"===typeof define&&define.amd?define(["react"],r):"object"===typeof exports?exports["@uiw/react-color"]=r(require("react")):e["@uiw/react-color"]=r(e.React)}(self,(e=>(()=>{"use strict";var r={85:(e,r,o)=>{e.exports=o(335)},335:(e,r,o)=>{var t=o(442),a=Symbol.for("react.element"),l=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,n=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function d(e,r,o){var t,l={},d=null,c=null;for(t in void 0!==o&&(d=""+o),void 0!==r.key&&(d=""+r.key),void 0!==r.ref&&(c=r.ref),r)s.call(r,t)&&!i.hasOwnProperty(t)&&(l[t]=r[t]);if(e&&e.defaultProps)for(t in r=e.defaultProps)void 0===l[t]&&(l[t]=r[t]);return{$$typeof:a,type:e,key:d,ref:c,props:l,_owner:n.current}}r.jsx=d,r.jsxs=d},442:r=>{r.exports=e}},o={};function t(e){var a=o[e];if(void 0!==a)return a.exports;var l=o[e]={exports:{}};return r[e](l,l.exports,t),l.exports}t.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},t.d=(e,r)=>{for(var o in r)t.o(r,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:r[o]})},t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t.r=e=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};function l(){return l=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var t in o)({}).hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e},l.apply(null,arguments)}t.r(a),t.d(a,{Alpha:()=>de,BACKGROUND_IMG:()=>ne,Block:()=>me,Chrome:()=>Ue,Circle:()=>Ze,Colorful:()=>or,Compact:()=>nr,EditableInput:()=>he,EditableInputHSLA:()=>Oe,EditableInputRGBA:()=>He,Github:()=>je,Hue:()=>Te,Material:()=>pr,Pointer:()=>le,Saturation:()=>Ne,ShadeSlider:()=>mr,Sketch:()=>kr,Slider:()=>jr,Swatch:()=>be,Wheel:()=>Mr,baseNamed:()=>gr,color:()=>O,colorKeywords:()=>ur,colorKeywordsBase:()=>br,colorNameToHex:()=>fr,equalColorObjects:()=>W,equalColorString:()=>G,equalHex:()=>q,getContrastingColor:()=>_,hexToHsva:()=>A,hexToRgba:()=>j,hexToXY:()=>M,hslStringToHsla:()=>u,hslStringToHsva:()=>b,hslaStringToHsva:()=>g,hslaToHsl:()=>D,hslaToHsva:()=>f,hsvStringToHsva:()=>C,hsvaStringToHsva:()=>v,hsvaToHex:()=>P,hsvaToHexa:()=>T,hsvaToHslString:()=>d,hsvaToHsla:()=>x,hsvaToHslaString:()=>h,hsvaToHsv:()=>L,hsvaToHsvString:()=>c,hsvaToHsvaString:()=>p,hsvaToRgbString:()=>E,hsvaToRgba:()=>R,hsvaToRgbaString:()=>S,parseHue:()=>y,rgbStringToHsva:()=>F,rgbToXY:()=>z,rgbaStringToHsva:()=>w,rgbaToHex:()=>k,rgbaToHexa:()=>B,rgbaToHsva:()=>i,rgbaToRgb:()=>N,validHex:()=>X,xyToHex:()=>H,xyToRgb:()=>I});var s=255,n=100,i=e=>{var{r:r,g:o,b:t,a:a}=e,l=Math.max(r,o,t),i=l-Math.min(r,o,t),d=i?l===r?(o-t)/i:l===o?2+(t-r)/i:4+(r-o)/i:0;return{h:60*(d<0?d+6:d),s:l?i/l*n:0,v:l/s*n,a:a}},d=e=>{var{h:r,s:o,l:t}=x(e);return"hsl("+r+", "+Math.round(o)+"%, "+Math.round(t)+"%)"},c=e=>{var{h:r,s:o,v:t}=e;return"hsv("+r+", "+o+"%, "+t+"%)"},p=e=>{var{h:r,s:o,v:t,a:a}=e;return"hsva("+r+", "+o+"%, "+t+"%, "+a+")"},h=e=>{var{h:r,s:o,l:t,a:a}=x(e);return"hsla("+r+", "+o+"%, "+t+"%, "+a+")"},u=e=>{var[r,o,t,a]=(e.match(/\d+/g)||[]).map(Number);return{h:r,s:o,l:t,a:a}},g=e=>{var r=/hsla?\(?\s*(-?\d*\.?\d+)(deg|rad|grad|turn)?[,\s]+(-?\d*\.?\d+)%?[,\s]+(-?\d*\.?\d+)%?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return r?f({h:y(r[1],r[2]),s:Number(r[3]),l:Number(r[4]),a:void 0===r[5]?1:Number(r[5])/(r[6]?100:1)}):{h:0,s:0,v:0,a:1}},b=g,f=e=>{var{h:r,s:o,l:t,a:a}=e;return{h:r,s:(o*=(t<50?t:n-t)/n)>0?2*o/(t+o)*n:0,v:t+o,a:a}},x=e=>{var{h:r,s:o,v:t,a:a}=e,l=(200-o)*t/n;return{h:r,s:l>0&&l<200?o*t/n/(l<=n?l:200-l)*n:0,l:l/2,a:a}},v=e=>{var r=/hsva?\(?\s*(-?\d*\.?\d+)(deg|rad|grad|turn)?[,\s]+(-?\d*\.?\d+)%?[,\s]+(-?\d*\.?\d+)%?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return r?{h:y(r[1],r[2]),s:Number(r[3]),v:Number(r[4]),a:void 0===r[5]?1:Number(r[5])/(r[6]?n:1)}:{h:0,s:0,v:0,a:1}},m={grad:.9,turn:360,rad:360/(2*Math.PI)},y=function(e,r){return void 0===r&&(r="deg"),Number(e)*(m[r]||1)},C=v,w=e=>{var r=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return r?i({r:Number(r[1])/(r[2]?n/s:1),g:Number(r[3])/(r[4]?n/s:1),b:Number(r[5])/(r[6]?n/s:1),a:void 0===r[7]?1:Number(r[7])/(r[8]?n:1)}):{h:0,s:0,v:0,a:1}},F=w,k=e=>{var r,{r:o,g:t,b:a}=e;return"#"+(r=(o<<16|t<<8|a).toString(16),new Array(7-r.length).join("0")+r)},B=e=>{var{r:r,g:o,b:t,a:a}=e,l="number"===typeof a&&(255*a|256).toString(16).slice(1);return""+k({r:r,g:o,b:t,a:a})+(l||"")},A=e=>i(j(e)),j=e=>{var r=e.replace("#","");/^#?/.test(e)&&3===r.length&&(e="#"+r.charAt(0)+r.charAt(0)+r.charAt(1)+r.charAt(1)+r.charAt(2)+r.charAt(2));var o=new RegExp("[A-Za-z0-9]{2}","g"),[t,a,l=0,n]=e.match(o).map((e=>parseInt(e,16)));return{r:t,g:a,b:l,a:(null!=n?n:255)/s}},R=e=>{var{h:r,s:o,v:t,a:a}=e,i=r/60,d=o/n,c=t/n,p=Math.floor(i)%6,h=i-Math.floor(i),u=s*c*(1-d),g=s*c*(1-d*h),b=s*c*(1-d*(1-h));c*=s;var f={};switch(p){case 0:f.r=c,f.g=b,f.b=u;break;case 1:f.r=g,f.g=c,f.b=u;break;case 2:f.r=u,f.g=c,f.b=b;break;case 3:f.r=u,f.g=g,f.b=c;break;case 4:f.r=b,f.g=u,f.b=c;break;case 5:f.r=c,f.g=u,f.b=g}return f.r=Math.round(f.r),f.g=Math.round(f.g),f.b=Math.round(f.b),l({},f,{a:a})},E=e=>{var{r:r,g:o,b:t}=R(e);return"rgb("+r+", "+o+", "+t+")"},S=e=>{var{r:r,g:o,b:t,a:a}=R(e);return"rgba("+r+", "+o+", "+t+", "+a+")"},N=e=>{var{r:r,g:o,b:t}=e;return{r:r,g:o,b:t}},D=e=>{var{h:r,s:o,l:t}=e;return{h:r,s:o,l:t}},P=e=>k(R(e)),T=e=>B(R(e)),L=e=>{var{h:r,s:o,v:t}=e;return{h:r,s:o,v:t}},M=e=>z(N(j(e))),H=e=>k(l({},I(e),{a:255})),I=e=>{var{x:r,y:o,bri:t=255}=e,a=3.2406255*r+-1.537208*o+-.4986286*t,l=-.9689307*r+1.8757561*o+.0415175*t,s=.0557101*r+-.2040211*o+1.0569959*t,n=function(e){return e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055};return{r:Math.round(255*n(a)),g:Math.round(255*n(l)),b:Math.round(255*n(s))}},z=e=>{var{r:r,g:o,b:t}=e,a=function(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},l=a(r/255),s=a(o/255),n=a(t/255),i={};return i.x=.4124*l+.3576*s+.1805*n,i.y=.2126*l+.7152*s+.0722*n,i.bri=.0193*l+.1192*s+.9505*n,i},O=e=>{var r,o,t,a,l,s,n,i,d;return"string"===typeof e&&X(e)?(s=A(e),i=e):"string"!==typeof e&&(s=e),s&&(t=L(s),l=x(s),a=R(s),d=B(a),i=P(s),o=D(l),r=N(a),n=z(r)),{rgb:r,hsl:o,hsv:t,rgba:a,hsla:l,hsva:s,hex:i,hexa:d,xy:n}},_=e=>{if(!e)return"#ffffff";var r=O(e);return(299*r.rgb.r+587*r.rgb.g+114*r.rgb.b)/1e3>=128?"#000000":"#ffffff"},W=(e,r)=>{if(e===r)return!0;for(var o in e)if(e[o]!==r[o])return!1;return!0},G=(e,r)=>e.replace(/\s/g,"")===r.replace(/\s/g,""),q=(e,r)=>e.toLowerCase()===r.toLowerCase()||W(j(e),j(r)),X=e=>/^#?([A-Fa-f0-9]{3,4}){1,2}$/.test(e);function Y(e,r){if(null==e)return{};var o={};for(var t in e)if({}.hasOwnProperty.call(e,t)){if(-1!==r.indexOf(t))continue;o[t]=e[t]}return o}var U=t(442),V=t.n(U);function K(e){var r=(0,U.useRef)(e);return(0,U.useEffect)((()=>{r.current=e})),(0,U.useCallback)(((e,o)=>r.current&&r.current(e,o)),[])}var Q=e=>"touches"in e,Z=e=>{!Q(e)&&e.preventDefault&&e.preventDefault()},$=function(e,r,o){return void 0===r&&(r=0),void 0===o&&(o=1),e>o?o:e<r?r:e},J=(e,r)=>{var o=e.getBoundingClientRect(),t=Q(r)?r.touches[0]:r;return{left:$((t.pageX-(o.left+window.pageXOffset))/o.width),top:$((t.pageY-(o.top+window.pageYOffset))/o.height),width:o.width,height:o.height,x:t.pageX-(o.left+window.pageXOffset),y:t.pageY-(o.top+window.pageYOffset)}},ee=t(85),re=["prefixCls","className","onMove","onDown"],oe=V().forwardRef(((e,r)=>{var{prefixCls:o="w-color-interactive",className:t,onMove:a,onDown:s}=e,n=Y(e,re),i=(0,U.useRef)(null),d=(0,U.useRef)(!1),[c,p]=(0,U.useState)(!1),h=K(a),u=K(s),g=(0,U.useCallback)((e=>{(Z(e),i.current)&&((Q(e)?e.touches.length>0:e.buttons>0)?null==h||h(J(i.current,e),e):p(!1))}),[h]),b=(0,U.useCallback)((()=>p(!1)),[]),f=(0,U.useCallback)((e=>{e?(window.addEventListener(d.current?"touchmove":"mousemove",g),window.addEventListener(d.current?"touchend":"mouseup",b)):(window.removeEventListener("mousemove",g),window.removeEventListener("mouseup",b),window.removeEventListener("touchmove",g),window.removeEventListener("touchend",b))}),[g,b]);(0,U.useEffect)((()=>(f(c),()=>{f(!1)})),[c,g,b,f]);var x=(0,U.useCallback)((e=>{Z(e.nativeEvent),(e=>!(d.current&&!Q(e))&&(d.current=Q(e),!0))(e.nativeEvent)&&i.current&&(null==u||u(J(i.current,e.nativeEvent),e.nativeEvent),p(!0))}),[u]);return(0,ee.jsx)("div",l({},n,{className:[o,t||""].filter(Boolean).join(" "),style:l({},n.style,{touchAction:"none"}),ref:i,tabIndex:0,onMouseDown:x,onTouchStart:x}))}));oe.displayName="Interactive";const te=oe;var ae=["className","prefixCls","left","top","style","fillProps"],le=e=>{var{className:r,prefixCls:o,left:t,top:a,style:s,fillProps:n}=e,i=Y(e,ae),d=l({},s,{position:"absolute",left:t,top:a}),c=l({width:18,height:18,boxShadow:"var(--alpha-pointer-box-shadow)",borderRadius:"50%",backgroundColor:"var(--alpha-pointer-background-color)"},null==n?void 0:n.style,{transform:t?"translate(-9px, -1px)":"translate(-1px, -9px)"});return(0,ee.jsx)("div",l({className:o+"-pointer "+(r||""),style:d},i,{children:(0,ee.jsx)("div",l({className:o+"-fill"},n,{style:c}))}))},se=["prefixCls","className","hsva","background","bgProps","innerProps","pointerProps","radius","width","height","direction","style","onChange","pointer"],ne="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==",ie=V().forwardRef(((e,r)=>{var{prefixCls:o="w-color-alpha",className:t,hsva:a,background:s,bgProps:n={},innerProps:i={},pointerProps:d={},radius:c=0,width:p,height:u=16,direction:g="horizontal",style:b,onChange:f,pointer:x}=e,v=Y(e,se),m=e=>{f&&f(l({},a,{a:"horizontal"===g?e.left:e.top}),e)},y=h(Object.assign({},a,{a:1})),C="linear-gradient(to "+("horizontal"===g?"right":"bottom")+", rgba(244, 67, 54, 0) 0%, "+y+" 100%)",w={};"horizontal"===g?w.left=100*a.a+"%":w.top=100*a.a+"%";var F=l({"--alpha-background-color":"#fff","--alpha-pointer-background-color":"rgb(248, 248, 248)","--alpha-pointer-box-shadow":"rgb(0 0 0 / 37%) 0px 1px 4px 0px",borderRadius:c,background:"url("+ne+") left center",backgroundColor:"var(--alpha-background-color)"},{width:p,height:u},b,{position:"relative"}),k=x&&"function"===typeof x?x(l({prefixCls:o},d,w)):(0,ee.jsx)(le,l({},d,{prefixCls:o},w));return(0,ee.jsxs)("div",l({},v,{className:[o,o+"-"+g,t||""].filter(Boolean).join(" "),style:F,ref:r,children:[(0,ee.jsx)("div",l({},n,{style:l({inset:0,position:"absolute",background:s||C,borderRadius:c},n.style)})),(0,ee.jsx)(te,l({},i,{style:l({},i.style,{inset:0,zIndex:1,position:"absolute"}),onMove:m,onDown:m,children:k}))]}))}));ie.displayName="Alpha";const de=ie;var ce=["prefixCls","placement","label","value","className","style","labelStyle","inputStyle","onChange","onBlur","renderInput"],pe=V().forwardRef(((e,r)=>{var{prefixCls:o="w-color-editable-input",placement:t="bottom",label:a,value:s,className:n,style:i,labelStyle:d,inputStyle:c,onChange:p,onBlur:h,renderInput:u}=e,g=Y(e,ce),[b,f]=(0,U.useState)(s),x=(0,U.useRef)(!1);(0,U.useEffect)((()=>{e.value!==b&&(x.current||f(e.value))}),[e.value]);var v={};"bottom"===t&&(v.flexDirection="column"),"top"===t&&(v.flexDirection="column-reverse"),"left"===t&&(v.flexDirection="row-reverse");var m=l({"--editable-input-label-color":"rgb(153, 153, 153)","--editable-input-box-shadow":"rgb(204 204 204) 0px 0px 0px 1px inset","--editable-input-color":"#666",position:"relative",alignItems:"center",display:"flex",fontSize:11},v,i),y=l({width:"100%",paddingTop:2,paddingBottom:2,paddingLeft:3,paddingRight:3,fontSize:11,background:"transparent",boxSizing:"border-box",border:"none",color:"var(--editable-input-color)",boxShadow:"var(--editable-input-box-shadow)"},c),C=l({value:b,onChange:function(e,r){var o=(r||e.target.value).trim().replace(/^#/,"");/^#?([A-Fa-f0-9]{3,4}){1,2}$/.test(o)&&p&&p(e,o);var t=(e=>Number(String(e).replace(/%/g,"")))(o);isNaN(t)||p&&p(e,t),f(o)},onBlur:function(r){x.current=!1,f(e.value),h&&h(r)},autoComplete:"off",onFocus:()=>x.current=!0},g,{style:y});return(0,ee.jsxs)("div",{className:[o,n||""].filter(Boolean).join(" "),style:m,children:[u?u(C,r):(0,ee.jsx)("input",l({ref:r},C)),a&&(0,ee.jsx)("span",{style:l({color:"var(--editable-input-label-color)",textTransform:"capitalize"},d),children:a})]})}));pe.displayName="EditableInput";const he=pe;var ue=["prefixCls","className","color","colors","style","rectProps","onChange","addonAfter","addonBefore","rectRender"],ge=V().forwardRef(((e,r)=>{var{prefixCls:o="w-color-swatch",className:t,color:a,colors:s=[],style:n,rectProps:i={},onChange:d,addonAfter:c,addonBefore:p,rectRender:h}=e,u=Y(e,ue),g=l({"--swatch-background-color":"rgb(144, 19, 254)",background:"var(--swatch-background-color)",height:15,width:15,marginRight:5,marginBottom:5,cursor:"pointer",position:"relative",outline:"none",borderRadius:2},i.style),b=(e,r)=>{d&&d(A(e),O(A(e)),r)};return(0,ee.jsxs)("div",l({ref:r},u,{className:[o,t||""].filter(Boolean).join(" "),style:l({display:"flex",flexWrap:"wrap",position:"relative"},n),children:[p&&V().isValidElement(p)&&p,s&&Array.isArray(s)&&s.map(((e,r)=>{var o="",t="";"string"===typeof e&&(o=e,t=e),"object"===typeof e&&e.color&&(o=e.title||e.color,t=e.color);var s=a&&a.toLocaleLowerCase()===t.toLocaleLowerCase(),n=h&&h({title:o,color:t,checked:!!s,style:l({},g,{background:t}),onClick:e=>b(t,e)});if(n)return(0,ee.jsx)(U.Fragment,{children:n},r);var d=i.children&&V().isValidElement(i.children)?V().cloneElement(i.children,{color:t,checked:s}):null;return(0,ee.jsx)("div",l({tabIndex:0,title:o,onClick:e=>b(t,e)},i,{children:d,style:l({},g,{background:t})}),r)})),c&&V().isValidElement(c)&&c]}))}));ge.displayName="Swatch";const be=ge;var fe=["prefixCls","className","style","color","colors","onChange"],xe=["#D9E3F0","#F47373","#697689","#37D67A","#2CCCE4","#555555","#dce775","#ff8a65","#ba68c8"],ve=V().forwardRef(((e,r)=>{var{prefixCls:o="w-color-block",className:t,style:a,color:s,colors:n=xe,onChange:i}=e,d=Y(e,fe),c="string"===typeof s&&X(s)?A(s):s,p=s?P(c):"",h=(e,r)=>{"string"===typeof e&&X(e)&&/(3|6)/.test(String(e.replace(/^#/,"").length))&&i&&i(O(A(e)))},u=l({"--block-background-color":"rgb(255, 255, 255)","--block-box-shadow":"rgb(0 0 0 / 10%) 0 1px",width:170,borderRadius:6,background:"var(--block-background-color)",boxShadow:"var(--block-box-shadow)",position:"relative"},a);return(0,ee.jsxs)("div",l({ref:r,className:[o,t].filter(Boolean).join(" "),style:u},d,{children:[(0,ee.jsx)("div",{style:{width:0,height:0,borderStyle:"solid",borderWidth:"0 10px 10px",borderColor:"transparent transparent "+p,position:"absolute",top:-10,left:"50%",marginLeft:-10}}),(0,ee.jsx)("div",{title:p,style:{backgroundColor:""+p,color:_(p),height:110,fontSize:18,borderRadius:"6px 6px 0 0",display:"flex",alignItems:"center",justifyContent:"center"},children:p.toLocaleUpperCase()}),(0,ee.jsx)(be,{colors:n,color:p,style:{paddingLeft:10,paddingTop:10},rectProps:{style:{marginRight:10,marginBottom:10,borderRadius:4,height:22,width:22}},onChange:e=>{i&&i(O(e))}}),(0,ee.jsx)(he,{value:p.toLocaleUpperCase(),onChange:(e,r)=>h(r),onBlur:e=>{var r=e.target.value;e.target.value=r.slice(0,6),h(r.slice(0,6))},inputStyle:{height:22,outline:0,borderRadius:3,padding:"0 7px"},style:{padding:10,paddingTop:0,borderRadius:"0 0 6px 6px"}})]}))}));ve.displayName="Block";const me=ve;function ye(e){if(null==e)throw new TypeError("Cannot destructure "+e)}var Ce={marginRight:0,marginBottom:0,borderRadius:0,boxSizing:"border-box",height:25,width:25};function we(e){var{style:r,title:o,checked:t,color:a,onClick:s,rectProps:n}=e,i=(0,U.useRef)(null),d=(0,U.useCallback)((()=>{i.current.style.zIndex="2",i.current.style.outline="#fff solid 2px",i.current.style.boxShadow="rgb(0 0 0 / 25%) 0 0 5px 2px"}),[]),c=(0,U.useCallback)((()=>{t||(i.current.style.zIndex="0",i.current.style.outline="initial",i.current.style.boxShadow="initial")}),[t]),p=t?{zIndex:1,outline:"#fff solid 2px",boxShadow:"rgb(0 0 0 / 25%) 0 0 5px 2px"}:{zIndex:0};return(0,ee.jsx)("div",l({ref:i,title:o},n,{onClick:s,onMouseEnter:d,onMouseLeave:c,style:l({},r,{marginRight:0,marginBottom:0,borderRadius:0,boxSizing:"border-box",height:25,width:25},Ce,p,null==n?void 0:n.style)}))}var Fe=["prefixCls","placement","className","style","color","colors","rectProps","onChange","rectRender"],ke=["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],Be=function(e){return e.Left="L",e.LeftTop="LT",e.LeftBottom="LB",e.Right="R",e.RightTop="RT",e.RightBottom="RB",e.Top="T",e.TopRight="TR",e.TopLeft="TL",e.Bottom="B",e.BottomLeft="BL",e.BottomRight="BR",e}({}),Ae=V().forwardRef(((e,r)=>{var{prefixCls:o="w-color-github",placement:t=Be.TopRight,className:a,style:s,color:n,colors:i=ke,rectProps:d={},onChange:c,rectRender:p}=e,h=Y(e,Fe),u="string"===typeof n&&X(n)?A(n):n,g=n?P(u):"",b=l({"--github-border":"1px solid rgba(0, 0, 0, 0.2)","--github-background-color":"#fff","--github-box-shadow":"rgb(0 0 0 / 15%) 0px 3px 12px","--github-arrow-border-color":"rgba(0, 0, 0, 0.15)",width:200,borderRadius:4,background:"var(--github-background-color)",boxShadow:"var(--github-box-shadow)",border:"var(--github-border)",position:"relative",padding:5},s),f={borderStyle:"solid",position:"absolute"},x=l({},f),v=l({},f);/^T/.test(t)&&(x.borderWidth="0 8px 8px",x.borderColor="transparent transparent var(--github-arrow-border-color)",v.borderWidth="0 7px 7px",v.borderColor="transparent transparent var(--github-background-color)"),t===Be.TopRight&&(x.top=-8,v.top=-7),t===Be.Top&&(x.top=-8,v.top=-7),t===Be.TopLeft&&(x.top=-8,v.top=-7),/^B/.test(t)&&(x.borderWidth="8px 8px 0",x.borderColor="var(--github-arrow-border-color) transparent transparent",v.borderWidth="7px 7px 0",v.borderColor="var(--github-background-color) transparent transparent",t===Be.BottomRight&&(x.top="100%",v.top="100%"),t===Be.Bottom&&(x.top="100%",v.top="100%"),t===Be.BottomLeft&&(x.top="100%",v.top="100%")),/^(B|T)/.test(t)&&(t!==Be.Top&&t!==Be.Bottom||(x.left="50%",x.marginLeft=-8,v.left="50%",v.marginLeft=-7),t!==Be.TopRight&&t!==Be.BottomRight||(x.right=10,v.right=11),t!==Be.TopLeft&&t!==Be.BottomLeft||(x.left=7,v.left=8)),/^L/.test(t)&&(x.borderWidth="8px 8px 8px 0",x.borderColor="transparent var(--github-arrow-border-color) transparent transparent",v.borderWidth="7px 7px 7px 0",v.borderColor="transparent var(--github-background-color) transparent transparent",x.left=-8,v.left=-7),/^R/.test(t)&&(x.borderWidth="8px 0 8px 8px",x.borderColor="transparent transparent transparent var(--github-arrow-border-color)",v.borderWidth="7px 0 7px 7px",v.borderColor="transparent transparent transparent var(--github-background-color)",x.right=-8,v.right=-7),/^(L|R)/.test(t)&&(t!==Be.RightTop&&t!==Be.LeftTop||(x.top=5,v.top=6),t!==Be.Left&&t!==Be.Right||(x.top="50%",v.top="50%",x.marginTop=-8,v.marginTop=-7),t!==Be.LeftBottom&&t!==Be.RightBottom||(x.top="100%",v.top="100%",x.marginTop=-21,v.marginTop=-20));return(0,ee.jsx)(be,l({ref:r,className:[o,a].filter(Boolean).join(" "),colors:i,color:g,rectRender:e=>{var r=l({},(ye(e),e)),o=p&&p(l({},r));return o||(0,ee.jsx)(we,l({},r,{rectProps:d}))}},h,{onChange:e=>c&&c(O(e)),style:b,rectProps:{style:{marginRight:0,marginBottom:0,borderRadius:0,height:25,width:25}},addonBefore:(0,ee.jsxs)(U.Fragment,{children:[(0,ee.jsx)("div",{style:x}),(0,ee.jsx)("div",{style:v})]})}))}));Ae.displayName="Github";const je=Ae;var Re=e=>{var{className:r,color:o,left:t,top:a,prefixCls:l}=e,s={position:"absolute",top:a,left:t},n={"--saturation-pointer-box-shadow":"rgb(255 255 255) 0px 0px 0px 1.5px, rgb(0 0 0 / 30%) 0px 0px 1px 1px inset, rgb(0 0 0 / 40%) 0px 0px 1px 2px",width:6,height:6,transform:"translate(-3px, -3px)",boxShadow:"var(--saturation-pointer-box-shadow)",borderRadius:"50%",backgroundColor:o};return(0,U.useMemo)((()=>(0,ee.jsx)("div",{className:l+"-pointer "+(r||""),style:s,children:(0,ee.jsx)("div",{className:l+"-fill",style:n})})),[a,t,o,r,l])},Ee=["prefixCls","radius","pointer","className","hue","style","hsva","onChange"],Se=V().forwardRef(((e,r)=>{var o,{prefixCls:t="w-color-saturation",radius:a=0,pointer:s,className:n,hue:i=0,style:d,hsva:c,onChange:p}=e,u=Y(e,Ee),g=l({width:200,height:200,borderRadius:a},d,{position:"relative"}),[b,f]=(0,U.useState)({left:0,top:0,x:0,y:0,width:0,height:0}),x=(e,r)=>{f(e),p&&c&&p({h:c.h,s:100*e.left,v:100*(1-e.top),a:c.a})},v=(0,U.useMemo)((()=>{if(!c)return null;var e=$(b.x,0,b.width)+"px",r=$(b.y,0,b.height)+"px";0!==b.width&&0!==b.height||(e=c.s+"%",r=100-c.v+"%");var o={top:r,left:e,color:h(c)};return s&&"function"===typeof s?s(l({prefixCls:t},o)):(0,ee.jsx)(Re,l({prefixCls:t},o))}),[c,b,s,t]);return(0,ee.jsx)(te,l({className:[t,n||""].filter(Boolean).join(" ")},u,{style:l({position:"absolute",inset:0,cursor:"crosshair",backgroundImage:"linear-gradient(0deg, #000, transparent), linear-gradient(90deg, #fff, hsl("+(null!=(o=null==c?void 0:c.h)?o:i)+", 100%, 50%))"},g),ref:r,onMove:x,onDown:x,children:v}))}));Se.displayName="Saturation";const Ne=Se;var De=["prefixCls","className","hue","onChange","direction"],Pe=V().forwardRef(((e,r)=>{var{prefixCls:o="w-color-hue",className:t,hue:a=0,onChange:s,direction:n="horizontal"}=e,i=Y(e,De);return(0,ee.jsx)(de,l({ref:r,className:o+" "+(t||"")},i,{direction:n,background:"linear-gradient(to "+("horizontal"===n?"right":"bottom")+", rgb(255, 0, 0) 0%, rgb(255, 255, 0) 17%, rgb(0, 255, 0) 33%, rgb(0, 255, 255) 50%, rgb(0, 0, 255) 67%, rgb(255, 0, 255) 83%, rgb(255, 0, 0) 100%)",hsva:{h:a,s:100,v:100,a:a/360},onChange:(e,r)=>{s&&s({h:"horizontal"===n?360*r.left:360*r.top})}}))}));Pe.displayName="Hue";const Te=Pe;var Le=["prefixCls","hsva","placement","rProps","gProps","bProps","aProps","className","style","onChange"],Me=V().forwardRef(((e,r)=>{var{prefixCls:o="w-color-editable-input-rgba",hsva:t,placement:a="bottom",rProps:s={},gProps:n={},bProps:d={},aProps:c={},className:p,style:h,onChange:u}=e,g=Y(e,Le),b=t?R(t):{};function f(e){var r=Number(e.target.value);r&&r>255&&(e.target.value="255"),r&&r<0&&(e.target.value="0")}var x=(e,r,o)=>{"number"===typeof e&&("a"===r&&(e<0&&(e=0),e>100&&(e=100),u&&u(O(i(l({},b,{a:e/100}))))),e>255&&(e=255,o.target.value="255"),e<0&&(e=0,o.target.value="0"),"r"===r&&u&&u(O(i(l({},b,{r:e})))),"g"===r&&u&&u(O(i(l({},b,{g:e})))),"b"===r&&u&&u(O(i(l({},b,{b:e})))))};return(0,ee.jsxs)("div",l({ref:r,className:[o,p||""].filter(Boolean).join(" ")},g,{style:l({fontSize:11,display:"flex"},h),children:[(0,ee.jsx)(he,l({label:"R",value:b.r||0,onBlur:f,placement:a,onChange:(e,r)=>x(r,"r",e)},s,{style:l({},s.style)})),(0,ee.jsx)(he,l({label:"G",value:b.g||0,onBlur:f,placement:a,onChange:(e,r)=>x(r,"g",e)},n,{style:l({marginLeft:5},s.style)})),(0,ee.jsx)(he,l({label:"B",value:b.b||0,onBlur:f,placement:a,onChange:(e,r)=>x(r,"b",e)},d,{style:l({marginLeft:5},d.style)})),c&&(0,ee.jsx)(he,l({label:"A",value:b.a?parseInt(String(100*b.a),10):0,onBlur:f,placement:a,onChange:(e,r)=>x(r,"a",e)},c,{style:l({marginLeft:5},c.style)}))]}))}));Me.displayName="EditableInputRGBA";const He=Me;var Ie=["prefixCls","hsva","hProps","sProps","lProps","aProps","className","onChange"],ze=V().forwardRef(((e,r)=>{var{prefixCls:o="w-color-editable-input-hsla",hsva:t,hProps:a={},sProps:s={},lProps:n={},aProps:i={},className:d,onChange:c}=e,p=Y(e,Ie),h=t?x(t):{h:0,s:0,l:0,a:0},u=(e,r,o)=>{"number"===typeof e&&("h"===r&&(e<0&&(e=0),e>360&&(e=360),c&&c(O(f(l({},h,{h:e}))))),"s"===r&&(e<0&&(e=0),e>100&&(e=100),c&&c(O(f(l({},h,{s:e}))))),"l"===r&&(e<0&&(e=0),e>100&&(e=100),c&&c(O(f(l({},h,{l:e}))))),"a"===r&&(e<0&&(e=0),e>1&&(e=1),c&&c(O(f(l({},h,{a:e}))))))},g=0!=i&&l({label:"A",value:Math.round(100*h.a)/100},i,{onChange:(e,r)=>u(r,"a")});return(0,ee.jsx)(He,l({ref:r,hsva:t,rProps:l({label:"H",value:Math.round(h.h)},a,{onChange:(e,r)=>u(r,"h")}),gProps:l({label:"S",value:Math.round(h.s)+"%"},s,{onChange:(e,r)=>u(r,"s")}),bProps:l({label:"L",value:Math.round(h.l)+"%"},n,{onChange:(e,r)=>u(r,"l")}),aProps:g,className:[o,d||""].filter(Boolean).join(" ")},p))}));ze.displayName="EditableInputHSLA";const Oe=ze;var _e=["style"];function We(e){var{style:r}=e,o=Y(e,_e),t=(0,U.useRef)(null),a=(0,U.useCallback)((()=>{t.current.style.backgroundColor="var(--chrome-arrow-background-color)"}),[]),s=(0,U.useCallback)((()=>{t.current.style.backgroundColor="transparent"}),[]);return(0,ee.jsx)("div",l({ref:t,style:l({marginLeft:5,cursor:"pointer",transition:"background-color .3s",borderRadius:2},r)},o,{onMouseEnter:a,onMouseLeave:s,children:(0,ee.jsx)("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24",style:{display:"block"},children:(0,ee.jsx)("path",{d:"M373.888 576h276.224c9.322667 0 14.293333 11.178667 9.173333 18.773333l-1.258666 1.557334-138.112 146.858666a10.709333 10.709333 0 0 1-14.293334 1.365334l-1.536-1.365334-138.112-146.858666c-6.592-6.997333-2.666667-18.645333 5.973334-20.16l1.941333-0.170667h276.224-276.224z m146.026667-295.189333l138.112 146.858666c7.04 7.509333 2.069333 20.330667-7.914667 20.330667H373.888c-9.984 0-14.976-12.821333-7.914667-20.330667l138.112-146.858666a10.730667 10.730667 0 0 1 15.829334 0z",fill:"var(--chrome-arrow-fill)"})})}))}function Ge(e){return(0,ee.jsx)("svg",{viewBox:"0 0 512 512",height:"1em",width:"1em",onClick:()=>{"EyeDropper"in window&&(new window.EyeDropper).open().then((r=>{null==e.onPickColor||e.onPickColor(r.sRGBHex)})).catch((e=>{e.name}))},children:(0,ee.jsx)("path",{fill:"currentColor",d:"M482.8 29.23c38.9 38.98 38.9 102.17 0 141.17L381.2 271.9l9.4 9.5c12.5 12.5 12.5 32.7 0 45.2s-32.7 12.5-45.2 0l-160-160c-12.5-12.5-12.5-32.7 0-45.2s32.7-12.5 45.2 0l9.5 9.4L341.6 29.23c39-38.974 102.2-38.974 141.2 0zM55.43 323.3 176.1 202.6l45.3 45.3-120.7 120.7c-3.01 3-4.7 7-4.7 11.3V416h36.1c4.3 0 8.3-1.7 11.3-4.7l120.7-120.7 45.3 45.3-120.7 120.7c-15 15-35.4 23.4-56.6 23.4H89.69l-39.94 26.6c-12.69 8.5-29.59 6.8-40.377-4-10.786-10.8-12.459-27.7-3.998-40.4L32 422.3v-42.4c0-21.2 8.43-41.6 23.43-56.6z"})})}var qe=["prefixCls","className","style","color","showEditableInput","showEyeDropper","showColorPreview","showHue","showAlpha","inputType","rectProps","onChange"],Xe=function(e){return e.HEXA="hexa",e.RGBA="rgba",e.HSLA="hsla",e}({}),Ye=V().forwardRef(((e,r)=>{var{prefixCls:o="w-color-chrome",className:t,style:a,color:s,showEditableInput:n=!0,showEyeDropper:i=!0,showColorPreview:d=!0,showHue:c=!0,showAlpha:p=!0,inputType:h=Xe.RGBA,rectProps:u={},onChange:g}=e,b=Y(e,qe),f="string"===typeof s&&X(s)?A(s):s||{h:0,s:0,l:0,a:0},x=e=>g&&g(O(e)),[v,m]=(0,U.useState)(h),y={paddingTop:6},C={textAlign:"center",paddingTop:4,paddingBottom:4},w=l({"--chrome-arrow-fill":"#333","--chrome-arrow-background-color":"#e8e8e8",borderRadius:0,flexDirection:"column",width:230,padding:0},a),F={"--chrome-alpha-box-shadow":"rgb(0 0 0 / 25%) 0px 0px 1px inset",borderRadius:"50%",background:S(f),boxShadow:"var(--chrome-alpha-box-shadow)"},k={height:14,width:14},B={style:l({},k),fillProps:{style:k}};return(0,ee.jsx)(je,l({ref:r,color:f,style:w,colors:void 0,className:[o,t].filter(Boolean).join(" "),placement:Be.TopLeft},b,{addonAfter:(0,ee.jsxs)(U.Fragment,{children:[(0,ee.jsx)(Ne,{hsva:f,style:{width:"100%",height:130},onChange:e=>{x(l({},f,e,{a:f.a}))}}),(0,ee.jsxs)("div",{style:{padding:15,display:"flex",alignItems:"center",gap:10},children:["EyeDropper"in window&&i&&(0,ee.jsx)(Ge,{onPickColor:e=>{var r=A(e);x(l({},r))}}),d&&(0,ee.jsx)(de,{width:28,height:28,hsva:f,radius:2,style:{borderRadius:"50%"},bgProps:{style:{background:"transparent"}},innerProps:{style:F},pointer:()=>(0,ee.jsx)(U.Fragment,{})}),(0,ee.jsxs)("div",{style:{flex:1},children:[1==c&&(0,ee.jsx)(Te,{hue:f.h,style:{width:"100%",height:12,borderRadius:2},pointerProps:B,bgProps:{style:{borderRadius:2}},onChange:e=>{x(l({},f,e))}}),1==p&&(0,ee.jsx)(de,{hsva:f,style:{marginTop:6,height:12,borderRadius:2},pointerProps:B,bgProps:{style:{borderRadius:2}},onChange:e=>{x(l({},f,e))}})]})]}),n&&(0,ee.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",padding:"0 15px 15px 15px",userSelect:"none"},children:[(0,ee.jsxs)("div",{style:{flex:1},children:[v==Xe.RGBA&&(0,ee.jsx)(He,{hsva:f,rProps:{labelStyle:y,inputStyle:C},gProps:{labelStyle:y,inputStyle:C},bProps:{labelStyle:y,inputStyle:C},aProps:0!=p&&{labelStyle:y,inputStyle:C},onChange:e=>x(e.hsva)}),v===Xe.HEXA&&(0,ee.jsx)(he,{label:"HEX",labelStyle:y,inputStyle:C,value:f.a>0&&f.a<1?T(f).toLocaleUpperCase():P(f).toLocaleUpperCase(),onChange:(e,r)=>{"string"===typeof r&&x(A(/^#/.test(r)?r:"#"+r))}}),v===Xe.HSLA&&(0,ee.jsx)(Oe,{hsva:f,hProps:{labelStyle:y,inputStyle:C},sProps:{labelStyle:y,inputStyle:C},lProps:{labelStyle:y,inputStyle:C},aProps:0!=p&&{labelStyle:y,inputStyle:C},onChange:e=>x(e.hsva)})]}),(0,ee.jsx)(We,{onClick:()=>{v===Xe.RGBA&&m(Xe.HSLA),v===Xe.HSLA&&m(Xe.HEXA),v===Xe.HEXA&&m(Xe.RGBA)}})]})]}),rectRender:()=>(0,ee.jsx)(U.Fragment,{})}))}));Ye.displayName="Chrome";const Ue=Ye;function Ve(e){var{style:r,className:o,title:t,checked:a,color:s,onClick:n,rectProps:i}=e,d=(0,U.useRef)(null),c=(0,U.useCallback)((()=>{d.current.style.transform="scale(1.2)"}),[]),p=(0,U.useCallback)((()=>{d.current.style.transform="scale(1)"}),[]),h=l({"--circle-point-background-color":"#fff",height:a?"100%":0,width:a?"100%":0,borderRadius:"50%",backgroundColor:"var(--circle-point-background-color)",boxSizing:"border-box",transition:"height 100ms ease 0s, width 100ms ease 0s"},i.style);return(0,ee.jsx)("div",{ref:d,onClick:n,onMouseEnter:c,onMouseLeave:p,title:t,className:o,style:l({padding:3,marginRight:12,marginBottom:12},r,{display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:"50%",boxSizing:"border-box",transform:"scale(1)",boxShadow:s+" 0px 0px "+(a?5:0)+"px",transition:"transform 100ms ease 0s, box-shadow 100ms ease 0s"}),children:(0,ee.jsx)("div",l({},i,{style:h}))})}var Ke=["prefixCls","className","color","colors","rectProps","pointProps","onChange"],Qe=V().forwardRef(((e,r)=>{var{prefixCls:o="w-color-circle",className:t,color:a,colors:s=[],rectProps:n={},pointProps:i={},onChange:d}=e,c=Y(e,Ke),p="string"===typeof a&&X(a)?A(a):a||{},h=a?P(p):"",u=[o,t].filter(Boolean).join(" "),g=[o+"-point",null==i?void 0:i.className].filter(Boolean).join(" ");return(0,ee.jsx)(be,l({ref:r,colors:s,color:h},c,{className:u,rectRender:e=>{var r=l({},(ye(e),e));return(0,ee.jsx)(Ve,l({},r,i,{style:l({},r.style,i.style),className:g,rectProps:n}))},onChange:e=>{d&&d(O(e))}}))}));Qe.displayName="Circle";const Ze=Qe;var $e=["style","color"],Je=["prefixCls","className","onChange","color","style","disableAlpha"],er=e=>{var{style:r,color:o}=e,t=Y(e,$e),a=l({"--colorful-pointer-background-color":"#fff","--colorful-pointer-border":"2px solid #fff",height:28,width:28,position:"absolute",transform:"translate(-16px, -16px)",boxShadow:"0 2px 4px rgb(0 0 0 / 20%)",borderRadius:"50%",background:"url("+ne+")",backgroundColor:"var(--colorful-pointer-background-color)",border:"var(--colorful-pointer-border)",zIndex:1},r);return(0,ee.jsx)("div",l({},t,{style:a,children:(0,ee.jsx)("div",{style:{backgroundColor:o,borderRadius:"50%",height:"100%",width:"100%"}})}))},rr=V().forwardRef(((e,r)=>{var{prefixCls:o="w-color-colorful",className:t,onChange:a,color:s,style:n,disableAlpha:i}=e,d=Y(e,Je),c="string"===typeof s&&X(s)?A(s):s||{},p=e=>a&&a(O(e));return(0,ee.jsxs)("div",l({ref:r,style:l({width:200,position:"relative"},n)},d,{className:o+" "+(t||""),children:[(0,ee.jsx)(Ne,{hsva:c,className:o,radius:"8px 8px 0 0",style:{width:"auto",height:150,minWidth:120,borderBottom:"12px solid #000"},pointer:e=>{var{left:r,top:o,color:t}=e;return(0,ee.jsx)(er,{style:{left:r,top:o},color:P(c)})},onChange:e=>p(l({},c,e))}),(0,ee.jsx)(Te,{hue:c.h,height:24,radius:i?"0 0 8px 8px":0,className:o,onChange:e=>p(l({},c,e)),pointer:e=>{var{left:r}=e;return(0,ee.jsx)(er,{style:{left:r,transform:"translate(-16px, -5px)"},color:"hsl("+(c.h||0)+"deg 100% 50%)"})}}),!i&&(0,ee.jsx)(de,{hsva:c,height:24,className:o,radius:"0 0 8px 8px",pointer:e=>{var{left:r}=e;return(0,ee.jsx)(er,{style:{left:r,transform:"translate(-16px, -5px)"},color:S(c)})},onChange:e=>p(l({},c,e))})]}))}));rr.displayName="Colorful";const or=rr;var tr=["prefixCls","className","style","onChange","color","colors","rectProps","rectRender"],ar=["#4D4D4D","#999999","#FFFFFF","#F44E3B","#FE9200","#FCDC00","#DBDF00","#A4DD00","#68CCCA","#73D8FF","#AEA1FF","#FDA1FF","#333333","#808080","#cccccc","#D33115","#E27300","#FCC400","#B0BC00","#68BC00","#16A5A5","#009CE0","#7B64FF","#FA28FF","#000000","#666666","#B3B3B3","#9F0500","#C45100","#FB9E00","#808900","#194D33","#0C797D","#0062B1","#653294","#AB149E"];function lr(e){return e.checked?(0,ee.jsx)("div",{style:{height:5,width:5,borderRadius:"50%",backgroundColor:_(e.color)}}):null}var sr=V().forwardRef(((e,r)=>{var{prefixCls:o="w-color-compact",className:t,style:a,onChange:s,color:n,colors:i=ar,rectProps:d,rectRender:c}=e,p=Y(e,tr),h="string"===typeof n&&X(n)?A(n):n,u=n?P(h).replace(/^#/,""):"",g=(0,U.useCallback)((e=>s&&s(O(e))),[]),b={style:{alignItems:"baseline"},inputStyle:{boxShadow:"none",backgroundColor:"transparent",outline:0}},f=l({"--compact-background-color":"#f6f6f6",background:"var(--compact-background-color)",borderRadius:3,display:"flex",width:240,flexWrap:"wrap",paddingTop:5,paddingLeft:5},a);return(0,ee.jsxs)("div",l({ref:r,style:f,className:[o,t||""].filter(Boolean).join(" ")},p,{children:[(0,ee.jsx)(be,{colors:i,color:n?P(h):void 0,rectRender:c,rectProps:l({children:(0,ee.jsx)(lr,{})},d,{style:l({display:"flex",alignItems:"center",justifyContent:"center"},null==d?void 0:d.style)}),onChange:e=>g(e)}),(0,ee.jsxs)("div",{style:{display:"flex",margin:"0 4px 3px 0"},children:[(0,ee.jsx)(he,{onChange:(e,r)=>{var o;"string"===typeof(o=r)&&X(o)&&/(3|6)/.test(String(o.length))&&g(A(o))},labelStyle:{paddingRight:5,marginTop:-1},value:u.toLocaleUpperCase(),label:(0,ee.jsx)("div",{style:{width:8,height:8,backgroundColor:"#"+u}}),inputStyle:{outline:"none",boxShadow:"initial",background:"transparent"},style:{flexDirection:"row-reverse",flex:"1 1 0%",minWidth:80}}),(0,ee.jsx)(He,{hsva:h,placement:"left",onChange:e=>g(e.hsva),aProps:!1,rProps:b,gProps:b,bProps:b})]})]}))}));sr.displayName="Compact";const nr=sr;var ir=["prefixCls","className","style","color","onChange"],dr={boxShadow:"initial",borderWidth:"0 0 1px 0",borderBottomColor:"var(--material-border-bottom-color)",borderBottomStyle:"solid",height:30,outline:0,fontSize:15,padding:0},cr=V().forwardRef(((e,r)=>{var{prefixCls:o="w-color-material",className:t,style:a,color:s,onChange:n}=e,i=Y(e,ir),d="string"===typeof s&&X(s)?A(s):s,c=s?P(d).replace(/^#/,""):"",p=(e,r)=>{"string"===typeof e&&X(e)&&/(3|6)/.test(String(e.length))&&n&&n(O(A(e)))},h=l({"--material-border-bottom-color":"#eee","--material-background-color":"#fff",padding:16,width:98,fontFamily:"Roboto",backgroundColor:"var(--material-background-color)"},a);return(0,ee.jsxs)("div",l({ref:r,className:[o,t||""].filter(Boolean).join(" "),style:h},i,{children:[(0,ee.jsx)(he,{label:"Hex",value:c.toLocaleUpperCase(),onChange:(e,r)=>p(r),onBlur:e=>{var r=e.target.value;e.target.value=r.slice(0,6),p(r.slice(0,6))},inputStyle:{outline:0,border:0,height:30,fontSize:15,padding:0,boxShadow:"initial",borderWidth:"0 0 2px 0",borderBottomColor:c?"#"+c:"var(--material-border-bottom-color)",borderBottomStyle:"solid",background:"transparent"},style:{flexDirection:"column-reverse",alignItems:"flex-start"}}),(0,ee.jsx)(He,{hsva:d,placement:"top",style:{marginTop:11},rProps:{style:{alignItems:"flex-start"},inputStyle:l({},dr)},gProps:{style:{alignItems:"flex-start"},inputStyle:l({},dr)},bProps:{style:{alignItems:"flex-start"},inputStyle:l({},dr)},aProps:!1,onChange:e=>{return r=e.hsva,void(n&&n(O(r)));var r}})]}))}));cr.displayName="Material";const pr=cr,hr=["#F0F8FF","#FAEBD7","#00FFFF","#7FFFD4","#F0FFFF","#F5F5DC","#FFE4C4","#000000","#FFEBCD","#0000FF","#8A2BE2","#A52A2A","#DEB887","#5F9EA0","#7FFF00","#D2691E","#FF7F50","#6495ED","#FFF8DC","#DC143C","#00FFFF","#00008B","#008B8B","#B8860B","#A9A9A9","#006400","#A9A9A9","#BDB76B","#8B008B","#556B2F","#FF8C00","#9932CC","#8B0000","#E9967A","#8FBC8F","#483D8B","#2F4F4F","#2F4F4F","#00CED1","#9400D3","#FF1493","#00BFFF","#696969","#696969","#1E90FF","#B22222","#FFFAF0","#228B22","#FF00FF","#DCDCDC","#F8F8FF","#FFD700","#DAA520","#808080","#008000","#ADFF2F","#808080","#F0FFF0","#FF69B4","#CD5C5C","#4B0082","#FFFFF0","#F0E68C","#E6E6FA","#FFF0F5","#7CFC00","#FFFACD","#ADD8E6","#F08080","#E0FFFF","#FAFAD2","#D3D3D3","#90EE90","#D3D3D3","#FFB6C1","#FFA07A","#20B2AA","#87CEFA","#778899","#778899","#B0C4DE","#FFFFE0","#00FF00","#32CD32","#FAF0E6","#FF00FF","#800000","#66CDAA","#0000CD","#BA55D3","#9370DB","#3CB371","#7B68EE","#00FA9A","#48D1CC","#C71585","#191970","#F5FFFA","#FFE4E1","#FFE4B5","#FFDEAD","#000080","#FDF5E6","#808000","#6B8E23","#FFA500","#FF4500","#DA70D6","#EEE8AA","#98FB98","#AFEEEE","#DB7093","#FFEFD5","#FFDAB9","#CD853F","#FFC0CB","#DDA0DD","#B0E0E6","#800080","#663399","#FF0000","#BC8F8F","#4169E1","#8B4513","#FA8072","#F4A460","#2E8B57","#FFF5EE","#A0522D","#C0C0C0","#87CEEB","#6A5ACD","#708090","#708090","#FFFAFA","#00FF7F","#4682B4","#D2B48C","#008080","#D8BFD8","#FF6347","#40E0D0","#EE82EE","#F5DEB3","#FFFFFF","#F5F5F5","#FFFF00","#9ACD32"];var ur=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].reduce(((e,r,o)=>(e[r]=hr[o],e)),{}),gr=["aqua","black","blue","fuchsia","gray","green","lime","maroon","navy","olive","purple","red","silver","teal","white","yellow"],br=gr.reduce(((e,r)=>(e[r]=ur[r],e)),{});function fr(e){return ur[e]}var xr=["prefixCls","className","onChange","direction","hsva"],vr=V().forwardRef(((e,r)=>{var{prefixCls:o="w-color-saturation",className:t,onChange:a,direction:s="horizontal",hsva:n}=e,i=Y(e,xr),d=h(l({},n,{a:1,v:100}));return(0,ee.jsx)(de,l({ref:r},i,{className:o+" "+(t||""),hsva:{h:n.h,s:n.s,v:n.v,a:1-n.v/100},direction:s,background:"linear-gradient(to "+("horizontal"===s?"right":"bottom")+", "+d+", rgb(0, 0, 0))",onChange:(e,r)=>{a&&a({v:"horizontal"===s?100-100*r.left:100-100*r.top})}}))}));vr.displayName="ShadeSlider";const mr=vr;var yr=["prefixCls","className","onChange","width","presetColors","color","editableDisable","disableAlpha","style"],Cr=["#D0021B","#F5A623","#f8e61b","#8B572A","#7ED321","#417505","#BD10E0","#9013FE","#4A90E2","#50E3C2","#B8E986","#000000","#4A4A4A","#9B9B9B","#FFFFFF"],wr=e=>(0,ee.jsx)("div",{style:{boxShadow:"rgb(0 0 0 / 60%) 0px 0px 2px",width:4,top:1,bottom:1,left:e.left,borderRadius:1,position:"absolute",backgroundColor:"#fff"}}),Fr=V().forwardRef(((e,r)=>{var{prefixCls:o="w-color-sketch",className:t,onChange:a,width:s=218,presetColors:n=Cr,color:i,editableDisable:d=!0,disableAlpha:c=!1,style:p}=e,h=Y(e,yr),[u,g]=(0,U.useState)({h:209,s:36,v:90,a:1});(0,U.useEffect)((()=>{"string"===typeof i&&X(i)&&g(A(i)),"object"===typeof i&&g(i)}),[i]);var b=e=>{g(e),a&&a(O(e))},f=l({"--sketch-background":"rgb(255, 255, 255)","--sketch-box-shadow":"rgb(0 0 0 / 15%) 0px 0px 0px 1px, rgb(0 0 0 / 15%) 0px 8px 16px","--sketch-swatch-box-shadow":"rgb(0 0 0 / 15%) 0px 0px 0px 1px inset","--sketch-alpha-box-shadow":"rgb(0 0 0 / 15%) 0px 0px 0px 1px inset, rgb(0 0 0 / 25%) 0px 0px 4px inset","--sketch-swatch-border-top":"1px solid rgb(238, 238, 238)",background:"var(--sketch-background)",borderRadius:4,boxShadow:"var(--sketch-box-shadow)",width:s},p),x={borderRadius:2,background:S(u),boxShadow:"var(--sketch-alpha-box-shadow)"};return(0,ee.jsxs)("div",l({},h,{className:o+" "+(t||""),ref:r,style:f,children:[(0,ee.jsxs)("div",{style:{padding:"10px 10px 8px"},children:[(0,ee.jsx)(Ne,{hsva:u,style:{width:"auto",height:150},onChange:e=>b(l({},u,e,{a:u.a}))}),(0,ee.jsxs)("div",{style:{display:"flex",marginTop:4},children:[(0,ee.jsxs)("div",{style:{flex:1},children:[(0,ee.jsx)(Te,{width:"auto",height:10,hue:u.h,pointer:wr,innerProps:{style:{marginLeft:1,marginRight:5}},onChange:e=>b(l({},u,e))}),!c&&(0,ee.jsx)(de,{width:"auto",height:10,hsva:u,pointer:wr,style:{marginTop:4},innerProps:{style:{marginLeft:1,marginRight:5}},onChange:e=>b(l({},u,{a:e.a}))})]}),!c&&(0,ee.jsx)(de,{width:24,height:24,hsva:u,radius:2,style:{marginLeft:4},bgProps:{style:{background:"transparent"}},innerProps:{style:x},pointer:()=>(0,ee.jsx)(U.Fragment,{})})]})]}),d&&(0,ee.jsxs)("div",{style:{display:"flex",margin:"0 10px 3px 10px"},children:[(0,ee.jsx)(he,{label:"Hex",value:P(u).replace(/^#/,"").toLocaleUpperCase(),onChange:(e,r)=>{var o;"string"===typeof(o=r)&&X(o)&&/(3|6)/.test(String(o.length))&&b(A(o))},style:{minWidth:58}}),(0,ee.jsx)(He,{hsva:u,style:{marginLeft:6},aProps:!c&&{},onChange:e=>b(e.hsva)})]}),n&&n.length>0&&(0,ee.jsx)(be,{style:{borderTop:"var(--sketch-swatch-border-top)",paddingTop:10,paddingLeft:10},colors:n,color:P(u),onChange:e=>b(e),rectProps:{style:{marginRight:10,marginBottom:10,borderRadius:3,boxShadow:"var(--sketch-swatch-box-shadow)"}}})]}))}));Fr.displayName="Sketch";const kr=Fr;var Br=["prefixCls","className","style","onChange","color","lightness"],Ar=V().forwardRef(((e,r)=>{var{prefixCls:o="w-color-slider",className:t,style:a,onChange:s,color:n,lightness:i=[80,65,50,35,20]}=e,c=Y(e,Br),p="string"===typeof n&&X(n)?A(n):n||{};return(0,ee.jsx)("div",l({ref:r,style:l({display:"flex"},a),className:[o,t||""].filter(Boolean).join(" ")},c,{children:i.map(((e,r)=>{var o="hsl("+x(p).h+", 50%, "+e+"%)",t=o===d(p);return(0,ee.jsx)("div",{style:{paddingLeft:1,width:100/i.length+"%",boxSizing:"border-box"},children:(0,ee.jsx)("div",{onClick:e=>((e,r)=>{s&&s(O(b(e)),r)})(o,e),style:l({backgroundColor:o,height:12,cursor:"pointer"},t?{borderRadius:2,transform:"scale(1, 1.5)"}:{})})},r)}))}))}));Ar.displayName="Slider";const jr=Ar;var Rr=e=>{var{className:r,color:o,left:t,top:a,style:s,prefixCls:n}=e,i=l({},s,{position:"absolute",top:a,left:t}),d=n+"-pointer "+(r||"");return(0,ee.jsx)("div",{className:d,style:i,children:(0,ee.jsx)("div",{className:n+"-fill",style:{width:10,height:10,transform:"translate(-5px, -5px)",boxShadow:"rgb(255 255 255) 0px 0px 0px 1.5px, rgb(0 0 0 / 30%) 0px 0px 1px 1px inset, rgb(0 0 0 / 40%) 0px 0px 1px 2px",borderRadius:"50%",backgroundColor:"#fff"},children:(0,ee.jsx)("div",{style:{inset:0,borderRadius:"50%",position:"absolute",backgroundColor:o}})})})},Er=2*Math.PI,Sr=(e,r)=>Math.sqrt(e*e+r*r);function Nr(e){var{width:r=0}=e,o=r/2;return{width:r,radius:o,cx:o,cy:o}}function Dr(e){var{width:r=0}=e;return r/2}function Pr(e,r,o){var t,a=e.angle||0,l=e.direction;return o&&"clockwise"===l?r=a+r:"clockwise"===l?r=360-a+r:o&&"anticlockwise"===l?r=a+180-r:"anticlockwise"===l&&(r=a-r),(r%(t=360)+t)%t}var Tr=["prefixCls","radius","pointer","className","style","width","height","oval","direction","angle","color","onChange"],Lr=V().forwardRef(((e,r)=>{var{prefixCls:o="w-color-wheel",radius:t=0,pointer:a,className:s,style:n,width:i=200,height:d=200,oval:c,direction:p="anticlockwise",angle:h=180,color:u,onChange:g}=e,b=Y(e,Tr),f="string"===typeof u&&X(u)?A(u):u||{},x=u?P(f):"",v=function(e,r){var{cx:o,cy:t}=Nr(e),a=Dr(e),l=(180+Pr(e,r.h,!0))*(Er/360),s=r.s/100*a,n="clockwise"===e.direction?-1:1;return{x:o+s*Math.cos(l)*n,y:t+s*Math.sin(l)*n}}({width:i},f),m={top:"0",left:"0",color:x},y=(e,r)=>{var o=function(e,r,o){var{cx:t,cy:a}=Nr(e),l=Dr(e);r=t-r,o=a-o;var s=Pr(e,Math.atan2(-o,-r)*(360/Er)),n=Math.min(Sr(r,o),l);return{h:Math.round(s),s:Math.round(100/l*n)}}({width:i},i-e.x,d-e.y),t={h:o.h,s:o.s,v:f.v,a:f.a};g&&g(O(t))},C={zIndex:1,transform:"translate("+v.x+"px, "+v.y+"px) "+("x"===c||"X"===c?"scaleY(2)":"y"===c||"Y"===c?"scaleX(2)":"")},w=a&&"function"===typeof a?a(l({prefixCls:o,style:C},m)):(0,ee.jsx)(Rr,l({prefixCls:o,style:C},m));return(0,ee.jsxs)(te,l({className:[o,s||""].filter(Boolean).join(" ")},b,{style:l({position:"relative",width:i,transform:"x"===c||"X"===c?"scaleY(0.5)":"y"===c||"Y"===c?"scaleX(0.5)":"",height:d},n),ref:r,onMove:y,onDown:y,children:[w,(0,ee.jsx)("div",{style:{position:"absolute",borderRadius:"50%",background:"anticlockwise"===p?"conic-gradient(red, yellow, lime, aqua, blue, magenta, red)":"conic-gradient(red, magenta, blue, aqua, lime, yellow, red)",transform:"rotateZ("+(h+90)+"deg)",inset:0}}),(0,ee.jsx)("div",{style:{position:"absolute",borderRadius:"50%",background:"radial-gradient(circle closest-side, #fff, transparent)",inset:0}}),(0,ee.jsx)("div",{style:{backgroundColor:"#000",borderRadius:"50%",position:"absolute",inset:0,opacity:"number"===typeof f.v?1-f.v/100:0}})]}))}));Lr.displayName="Wheel";const Mr=Lr;return a})()));