@uiw/react-color
Version:
Color Picker component for React.
2 lines • 51.5 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={335(e,r,o){var t=o(442),a=Symbol.for("react.element"),l=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,s=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)n.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:s.current}}r.jsx=d,r.jsxs=d},85(e,r,o){e.exports=o(335)},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:()=>ce,BACKGROUND_IMG:()=>ie,Block:()=>ye,Chrome:()=>Qe,ChromeInputType:()=>Ke,Circle:()=>er,Colorful:()=>lr,Compact:()=>cr,EditableInput:()=>ue,EditableInputHSLA:()=>Ge,EditableInputRGBA:()=>Oe,Github:()=>Re,Hue:()=>He,Material:()=>gr,Pointer:()=>ne,Saturation:()=>Ne,ShadeSlider:()=>wr,Sketch:()=>jr,Slider:()=>Nr,Swatch:()=>ve,Wheel:()=>_r,baseNamed:()=>fr,color:()=>_,colorKeywords:()=>vr,colorKeywordsBase:()=>xr,colorNameToHex:()=>mr,equalColorObjects:()=>G,equalColorString:()=>q,equalHex:()=>U,getContrastingColor:()=>W,hexToHsva:()=>j,hexToRgba:()=>R,hexToXY:()=>H,hslStringToHsla:()=>u,hslStringToHsva:()=>b,hslaStringToHsva:()=>g,hslaToHsl:()=>P,hslaToHsva:()=>v,hsvStringToHsva:()=>C,hsvaStringToHsva:()=>x,hsvaToHex:()=>T,hsvaToHexa:()=>L,hsvaToHslString:()=>d,hsvaToHsla:()=>f,hsvaToHslaString:()=>h,hsvaToHsv:()=>M,hsvaToHsvString:()=>c,hsvaToHsvaString:()=>p,hsvaToRgbString:()=>E,hsvaToRgba:()=>S,hsvaToRgbaString:()=>D,parseHue:()=>y,rgbStringToHsva:()=>F,rgbToHex:()=>B,rgbToXY:()=>O,rgbaStringToHsva:()=>w,rgbaToHex:()=>k,rgbaToHexa:()=>A,rgbaToHsva:()=>i,rgbaToRgb:()=>N,validHex:()=>X,xyToHex:()=>z,xyToRgb:()=>I});var n=255,s=100,i=e=>{var r=e.r,o=e.g,t=e.b,a=e.a,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*s:0,v:l/n*s,a:a}},d=e=>{var r=f(e),o=r.h,t=r.s,a=r.l;return"hsl("+o+", "+Math.round(t)+"%, "+Math.round(a)+"%)"},c=e=>"hsv("+e.h+", "+e.s+"%, "+e.v+"%)",p=e=>"hsva("+e.h+", "+e.s+"%, "+e.v+"%, "+e.a+")",h=e=>{var r=f(e);return"hsla("+r.h+", "+r.s+"%, "+r.l+"%, "+r.a+")"},u=e=>{var r=(e.match(/\d+/g)||[]).map(Number);return{h:r[0],s:r[1],l:r[2],a:r[3]}},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?v({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,v=e=>{var r=e.h,o=e.s,t=e.l,a=e.a;return{h:r,s:(o*=(t<50?t:s-t)/s)>0?2*o/(t+o)*s:0,v:t+o,a:a}},f=e=>{var r=e.h,o=e.s,t=e.v,a=e.a,l=(200-o)*t/s;return{h:r,s:l>0&&l<200?o*t/s/(l<=s?l:200-l)*s:0,l:l/2,a:a}},x=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]?s: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=x,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]?s/n:1),g:Number(r[3])/(r[4]?s/n:1),b:Number(r[5])/(r[6]?s/n:1),a:void 0===r[7]?1:Number(r[7])/(r[8]?s:1)}):{h:0,s:0,v:0,a:1}},F=w,k=e=>{var r=e.r,o=e.g,t=e.b;return B({r:r,g:o,b:t})},B=e=>{var r,o=e.r,t=e.g,a=e.b;return"#"+(r=(o<<16|t<<8|a).toString(16),new Array(7-r.length).join("0")+r)},A=e=>{var r=e.r,o=e.g,t=e.b,a=e.a,l="number"===typeof a&&(255*a|256).toString(16).slice(1);return""+B({r:r,g:o,b:t})+(l||"")},j=e=>i(R(e)),R=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=e.match(o).map(e=>parseInt(e,16)),a=t[0],l=t[1],s=t[2],i=void 0===s?0:s,d=t[3];return{r:a,g:l,b:i,a:(null!=d?d:255)/n}},S=e=>{var r=e.h,o=e.s,t=e.v,a=e.a,i=r/60,d=o/s,c=t/s,p=Math.floor(i)%6,h=i-Math.floor(i),u=n*c*(1-d),g=n*c*(1-d*h),b=n*c*(1-d*(1-h));c*=n;var v={};switch(p){case 0:v.r=c,v.g=b,v.b=u;break;case 1:v.r=g,v.g=c,v.b=u;break;case 2:v.r=u,v.g=c,v.b=b;break;case 3:v.r=u,v.g=g,v.b=c;break;case 4:v.r=b,v.g=u,v.b=c;break;case 5:v.r=c,v.g=u,v.b=g}return v.r=Math.round(v.r),v.g=Math.round(v.g),v.b=Math.round(v.b),l({},v,{a:a})},E=e=>{var r=S(e);return"rgb("+r.r+", "+r.g+", "+r.b+")"},D=e=>{var r=S(e);return"rgba("+r.r+", "+r.g+", "+r.b+", "+r.a+")"},N=e=>({r:e.r,g:e.g,b:e.b}),P=e=>({h:e.h,s:e.s,l:e.l}),T=e=>B(S(e)),L=e=>A(S(e)),M=e=>({h:e.h,s:e.s,v:e.v}),H=e=>O(N(R(e))),z=e=>B(l({},I(e))),I=e=>{var r=e.x,o=e.y,t=e.bri,a=void 0===t?255:t,l=3.2406255*r+-1.537208*o+-.4986286*a,n=-.9689307*r+1.8757561*o+.0415175*a,s=.0557101*r+-.2040211*o+1.0569959*a,i=function(e){return e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055};return{r:Math.round(255*i(l)),g:Math.round(255*i(n)),b:Math.round(255*i(s))}},O=e=>{var r=e.r,o=e.g,t=e.b,a=function(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},l=a(r/255),n=a(o/255),s=a(t/255),i={};return i.x=.4124*l+.3576*n+.1805*s,i.y=.2126*l+.7152*n+.0722*s,i.bri=.0193*l+.1192*n+.9505*s,i},_=e=>{var r,o,t,a,l,n,s,i,d;return"string"===typeof e&&X(e)?(n=j(e),i=e):"string"!==typeof e&&(n=e),n&&(t=M(n),l=f(n),a=S(n),d=A(a),i=T(n),o=P(l),r=N(a),s=O(r)),{rgb:r,hsl:o,hsv:t,rgba:a,hsla:l,hsva:n,hex:i,hexa:d,xy:s}},W=e=>{if(!e)return"#ffffff";var r=_(e);return(299*r.rgb.r+587*r.rgb.g+114*r.rgb.b)/1e3>=128?"#000000":"#ffffff"},G=(e,r)=>{if(e===r)return!0;for(var o in e)if(e[o]!==r[o])return!1;return!0},q=(e,r)=>e.replace(/\s/g,"")===r.replace(/\s/g,""),U=(e,r)=>e.toLowerCase()===r.toLowerCase()||G(R(e),R(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 K=t(442),V=t.n(K);function Q(e){var r=(0,K.useRef)(e);return(0,K.useEffect)(()=>{r.current=e}),(0,K.useCallback)((e,o)=>r.current&&r.current(e,o),[])}var Z=e=>"touches"in e,$=e=>{!Z(e)&&e.preventDefault&&e.preventDefault()},J=function(e,r,o){return void 0===r&&(r=0),void 0===o&&(o=1),e>o?o:e<r?r:e},ee=(e,r)=>{var o=e.getBoundingClientRect(),t=Z(r)?r.touches[0]:r;return{left:J((t.pageX-(o.left+window.pageXOffset))/o.width),top:J((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)}},re=t(85),oe=["prefixCls","className","onMove","onDown"],te=V().forwardRef((e,r)=>{var o=e.prefixCls,t=void 0===o?"w-color-interactive":o,a=e.className,n=e.onMove,s=e.onDown,i=Y(e,oe),d=(0,K.useRef)(null),c=(0,K.useRef)(!1),p=(0,K.useState)(!1),h=p[0],u=p[1],g=Q(n),b=Q(s),v=(0,K.useCallback)(e=>{($(e),d.current)&&((Z(e)?e.touches.length>0:e.buttons>0)?null==g||g(ee(d.current,e),e):u(!1))},[g]),f=(0,K.useCallback)(()=>u(!1),[]),x=(0,K.useCallback)(e=>{e?(window.addEventListener(c.current?"touchmove":"mousemove",v),window.addEventListener(c.current?"touchend":"mouseup",f)):(window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",f),window.removeEventListener("touchmove",v),window.removeEventListener("touchend",f))},[v,f]);(0,K.useEffect)(()=>(x(h),()=>{x(!1)}),[h,v,f,x]);var m=(0,K.useCallback)(e=>{var r=document.activeElement;null==r||r.blur(),$(e.nativeEvent),(e=>!(c.current&&!Z(e))&&(c.current=Z(e),!0))(e.nativeEvent)&&d.current&&(null==b||b(ee(d.current,e.nativeEvent),e.nativeEvent),u(!0))},[b]);return(0,re.jsx)("div",l({},i,{className:[t,a||""].filter(Boolean).join(" "),style:l({},i.style,{touchAction:"none"}),ref:d,tabIndex:0,onMouseDown:m,onTouchStart:m}))});te.displayName="Interactive";const ae=te;var le=["className","prefixCls","left","top","style","fillProps"],ne=e=>{var r=e.className,o=e.prefixCls,t=e.left,a=e.top,n=e.style,s=e.fillProps,i=Y(e,le),d=l({},n,{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==s?void 0:s.style,{transform:t?"translate(-9px, -1px)":"translate(-1px, -9px)"});return(0,re.jsx)("div",l({className:o+"-pointer "+(r||""),style:d},i,{children:(0,re.jsx)("div",l({className:o+"-fill"},s,{style:c}))}))},se=["prefixCls","className","hsva","background","bgProps","innerProps","pointerProps","radius","width","height","direction","reverse","style","onChange","pointer"],ie="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==",de=V().forwardRef((e,r)=>{var o=e.prefixCls,t=void 0===o?"w-color-alpha":o,a=e.className,n=e.hsva,s=e.background,i=e.bgProps,d=void 0===i?{}:i,c=e.innerProps,p=void 0===c?{}:c,u=e.pointerProps,g=void 0===u?{}:u,b=e.radius,v=void 0===b?0:b,f=e.width,x=e.height,m=void 0===x?16:x,y=e.direction,C=void 0===y?"horizontal":y,w=e.reverse,F=void 0!==w&&w,k=e.style,B=e.onChange,A=e.pointer,j=Y(e,se),R=(0,K.useCallback)(e=>{var r="horizontal"===C?e.left:e.top;return"horizontal"===C?F?1-r:r:F?r:1-r},[C,F]),S=(0,K.useCallback)(e=>"horizontal"===C?F?1-e:e:F?e:1-e,[C,F]),E=e=>{var r=R(e);B&&B(l({},n,{a:r}),e)},D=h(Object.assign({},n,{a:1})),N="horizontal"===C?F?"linear-gradient(to right, "+D+" 0%, rgba(244, 67, 54, 0) 100%)":"linear-gradient(to right, rgba(244, 67, 54, 0) 0%, "+D+" 100%)":F?"linear-gradient(to bottom, rgba(244, 67, 54, 0) 0%, "+D+" 100%)":"linear-gradient(to bottom, "+D+" 0%, rgba(244, 67, 54, 0) 100%)",P={};"horizontal"===C?P.left=100*S(n.a)+"%":P.top=100*S(n.a)+"%";var T=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:v,background:"url("+ie+") left center",backgroundColor:"var(--alpha-background-color)"},{width:f,height:m},k,{position:"relative"}),L=(0,K.useCallback)(e=>{var r=.01,o=n.a,t=o;switch(e.key){case"ArrowLeft":"horizontal"===C&&(t=F?Math.min(1,o+r):Math.max(0,o-r),e.preventDefault());break;case"ArrowRight":"horizontal"===C&&(t=F?Math.max(0,o-r):Math.min(1,o+r),e.preventDefault());break;case"ArrowUp":"vertical"===C&&(t=F?Math.max(0,o-r):Math.min(1,o+r),e.preventDefault());break;case"ArrowDown":"vertical"===C&&(t=F?Math.min(1,o+r):Math.max(0,o-r),e.preventDefault());break;default:return}if(t!==o){var a=S(t),s={left:"horizontal"===C?a:n.a,top:"vertical"===C?a:n.a,width:0,height:0,x:0,y:0};B&&B(l({},n,{a:t}),s)}},[S,n,C,B,F]),M=(0,K.useCallback)(e=>{e.target.focus()},[]),H=A&&"function"===typeof A?A(l({prefixCls:t},g,P)):(0,re.jsx)(ne,l({},g,{prefixCls:t},P));return(0,re.jsxs)("div",l({},j,{className:[t,t+"-"+C,a||""].filter(Boolean).join(" "),style:T,ref:r,children:[(0,re.jsx)("div",l({},d,{style:l({inset:0,position:"absolute",background:s||N,borderRadius:v},d.style)})),(0,re.jsx)(ae,l({},p,{style:l({},p.style,{inset:0,zIndex:1,position:"absolute",outline:"none"}),onMove:E,onDown:E,onClick:M,onKeyDown:L,children:H}))]}))});de.displayName="Alpha";const ce=de;var pe=["prefixCls","placement","label","value","className","style","labelStyle","inputStyle","onChange","onBlur","renderInput"],he=V().forwardRef((e,r)=>{var o=e.prefixCls,t=void 0===o?"w-color-editable-input":o,a=e.placement,n=void 0===a?"bottom":a,s=e.label,i=e.value,d=e.className,c=e.style,p=e.labelStyle,h=e.inputStyle,u=e.onChange,g=e.onBlur,b=e.renderInput,v=Y(e,pe),f=(0,K.useState)(i),x=f[0],m=f[1],y=(0,K.useRef)(!1),C=(0,K.useRef)(v.id||t+"-"+Math.random().toString(36).slice(2,11)),w=v.id||C.current;(0,K.useEffect)(()=>{e.value!==x&&(y.current||m(e.value))},[e.value]);var F={};"bottom"===n&&(F.flexDirection="column"),"top"===n&&(F.flexDirection="column-reverse"),"left"===n&&(F.flexDirection="row-reverse");var k=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},F,c),B=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)"},h),A=l({value:x,onChange:function(e,r){var o=(r||e.target.value).trim().replace(/^#/,"");/^#?([A-Fa-f0-9]{3,4}){1,2}$/.test(o)&&u&&u(e,o);var t=(e=>Number(String(e).replace(/%/g,"")))(o);isNaN(t)||u&&u(e,t),m(o)},onBlur:function(r){y.current=!1,m(e.value),g&&g(r)},autoComplete:"off",onFocus:()=>y.current=!0},v,{id:w,style:B,onFocusCapture:e=>{var r=e.target;r.setSelectionRange(r.value.length,r.value.length)}});return(0,re.jsxs)("div",{className:[t,d||""].filter(Boolean).join(" "),style:k,children:[b?b(A,r):(0,re.jsx)("input",l({ref:r},A)),s&&(0,re.jsx)("label",{htmlFor:w,style:l({color:"var(--editable-input-label-color)",textTransform:"capitalize"},p),children:s})]})});he.displayName="EditableInput";const ue=he;var ge=["prefixCls","className","color","colors","style","rectProps","onChange","addonAfter","addonBefore","rectRender"],be=V().forwardRef((e,r)=>{var o=e.prefixCls,t=void 0===o?"w-color-swatch":o,a=e.className,n=e.color,s=e.colors,i=void 0===s?[]:s,d=e.style,c=e.rectProps,p=void 0===c?{}:c,h=e.onChange,u=e.addonAfter,g=e.addonBefore,b=e.rectRender,v=Y(e,ge),f=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},p.style),x=(e,r)=>{h&&h(j(e),_(j(e)),r)};return(0,re.jsxs)("div",l({ref:r},v,{className:[t,a||""].filter(Boolean).join(" "),style:l({display:"flex",flexWrap:"wrap",position:"relative"},d),children:[g&&V().isValidElement(g)&&g,i&&Array.isArray(i)&&i.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 a=n&&n.toLocaleLowerCase()===t.toLocaleLowerCase(),s=b&&b({title:o,color:t,checked:!!a,style:l({},f,{background:t}),onClick:e=>x(t,e)});if(s)return(0,re.jsx)(K.Fragment,{children:s},r);var i=p.children&&V().isValidElement(p.children)?V().cloneElement(p.children,{color:t,checked:a}):null;return(0,re.jsx)("div",l({tabIndex:0,title:o,onClick:e=>x(t,e)},p,{children:i,style:l({},f,{background:t})}),r)}),u&&V().isValidElement(u)&&u]}))});be.displayName="Swatch";const ve=be;var fe=["prefixCls","className","style","color","colors","showTriangle","onChange"],xe=["#D9E3F0","#F47373","#697689","#37D67A","#2CCCE4","#555555","#dce775","#ff8a65","#ba68c8"],me=V().forwardRef((e,r)=>{var o=e.prefixCls,t=void 0===o?"w-color-block":o,a=e.className,n=e.style,s=e.color,i=e.colors,d=void 0===i?xe:i,c=e.showTriangle,p=void 0===c||c,h=e.onChange,u=Y(e,fe),g="string"===typeof s&&X(s)?j(s):s,b=s?T(g):"",v=(e,r)=>{"string"===typeof e&&X(e)&&/(3|6)/.test(String(e.replace(/^#/,"").length))&&h&&h(_(j(e)))},f=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"},n);return(0,re.jsxs)("div",l({ref:r,className:[t,a].filter(Boolean).join(" "),style:f},u,{children:[p&&(0,re.jsx)("div",{style:{width:0,height:0,borderStyle:"solid",borderWidth:"0 10px 10px",borderColor:"transparent transparent "+b,position:"absolute",top:-10,left:"50%",marginLeft:-10}}),(0,re.jsx)("div",{title:b,style:{backgroundColor:""+b,color:W(b),height:110,fontSize:18,borderRadius:"6px 6px 0 0",display:"flex",alignItems:"center",justifyContent:"center"},children:b.toLocaleUpperCase()}),(0,re.jsx)(ve,{colors:d,color:b,style:{paddingLeft:10,paddingTop:10},rectProps:{style:{marginRight:10,marginBottom:10,borderRadius:4,height:22,width:22}},onChange:e=>{h&&h(_(e))}}),(0,re.jsx)(ue,{value:b.toLocaleUpperCase(),onChange:(e,r)=>v(r),onBlur:e=>{var r=e.target.value;e.target.value=r.slice(0,6),v(r.slice(0,6))},inputStyle:{height:22,outline:0,borderRadius:3,padding:"0 7px"},style:{padding:10,paddingTop:0,borderRadius:"0 0 6px 6px"}})]}))});me.displayName="Block";const ye=me;function Ce(e){if(null==e)throw new TypeError("Cannot destructure "+e)}var we={marginRight:0,marginBottom:0,borderRadius:0,boxSizing:"border-box",height:25,width:25};function Fe(e){var r=e.style,o=e.title,t=e.checked,a=(e.color,e.onClick),n=e.rectProps,s=(0,K.useRef)(null),i=(0,K.useCallback)(()=>{s.current.style.zIndex="2",s.current.style.outline="#fff solid 2px",s.current.style.boxShadow="rgb(0 0 0 / 25%) 0 0 5px 2px"},[]),d=(0,K.useCallback)(()=>{t||(s.current.style.zIndex="0",s.current.style.outline="initial",s.current.style.boxShadow="initial")},[t]),c=t?{zIndex:1,outline:"#fff solid 2px",boxShadow:"rgb(0 0 0 / 25%) 0 0 5px 2px"}:{zIndex:0};return(0,re.jsx)("div",l({ref:s,title:o},n,{onClick:a,onMouseEnter:i,onMouseLeave:d,style:l({},r,{marginRight:0,marginBottom:0,borderRadius:0,boxSizing:"border-box",height:25,width:25},we,c,null==n?void 0:n.style)}))}var ke=["prefixCls","placement","className","style","color","colors","showTriangle","rectProps","onChange","rectRender"],Be=["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],Ae=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}({}),je=V().forwardRef((e,r)=>{var o=e.prefixCls,t=void 0===o?"w-color-github":o,a=e.placement,n=void 0===a?Ae.TopRight:a,s=e.className,i=e.style,d=e.color,c=e.colors,p=void 0===c?Be:c,h=e.showTriangle,u=void 0===h||h,g=e.rectProps,b=void 0===g?{}:g,v=e.onChange,f=e.rectRender,x=Y(e,ke),m="string"===typeof d&&X(d)?j(d):d,y=d?T(m):"",C=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},i),w={borderStyle:"solid",position:"absolute"},F=l({},w),k=l({},w);/^T/.test(n)&&(F.borderWidth="0 8px 8px",F.borderColor="transparent transparent var(--github-arrow-border-color)",k.borderWidth="0 7px 7px",k.borderColor="transparent transparent var(--github-background-color)"),n===Ae.TopRight&&(F.top=-8,k.top=-7),n===Ae.Top&&(F.top=-8,k.top=-7),n===Ae.TopLeft&&(F.top=-8,k.top=-7),/^B/.test(n)&&(F.borderWidth="8px 8px 0",F.borderColor="var(--github-arrow-border-color) transparent transparent",k.borderWidth="7px 7px 0",k.borderColor="var(--github-background-color) transparent transparent",n===Ae.BottomRight&&(F.top="100%",k.top="100%"),n===Ae.Bottom&&(F.top="100%",k.top="100%"),n===Ae.BottomLeft&&(F.top="100%",k.top="100%")),/^(B|T)/.test(n)&&(n!==Ae.Top&&n!==Ae.Bottom||(F.left="50%",F.marginLeft=-8,k.left="50%",k.marginLeft=-7),n!==Ae.TopRight&&n!==Ae.BottomRight||(F.right=10,k.right=11),n!==Ae.TopLeft&&n!==Ae.BottomLeft||(F.left=7,k.left=8)),/^L/.test(n)&&(F.borderWidth="8px 8px 8px 0",F.borderColor="transparent var(--github-arrow-border-color) transparent transparent",k.borderWidth="7px 7px 7px 0",k.borderColor="transparent var(--github-background-color) transparent transparent",F.left=-8,k.left=-7),/^R/.test(n)&&(F.borderWidth="8px 0 8px 8px",F.borderColor="transparent transparent transparent var(--github-arrow-border-color)",k.borderWidth="7px 0 7px 7px",k.borderColor="transparent transparent transparent var(--github-background-color)",F.right=-8,k.right=-7),/^(L|R)/.test(n)&&(n!==Ae.RightTop&&n!==Ae.LeftTop||(F.top=5,k.top=6),n!==Ae.Left&&n!==Ae.Right||(F.top="50%",k.top="50%",F.marginTop=-8,k.marginTop=-7),n!==Ae.LeftBottom&&n!==Ae.RightBottom||(F.top="100%",k.top="100%",F.marginTop=-21,k.marginTop=-20));return(0,re.jsx)(ve,l({ref:r,className:[t,s].filter(Boolean).join(" "),colors:p,color:y,rectRender:e=>{var r=l({},(Ce(e),e)),o=f&&f(l({},r));return o||(0,re.jsx)(Fe,l({},r,{rectProps:b}))}},x,{onChange:e=>v&&v(_(e)),style:C,rectProps:{style:{marginRight:0,marginBottom:0,borderRadius:0,height:25,width:25}},addonBefore:(0,re.jsx)(K.Fragment,{children:u&&(0,re.jsxs)(K.Fragment,{children:[(0,re.jsx)("div",{style:F}),(0,re.jsx)("div",{style:k})]})})}))});je.displayName="Github";const Re=je;var Se=e=>{var r=e.className,o=e.color,t=e.left,a=e.top,l=e.prefixCls,n={position:"absolute",top:a,left:t},s={"--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,K.useMemo)(()=>(0,re.jsx)("div",{className:l+"-pointer "+(r||""),style:n,children:(0,re.jsx)("div",{className:l+"-fill",style:s})}),[a,t,o,r,l])},Ee=["prefixCls","radius","pointer","className","hue","style","hsva","onChange"],De=V().forwardRef((e,r)=>{var o,t=e.prefixCls,a=void 0===t?"w-color-saturation":t,n=e.radius,s=void 0===n?0:n,i=e.pointer,d=e.className,c=e.hue,p=void 0===c?0:c,u=e.style,g=e.hsva,b=e.onChange,v=Y(e,Ee),f=l({width:200,height:200,borderRadius:s},u,{position:"relative"}),x=(0,K.useRef)(null),m=(0,K.useCallback)(e=>{x.current=e,"function"===typeof r?r(e):r&&"current"in r&&(r.current=e)},[r]),y=(0,K.useCallback)((e,r)=>{b&&g&&b({h:g.h,s:100*e.left,v:100*(1-e.top),a:g.a});var o=x.current;o&&o.focus()},[g,b]),C=(0,K.useCallback)(e=>{if(g&&b){var r=g.s,o=g.v,t=!1;switch(e.key){case"ArrowLeft":r=Math.max(0,g.s-1),t=!0,e.preventDefault();break;case"ArrowRight":r=Math.min(100,g.s+1),t=!0,e.preventDefault();break;case"ArrowUp":o=Math.min(100,g.v+1),t=!0,e.preventDefault();break;case"ArrowDown":o=Math.max(0,g.v-1),t=!0,e.preventDefault();break;default:return}t&&b({h:g.h,s:r,v:o,a:g.a})}},[g,b]),w=(0,K.useMemo)(()=>{if(!g)return null;var e={top:100-g.v+"%",left:g.s+"%",color:h(g)};return i&&"function"===typeof i?i(l({prefixCls:a},e)):(0,re.jsx)(Se,l({prefixCls:a},e))},[g,i,a]),F=(0,K.useCallback)(e=>{e.target.focus()},[]);return(0,re.jsx)(ae,l({className:[a,d||""].filter(Boolean).join(" ")},v,{style:l({position:"absolute",inset:0,cursor:"crosshair",backgroundImage:"linear-gradient(0deg, #000, transparent), linear-gradient(90deg, #fff, hsl("+(null!=(o=null==g?void 0:g.h)?o:p)+", 100%, 50%))"},f,{outline:"none"}),ref:m,onMove:y,onDown:y,onKeyDown:C,onClick:F,children:w}))});De.displayName="Saturation";const Ne=De;var Pe=["prefixCls","className","hue","onChange","direction","reverse"],Te="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%",Le="rgb(255, 0, 0) 0%, rgb(255, 0, 255) 17%, rgb(0, 0, 255) 33%, rgb(0, 255, 255) 50%, rgb(0, 255, 0) 67%, rgb(255, 255, 0) 83%, rgb(255, 0, 0) 100%",Me=V().forwardRef((e,r)=>{var o=e.prefixCls,t=void 0===o?"w-color-hue":o,a=e.className,n=e.hue,s=void 0===n?0:n,i=e.onChange,d=e.direction,c=void 0===d?"horizontal":d,p=e.reverse,h=void 0!==p&&p,u=Y(e,Pe),g=(0,K.useCallback)(()=>{if("horizontal"===c){return"linear-gradient(to right, "+(h?Le:Te)+")"}return"linear-gradient(to bottom, "+(h?Te:Le)+")"},[c,h]),b=(0,K.useCallback)(e=>{var r="horizontal"===c?e.left:e.top;return 360*("horizontal"===c?h?1-r:r:h?r:1-r)},[c,h]),v=(0,K.useMemo)(()=>g(),[g]);return(0,re.jsx)(ce,l({ref:r,className:t+" "+(a||"")},u,{direction:c,reverse:h,background:v,hsva:{h:s,s:100,v:100,a:s/360},onChange:(e,r)=>{i&&i({h:b(r)})}}))});Me.displayName="Hue";const He=Me;var ze=["prefixCls","hsva","placement","rProps","gProps","bProps","aProps","className","style","onChange"],Ie=V().forwardRef((e,r)=>{var o=e.prefixCls,t=void 0===o?"w-color-editable-input-rgba":o,a=e.hsva,n=e.placement,s=void 0===n?"bottom":n,d=e.rProps,c=void 0===d?{}:d,p=e.gProps,h=void 0===p?{}:p,u=e.bProps,g=void 0===u?{}:u,b=e.aProps,v=void 0===b?{}:b,f=e.className,x=e.style,m=e.onChange,y=Y(e,ze),C=a?S(a):{};function w(e){var r=Number(e.target.value);r&&r>255&&(e.target.value="255"),r&&r<0&&(e.target.value="0")}var F=(e,r,o)=>{"number"===typeof e&&("a"===r&&(e<0&&(e=0),e>100&&(e=100),m&&m(_(i(l({},C,{a:e/100}))))),e>255&&(e=255,o.target.value="255"),e<0&&(e=0,o.target.value="0"),"r"===r&&m&&m(_(i(l({},C,{r:e})))),"g"===r&&m&&m(_(i(l({},C,{g:e})))),"b"===r&&m&&m(_(i(l({},C,{b:e})))))},k=C.a?Math.round(100*C.a)/100:0;return(0,re.jsxs)("div",l({ref:r,className:[t,f||""].filter(Boolean).join(" ")},y,{style:l({fontSize:11,display:"flex"},x),children:[(0,re.jsx)(ue,l({label:"R",value:C.r||0,onBlur:w,placement:s,onChange:(e,r)=>F(r,"r",e)},c,{style:l({},c.style)})),(0,re.jsx)(ue,l({label:"G",value:C.g||0,onBlur:w,placement:s,onChange:(e,r)=>F(r,"g",e)},h,{style:l({marginLeft:5},h.style)})),(0,re.jsx)(ue,l({label:"B",value:C.b||0,onBlur:w,placement:s,onChange:(e,r)=>F(r,"b",e)},g,{style:l({marginLeft:5},g.style)})),v&&(0,re.jsx)(ue,l({label:"A",value:parseInt(String(100*k),10),onBlur:e=>{var r=Number(e.target.value);r&&r>100&&(e.target.value="100"),r&&r<0&&(e.target.value="0")},placement:s,onChange:(e,r)=>F(r,"a",e)},v,{style:l({marginLeft:5},v.style)}))]}))});Ie.displayName="EditableInputRGBA";const Oe=Ie;var _e=["prefixCls","hsva","hProps","sProps","lProps","aProps","className","onChange"],We=V().forwardRef((e,r)=>{var o=e.prefixCls,t=void 0===o?"w-color-editable-input-hsla":o,a=e.hsva,n=e.hProps,s=void 0===n?{}:n,i=e.sProps,d=void 0===i?{}:i,c=e.lProps,p=void 0===c?{}:c,h=e.aProps,u=void 0===h?{}:h,g=e.className,b=e.onChange,x=Y(e,_e),m=a?f(a):{h:0,s:0,l:0,a:0},y=(e,r,o)=>{"number"===typeof e&&("h"===r&&(e<0&&(e=0),e>360&&(e=360),b&&b(_(v(l({},m,{h:e}))))),"s"===r&&(e<0&&(e=0),e>100&&(e=100),b&&b(_(v(l({},m,{s:e}))))),"l"===r&&(e<0&&(e=0),e>100&&(e=100),b&&b(_(v(l({},m,{l:e}))))),"a"===r&&(e<0&&(e=0),e>1&&(e=1),b&&b(_(v(l({},m,{a:e}))))))},C=0!=u&&l({label:"A",value:Math.round(100*m.a)/100},u,{onChange:(e,r)=>y(r,"a")});return(0,re.jsx)(Oe,l({ref:r,hsva:a,rProps:l({label:"H",value:Math.round(m.h)},s,{onChange:(e,r)=>y(r,"h")}),gProps:l({label:"S",value:Math.round(m.s)+"%"},d,{onChange:(e,r)=>y(r,"s")}),bProps:l({label:"L",value:Math.round(m.l)+"%"},p,{onChange:(e,r)=>y(r,"l")}),aProps:C,className:[t,g||""].filter(Boolean).join(" ")},x))});We.displayName="EditableInputHSLA";const Ge=We;var qe=["style"];function Ue(e){var r=e.style,o=Y(e,qe),t=(0,K.useRef)(null),a=(0,K.useCallback)(()=>{t.current.style.backgroundColor="var(--chrome-arrow-background-color)"},[]),n=(0,K.useCallback)(()=>{t.current.style.backgroundColor="transparent"},[]);return(0,re.jsx)("div",l({ref:t,style:l({marginLeft:5,cursor:"pointer",transition:"background-color .3s",borderRadius:2},r)},o,{onMouseEnter:a,onMouseLeave:n,children:(0,re.jsx)("svg",{viewBox:"0 0 1024 1024",width:"24",height:"24",style:{display:"block"},children:(0,re.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 Xe(e){return(0,re.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,re.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 Ye=["prefixCls","className","style","color","showEditableInput","showEyeDropper","showColorPreview","showHue","showAlpha","horizontal","inputType","rectProps","onChange"],Ke=function(e){return e.HEXA="hexa",e.RGBA="rgba",e.HSLA="hsla",e}({}),Ve=V().forwardRef((e,r)=>{var o=e.prefixCls,t=void 0===o?"w-color-chrome":o,a=e.className,n=e.style,s=e.color,i=e.showEditableInput,d=void 0===i||i,c=e.showEyeDropper,p=void 0===c||c,h=e.showColorPreview,u=void 0===h||h,g=e.showHue,b=void 0===g||g,v=e.showAlpha,f=void 0===v||v,x=e.horizontal,m=void 0!==x&&x,y=e.inputType,C=void 0===y?Ke.RGBA:y,w=(e.rectProps,e.onChange),F=Y(e,Ye),k="string"===typeof s&&X(s)?j(s):s||{h:0,s:0,l:0,a:0},B=e=>w&&w(_(e)),A=(0,K.useState)(C),R=A[0],S=A[1],E={paddingTop:6},N={textAlign:"center",paddingTop:4,paddingBottom:4},P=l({"--chrome-arrow-fill":"#333","--chrome-arrow-background-color":"#e8e8e8",borderRadius:0,flexDirection:m?"row":"column",width:m?460:230,padding:0},n),M={"--chrome-alpha-box-shadow":"rgb(0 0 0 / 25%) 0px 0px 1px inset",borderRadius:"50%",background:D(k),boxShadow:"var(--chrome-alpha-box-shadow)"},H={height:14,width:14},z={style:l({},H),fillProps:{style:H}};return(0,re.jsx)(Re,l({ref:r,color:k,style:P,colors:void 0,className:[t,a].filter(Boolean).join(" "),placement:Ae.TopLeft},F,{addonAfter:(0,re.jsxs)(K.Fragment,{children:[(0,re.jsx)(Ne,{hsva:k,style:m?{width:230,height:120}:{width:"100%",height:130},onChange:e=>{B(l({},k,e,{a:k.a}))}}),(0,re.jsxs)("div",{style:{display:"flex",flexDirection:"column",width:m?230:"inherit"},children:[(0,re.jsxs)("div",{style:{padding:15,display:"flex",alignItems:"center",gap:10},children:["EyeDropper"in window&&p&&(0,re.jsx)(Xe,{onPickColor:e=>{var r=j(e);B(l({},r))}}),u&&(0,re.jsx)(ce,{width:28,height:28,hsva:k,radius:2,style:{borderRadius:"50%"},bgProps:{style:{background:"transparent"}},innerProps:{style:M},pointer:()=>(0,re.jsx)(K.Fragment,{})}),(0,re.jsxs)("div",{style:{flex:1},children:[1==b&&(0,re.jsx)(He,{hue:k.h,style:{width:"100%",height:12,borderRadius:2},pointerProps:z,bgProps:{style:{borderRadius:2}},onChange:e=>{B(l({},k,e))}}),1==f&&(0,re.jsx)(ce,{hsva:k,style:{marginTop:6,height:12,borderRadius:2},pointerProps:z,bgProps:{style:{borderRadius:2}},onChange:e=>{B(l({},k,e))}})]})]}),d&&(0,re.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",padding:"0 15px 15px 15px",userSelect:"none"},children:[(0,re.jsxs)("div",{style:{flex:1},children:[R==Ke.RGBA&&(0,re.jsx)(Oe,{hsva:k,rProps:{labelStyle:E,inputStyle:N},gProps:{labelStyle:E,inputStyle:N},bProps:{labelStyle:E,inputStyle:N},aProps:0!=f&&{labelStyle:E,inputStyle:N},onChange:e=>B(e.hsva)}),R===Ke.HEXA&&(0,re.jsx)(ue,{label:"HEX",labelStyle:E,inputStyle:N,value:k.a>0&&k.a<1?L(k).toLocaleUpperCase():T(k).toLocaleUpperCase(),onChange:(e,r)=>{"string"===typeof r&&B(j(/^#/.test(r)?r:"#"+r))}}),R===Ke.HSLA&&(0,re.jsx)(Ge,{hsva:k,hProps:{labelStyle:E,inputStyle:N},sProps:{labelStyle:E,inputStyle:N},lProps:{labelStyle:E,inputStyle:N},aProps:0!=f&&{labelStyle:E,inputStyle:N},onChange:e=>B(e.hsva)})]}),(0,re.jsx)(Ue,{onClick:()=>{R===Ke.RGBA&&S(Ke.HSLA),R===Ke.HSLA&&S(Ke.HEXA),R===Ke.HEXA&&S(Ke.RGBA)}})]})]})]}),rectRender:()=>(0,re.jsx)(K.Fragment,{})}))});Ve.displayName="Chrome";const Qe=Ve;function Ze(e){var r,o,t,a=e.style,n=e.className,s=e.title,i=e.checked,d=e.color,c=e.onClick,p=e.rectProps,h=(0,K.useRef)(null),u=(0,K.useCallback)(()=>{h.current.style.transform="scale(1.2)"},[]),g=(0,K.useCallback)(()=>{h.current.style.transform="scale(1)"},[]),b=(null==p||null==(r=p.style)?void 0:r.width)||"100%",v=(null==p||null==(o=p.style)?void 0:o.height)||"100%",f=l({"--circle-point-background-color":"#fff",backgroundColor:"var(--circle-point-background-color)",boxSizing:"border-box",transition:"height 100ms ease 0s, width 100ms ease 0s"},p.style,{borderRadius:(null==p||null==(t=p.style)?void 0:t.borderRadius)||"50%",height:i?v:0,width:i?b:0});return(0,re.jsx)("div",{ref:h,onClick:c,onMouseEnter:u,onMouseLeave:g,title:s,className:n,style:l({padding:3,marginRight:12,marginBottom:12,display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:"50%",boxSizing:"border-box",transform:"scale(1)",transition:"transform 100ms ease 0s, box-shadow 100ms ease 0s"},a,{boxShadow:d+" 0px 0px "+(i?5:0)+"px"}),children:(0,re.jsx)("div",l({},p,{style:f}))})}var $e=["prefixCls","className","color","colors","rectProps","pointProps","style","onChange"],Je=V().forwardRef((e,r)=>{var o,t,a,n,s,i=e.prefixCls,d=void 0===i?"w-color-circle":i,c=e.className,p=e.color,h=e.colors,u=void 0===h?[]:h,g=e.rectProps,b=void 0===g?{}:g,v=e.pointProps,f=void 0===v?{}:v,x=e.style,m=void 0===x?{}:x,y=e.onChange,C=Y(e,$e),w="string"===typeof p&&X(p)?j(p):p||{},F=p?T(w):"",k=[d,c].filter(Boolean).join(" "),B=[d+"-point",null==f?void 0:f.className].filter(Boolean).join(" ");return f.style=f.style||{},f.style.borderRadius=(null==(o=f.style)?void 0:o.borderRadius)||"50%",f.style.width=(null==(t=f.style)?void 0:t.width)||26,f.style.height=(null==(a=f.style)?void 0:a.height)||26,f.style.marginRight=(null==(n=f.style)?void 0:n.marginRight)||0,f.style.marginBottom=(null==(s=f.style)?void 0:s.marginBottom)||0,m.gap=m.gap||10,(0,re.jsx)(ve,l({ref:r,colors:u,color:F,style:m},C,{className:k,rectRender:e=>{var r=l({},(Ce(e),e));return(0,re.jsx)(Ze,l({},r,f,{style:l({},r.style,f.style),className:B,rectProps:b}))},onChange:e=>{y&&y(_(e))}}))});Je.displayName="Circle";const er=Je;var rr=["style","color"],or=["prefixCls","className","onChange","color","style","disableAlpha"],tr=e=>{var r=e.style,o=e.color,t=Y(e,rr),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("+ie+")",backgroundColor:"var(--colorful-pointer-background-color)",border:"var(--colorful-pointer-border)",zIndex:1},r);return(0,re.jsx)("div",l({},t,{style:a,children:(0,re.jsx)("div",{style:{backgroundColor:o,borderRadius:"50%",height:"100%",width:"100%"}})}))},ar=V().forwardRef((e,r)=>{var o=e.prefixCls,t=void 0===o?"w-color-colorful":o,a=e.className,n=e.onChange,s=e.color,i=e.style,d=e.disableAlpha,c=Y(e,or),p="string"===typeof s&&X(s)?j(s):s||{},h=e=>n&&n(_(e));return(0,re.jsxs)("div",l({ref:r,style:l({width:200,position:"relative"},i)},c,{className:t+" "+(a||""),children:[(0,re.jsx)(Ne,{hsva:p,className:t,radius:"8px 8px 0 0",style:{width:"auto",height:150,minWidth:120,borderBottom:"12px solid #000"},pointer:e=>{var r=e.left,o=e.top;e.color;return(0,re.jsx)(tr,{style:{left:r,top:o},color:T(p)})},onChange:e=>h(l({},p,e))}),(0,re.jsx)(He,{hue:p.h,height:24,radius:d?"0 0 8px 8px":0,className:t,onChange:e=>h(l({},p,e)),pointer:e=>{var r=e.left;return(0,re.jsx)(tr,{style:{left:r,transform:"translate(-16px, -5px)"},color:"hsl("+(p.h||0)+"deg 100% 50%)"})}}),!d&&(0,re.jsx)(ce,{hsva:p,height:24,className:t,radius:"0 0 8px 8px",pointer:e=>{var r=e.left;return(0,re.jsx)(tr,{style:{left:r,transform:"translate(-16px, -5px)"},color:D(p)})},onChange:e=>h(l({},p,e))})]}))});ar.displayName="Colorful";const lr=ar;var nr=["prefixCls","className","style","onChange","color","colors","rectProps","rectRender","addonBefore","addonAfter"],sr=["#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 ir(e){return e.checked?(0,re.jsx)("div",{style:{height:5,width:5,borderRadius:"50%",backgroundColor:W(e.color)}}):null}var dr=V().forwardRef((e,r)=>{var o=e.prefixCls,t=void 0===o?"w-color-compact":o,a=e.className,n=e.style,s=e.onChange,i=e.color,d=e.colors,c=void 0===d?sr:d,p=e.rectProps,h=e.rectRender,u=e.addonBefore,g=e.addonAfter,b=Y(e,nr),v="string"===typeof i&&X(i)?j(i):i,f=i?T(v).replace(/^#/,""):"",x=(0,K.useCallback)(e=>s&&s(_(e)),[s]),m={style:{alignItems:"baseline"},inputStyle:{boxShadow:"none",backgroundColor:"transparent",outline:0}},y=l({"--compact-background-color":"#f6f6f6",background:"var(--compact-background-color)",borderRadius:3,display:"flex",width:240,flexWrap:"wrap",paddingTop:5,paddingLeft:5},n);return(0,re.jsxs)("div",l({ref:r,style:y,className:[t,a||""].filter(Boolean).join(" ")},b,{children:[(0,re.jsx)(ve,{colors:c,color:i?T(v):void 0,rectRender:h,rectProps:l({children:(0,re.jsx)(ir,{})},p,{style:l({display:"flex",alignItems:"center",justifyContent:"center"},null==p?void 0:p.style)}),onChange:e=>x(e),addonBefore:u,addonAfter:g}),(0,re.jsxs)("div",{className:[t+"-input-wrapper",a||""].filter(Boolean).join(" "),style:{display:"flex",margin:"0 4px 3px 0"},children:[(0,re.jsx)(ue,{onChange:(e,r)=>{var o;"string"===typeof(o=r)&&X(o)&&/(3|6)/.test(String(o.length))&&x(j(o))},labelStyle:{paddingRight:5,marginTop:-1},value:f.toLocaleUpperCase(),label:(0,re.jsx)("div",{style:{width:8,height:8,backgroundColor:"#"+f}}),inputStyle:{outline:"none",boxShadow:"initial",background:"transparent"},style:{flexDirection:"row-reverse",flex:"1 1 0%",minWidth:80}}),(0,re.jsx)(Oe,{hsva:v,placement:"left",onChange:e=>x(e.hsva),aProps:!1,rProps:m,gProps:m,bProps:m})]})]}))});dr.displayName="Compact";const cr=dr;var pr=["prefixCls","className","style","color","onChange"],hr={boxShadow:"initial",borderWidth:"0 0 1px 0",borderBottomColor:"var(--material-border-bottom-color)",borderBottomStyle:"solid",height:30,outline:0,fontSize:15,padding:0},ur=V().forwardRef((e,r)=>{var o=e.prefixCls,t=void 0===o?"w-color-material":o,a=e.className,n=e.style,s=e.color,i=e.onChange,d=Y(e,pr),c="string"===typeof s&&X(s)?j(s):s,p=s?T(c).replace(/^#/,""):"",h=(e,r)=>{"string"===typeof e&&X(e)&&/(3|6)/.test(String(e.length))&&i&&i(_(j(e)))},u=l({"--material-border-bottom-color":"#eee","--material-background-color":"#fff",padding:16,width:98,fontFamily:"Roboto",backgroundColor:"var(--material-background-color)"},n);return(0,re.jsxs)("div",l({ref:r,className:[t,a||""].filter(Boolean).join(" "),style:u},d,{children:[(0,re.jsx)(ue,{label:"Hex",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:{outline:0,border:0,height:30,fontSize:15,padding:0,boxShadow:"initial",borderWidth:"0 0 2px 0",borderBottomColor:p?"#"+p:"var(--material-border-bottom-color)",borderBottomStyle:"solid",background:"transparent"},style:{flexDirection:"column-reverse",alignItems:"flex-start"}}),(0,re.jsx)(Oe,{hsva:c,placement:"top",style:{marginTop:11},rProps:{style:{alignItems:"flex-start"},inputStyle:l({},hr)},gProps:{style:{alignItems:"flex-start"},inputStyle:l({},hr)},bProps:{style:{alignItems:"flex-start"},inputStyle:l({},hr)},aProps:!1,onChange:e=>{return r=e.hsva,void(i&&i(_(r)));var r}})]}))});ur.displayName="Material";const gr=ur,br=["#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 vr=["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]=br[o],e),{}),fr=["aqua","black","blue","fuchsia","gray","green","lime","maroon","navy","olive","purple","red","silver","teal","white","yellow"],xr=fr.reduce((e,r)=>(e[r]=vr[r],e),{});function mr(e){return vr[e]}var yr=["prefixCls","className","onChange","direction","hsva"],Cr=V().forwardRef((e,r)=>{var o=e.prefixCls,t=void 0===o?"w-color-saturation":o,a=e.className,n=e.onChange,s=e.direction,i=void 0===s?"horizontal":s,d=e.hsva,c=Y(e,yr),p=h(l({},d,{a:1,v:100}));return(0,re.jsx)(ce,l({ref:r},c,{className:t+" "+(a||""),hsva:{h:d.h,s:d.s,v:d.v,a:1-d.v/100},direction:i,background:"linear-gradient(to "+("horizontal"===i?"right":"bottom")+", "+p+", rgb(0, 0, 0))",onChange:(e,r)=>{n&&n({v:"horizontal"===i?100-100*r.left:100-100*r.top})}}))});Cr.displayName="ShadeSlider";const wr=Cr;var Fr=["prefixCls","className","onChange","width","presetColors","color","editableDisable","disableAlpha","style"],kr=["#D0021B","#F5A623","#f8e61b","#8B572A","#7ED321","#417505","#BD10E0","#9013FE","#4A90E2","#50E3C2","#B8E986","#000000","#4A4A4A","#9B9B9B","#FFFFFF"],Br=e=>(0,re.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"}}),Ar=V().forwardRef((e,r)=>{var o=e.prefixCls,t=void 0===o?"w-color-sketch":o,a=e.className,n=e.onChange,s=e.width,i=void 0===s?218:s,d=e.presetColors,c=void 0===d?kr:d,p=e.color,h=e.editableDisable,u=void 0===h||h,g=e.disableAlpha,b=void 0!==g&&g,v=e.style,f=Y(e,Fr),x=(0,K.useState)({h:209,s:36,v:90,a:1}),m=x[0],y=x[1];(0,K.useEffect)(()=>{"string"===typeof p&&X(p)&&y(j(p)),"object"===typeof p&&y(p)},[p]);var C=e=>{y(e),n&&n(_(e))},w=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:i},v),F={borderRadius:2,background:D(m),boxShadow:"var(--sketch-alpha-box-shadow)"};return(0,re.jsxs)("div",l({},f,{className:t+" "+(a||""),ref:r,style:w,children:[(0,re.jsxs)("div",{style:{padding:"10px 10px 8px"},children:[(0,re.jsx)(Ne,{hsva:m,style:{width:"auto",height:150},onChange:e=>C(l({},m,e,{a:m.a}))}),(0,re.jsxs)("div",{style:{display:"flex",marginTop:4},children:[(0,re.jsxs)("div",{style:{flex:1},children:[(0,re.jsx)(He,{width:"auto",height:10,hue:m.h,pointer:Br,innerProps:{style:{marginLeft:1,marginRight:5}},onChange:e=>C(l({},m,e))}),!b&&(0,re.jsx)(ce,{width:"auto",height:10,hsva:m,pointer:Br,style:{marginTop:4},innerProps:{style:{marginLeft:1,marginRight:5}},onChange:e=>C(l({},m,{a:e.a}))})]}),!b&&(0,re.jsx)(ce,{width:24,height:24,hsva:m,radius:2,style:{marginLeft:4},bgProps:{style:{background:"transparent"}},innerProps:{style:F},pointer:()=>(0,re.jsx)(K.Fragment,{})})]})]}),u&&(0,re.jsxs)("div",{style:{display:"flex",margin:"0 10px 3px 10px"},children:[(0,re.jsx)(ue,{label:"Hex",value:T(m).replace(/^#/,"").toLocaleUpperCase(),onChange:(e,r)=>{var o;"string"===typeof(o=r)&&X(o)&&/(3|6)/.test(String(o.length))&&C(j(o))},style:{minWidth:58}}),(0,re.jsx)(Oe,{hsva:m,style:{marginLeft:6},aProps:!b&&{},onChange:e=>C(e.hsva)})]}),c&&c.length>0&&(0,re.jsx)(ve,{style:{borderTop:"var(--sketch-swatch-border-top)",paddingTop:10,paddingLeft:10},colors:c,color:T(m),onChange:e=>C(e),rectProps:{style:{marginRight:10,marginBottom:10,borderRadius:3,boxShadow:"var(--sketch-swatch-box-shadow)"}}})]}))});Ar.displayName="Sketch";const jr=Ar;var Rr=["prefixCls","className","style","onChange","color","customColorShades","lightness"],Sr=e=>"string"===typeof e&&X(e)?j(e):e||{},Er=function(e,r,o){return void 0===o&&(o=2),Math.abs(e-r)<=o},Dr=V().forwardRef((e,r)=>{var o=e.prefixCls,t=void 0===o?"w-color-slider":o,a=e.className,n=e.style,s=e.onChange,i=e.color,d=e.customColorShades,c=void 0===d?[{color:"#000000",lightness:[50,40,30,20,10]},{color:"#ffffff",lightness:[95,90,80,70,60]}]:d,p=e.lightness,h=void 0===p?[80,65,50,35,20]:p,u=Y(e,Rr),g=Sr(i),b=c.find(e=>{var r=((e,r,o)=>{var t=Er(e.h,r.h)&&Er(e.s,r.s)&&Er(e.a,r.a);return!(!t||!Er(e.v,r.v))||!!o&&t&&o.some(e=>Er(r.v,e))})(Sr(e.color),g,e.lightness);return r}),v=b?b.lightness:h;return(0,re.jsx)("div",l({ref:r,style:l({display:"flex"},n),className:[t,a||""].filter(Boolean).join(" ")},u,{children:v.map((e,r)=>{var o=l({},g,{v:e}),t=S(o),a="rgba("+t.r+", "+t.g+", "+t.b+", "+t.a+")",n=a===D(g);return(0,re.jsx)("div",{style:{paddingLeft:1,width:100/v.length+"%",boxSizing:"border-box"},children:(0,re.jsx)("div",{onClick:e=>((e,r)=>{var o=w(e);s&&s(_(o),r)})(a,e),style:l({backgroundColor:a,height:12,cursor:"pointer"},n?{borderRadius:2,transform:"scale(1, 1.5)"}:{})})},r)})}))});Dr.displayName="Slider";const Nr=Dr;var Pr=e=>{var r=e.className,o=e.color,t=e.left,a=e.top,n=e.style,s=e.prefixCls,i=l({},n,{position:"absolute",top:a,left:t}),d=s+"-pointer "+(r||"");return(0,re.jsx)("div",{className:d,style:i,children:(0,re.jsx)("div",{className:s+"-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,re.jsx)("div",{style:{inset:0,borderRadius:"50%",position:"absolute",backgroundColor:o}})})})},Tr=2*Math.PI,Lr=(e,r)=>Math.sqrt(e*e+r*r);function Mr(e){var r=e.width,o=void 0===r?0:r,t=o/2;return{width:o,radius:t,cx:t,cy:t}}function Hr(e){var r=e.width;return(void 0===r?0:r)/2}function zr(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 Ir=["prefixCls","radius","pointer","className","style","width","height","oval","direction","angle","color","onChange"],Or=V().forwardRef((e,r)=>{var o=e.prefixCls,t=void 0===o?"w-color-wheel":o,a=(e.radius,e.pointer),n=e.className,s=e.style,i=e.width,d=void 0===i?200:i,c=e.height,p=void 0===c?200:c,h=e.oval,u=e.direction,g=void 0===u?"anticlockwise":u,b=e.angle,v=void 0===b?180:b,f=e.color,x=e.onChange,m=Y(e,Ir),y="string"===typeof f&&X(f)?j(f):f||{},C=f?T(y):"",w={width:d,dir