@contentstudio/ui 0.1.57 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,66 @@
1
+ "use strict";const Z=(e,t=0,n=1)=>Ae(Me(t,e),n),Te=e=>{e._clipped=!1,e._unclipped=e.slice(0);for(let t=0;t<=3;t++)t<3?((e[t]<0||e[t]>255)&&(e._clipped=!0),e[t]=Z(e[t],0,255)):t===3&&(e[t]=Z(e[t],0,1));return e},Xe={};for(let e of["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"])Xe[`[object ${e}]`]=e.toLowerCase();function x(e){return Xe[Object.prototype.toString.call(e)]||"object"}const C=(e,t=null)=>e.length>=3?Array.prototype.slice.call(e):x(e[0])=="object"&&t?t.split("").filter(n=>e[0][n]!==void 0).map(n=>e[0][n]):e[0],ae=e=>{if(e.length<2)return null;const t=e.length-1;return x(e[t])=="string"?e[t].toLowerCase():null},{PI:ue,min:Ae,max:Me}=Math,F=ue*2,ie=ue/3,Tt=ue/180,At=180/ue,m={format:{},autodetect:[]};class l{constructor(...t){const n=this;if(x(t[0])==="object"&&t[0].constructor&&t[0].constructor===this.constructor)return t[0];let r=ae(t),s=!1;if(!r){s=!0,m.sorted||(m.autodetect=m.autodetect.sort((c,o)=>o.p-c.p),m.sorted=!0);for(let c of m.autodetect)if(r=c.test(...t),r)break}if(m.format[r]){const c=m.format[r].apply(null,s?t:t.slice(0,-1));n._rgb=Te(c)}else throw new Error("unknown format: "+t);n._rgb.length===3&&n._rgb.push(1)}toString(){return x(this.hex)=="function"?this.hex():`[${this._rgb.join(",")}]`}}const Mt="2.6.0",y=(...e)=>new y.Color(...e);y.Color=l;y.version=Mt;const jt=(...e)=>{e=C(e,"cmyk");const[t,n,r,s]=e,c=e.length>4?e[4]:1;return s===1?[0,0,0,c]:[t>=1?0:255*(1-t)*(1-s),n>=1?0:255*(1-n)*(1-s),r>=1?0:255*(1-r)*(1-s),c]},{max:Be}=Math,Pt=(...e)=>{let[t,n,r]=C(e,"rgb");t=t/255,n=n/255,r=r/255;const s=1-Be(t,Be(n,r)),c=s<1?1/(1-s):0,o=(1-t-s)*c,f=(1-n-s)*c,a=(1-r-s)*c;return[o,f,a,s]};l.prototype.cmyk=function(){return Pt(this._rgb)};y.cmyk=(...e)=>new l(...e,"cmyk");m.format.cmyk=jt;m.autodetect.push({p:2,test:(...e)=>{if(e=C(e,"cmyk"),x(e)==="array"&&e.length===4)return"cmyk"}});const de=e=>Math.round(e*100)/100,Ot=(...e)=>{const t=C(e,"hsla");let n=ae(e)||"lsa";return t[0]=de(t[0]||0),t[1]=de(t[1]*100)+"%",t[2]=de(t[2]*100)+"%",n==="hsla"||t.length>3&&t[3]<1?(t[3]=t.length>3?t[3]:1,n="hsla"):t.length=3,`${n}(${t.join(",")})`},Ve=(...e)=>{e=C(e,"rgba");let[t,n,r]=e;t/=255,n/=255,r/=255;const s=Ae(t,n,r),c=Me(t,n,r),o=(c+s)/2;let f,a;return c===s?(f=0,a=Number.NaN):f=o<.5?(c-s)/(c+s):(c-s)/(2-c-s),t==c?a=(n-r)/(c-s):n==c?a=2+(r-t)/(c-s):r==c&&(a=4+(t-n)/(c-s)),a*=60,a<0&&(a+=360),e.length>3&&e[3]!==void 0?[a,f,o,e[3]]:[a,f,o]},{round:be}=Math,Rt=(...e)=>{const t=C(e,"rgba");let n=ae(e)||"rgb";return n.substr(0,3)=="hsl"?Ot(Ve(t),n):(t[0]=be(t[0]),t[1]=be(t[1]),t[2]=be(t[2]),(n==="rgba"||t.length>3&&t[3]<1)&&(t[3]=t.length>3?t[3]:1,n="rgba"),`${n}(${t.slice(0,n==="rgb"?3:4).join(",")})`)},{round:he}=Math,Ee=(...e)=>{e=C(e,"hsl");const[t,n,r]=e;let s,c,o;if(n===0)s=c=o=r*255;else{const f=[0,0,0],a=[0,0,0],i=r<.5?r*(1+n):r+n-r*n,b=2*r-i,d=t/360;f[0]=d+1/3,f[1]=d,f[2]=d-1/3;for(let h=0;h<3;h++)f[h]<0&&(f[h]+=1),f[h]>1&&(f[h]-=1),6*f[h]<1?a[h]=b+(i-b)*6*f[h]:2*f[h]<1?a[h]=i:3*f[h]<2?a[h]=b+(i-b)*(2/3-f[h])*6:a[h]=b;[s,c,o]=[he(a[0]*255),he(a[1]*255),he(a[2]*255)]}return e.length>3?[s,c,o,e[3]]:[s,c,o,1]},Ue=/^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/,Ze=/^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/,Je=/^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,Ke=/^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,We=/^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,Qe=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,{round:Le}=Math,je=e=>{e=e.toLowerCase().trim();let t;if(m.format.named)try{return m.format.named(e)}catch{}if(t=e.match(Ue)){const n=t.slice(1,4);for(let r=0;r<3;r++)n[r]=+n[r];return n[3]=1,n}if(t=e.match(Ze)){const n=t.slice(1,5);for(let r=0;r<4;r++)n[r]=+n[r];return n}if(t=e.match(Je)){const n=t.slice(1,4);for(let r=0;r<3;r++)n[r]=Le(n[r]*2.55);return n[3]=1,n}if(t=e.match(Ke)){const n=t.slice(1,5);for(let r=0;r<3;r++)n[r]=Le(n[r]*2.55);return n[3]=+n[3],n}if(t=e.match(We)){const n=t.slice(1,4);n[1]*=.01,n[2]*=.01;const r=Ee(n);return r[3]=1,r}if(t=e.match(Qe)){const n=t.slice(1,4);n[1]*=.01,n[2]*=.01;const r=Ee(n);return r[3]=+t[4],r}};je.test=e=>Ue.test(e)||Ze.test(e)||Je.test(e)||Ke.test(e)||We.test(e)||Qe.test(e);l.prototype.css=function(e){return Rt(this._rgb,e)};y.css=(...e)=>new l(...e,"css");m.format.css=je;m.autodetect.push({p:5,test:(e,...t)=>{if(!t.length&&x(e)==="string"&&je.test(e))return"css"}});m.format.gl=(...e)=>{const t=C(e,"rgba");return t[0]*=255,t[1]*=255,t[2]*=255,t};y.gl=(...e)=>new l(...e,"gl");l.prototype.gl=function(){const e=this._rgb;return[e[0]/255,e[1]/255,e[2]/255,e[3]]};const{floor:Bt}=Math,Lt=(...e)=>{e=C(e,"hcg");let[t,n,r]=e,s,c,o;r=r*255;const f=n*255;if(n===0)s=c=o=r;else{t===360&&(t=0),t>360&&(t-=360),t<0&&(t+=360),t/=60;const a=Bt(t),i=t-a,b=r*(1-n),d=b+f*(1-i),h=b+f*i,$=b+f;switch(a){case 0:[s,c,o]=[$,h,b];break;case 1:[s,c,o]=[d,$,b];break;case 2:[s,c,o]=[b,$,h];break;case 3:[s,c,o]=[b,d,$];break;case 4:[s,c,o]=[h,b,$];break;case 5:[s,c,o]=[$,b,d];break}}return[s,c,o,e.length>3?e[3]:1]},St=(...e)=>{const[t,n,r]=C(e,"rgb"),s=Ae(t,n,r),c=Me(t,n,r),o=c-s,f=o*100/255,a=s/(255-o)*100;let i;return o===0?i=Number.NaN:(t===c&&(i=(n-r)/o),n===c&&(i=2+(r-t)/o),r===c&&(i=4+(t-n)/o),i*=60,i<0&&(i+=360)),[i,f,a]};l.prototype.hcg=function(){return St(this._rgb)};y.hcg=(...e)=>new l(...e,"hcg");m.format.hcg=Lt;m.autodetect.push({p:1,test:(...e)=>{if(e=C(e,"hcg"),x(e)==="array"&&e.length===3)return"hcg"}});const zt=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,Ft=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,et=e=>{if(e.match(zt)){(e.length===4||e.length===7)&&(e=e.substr(1)),e.length===3&&(e=e.split(""),e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]);const t=parseInt(e,16),n=t>>16,r=t>>8&255,s=t&255;return[n,r,s,1]}if(e.match(Ft)){(e.length===5||e.length===9)&&(e=e.substr(1)),e.length===4&&(e=e.split(""),e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]);const t=parseInt(e,16),n=t>>24&255,r=t>>16&255,s=t>>8&255,c=Math.round((t&255)/255*100)/100;return[n,r,s,c]}throw new Error(`unknown hex color: ${e}`)},{round:ne}=Math,tt=(...e)=>{let[t,n,r,s]=C(e,"rgba"),c=ae(e)||"auto";s===void 0&&(s=1),c==="auto"&&(c=s<1?"rgba":"rgb"),t=ne(t),n=ne(n),r=ne(r);let f="000000"+(t<<16|n<<8|r).toString(16);f=f.substr(f.length-6);let a="0"+ne(s*255).toString(16);switch(a=a.substr(a.length-2),c.toLowerCase()){case"rgba":return`#${f}${a}`;case"argb":return`#${a}${f}`;default:return`#${f}`}};l.prototype.hex=function(e){return tt(this._rgb,e)};y.hex=(...e)=>new l(...e,"hex");m.format.hex=et;m.autodetect.push({p:4,test:(e,...t)=>{if(!t.length&&x(e)==="string"&&[3,4,5,6,7,8,9].indexOf(e.length)>=0)return"hex"}});const{cos:X}=Math,qt=(...e)=>{e=C(e,"hsi");let[t,n,r]=e,s,c,o;return isNaN(t)&&(t=0),isNaN(n)&&(n=0),t>360&&(t-=360),t<0&&(t+=360),t/=360,t<1/3?(o=(1-n)/3,s=(1+n*X(F*t)/X(ie-F*t))/3,c=1-(o+s)):t<2/3?(t-=1/3,s=(1-n)/3,c=(1+n*X(F*t)/X(ie-F*t))/3,o=1-(s+c)):(t-=2/3,c=(1-n)/3,o=(1+n*X(F*t)/X(ie-F*t))/3,s=1-(c+o)),s=Z(r*s*3),c=Z(r*c*3),o=Z(r*o*3),[s*255,c*255,o*255,e.length>3?e[3]:1]},{min:It,sqrt:Gt,acos:Dt}=Math,Yt=(...e)=>{let[t,n,r]=C(e,"rgb");t/=255,n/=255,r/=255;let s;const c=It(t,n,r),o=(t+n+r)/3,f=o>0?1-c/o:0;return f===0?s=NaN:(s=(t-n+(t-r))/2,s/=Gt((t-n)*(t-n)+(t-r)*(n-r)),s=Dt(s),r>n&&(s=F-s),s/=F),[s*360,f,o]};l.prototype.hsi=function(){return Yt(this._rgb)};y.hsi=(...e)=>new l(...e,"hsi");m.format.hsi=qt;m.autodetect.push({p:2,test:(...e)=>{if(e=C(e,"hsi"),x(e)==="array"&&e.length===3)return"hsi"}});l.prototype.hsl=function(){return Ve(this._rgb)};y.hsl=(...e)=>new l(...e,"hsl");m.format.hsl=Ee;m.autodetect.push({p:2,test:(...e)=>{if(e=C(e,"hsl"),x(e)==="array"&&e.length===3)return"hsl"}});const{floor:Ht}=Math,Xt=(...e)=>{e=C(e,"hsv");let[t,n,r]=e,s,c,o;if(r*=255,n===0)s=c=o=r;else{t===360&&(t=0),t>360&&(t-=360),t<0&&(t+=360),t/=60;const f=Ht(t),a=t-f,i=r*(1-n),b=r*(1-n*a),d=r*(1-n*(1-a));switch(f){case 0:[s,c,o]=[r,d,i];break;case 1:[s,c,o]=[b,r,i];break;case 2:[s,c,o]=[i,r,d];break;case 3:[s,c,o]=[i,b,r];break;case 4:[s,c,o]=[d,i,r];break;case 5:[s,c,o]=[r,i,b];break}}return[s,c,o,e.length>3?e[3]:1]},{min:Vt,max:Ut}=Math,Zt=(...e)=>{e=C(e,"rgb");let[t,n,r]=e;const s=Vt(t,n,r),c=Ut(t,n,r),o=c-s;let f,a,i;return i=c/255,c===0?(f=Number.NaN,a=0):(a=o/c,t===c&&(f=(n-r)/o),n===c&&(f=2+(r-t)/o),r===c&&(f=4+(t-n)/o),f*=60,f<0&&(f+=360)),[f,a,i]};l.prototype.hsv=function(){return Zt(this._rgb)};y.hsv=(...e)=>new l(...e,"hsv");m.format.hsv=Xt;m.autodetect.push({p:2,test:(...e)=>{if(e=C(e,"hsv"),x(e)==="array"&&e.length===3)return"hsv"}});const O={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},{pow:Jt}=Math,nt=(...e)=>{e=C(e,"lab");const[t,n,r]=e;let s,c,o,f,a,i;return c=(t+16)/116,s=isNaN(n)?c:c+n/500,o=isNaN(r)?c:c-r/200,c=O.Yn*pe(c),s=O.Xn*pe(s),o=O.Zn*pe(o),f=ge(3.2404542*s-1.5371385*c-.4985314*o),a=ge(-.969266*s+1.8760108*c+.041556*o),i=ge(.0556434*s-.2040259*c+1.0572252*o),[f,a,i,e.length>3?e[3]:1]},ge=e=>255*(e<=.00304?12.92*e:1.055*Jt(e,1/2.4)-.055),pe=e=>e>O.t1?e*e*e:O.t2*(e-O.t0),{pow:rt}=Math,st=(...e)=>{const[t,n,r]=C(e,"rgb"),[s,c,o]=Kt(t,n,r),f=116*c-16;return[f<0?0:f,500*(s-c),200*(c-o)]},me=e=>(e/=255)<=.04045?e/12.92:rt((e+.055)/1.055,2.4),ye=e=>e>O.t3?rt(e,1/3):e/O.t2+O.t0,Kt=(e,t,n)=>{e=me(e),t=me(t),n=me(n);const r=ye((.4124564*e+.3575761*t+.1804375*n)/O.Xn),s=ye((.2126729*e+.7151522*t+.072175*n)/O.Yn),c=ye((.0193339*e+.119192*t+.9503041*n)/O.Zn);return[r,s,c]};l.prototype.lab=function(){return st(this._rgb)};y.lab=(...e)=>new l(...e,"lab");m.format.lab=nt;m.autodetect.push({p:2,test:(...e)=>{if(e=C(e,"lab"),x(e)==="array"&&e.length===3)return"lab"}});const{sin:Wt,cos:Qt}=Math,ct=(...e)=>{let[t,n,r]=C(e,"lch");return isNaN(r)&&(r=0),r=r*Tt,[t,Qt(r)*n,Wt(r)*n]},ot=(...e)=>{e=C(e,"lch");const[t,n,r]=e,[s,c,o]=ct(t,n,r),[f,a,i]=nt(s,c,o);return[f,a,i,e.length>3?e[3]:1]},en=(...e)=>{const t=C(e,"hcl").reverse();return ot(...t)},{sqrt:tn,atan2:nn,round:rn}=Math,ft=(...e)=>{const[t,n,r]=C(e,"lab"),s=tn(n*n+r*r);let c=(nn(r,n)*At+360)%360;return rn(s*1e4)===0&&(c=Number.NaN),[t,s,c]},at=(...e)=>{const[t,n,r]=C(e,"rgb"),[s,c,o]=st(t,n,r);return ft(s,c,o)};l.prototype.lch=function(){return at(this._rgb)};l.prototype.hcl=function(){return at(this._rgb).reverse()};y.lch=(...e)=>new l(...e,"lch");y.hcl=(...e)=>new l(...e,"hcl");m.format.lch=ot;m.format.hcl=en;["lch","hcl"].forEach(e=>m.autodetect.push({p:2,test:(...t)=>{if(t=C(t,e),x(t)==="array"&&t.length===3)return e}}));const J={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",maroon2:"#7f0000",maroon3:"#b03060",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",purple2:"#7f007f",purple3:"#a020f0",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};l.prototype.name=function(){const e=tt(this._rgb,"rgb");for(let t of Object.keys(J))if(J[t]===e)return t.toLowerCase();return e};m.format.named=e=>{if(e=e.toLowerCase(),J[e])return et(J[e]);throw new Error("unknown color name: "+e)};m.autodetect.push({p:5,test:(e,...t)=>{if(!t.length&&x(e)==="string"&&J[e.toLowerCase()])return"named"}});const sn=e=>{if(x(e)=="number"&&e>=0&&e<=16777215){const t=e>>16,n=e>>8&255,r=e&255;return[t,n,r,1]}throw new Error("unknown num color: "+e)},cn=(...e)=>{const[t,n,r]=C(e,"rgb");return(t<<16)+(n<<8)+r};l.prototype.num=function(){return cn(this._rgb)};y.num=(...e)=>new l(...e,"num");m.format.num=sn;m.autodetect.push({p:5,test:(...e)=>{if(e.length===1&&x(e[0])==="number"&&e[0]>=0&&e[0]<=16777215)return"num"}});const{round:ut}=Math;l.prototype.rgb=function(e=!0){return e===!1?this._rgb.slice(0,3):this._rgb.slice(0,3).map(ut)};l.prototype.rgba=function(e=!0){return this._rgb.slice(0,4).map((t,n)=>n<3?e===!1?t:ut(t):t)};y.rgb=(...e)=>new l(...e,"rgb");m.format.rgb=(...e)=>{const t=C(e,"rgba");return t[3]===void 0&&(t[3]=1),t};m.autodetect.push({p:3,test:(...e)=>{if(e=C(e,"rgba"),x(e)==="array"&&(e.length===3||e.length===4&&x(e[3])=="number"&&e[3]>=0&&e[3]<=1))return"rgb"}});const{log:re}=Math,lt=e=>{const t=e/100;let n,r,s;return t<66?(n=255,r=t<6?0:-155.25485562709179-.44596950469579133*(r=t-2)+104.49216199393888*re(r),s=t<20?0:-254.76935184120902+.8274096064007395*(s=t-10)+115.67994401066147*re(s)):(n=351.97690566805693+.114206453784165*(n=t-55)-40.25366309332127*re(n),r=325.4494125711974+.07943456536662342*(r=t-50)-28.0852963507957*re(r),s=255),[n,r,s,1]},{round:on}=Math,fn=(...e)=>{const t=C(e,"rgb"),n=t[0],r=t[2];let s=1e3,c=4e4;const o=.4;let f;for(;c-s>o;){f=(c+s)*.5;const a=lt(f);a[2]/a[0]>=r/n?c=f:s=f}return on(f)};l.prototype.temp=l.prototype.kelvin=l.prototype.temperature=function(){return fn(this._rgb)};y.temp=y.kelvin=y.temperature=(...e)=>new l(...e,"temp");m.format.temp=m.format.kelvin=m.format.temperature=lt;const{pow:ce,sign:an}=Math,it=(...e)=>{e=C(e,"lab");const[t,n,r]=e,s=ce(t+.3963377774*n+.2158037573*r,3),c=ce(t-.1055613458*n-.0638541728*r,3),o=ce(t-.0894841775*n-1.291485548*r,3);return[255*we(4.0767416621*s-3.3077115913*c+.2309699292*o),255*we(-1.2684380046*s+2.6097574011*c-.3413193965*o),255*we(-.0041960863*s-.7034186147*c+1.707614701*o),e.length>3?e[3]:1]};function we(e){const t=Math.abs(e);return t>.0031308?(an(e)||1)*(1.055*ce(t,1/2.4)-.055):e*12.92}const{cbrt:ke,pow:un,sign:ln}=Math,dt=(...e)=>{const[t,n,r]=C(e,"rgb"),[s,c,o]=[_e(t/255),_e(n/255),_e(r/255)],f=ke(.4122214708*s+.5363325363*c+.0514459929*o),a=ke(.2119034982*s+.6806995451*c+.1073969566*o),i=ke(.0883024619*s+.2817188376*c+.6299787005*o);return[.2104542553*f+.793617785*a-.0040720468*i,1.9779984951*f-2.428592205*a+.4505937099*i,.0259040371*f+.7827717662*a-.808675766*i]};function _e(e){const t=Math.abs(e);return t<.04045?e/12.92:(ln(e)||1)*un((t+.055)/1.055,2.4)}l.prototype.oklab=function(){return dt(this._rgb)};y.oklab=(...e)=>new l(...e,"oklab");m.format.oklab=it;m.autodetect.push({p:3,test:(...e)=>{if(e=C(e,"oklab"),x(e)==="array"&&e.length===3)return"oklab"}});const dn=(...e)=>{e=C(e,"lch");const[t,n,r]=e,[s,c,o]=ct(t,n,r),[f,a,i]=it(s,c,o);return[f,a,i,e.length>3?e[3]:1]},bn=(...e)=>{const[t,n,r]=C(e,"rgb"),[s,c,o]=dt(t,n,r);return ft(s,c,o)};l.prototype.oklch=function(){return bn(this._rgb)};y.oklch=(...e)=>new l(...e,"oklch");m.format.oklch=dn;m.autodetect.push({p:3,test:(...e)=>{if(e=C(e,"oklch"),x(e)==="array"&&e.length===3)return"oklch"}});l.prototype.alpha=function(e,t=!1){return e!==void 0&&x(e)==="number"?t?(this._rgb[3]=e,this):new l([this._rgb[0],this._rgb[1],this._rgb[2],e],"rgb"):this._rgb[3]};l.prototype.clipped=function(){return this._rgb._clipped||!1};l.prototype.darken=function(e=1){const t=this,n=t.lab();return n[0]-=O.Kn*e,new l(n,"lab").alpha(t.alpha(),!0)};l.prototype.brighten=function(e=1){return this.darken(-e)};l.prototype.darker=l.prototype.darken;l.prototype.brighter=l.prototype.brighten;l.prototype.get=function(e){const[t,n]=e.split("."),r=this[t]();if(n){const s=t.indexOf(n)-(t.substr(0,2)==="ok"?2:0);if(s>-1)return r[s];throw new Error(`unknown channel ${n} in mode ${t}`)}else return r};const{pow:hn}=Math,gn=1e-7,pn=20;l.prototype.luminance=function(e,t="rgb"){if(e!==void 0&&x(e)==="number"){if(e===0)return new l([0,0,0,this._rgb[3]],"rgb");if(e===1)return new l([255,255,255,this._rgb[3]],"rgb");let n=this.luminance(),r=pn;const s=(o,f)=>{const a=o.interpolate(f,.5,t),i=a.luminance();return Math.abs(e-i)<gn||!r--?a:i>e?s(o,a):s(a,f)},c=(n>e?s(new l([0,0,0]),this):s(this,new l([255,255,255]))).rgb();return new l([...c,this._rgb[3]])}return mn(...this._rgb.slice(0,3))};const mn=(e,t,n)=>(e=$e(e),t=$e(t),n=$e(n),.2126*e+.7152*t+.0722*n),$e=e=>(e/=255,e<=.03928?e/12.92:hn((e+.055)/1.055,2.4)),P={},Q=(e,t,n=.5,...r)=>{let s=r[0]||"lrgb";if(!P[s]&&!r.length&&(s=Object.keys(P)[0]),!P[s])throw new Error(`interpolation mode ${s} is not defined`);return x(e)!=="object"&&(e=new l(e)),x(t)!=="object"&&(t=new l(t)),P[s](e,t,n).alpha(e.alpha()+n*(t.alpha()-e.alpha()))};l.prototype.mix=l.prototype.interpolate=function(e,t=.5,...n){return Q(this,e,t,...n)};l.prototype.premultiply=function(e=!1){const t=this._rgb,n=t[3];return e?(this._rgb=[t[0]*n,t[1]*n,t[2]*n,n],this):new l([t[0]*n,t[1]*n,t[2]*n,n],"rgb")};l.prototype.saturate=function(e=1){const t=this,n=t.lch();return n[1]+=O.Kn*e,n[1]<0&&(n[1]=0),new l(n,"lch").alpha(t.alpha(),!0)};l.prototype.desaturate=function(e=1){return this.saturate(-e)};l.prototype.set=function(e,t,n=!1){const[r,s]=e.split("."),c=this[r]();if(s){const o=r.indexOf(s)-(r.substr(0,2)==="ok"?2:0);if(o>-1){if(x(t)=="string")switch(t.charAt(0)){case"+":c[o]+=+t;break;case"-":c[o]+=+t;break;case"*":c[o]*=+t.substr(1);break;case"/":c[o]/=+t.substr(1);break;default:c[o]=+t}else if(x(t)==="number")c[o]=t;else throw new Error("unsupported value for Color.set");const f=new l(c,r);return n?(this._rgb=f._rgb,this):f}throw new Error(`unknown channel ${s} in mode ${r}`)}else return c};l.prototype.tint=function(e=.5,...t){return Q(this,"white",e,...t)};l.prototype.shade=function(e=.5,...t){return Q(this,"black",e,...t)};const yn=(e,t,n)=>{const r=e._rgb,s=t._rgb;return new l(r[0]+n*(s[0]-r[0]),r[1]+n*(s[1]-r[1]),r[2]+n*(s[2]-r[2]),"rgb")};P.rgb=yn;const{sqrt:xe,pow:V}=Math,wn=(e,t,n)=>{const[r,s,c]=e._rgb,[o,f,a]=t._rgb;return new l(xe(V(r,2)*(1-n)+V(o,2)*n),xe(V(s,2)*(1-n)+V(f,2)*n),xe(V(c,2)*(1-n)+V(a,2)*n),"rgb")};P.lrgb=wn;const kn=(e,t,n)=>{const r=e.lab(),s=t.lab();return new l(r[0]+n*(s[0]-r[0]),r[1]+n*(s[1]-r[1]),r[2]+n*(s[2]-r[2]),"lab")};P.lab=kn;const K=(e,t,n,r)=>{let s,c;r==="hsl"?(s=e.hsl(),c=t.hsl()):r==="hsv"?(s=e.hsv(),c=t.hsv()):r==="hcg"?(s=e.hcg(),c=t.hcg()):r==="hsi"?(s=e.hsi(),c=t.hsi()):r==="lch"||r==="hcl"?(r="hcl",s=e.hcl(),c=t.hcl()):r==="oklch"&&(s=e.oklch().reverse(),c=t.oklch().reverse());let o,f,a,i,b,d;(r.substr(0,1)==="h"||r==="oklch")&&([o,a,b]=s,[f,i,d]=c);let h,$,T,A;return!isNaN(o)&&!isNaN(f)?(f>o&&f-o>180?A=f-(o+360):f<o&&o-f>180?A=f+360-o:A=f-o,$=o+n*A):isNaN(o)?isNaN(f)?$=Number.NaN:($=f,(b==1||b==0)&&r!="hsv"&&(h=i)):($=o,(d==1||d==0)&&r!="hsv"&&(h=a)),h===void 0&&(h=a+n*(i-a)),T=b+n*(d-b),r==="oklch"?new l([T,h,$],r):new l([$,h,T],r)},bt=(e,t,n)=>K(e,t,n,"lch");P.lch=bt;P.hcl=bt;const _n=(e,t,n)=>{const r=e.num(),s=t.num();return new l(r+n*(s-r),"num")};P.num=_n;const $n=(e,t,n)=>K(e,t,n,"hcg");P.hcg=$n;const xn=(e,t,n)=>K(e,t,n,"hsi");P.hsi=xn;const Cn=(e,t,n)=>K(e,t,n,"hsl");P.hsl=Cn;const Nn=(e,t,n)=>K(e,t,n,"hsv");P.hsv=Nn;const vn=(e,t,n)=>{const r=e.oklab(),s=t.oklab();return new l(r[0]+n*(s[0]-r[0]),r[1]+n*(s[1]-r[1]),r[2]+n*(s[2]-r[2]),"oklab")};P.oklab=vn;const En=(e,t,n)=>K(e,t,n,"oklch");P.oklch=En;const{pow:Ce,sqrt:Ne,PI:ve,cos:Se,sin:ze,atan2:Tn}=Math,An=(e,t="lrgb",n=null)=>{const r=e.length;n||(n=Array.from(new Array(r)).map(()=>1));const s=r/n.reduce(function(d,h){return d+h});if(n.forEach((d,h)=>{n[h]*=s}),e=e.map(d=>new l(d)),t==="lrgb")return Mn(e,n);const c=e.shift(),o=c.get(t),f=[];let a=0,i=0;for(let d=0;d<o.length;d++)if(o[d]=(o[d]||0)*n[0],f.push(isNaN(o[d])?0:n[0]),t.charAt(d)==="h"&&!isNaN(o[d])){const h=o[d]/180*ve;a+=Se(h)*n[0],i+=ze(h)*n[0]}let b=c.alpha()*n[0];e.forEach((d,h)=>{const $=d.get(t);b+=d.alpha()*n[h+1];for(let T=0;T<o.length;T++)if(!isNaN($[T]))if(f[T]+=n[h+1],t.charAt(T)==="h"){const A=$[T]/180*ve;a+=Se(A)*n[h+1],i+=ze(A)*n[h+1]}else o[T]+=$[T]*n[h+1]});for(let d=0;d<o.length;d++)if(t.charAt(d)==="h"){let h=Tn(i/f[d],a/f[d])/ve*180;for(;h<0;)h+=360;for(;h>=360;)h-=360;o[d]=h}else o[d]=o[d]/f[d];return b/=r,new l(o,t).alpha(b>.99999?1:b,!0)},Mn=(e,t)=>{const n=e.length,r=[0,0,0,0];for(let s=0;s<e.length;s++){const c=e[s],o=t[s]/n,f=c._rgb;r[0]+=Ce(f[0],2)*o,r[1]+=Ce(f[1],2)*o,r[2]+=Ce(f[2],2)*o,r[3]+=f[3]*o}return r[0]=Ne(r[0]),r[1]=Ne(r[1]),r[2]=Ne(r[2]),r[3]>.9999999&&(r[3]=1),new l(Te(r))},{pow:jn}=Math;function fe(e){let t="rgb",n=y("#ccc"),r=0,s=[0,1],c=[],o=[0,0],f=!1,a=[],i=!1,b=0,d=1,h=!1,$={},T=!0,A=1;const _=function(u){if(u=u||["#fff","#000"],u&&x(u)==="string"&&y.brewer&&y.brewer[u.toLowerCase()]&&(u=y.brewer[u.toLowerCase()]),x(u)==="array"){u.length===1&&(u=[u[0],u[0]]),u=u.slice(0);for(let g=0;g<u.length;g++)u[g]=y(u[g]);c.length=0;for(let g=0;g<u.length;g++)c.push(g/(u.length-1))}return B(),a=u},w=function(u){if(f!=null){const g=f.length-1;let k=0;for(;k<g&&u>=f[k];)k++;return k-1}return 0};let I=u=>u,G=u=>u;const R=function(u,g){let k,p;if(g==null&&(g=!1),isNaN(u)||u===null)return n;g?p=u:f&&f.length>2?p=w(u)/(f.length-2):d!==b?p=(u-b)/(d-b):p=1,p=G(p),g||(p=I(p)),A!==1&&(p=jn(p,A)),p=o[0]+p*(1-o[0]-o[1]),p=Z(p,0,1);const E=Math.floor(p*1e4);if(T&&$[E])k=$[E];else{if(x(a)==="array")for(let N=0;N<c.length;N++){const M=c[N];if(p<=M){k=a[N];break}if(p>=M&&N===c.length-1){k=a[N];break}if(p>M&&p<c[N+1]){p=(p-M)/(c[N+1]-M),k=y.interpolate(a[N],a[N+1],p,t);break}}else x(a)==="function"&&(k=a(p));T&&($[E]=k)}return k};var B=()=>$={};_(e);const v=function(u){const g=y(R(u));return i&&g[i]?g[i]():g};return v.classes=function(u){if(u!=null){if(x(u)==="array")f=u,s=[u[0],u[u.length-1]];else{const g=y.analyze(s);u===0?f=[g.min,g.max]:f=y.limits(g,"e",u)}return v}return f},v.domain=function(u){if(!arguments.length)return s;b=u[0],d=u[u.length-1],c=[];const g=a.length;if(u.length===g&&b!==d)for(let k of Array.from(u))c.push((k-b)/(d-b));else{for(let k=0;k<g;k++)c.push(k/(g-1));if(u.length>2){const k=u.map((E,N)=>N/(u.length-1)),p=u.map(E=>(E-b)/(d-b));p.every((E,N)=>k[N]===E)||(G=E=>{if(E<=0||E>=1)return E;let N=0;for(;E>=p[N+1];)N++;const M=(E-p[N])/(p[N+1]-p[N]);return k[N]+M*(k[N+1]-k[N])})}}return s=[b,d],v},v.mode=function(u){return arguments.length?(t=u,B(),v):t},v.range=function(u,g){return _(u),v},v.out=function(u){return i=u,v},v.spread=function(u){return arguments.length?(r=u,v):r},v.correctLightness=function(u){return u==null&&(u=!0),h=u,B(),h?I=function(g){const k=R(0,!0).lab()[0],p=R(1,!0).lab()[0],E=k>p;let N=R(g,!0).lab()[0];const M=k+(p-k)*g;let H=N-M,W=0,ee=1,te=20;for(;Math.abs(H)>.01&&te-- >0;)(function(){return E&&(H*=-1),H<0?(W=g,g+=(ee-g)*.5):(ee=g,g+=(W-g)*.5),N=R(g,!0).lab()[0],H=N-M})();return g}:I=g=>g,v},v.padding=function(u){return u!=null?(x(u)==="number"&&(u=[u,u]),o=u,v):o},v.colors=function(u,g){arguments.length<2&&(g="hex");let k=[];if(arguments.length===0)k=a.slice(0);else if(u===1)k=[v(.5)];else if(u>1){const p=s[0],E=s[1]-p;k=Pn(0,u,!1).map(N=>v(p+N/(u-1)*E))}else{e=[];let p=[];if(f&&f.length>2)for(let E=1,N=f.length,M=1<=N;M?E<N:E>N;M?E++:E--)p.push((f[E-1]+f[E])*.5);else p=s;k=p.map(E=>v(E))}return y[g]&&(k=k.map(p=>p[g]())),k},v.cache=function(u){return u!=null?(T=u,v):T},v.gamma=function(u){return u!=null?(A=u,v):A},v.nodata=function(u){return u!=null?(n=y(u),v):n},v}function Pn(e,t,n){let r=[],s=e<t,c=n?s?t+1:t-1:t;for(let o=e;s?o<c:o>c;s?o++:o--)r.push(o);return r}const On=function(e){let t=[1,1];for(let n=1;n<e;n++){let r=[1];for(let s=1;s<=t.length;s++)r[s]=(t[s]||0)+t[s-1];t=r}return t},Rn=function(e){let t,n,r,s;if(e=e.map(c=>new l(c)),e.length===2)[n,r]=e.map(c=>c.lab()),t=function(c){const o=[0,1,2].map(f=>n[f]+c*(r[f]-n[f]));return new l(o,"lab")};else if(e.length===3)[n,r,s]=e.map(c=>c.lab()),t=function(c){const o=[0,1,2].map(f=>(1-c)*(1-c)*n[f]+2*(1-c)*c*r[f]+c*c*s[f]);return new l(o,"lab")};else if(e.length===4){let c;[n,r,s,c]=e.map(o=>o.lab()),t=function(o){const f=[0,1,2].map(a=>(1-o)*(1-o)*(1-o)*n[a]+3*(1-o)*(1-o)*o*r[a]+3*(1-o)*o*o*s[a]+o*o*o*c[a]);return new l(f,"lab")}}else if(e.length>=5){let c,o,f;c=e.map(a=>a.lab()),f=e.length-1,o=On(f),t=function(a){const i=1-a,b=[0,1,2].map(d=>c.reduce((h,$,T)=>h+o[T]*i**(f-T)*a**T*$[d],0));return new l(b,"lab")}}else throw new RangeError("No point in running bezier with only one color.");return t},Bn=e=>{const t=Rn(e);return t.scale=()=>fe(t),t},S=(e,t,n)=>{if(!S[n])throw new Error("unknown blend mode "+n);return S[n](e,t)},D=e=>(t,n)=>{const r=y(n).rgb(),s=y(t).rgb();return y.rgb(e(r,s))},Y=e=>(t,n)=>{const r=[];return r[0]=e(t[0],n[0]),r[1]=e(t[1],n[1]),r[2]=e(t[2],n[2]),r},Ln=e=>e,Sn=(e,t)=>e*t/255,zn=(e,t)=>e>t?t:e,Fn=(e,t)=>e>t?e:t,qn=(e,t)=>255*(1-(1-e/255)*(1-t/255)),In=(e,t)=>t<128?2*e*t/255:255*(1-2*(1-e/255)*(1-t/255)),Gn=(e,t)=>255*(1-(1-t/255)/(e/255)),Dn=(e,t)=>e===255?255:(e=255*(t/255)/(1-e/255),e>255?255:e);S.normal=D(Y(Ln));S.multiply=D(Y(Sn));S.screen=D(Y(qn));S.overlay=D(Y(In));S.darken=D(Y(zn));S.lighten=D(Y(Fn));S.dodge=D(Y(Dn));S.burn=D(Y(Gn));const{pow:Yn,sin:Hn,cos:Xn}=Math;function Vn(e=300,t=-1.5,n=1,r=1,s=[0,1]){let c=0,o;x(s)==="array"?o=s[1]-s[0]:(o=0,s=[s,s]);const f=function(a){const i=F*((e+120)/360+t*a),b=Yn(s[0]+o*a,r),h=(c!==0?n[0]+a*c:n)*b*(1-b)/2,$=Xn(i),T=Hn(i),A=b+h*(-.14861*$+1.78277*T),_=b+h*(-.29227*$-.90649*T),w=b+h*(1.97294*$);return y(Te([A*255,_*255,w*255,1]))};return f.start=function(a){return a==null?e:(e=a,f)},f.rotations=function(a){return a==null?t:(t=a,f)},f.gamma=function(a){return a==null?r:(r=a,f)},f.hue=function(a){return a==null?n:(n=a,x(n)==="array"?(c=n[1]-n[0],c===0&&(n=n[1])):c=0,f)},f.lightness=function(a){return a==null?s:(x(a)==="array"?(s=a,o=a[1]-a[0]):(s=[a,a],o=0),f)},f.scale=()=>y.scale(f),f.hue(n),f}const Un="0123456789abcdef",{floor:Zn,random:Jn}=Math,Kn=()=>{let e="#";for(let t=0;t<6;t++)e+=Un.charAt(Zn(Jn()*16));return new l(e,"hex")},{log:Fe,pow:Wn,floor:Qn,abs:e0}=Math;function ht(e,t=null){const n={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0};return x(e)==="object"&&(e=Object.values(e)),e.forEach(r=>{t&&x(r)==="object"&&(r=r[t]),r!=null&&!isNaN(r)&&(n.values.push(r),n.sum+=r,r<n.min&&(n.min=r),r>n.max&&(n.max=r),n.count+=1)}),n.domain=[n.min,n.max],n.limits=(r,s)=>gt(n,r,s),n}function gt(e,t="equal",n=7){x(e)=="array"&&(e=ht(e));const{min:r,max:s}=e,c=e.values.sort((f,a)=>f-a);if(n===1)return[r,s];const o=[];if(t.substr(0,1)==="c"&&(o.push(r),o.push(s)),t.substr(0,1)==="e"){o.push(r);for(let f=1;f<n;f++)o.push(r+f/n*(s-r));o.push(s)}else if(t.substr(0,1)==="l"){if(r<=0)throw new Error("Logarithmic scales are only possible for values > 0");const f=Math.LOG10E*Fe(r),a=Math.LOG10E*Fe(s);o.push(r);for(let i=1;i<n;i++)o.push(Wn(10,f+i/n*(a-f)));o.push(s)}else if(t.substr(0,1)==="q"){o.push(r);for(let f=1;f<n;f++){const a=(c.length-1)*f/n,i=Qn(a);if(i===a)o.push(c[i]);else{const b=a-i;o.push(c[i]*(1-b)+c[i+1]*b)}}o.push(s)}else if(t.substr(0,1)==="k"){let f;const a=c.length,i=new Array(a),b=new Array(n);let d=!0,h=0,$=null;$=[],$.push(r);for(let _=1;_<n;_++)$.push(r+_/n*(s-r));for($.push(s);d;){for(let w=0;w<n;w++)b[w]=0;for(let w=0;w<a;w++){const I=c[w];let G=Number.MAX_VALUE,R;for(let B=0;B<n;B++){const v=e0($[B]-I);v<G&&(G=v,R=B),b[R]++,i[w]=R}}const _=new Array(n);for(let w=0;w<n;w++)_[w]=null;for(let w=0;w<a;w++)f=i[w],_[f]===null?_[f]=c[w]:_[f]+=c[w];for(let w=0;w<n;w++)_[w]*=1/b[w];d=!1;for(let w=0;w<n;w++)if(_[w]!==$[w]){d=!0;break}$=_,h++,h>200&&(d=!1)}const T={};for(let _=0;_<n;_++)T[_]=[];for(let _=0;_<a;_++)f=i[_],T[f].push(c[_]);let A=[];for(let _=0;_<n;_++)A.push(T[_][0]),A.push(T[_][T[_].length-1]);A=A.sort((_,w)=>_-w),o.push(A[0]);for(let _=1;_<A.length;_+=2){const w=A[_];!isNaN(w)&&o.indexOf(w)===-1&&o.push(w)}}return o}const t0=(e,t)=>{e=new l(e),t=new l(t);const n=e.luminance(),r=t.luminance();return n>r?(n+.05)/(r+.05):(r+.05)/(n+.05)},{sqrt:z,pow:j,min:n0,max:r0,atan2:qe,abs:Ie,cos:se,sin:Ge,exp:s0,PI:De}=Math;function c0(e,t,n=1,r=1,s=1){var c=function(le){return 360*le/(2*De)},o=function(le){return 2*De*le/360};e=new l(e),t=new l(t);const[f,a,i]=Array.from(e.lab()),[b,d,h]=Array.from(t.lab()),$=(f+b)/2,T=z(j(a,2)+j(i,2)),A=z(j(d,2)+j(h,2)),_=(T+A)/2,w=.5*(1-z(j(_,7)/(j(_,7)+j(25,7)))),I=a*(1+w),G=d*(1+w),R=z(j(I,2)+j(i,2)),B=z(j(G,2)+j(h,2)),v=(R+B)/2,u=c(qe(i,I)),g=c(qe(h,G)),k=u>=0?u:u+360,p=g>=0?g:g+360,E=Ie(k-p)>180?(k+p+360)/2:(k+p)/2,N=1-.17*se(o(E-30))+.24*se(o(2*E))+.32*se(o(3*E+6))-.2*se(o(4*E-63));let M=p-k;M=Ie(M)<=180?M:p<=k?M+360:M-360,M=2*z(R*B)*Ge(o(M)/2);const H=b-f,W=B-R,ee=1+.015*j($-50,2)/z(20+j($-50,2)),te=1+.045*v,Re=1+.015*v*N,Nt=30*s0(-j((E-275)/25,2)),vt=-(2*z(j(v,7)/(j(v,7)+j(25,7))))*Ge(2*o(Nt)),Et=z(j(H/(n*ee),2)+j(W/(r*te),2)+j(M/(s*Re),2)+vt*(W/(r*te))*(M/(s*Re)));return r0(0,n0(100,Et))}function o0(e,t,n="lab"){e=new l(e),t=new l(t);const r=e.get(n),s=t.get(n);let c=0;for(let o in r){const f=(r[o]||0)-(s[o]||0);c+=f*f}return Math.sqrt(c)}const f0=(...e)=>{try{return new l(...e),!0}catch{return!1}},a0={cool(){return fe([y.hsl(180,1,.9),y.hsl(250,.7,.4)])},hot(){return fe(["#000","#f00","#ff0","#fff"]).mode("rgb")}},oe={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]};for(let e of Object.keys(oe))oe[e.toLowerCase()]=oe[e];Object.assign(y,{average:An,bezier:Bn,blend:S,cubehelix:Vn,mix:Q,interpolate:Q,random:Kn,scale:fe,analyze:ht,contrast:t0,deltaE:c0,distance:o0,limits:gt,valid:f0,scales:a0,input:m,colors:J,brewer:oe});const pt=[50,100,200,250,300,400,450,500,550,575,600,700,800,900],u0=[.96,.907,.805,.75,.697,.605,.567,.576,.529,.526,.523,.41,.318,.243],Ye=[.32,.16,.08,.06,.04,.02,0,0,.04,.06,.08,.16,.24,.32],He=pt.indexOf(500);function l0(e){let t=e.replace("#","");t.length===3&&(t=t.split("").map(r=>r+r).join(""));const n=parseInt(t,16);return[n>>16&255,n>>8&255,n&255]}function i0(e){const t=e;typeof t.clamp=="function"?e=t.clamp():typeof t.clip=="function"&&(e=t.clip());const[n,r,s]=l0(e.hex());return`${n} ${r} ${s}`}function L(e){const t=y(e);return pt.reduce((n,r,s)=>{let c=t;if(s!==He){c=c.set("hsl.l",u0[s]);const o=Ye[s]-Ye[He];c=o>=0?c.saturate(o):c.desaturate(-o)}return n[r]=i0(c),n},{})}const q={primary:"#2a70fc",secondary:"#6b7280",success:"#56c288",warning:"#ffc555",danger:"#f5144c",info:"#3b82f6"};function Pe(e){const{primary:t=q.primary,secondary:n=q.secondary,success:r=q.success,warning:s=q.warning,danger:c=q.danger,info:o=q.info,green:f=r,yellow:a=s,orange:i="#f97316",red:b=c}=e,d={primary:L(t),secondary:L(n),success:L(r),warning:L(s),danger:L(c),info:L(o)};return f!==r&&(d.green=L(f)),a!==s&&(d.yellow=L(a)),i&&(d.orange=L(i)),b!==c&&(d.red=L(b)),d}function d0(e){const t=[];Object.keys(e).forEach(s=>{const c=e[s];c&&Object.entries(c).forEach(([o,f])=>{t.push(` --cstu-${s}-${o}: ${f};`)})});const n=`:root {
2
+ ${t.join(`
3
+ `)}
4
+ }`;let r=document.getElementById("cstu-theme-vars");r||(r=document.createElement("style"),r.id="cstu-theme-vars",document.head.appendChild(r)),r.textContent=n}function mt(e){return/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(e)}function b0(e){const t=[];return Object.entries(e).forEach(([n,r])=>{r&&!mt(r)&&t.push(`Invalid hex color for ${n}: ${r}`)}),{valid:t.length===0,errors:t}}function yt(e,t){const n={...e};return Object.entries(t).forEach(([r,s])=>{s!==void 0&&(n[r]=s)}),n}function wt(e){return yt(q,e)}function U(e,t){return{name:e,theme:wt(t),metadata:{created:new Date().toISOString(),version:"1.0.0"}}}const Oe={default:U("Default",q),purple:U("Purple",{primary:"#8B5CF6",secondary:"#6B7280",success:"#10B981",warning:"#F59E0B",danger:"#EF4444",info:"#3B82F6"}),emerald:U("Emerald",{primary:"#10B981",secondary:"#6B7280",success:"#059669",warning:"#D97706",danger:"#DC2626",info:"#0891B2"}),rose:U("Rose",{primary:"#F43F5E",secondary:"#6B7280",success:"#10B981",warning:"#F59E0B",danger:"#EF4444",info:"#3B82F6"}),amber:U("Amber",{primary:"#F59E0B",secondary:"#6B7280",success:"#10B981",warning:"#D97706",danger:"#EF4444",info:"#3B82F6"})};function h0(e){return Oe[e]||null}function g0(){return Object.values(Oe)}function p0(e){const t=[],n=[];return Object.entries(e).forEach(([r,s])=>{s&&typeof s=="string"&&(m0(s)||t.push(`Invalid hex color for ${r}: ${s}`))}),e.primary&&e.secondary,{isValid:t.length===0,errors:t,warnings:n}}function m0(e){return/^#([0-9A-F]{3}|[0-9A-F]{4}|[0-9A-F]{6}|[0-9A-F]{8})$/i.test(e)}function kt(e){const t=Pe(e);return{colors:_t(t),safelist:$t(t),plugins:xt()}}function _t(e){const t={};return Object.entries(e).forEach(([n,r])=>{t[n]={},Object.entries(r).forEach(([s,c])=>{t[n][s]=`rgb(${c} / <alpha-value>)`})}),t}function y0(){const e=t=>`rgb(var(${t}) / <alpha-value>)`;return{"cstu-primary":{50:e("--cstu-primary-50"),100:e("--cstu-primary-100"),200:e("--cstu-primary-200"),300:e("--cstu-primary-300"),400:e("--cstu-primary-400"),450:e("--cstu-primary-450"),500:e("--cstu-primary-500"),550:e("--cstu-primary-550"),600:e("--cstu-primary-600"),700:e("--cstu-primary-700"),800:e("--cstu-primary-800"),900:e("--cstu-primary-900")},"cstu-secondary":{50:e("--cstu-secondary-50"),100:e("--cstu-secondary-100"),200:e("--cstu-secondary-200"),250:e("--cstu-secondary-250"),300:e("--cstu-secondary-300"),400:e("--cstu-secondary-400"),500:e("--cstu-secondary-500"),550:e("--cstu-secondary-550"),575:e("--cstu-secondary-575"),600:e("--cstu-secondary-600"),700:e("--cstu-secondary-700"),800:e("--cstu-secondary-800"),900:e("--cstu-secondary-900")},"cstu-success":{50:e("--cstu-success-50"),100:e("--cstu-success-100"),200:e("--cstu-success-200"),250:e("--cstu-success-250"),300:e("--cstu-success-300"),400:e("--cstu-success-400"),450:e("--cstu-success-450"),500:e("--cstu-success-500"),550:e("--cstu-success-550"),575:e("--cstu-success-575"),600:e("--cstu-success-600"),700:e("--cstu-success-700"),800:e("--cstu-success-800"),900:e("--cstu-success-900")},"cstu-warning":{50:e("--cstu-warning-50"),100:e("--cstu-warning-100"),200:e("--cstu-warning-200"),250:e("--cstu-warning-250"),300:e("--cstu-warning-300"),400:e("--cstu-warning-400"),450:e("--cstu-warning-450"),500:e("--cstu-warning-500"),550:e("--cstu-warning-550"),575:e("--cstu-warning-575"),600:e("--cstu-warning-600"),700:e("--cstu-warning-700"),800:e("--cstu-warning-800"),900:e("--cstu-warning-900")},"cstu-danger":{50:e("--cstu-danger-50"),100:e("--cstu-danger-100"),200:e("--cstu-danger-200"),250:e("--cstu-danger-250"),300:e("--cstu-danger-300"),400:e("--cstu-danger-400"),450:e("--cstu-danger-450"),500:e("--cstu-danger-500"),550:e("--cstu-danger-550"),575:e("--cstu-danger-575"),600:e("--cstu-danger-600"),700:e("--cstu-danger-700"),800:e("--cstu-danger-800"),900:e("--cstu-danger-900")},"cstu-info":{50:e("--cstu-info-50"),100:e("--cstu-info-100"),200:e("--cstu-info-200"),250:e("--cstu-info-250"),300:e("--cstu-info-300"),400:e("--cstu-info-400"),450:e("--cstu-info-450"),500:e("--cstu-info-500"),550:e("--cstu-info-550"),575:e("--cstu-info-575"),600:e("--cstu-info-600"),700:e("--cstu-info-700"),800:e("--cstu-info-800"),900:e("--cstu-info-900")},"cstu-blue":{50:e("--cstu-blue-50"),100:e("--cstu-blue-100"),200:e("--cstu-blue-200"),300:e("--cstu-blue-300"),400:e("--cstu-blue-400"),450:e("--cstu-blue-450"),500:e("--cstu-blue-500"),550:e("--cstu-blue-550"),600:e("--cstu-blue-600"),700:e("--cstu-blue-700"),800:e("--cstu-blue-800"),900:e("--cstu-blue-900")},"cstu-gray":{50:e("--cstu-gray-50"),100:e("--cstu-gray-100"),200:e("--cstu-gray-200"),250:e("--cstu-gray-250"),300:e("--cstu-gray-300"),400:e("--cstu-gray-400"),500:e("--cstu-gray-500"),550:e("--cstu-gray-550"),575:e("--cstu-gray-575"),600:e("--cstu-gray-600"),700:e("--cstu-gray-700"),800:e("--cstu-gray-800"),900:e("--cstu-gray-900")},"cstu-sea-blue":{50:e("--cstu-sea-blue-50"),100:e("--cstu-sea-blue-100"),200:e("--cstu-sea-blue-200"),300:e("--cstu-sea-blue-300"),400:e("--cstu-sea-blue-400"),500:e("--cstu-sea-blue-500"),600:e("--cstu-sea-blue-600"),700:e("--cstu-sea-blue-700"),800:e("--cstu-sea-blue-800"),900:e("--cstu-sea-blue-900")},"cstu-purple":{50:e("--cstu-purple-50"),100:e("--cstu-purple-100"),200:e("--cstu-purple-200"),300:e("--cstu-purple-300"),400:e("--cstu-purple-400"),500:e("--cstu-purple-500"),600:e("--cstu-purple-600"),700:e("--cstu-purple-700"),800:e("--cstu-purple-800"),900:e("--cstu-purple-900")},"cstu-green":{50:e("--cstu-green-50"),100:e("--cstu-green-100"),200:e("--cstu-green-200"),300:e("--cstu-green-300"),400:e("--cstu-green-400"),500:e("--cstu-green-500"),600:e("--cstu-green-600"),700:e("--cstu-green-700"),800:e("--cstu-green-800"),900:e("--cstu-green-900")},"cstu-yellow":{50:e("--cstu-yellow-50"),100:e("--cstu-yellow-100"),200:e("--cstu-yellow-200"),300:e("--cstu-yellow-300"),400:e("--cstu-yellow-400"),500:e("--cstu-yellow-500"),600:e("--cstu-yellow-600"),700:e("--cstu-yellow-700"),800:e("--cstu-yellow-800"),900:e("--cstu-yellow-900")},"cstu-orange":{50:e("--cstu-orange-50"),100:e("--cstu-orange-100"),200:e("--cstu-orange-200"),300:e("--cstu-orange-300"),400:e("--cstu-orange-400"),500:e("--cstu-orange-500"),600:e("--cstu-orange-600"),700:e("--cstu-orange-700"),800:e("--cstu-orange-800"),900:e("--cstu-orange-900")},"cstu-red":{50:e("--cstu-red-50"),100:e("--cstu-red-100"),200:e("--cstu-red-200"),300:e("--cstu-red-300"),400:e("--cstu-red-400"),500:e("--cstu-red-500"),600:e("--cstu-red-600"),700:e("--cstu-red-700"),800:e("--cstu-red-800"),900:e("--cstu-red-900")}}}function $t(e){const t=[],n=Object.keys(e),r=n[0],s=Object.keys(e[r]||{}),c=["bg","text","border","ring","shadow","hover:bg","hover:text","hover:border","focus:bg","focus:text","focus:border","focus:ring","dark:bg","dark:text","dark:border"];return n.forEach(o=>{s.forEach(f=>{c.forEach(a=>{t.push(`${a}-${o}-${f}`)})})}),t}function xt(e){return[`
5
+ plugin(function({ addUtilities, theme }) {
6
+ const colors = theme('colors')
7
+ const utilities = {}
8
+
9
+ // Generate cstu- prefixed utilities
10
+ Object.entries(colors).forEach(([colorName, shades]) => {
11
+ if (typeof shades === 'object') {
12
+ Object.entries(shades).forEach(([shade, value]) => {
13
+ utilities[\`.cstu-bg-\${colorName}-\${shade}\`] = {
14
+ backgroundColor: value
15
+ }
16
+ utilities[\`.cstu-text-\${colorName}-\${shade}\`] = {
17
+ color: value
18
+ }
19
+ utilities[\`.cstu-border-\${colorName}-\${shade}\`] = {
20
+ borderColor: value
21
+ }
22
+ })
23
+ }
24
+ })
25
+
26
+ addUtilities(utilities)
27
+ })
28
+ `]}function Ct(e,t={}){const n=kt(e);return{content:t.content||["./src/**/*.{js,ts,jsx,tsx,vue}"],darkMode:t.darkMode||"class",theme:{extend:{colors:n.colors,...t.extendTheme||{}}},plugins:[...t.plugins||[]],safelist:n.safelist}}function w0(e,t={}){const n=Ct(e,t);return`const withOpacity = (hex) => \`rgb(var(\${hex}) / <alpha-value>)\`
29
+
30
+ /** @type {import('tailwindcss').Config} */
31
+ module.exports = ${JSON.stringify(n,null,2)}
32
+ `}function k0(e){const t=Pe(e);let n=`:root {
33
+ `;return Object.entries(t).forEach(([r,s])=>{Object.entries(s).forEach(([c,o])=>{n+=` --cstu-${r}-${c}: ${o};
34
+ `})}),n+=`}
35
+ `,n+=`
36
+ .dark {
37
+ `,n+=`}
38
+ `,n}function _0(e){return`import { ThemeProvider } from '@your-org/design-system'
39
+ import { useTheme } from '@your-org/design-system'
40
+
41
+ // Your custom theme
42
+ const customTheme = ${JSON.stringify(e,null,2)}
43
+
44
+ // In your main app file
45
+ export default function App() {
46
+ return (
47
+ <ThemeProvider initialTheme={customTheme}>
48
+ <YourApp />
49
+ </ThemeProvider>
50
+ )
51
+ }
52
+
53
+ // In your components
54
+ export function MyComponent() {
55
+ const { theme, setColors } = useTheme()
56
+
57
+ // Access theme colors
58
+ const primaryColor = theme.value.primary
59
+
60
+ return (
61
+ <div className="bg-primary-500 text-white">
62
+ Your content here
63
+ </div>
64
+ )
65
+ }
66
+ `}exports.applyTheme=d0;exports.chroma=y;exports.createThemePreset=U;exports.defaultTheme=q;exports.exportTailwindConfig=w0;exports.extendTheme=wt;exports.generateCSSCustomProperties=k0;exports.generateCstuColorConfig=y0;exports.generateFullTailwindConfig=Ct;exports.generateIntegrationCode=_0;exports.generatePalette=Pe;exports.generatePlugins=xt;exports.generateSafelist=$t;exports.generateShades=L;exports.generateTailwindColors=_t;exports.generateTailwindConfig=kt;exports.getThemePreset=h0;exports.getThemePresets=g0;exports.isValidHexColor=mt;exports.mergeThemes=yt;exports.themePresets=Oe;exports.validateTheme=p0;exports.validateThemeOptions=b0;