From c43915dc5e16f8c09aba0ccb387567cd394e46f5 Mon Sep 17 00:00:00 2001 From: Kartavya Patel <82671701+patelka2211@users.noreply.github.com> Date: Thu, 29 Jun 2023 15:03:09 +0530 Subject: [PATCH] v1.1.2 - ready to publish --- DynamicColors.js | 4 ++-- README.md | 8 ++++---- package-lock.json | 4 ++-- package.json | 2 +- src/dynamicColors.ts | 4 ++-- src/getColor.ts | 19 ++++++------------- src/helper/mdc.js | 3 +-- 7 files changed, 18 insertions(+), 26 deletions(-) diff --git a/DynamicColors.js b/DynamicColors.js index 369f1fe..35cae30 100644 --- a/DynamicColors.js +++ b/DynamicColors.js @@ -1,7 +1,7 @@ /** * **Dynamic Colors** from KPVERSE * - * Updated on June 28, 2023. + * Updated on June 29, 2023. * * Copyright © 2023-present, Kartavya Patel. All rights reserved. * @@ -9,4 +9,4 @@ * * @license {@link https://github.com/patelka2211/dynamic-colors/blob/main/LICENSE MIT} */ -!function(){"use strict";var n=[];function e(e){var t=n.includes(e);return t&&console.warn("Warning: The 'DynamicColors instance' named '".concat(e.replace("-dc",""),"' is protected and cannot be removed.")),t}var t,r,o=[];function i(n){var t;return(void 0===n.dcID||!e(n.dcID))&&(!!o.includes(n)&&(o.splice(o.indexOf(n),1),void 0!==n.dcID&&(null===(t=document.getElementById(n.dcID))||void 0===t||t.remove()),!0))}function a(n){r!==n&&(r=n,o.forEach((function(n){var e=n.dcColor;null!==e&&n.setColor(e)})))}function l(n){a(n.matches?"dark":"light")}var u=null;function c(n){t=n,a(n),null==u||u.removeEventListener("change",l),u=null}function s(){return"light"!==t&&c("light"),"light"}function d(){return"dark"!==t&&c("dark"),"dark"}function h(){if(void 0===window.matchMedia)return s();if("auto"===t&&null!==u)return u.matches?"dark":"light";t="auto";var n=(u=window.matchMedia("(prefers-color-scheme: dark)")).matches?"dark":"light";return a(n),u.addEventListener("change",l),n}function m(n){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},m(n)}function f(){function n(n,e,t){return Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}),n[e]}function e(n,e,t,o){var i=e&&e.prototype instanceof r?e:r,a=Object.create(i.prototype),l=new h(o||[]);return b(a,"_invoke",{value:u(n,t,l)}),a}function t(n,e,t){try{return{type:"normal",arg:n.call(e,t)}}catch(n){return{type:"throw",arg:n}}}function r(){}function o(){}function i(){}function a(e){["next","throw","return"].forEach((function(t){n(e,t,(function(n){return this._invoke(t,n)}))}))}function l(n,e){function r(o,i,a,l){var u=t(n[o],n,i);if("throw"!==u.type){var c=u.arg,s=c.value;return s&&"object"==m(s)&&y.call(s,"__await")?e.resolve(s.__await).then((function(n){r("next",n,a,l)}),(function(n){r("throw",n,a,l)})):e.resolve(s).then((function(n){c.value=n,a(c)}),(function(n){return r("throw",n,a,l)}))}l(u.arg)}var o;b(this,"_invoke",{value:function(n,t){function i(){return new e((function(e,o){r(n,t,e,o)}))}return o=o?o.then(i,i):i()}})}function u(n,e,r){var o="suspendedStart";return function(i,a){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===i)throw a;return{value:void 0,done:!0}}for(r.method=i,r.arg=a;;){var l=r.delegate;if(l){var u=c(l,r);if(u){if(u===k)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===o)throw o="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o="executing";var s=t(n,e,r);if("normal"===s.type){if(o=r.done?"completed":"suspendedYield",s.arg===k)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o="completed",r.method="throw",r.arg=s.arg)}}}function c(n,e){var r=e.method,o=n.iterator[r];if(void 0===o)return e.delegate=null,"throw"===r&&n.iterator.return&&(e.method="return",e.arg=void 0,c(n,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),k;var i=t(o,n.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,k;var a=i.arg;return a?a.done?(e[n.resultName]=a.value,e.next=n.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,k):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,k)}function s(n){var e={tryLoc:n[0]};1 in n&&(e.catchLoc=n[1]),2 in n&&(e.finallyLoc=n[2],e.afterLoc=n[3]),this.tryEntries.push(e)}function d(n){var e=n.completion||{};e.type="normal",delete e.arg,n.completion=e}function h(n){this.tryEntries=[{tryLoc:"root"}],n.forEach(s,this),this.reset(!0)}function f(n){if(n){var e=n[w];if(e)return e.call(n);if("function"==typeof n.next)return n;if(!isNaN(n.length)){var t=-1,r=function e(){for(;++t=0;--r){var o=this.tryEntries[r],i=o.completion;if("root"===o.tryLoc)return e("end");if(o.tryLoc<=this.prev){var a=y.call(o,"catchLoc"),l=y.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--t){var r=this.tryEntries[t];if(r.tryLoc<=this.prev&&y.call(r,"finallyLoc")&&this.prev=0;--e){var t=this.tryEntries[e];if(t.finallyLoc===n)return this.complete(t.completion,t.afterLoc),d(t),k}},catch:function(n){for(var e=this.tryEntries.length-1;e>=0;--e){var t=this.tryEntries[e];if(t.tryLoc===n){var r=t.completion;if("throw"===r.type){var o=r.arg;d(t)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(n,e,t){return this.delegate={iterator:f(n),resultName:e,nextLoc:t},"next"===this.method&&(this.arg=void 0),k}},g}function v(n,e,t,r,o,i,a){try{var l=n[i](a),u=l.value}catch(n){return void t(n)}l.done?e(u):Promise.resolve(u).then(r,o)}function g(n){return function(){var e=this,t=arguments;return new Promise((function(r,o){function i(n){v(l,r,o,i,a,"next",n)}function a(n){v(l,r,o,i,a,"throw",n)}var l=n.apply(e,t);i(void 0)}))}}function p(n,e){return function(n){if(Array.isArray(n))return n}(n)||function(n,e){var t=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null!=t){var r,o,i,a,l=[],u=!0,c=!1;try{if(i=(t=t.call(n)).next,0===e){if(Object(t)!==t)return;u=!1}else for(;!(u=(r=i.call(t)).done)&&(l.push(r.value),l.length!==e);u=!0);}catch(n){c=!0,o=n}finally{try{if(!u&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}(n,e)||k(n,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(n,e){var t="undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(!t){if(Array.isArray(n)||(t=k(n))||e&&n&&"number"==typeof n.length){t&&(n=t);var r=0,o=function(){};return{s:o,n:function(){return r>=n.length?{done:!0}:{done:!1,value:n[r++]}},e:function(n){throw n},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){t=t.call(n)},n:function(){var n=t.next();return a=n.done,n},e:function(n){l=!0,i=n},f:function(){try{a||null==t.return||t.return()}finally{if(l)throw i}}}}function b(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&F(n,e)}function F(n,e){return F=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,e){return n.__proto__=e,n},F(n,e)}function w(n){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(n){return!1}}();return function(){var t,r=E(n);if(e){var o=E(this).constructor;t=Reflect.construct(r,arguments,o)}else t=r.apply(this,arguments);return function(n,e){if(e&&("object"===m(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(n){if(void 0===n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}(n)}(this,t)}}function E(n){return E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},E(n)}function C(n){return function(n){if(Array.isArray(n))return A(n)}(n)||function(n){if("undefined"!=typeof Symbol&&null!=n[Symbol.iterator]||null!=n["@@iterator"])return Array.from(n)}(n)||k(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function k(n,e){if(n){if("string"==typeof n)return A(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);return"Object"===t&&n.constructor&&(t=n.constructor.name),"Map"===t||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?A(n,e):void 0}}function A(n,e){(null==e||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t216/24389,o=[(r?e*e*e:(116*e-16)/t)*en[0],(8=n?12.92*n:1.055*Math.pow(n,1/2.4)-.055},U=function(n){return(-16777216|(255&n[0])<<16|(255&n[1])<<8|255&n[2])>>>0},H=function(n,e,t){return n/=100,e/=100,t/=100,U([Math.round(W(255,255*_(3.2406*n+-1.5372*e+-.4986*t))),Math.round(W(255,255*_(-.9689*n+1.8758*e+.0415*t))),Math.round(W(255,255*_(.0557*n+-.204*e+1.057*t)))])},q=function(n,e,t){var r=t*Math.PI/180,o=1/.0228*Math.log(1+.0228*e*tn.fLRoot);return new Q(t,e,n,4/tn.c*Math.sqrt(n/100)*(tn.aw+4)*tn.fLRoot,50*Math.sqrt(e/Math.sqrt(n/100)*tn.c/(tn.aw+4)),(1+100*.007)*n/(1+.007*n),o*Math.cos(r),o*Math.sin(r))},$=function(n){var e=Math.pow((0===n.chroma||0===n.j?0:n.chroma/Math.sqrt(n.j/100))/Math.pow(1.64-Math.pow(.29,tn.n),.73),1/.9),t=n.hue*Math.PI/180,r=tn.aw*Math.pow(n.j/100,1/tn.c/tn.z)/tn.nbb,o=Math.sin(t),i=Math.cos(t),a=23*(r+.305)*e/(5e4/13*(Math.cos(t+2)+3.8)*5.75*tn.nc*tn.ncb+11*e*i+108*e*o),l=a*i,u=a*o,c=(460*r+451*l+288*u)/1403,s=(460*r-891*l-261*u)/1403,d=(460*r-220*l-6300*u)/1403,h=100/tn.fl*Z(c)*Math.pow(Math.max(0,27.13*Math.abs(c)/(400-Math.abs(c))),1/.42)/tn.rgbD[0],m=100/tn.fl*Z(s)*Math.pow(Math.max(0,27.13*Math.abs(s)/(400-Math.abs(s))),1/.42)/tn.rgbD[1],f=100/tn.fl*Z(d)*Math.pow(Math.max(0,27.13*Math.abs(d)/(400-Math.abs(d))),1/.42)/tn.rgbD[2];return H(1.86206786*h-1.01125463*m+.14918677*f,.38752654*h+.62144744*m-.00897398*f,-.0158415*h-.03412294*m+1.04996444*f)},W=function(n,e){return Math.min(Math.max(e,0),n)},z=function(n){return 0>n?n%360+360:360<=n?n%360:n},Y=function(n,e,t){if(1>e||0>=Math.round(t)||100<=Math.round(t))return j(t);n=z(n);for(var r=e,o=e,i=0,a=!0,l=null;.4<=Math.abs(i-r);){for(var u=n,c=o,s=t,d=0,h=100,m=void 0,f=1e3,v=1e3,g=null;.01b){var F=on(p),w=F.distance(q(F.j,F.chroma,u));1>=w&&w<=v&&(f=b,v=w,g=F)}if(0===f&&0===v)break;y>16)/255)+71.52*rn(((65280&n)>>8)/255)+7.22*rn((255&n)/255);return(e/=100)<=216/24389?24389/27*e:116*Math.pow(e,1/3)-16},K=function(){function n(e,t,r){x(this,n),this.internalHue=e,this.internalChroma=t,this.internalTone=r,X(this,this.toInt())}return M(n,[{key:"toInt",value:function(){return Y(z(this.internalHue),this.internalChroma,W(100,this.internalTone))}},{key:"hue",get:function(){return this.internalHue},set:function(n){X(this,Y(z(z(n)),this.internalChroma,W(100,this.internalTone)))}},{key:"chroma",get:function(){return this.internalChroma},set:function(n){X(this,Y(z(this.internalHue),n,W(100,this.internalTone)))}},{key:"tone",get:function(){return this.internalTone},set:function(n){X(this,Y(z(this.internalHue),this.internalChroma,W(100,n)))}}]),n}(),Q=function(){function n(e,t,r,o,i,a,l,u){x(this,n),this.hue=e,this.chroma=t,this.j=r,this.q=o,this.s=i,this.jstar=a,this.astar=l,this.bstar=u}return M(n,[{key:"distance",value:function(n){var e=this.jstar-n.jstar,t=this.astar-n.astar,r=this.bstar-n.bstar;return 1.41*Math.pow(Math.sqrt(e*e+t*t+r*r),.63)}}]),n}(),Z=function(n){return 0>n?-1:0===n?0:1},nn=M((function n(e,t,r,o,i,a,l,u,c,s){x(this,n),this.n=e,this.aw=t,this.nbb=r,this.ncb=o,this.c=i,this.nc=a,this.rgbD=l,this.fl=u,this.fLRoot=c,this.z=s})),en=[95.047,100,108.883],tn=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:en,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200/Math.PI*100*Math.pow(66/116,3)/100,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:50,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2,o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],i=.401288*n[0]+.650173*n[1]+-.051461*n[2],a=-.250268*n[0]+1.204414*n[1]+.045854*n[2],l=-.002079*n[0]+.048952*n[1]+.953127*n[2],u=.8+r/10;if(.9<=u)var c=10*(u-.9),s=.59*(1-c)+.69*c;else{var d=10*(u-.8);s=.525*(1-d)+.59*d}var h=o?1:u*(1-1/3.6*Math.exp((-e-42)/92)),m=[100/i*(h=1h?0:h)+1-h,100/a*h+1-h,100/l*h+1-h],f=1/(5*e+1),v=f*f*f*f,g=1-v,p=v*e+.1*g*g*Math.cbrt(5*e),y=(8=n?n/12.92:Math.pow((n+.055)/1.055,2.4)},on=function(n){var e=100*rn(((16711680&n)>>16)/255),t=100*rn(((65280&n)>>8)/255),r=100*rn((255&n)/255),o=.41233895*e+.35762064*t+.18051042*r,i=.2126*e+.7152*t+.0722*r,a=.01932141*e+.11916382*t+.95034478*r,l=tn.rgbD[0]*(.401288*o+.650173*i-.051461*a),u=tn.rgbD[1]*(-.250268*o+1.204414*i+.045854*a),c=tn.rgbD[2]*(-.002079*o+.048952*i+.953127*a),s=Math.pow(tn.fl*Math.abs(l)/100,.42),d=Math.pow(tn.fl*Math.abs(u)/100,.42),h=Math.pow(tn.fl*Math.abs(c)/100,.42),m=400*Z(l)*s/(s+27.13),f=400*Z(u)*d/(d+27.13),v=400*Z(c)*h/(h+27.13),g=(11*m+-12*f+v)/11,p=(m+f-2*v)/9,y=180*Math.atan2(p,g)/Math.PI,b=0>y?y+360:360<=y?y-360:y,F=b*Math.PI/180,w=100*Math.pow((40*m+20*f+v)/20*tn.nbb/tn.aw,tn.c*tn.z),E=Math.pow(5e4/13*.25*(Math.cos((20.14>b?b+360:b)*Math.PI/180+2)+3.8)*tn.nc*tn.ncb*Math.sqrt(g*g+p*p)/((20*m+20*f+21*v)/20+.305),.9)*Math.pow(1.64-Math.pow(.29,tn.n),.73),C=E*Math.sqrt(w/100),k=1/.0228*Math.log(1+.0228*C*tn.fLRoot);return new Q(b,C,w,4/tn.c*Math.sqrt(w/100)*(tn.aw+4)*tn.fLRoot,50*Math.sqrt(E*tn.c/(tn.aw+4)),(1+100*.007)*w/(1+.007*w),k*Math.cos(F),k*Math.sin(F))},an=M((function n(e){x(this,n);var t=function(n){var e=on(n);return new K(e.hue,e.chroma,J(n))}(e),r=t.hue;this.a1=new R(r,Math.max(48,t.chroma)),this.a2=new R(r,16),this.a3=new R(r+60,24),this.n1=new R(r,4),this.n2=new R(r,8),this.error=new R(25,84)})),ln=function(){function n(){x(this,n)}return M(n,[{key:"internal",get:function(){return!1}},{key:"is3p",get:function(){return!this.internal}},{key:"is1p",get:function(){return this.internal}},{key:"enableDsp",get:function(){return!this.is1p}},{key:"enableAndroid",get:function(){return this.is1p}},{key:"enableWebExport",get:function(){return this.is3p}},{key:"enableExtendedColors",get:function(){return!0}},{key:"enableColorShift",get:function(){return this.is1p}}]),n}(),un=new ln;un.enableDsp,un.enableAndroid,un.enableWebExport,un.enableColorShift;var cn,sn=function(n){var e=un.is3p,t=new an(function(n){var e=3===(n=n.replace("#","")).length,t=6===n.length,r=8===n.length;if(!e&&!t&&!r)throw Error("unexpected hex "+n);var o=0,i=0,a=0;return e?(o=parseInt(n.slice(0,1).repeat(2),16),i=parseInt(n.slice(1,2).repeat(2),16),a=parseInt(n.slice(2,3).repeat(2),16)):t?(o=parseInt(n.slice(0,2),16),i=parseInt(n.slice(2,4),16),a=parseInt(n.slice(4,6),16)):r&&(o=parseInt(n.slice(2,4),16),i=parseInt(n.slice(4,6),16),a=parseInt(n.slice(6,8),16)),(-16777216|(255&o)<<16|(255&i)<<8|255&a)>>>0}(n));return new G({tones:t,seed:n,is3p:e,overrides:{},blend:!1,isBaseline:!1})},dn=function(n){var e,t=(65280&n)>>8,r=255&n,o=[((16711680&n)>>16).toString(16),t.toString(16),r.toString(16)],i=y(o.entries());try{for(i.s();!(e=i.n()).done;){var a=p(e.value,2),l=a[0],u=a[1],c=l,s=u;1===s.length&&(o[c]="0"+s)}}catch(n){i.e(n)}finally{i.f()}return"#"+o.join("")},hn=function(n){var e,t=0,r=y(n.values());try{for(r.s();!(e=r.n()).done;){t+=e.value}}catch(n){r.e(n)}finally{r.f()}var o,i=new Map,a=new Map,l=Array(360).fill(0),u=y(n.entries());try{for(u.s();!(o=u.n()).done;){var c=p(o.value,2),s=c[0],d=c[1],h=s,m=d/t;i.set(h,m);var f=on(h);a.set(h,f),l[Math.round(f.hue)]+=m}}catch(n){u.e(n)}finally{u.f()}var v,g=new Map,b=y(a.entries());try{for(b.s();!(v=b.n()).done;){for(var F=p(v.value,2),w=F[0],E=F[1],C=w,k=Math.round(E.hue),A=0,x=k-15;xO.chroma?.1:.3))}}catch(n){B.e(n)}finally{B.f()}var I,j=function(n,e){var t,r=[],o=y(e.entries());try{for(o.s();!(t=o.n()).done;){var i=p(t.value,2),a=i[0],l=i[1],u=a,c=l,s=n.get(u);15<=c.chroma&&10<=J(u)&&.01<=s&&r.push(u)}}catch(n){o.e(n)}finally{o.f()}return r}(g,a),L=new Map,G=y(j);try{for(G.s();!(I=G.n()).done;){var R,_=I.value,U=!1,H=a.get(_).hue,q=y(L);try{for(q.s();!(R=q.n()).done;){var $=p(R.value,1)[0],W=a.get($).hue;if(15>180-Math.abs(Math.abs(H-W)-180)){U=!0;break}}}catch(n){q.e(n)}finally{q.f()}U||L.set(_,M.get(_))}}catch(n){G.e(n)}finally{G.f()}var Y=Array.from(L.entries());Y.sort((function(n,e){return e[1]-n[1]}));var X=Y.map((function(n){return n[0]}));return 0===X.length&&X.push(4282549748),X},mn=M((function n(){x(this,n),this.index=this.distance=-1})),fn=function(n){var e,t=216/24389,r=24389/27,o=100*rn(((16711680&n)>>16)/255),i=100*rn(((65280&n)>>8)/255),a=100*rn((255&n)/255),l=(.2126*o+.7152*i+.0722*a)/en[1];e=l>t?Math.pow(l,1/3):(r*l+16)/116;var u=(.41233895*o+.35762064*i+.18051042*a)/en[0],c=(.01932141*o+.11916382*i+.95034478*a)/en[2];return[116*e-16,500*((u>t?Math.pow(u,1/3):(r*u+16)/116)-e),200*(e-(c>t?Math.pow(c,1/3):(r*c+16)/116))]},vn=function(){function n(){x(this,n)}return M(n,[{key:"toInt",value:function(n){var e=n[0],t=216/24389,r=24389/27,o=(e+16)/116,i=n[1]/500+o,a=o-n[2]/200,l=i*i*i,u=a*a*a,c=[(l>t?l:(116*i-16)/r)*en[0],(8t?u:(116*a-16)/r)*en[2]];return H(c[0],c[1],c[2])}},{key:"distance",value:function(n,e){var t=n[0]-e[0],r=n[1]-e[1],o=n[2]-e[2];return t*t+r*r+o*o}}]),n}(),gn=M((function n(e){x(this,n),this.resultCount=e})),pn=function(n,e){var t=n.volume(e,n.momentsR),r=n.volume(e,n.momentsG),o=n.volume(e,n.momentsB);return n.moments[Cn(e.r1,e.g1,e.b1)]-n.moments[Cn(e.r1,e.g1,e.b0)]-n.moments[Cn(e.r1,e.g0,e.b1)]+n.moments[Cn(e.r1,e.g0,e.b0)]-n.moments[Cn(e.r0,e.g1,e.b1)]+n.moments[Cn(e.r0,e.g1,e.b0)]+n.moments[Cn(e.r0,e.g0,e.b1)]-n.moments[Cn(e.r0,e.g0,e.b0)]-(t*t+r*r+o*o)/n.volume(e,n.weights)},yn=M((function n(e,t){x(this,n),this.cutLocation=e,this.maximum=t})),bn=function(n,e,t,r,o,i,a,l,u){for(var c,s,d,h,m=n.bottom(e,t,n.momentsR),f=n.bottom(e,t,n.momentsG),v=n.bottom(e,t,n.momentsB),g=n.bottom(e,t,n.weights),p=0,y=-1,b=r;bp&&(p=E,y=b))}return new yn(y,p)},Fn=function(n,e,t){var r,o=n.volume(e,n.momentsR),i=n.volume(e,n.momentsG),a=n.volume(e,n.momentsB),l=n.volume(e,n.weights),u=bn(n,e,"red",e.r0+1,e.r1,o,i,a,l),c=bn(n,e,"green",e.g0+1,e.g1,o,i,a,l),s=bn(n,e,"blue",e.b0+1,e.b1,o,i,a,l),d=u.maximum,h=c.maximum,m=s.maximum;if(d>=h&&d>=m){if(0>u.cutLocation)return!1;r="red"}else r=h>=d&&h>=m?"green":"blue";switch(t.r1=e.r1,t.g1=e.g1,t.b1=e.b1,r){case"red":e.r1=u.cutLocation,t.r0=e.r1,t.g0=e.g0,t.b0=e.b0;break;case"green":e.g1=c.cutLocation,t.r0=e.r0,t.g0=e.g1,t.b0=e.b0;break;case"blue":e.b1=s.cutLocation,t.r0=e.r0,t.g0=e.g0,t.b0=e.b1;break;default:throw Error("unexpected direction "+r)}return e.vol=(e.r1-e.r0)*(e.g1-e.g0)*(e.b1-e.b0),t.vol=(t.r1-t.r0)*(t.g1-t.g0)*(t.b1-t.b0),!0},wn=M((function n(){x(this,n),this.vol=this.b1=this.b0=this.g1=this.g0=this.r1=this.r0=0})),En=function(n){n.cubes=Array.from({length:256}).fill(0).map((function(){return new wn}));var e=Array.from({length:256}).fill(0);n.cubes[0].r0=0,n.cubes[0].g0=0,n.cubes[0].b0=0,n.cubes[0].r1=32,n.cubes[0].g1=32,n.cubes[0].b1=32;for(var t=256,r=0,o=1;256>o;o++){Fn(n,n.cubes[r],n.cubes[o])?(e[r]=1i&&(i=e[a],r=a);if(0>=i){t=o+1;break}}return new gn(t)},Cn=function(n,e,t){return(n<<10)+(n<<6)+n+(e<<5)+e+t},kn=function(){function n(){x(this,n),this.weights=[],this.momentsR=[],this.momentsG=[],this.momentsB=[],this.moments=[],this.cubes=[]}return M(n,[{key:"volume",value:function(n,e){return e[Cn(n.r1,n.g1,n.b1)]-e[Cn(n.r1,n.g1,n.b0)]-e[Cn(n.r1,n.g0,n.b1)]+e[Cn(n.r1,n.g0,n.b0)]-e[Cn(n.r0,n.g1,n.b1)]+e[Cn(n.r0,n.g1,n.b0)]+e[Cn(n.r0,n.g0,n.b1)]-e[Cn(n.r0,n.g0,n.b0)]}},{key:"bottom",value:function(n,e,t){switch(e){case"red":return-t[Cn(n.r0,n.g1,n.b1)]+t[Cn(n.r0,n.g1,n.b0)]+t[Cn(n.r0,n.g0,n.b1)]-t[Cn(n.r0,n.g0,n.b0)];case"green":return-t[Cn(n.r1,n.g0,n.b1)]+t[Cn(n.r1,n.g0,n.b0)]+t[Cn(n.r0,n.g0,n.b1)]-t[Cn(n.r0,n.g0,n.b0)];case"blue":return-t[Cn(n.r1,n.g1,n.b0)]+t[Cn(n.r1,n.g0,n.b0)]+t[Cn(n.r0,n.g1,n.b0)]-t[Cn(n.r0,n.g0,n.b0)];default:throw Error("unexpected direction $direction")}}},{key:"top",value:function(n,e,t,r){switch(e){case"red":return r[Cn(t,n.g1,n.b1)]-r[Cn(t,n.g1,n.b0)]-r[Cn(t,n.g0,n.b1)]+r[Cn(t,n.g0,n.b0)];case"green":return r[Cn(n.r1,t,n.b1)]-r[Cn(n.r1,t,n.b0)]-r[Cn(n.r0,t,n.b1)]+r[Cn(n.r0,t,n.b0)];case"blue":return r[Cn(n.r1,n.g1,t)]-r[Cn(n.r1,n.g0,t)]-r[Cn(n.r0,n.g1,t)]+r[Cn(n.r0,n.g0,t)];default:throw Error("unexpected direction $direction")}}}]),n}(),An=function(n){if(n instanceof xn){if(!(n instanceof Sn))throw Error("Unexpected type when unwrapping SafeUrl");var e=n.privateDoNotAccessOrElseWrappedUrl}else e=unwrap(n);return e},xn=M((function n(){x(this,n)})),Sn=function(n){function e(n){var r;return x(this,e),(r=t.call(this)).privateDoNotAccessOrElseWrappedUrl=n,r}b(e,n);var t=w(e);return M(e,[{key:"toString",value:function(){return this.privateDoNotAccessOrElseWrappedUrl}}]),e}(xn),Mn=function(n){var e=n.type.match(/^([^;]+)(?:;\w+=(?:\w+|"[\w;,= ]+"))*$/i);if(2!==(null==e?void 0:e.length)||!(/^image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp|x-icon)$/i.test(e[1])||/^video\/(?:mpeg|mp4|ogg|webm|x-matroska|quicktime|x-ms-wmv)$/i.test(e[1])||/^audio\/(?:3gpp2|3gpp|aac|L16|midi|mp3|mp4|mpeg|oga|ogg|opus|x-m4a|x-matroska|x-wav|wav|webm)$/i.test(e[1])))throw Error("unsafe blob MIME type: ".concat(n.type));return new Sn(URL.createObjectURL(n))},Bn=(cn=g(f().mark((function n(e){var t,r,o;return f().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t=Mn(new Blob([e],{type:"image/png"})),n.next=3,new Promise((function(n,e){var r=new Image;r.onload=function(){n(r)},r.onerror=function(){e()},r.src=An(t)}));case 3:return r=n.sent,(o=document.createElement("canvas").getContext("2d")).canvas.width=112,o.canvas.height=112,o.drawImage(r,0,0,r.width,r.height,0,0,o.canvas.width,o.canvas.height),n.abrupt("return",o.getImageData(0,0,r.width,r.height));case 9:case"end":return n.stop()}}),n)}))),function(n){return cn.apply(this,arguments)}),Dn=function(){var n=g(f().mark((function n(e){var t,r,o,i;return f().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t=new Uint8Array(e),n.next=3,Bn(t);case 3:for(r=n.sent,o=[],i=0;ir.data[i+3]||o.push(U([r.data[i],r.data[i+1],r.data[i+2]]));return n.abrupt("return",o);case 7:case"end":return n.stop()}}),n)})));return function(e){return n.apply(this,arguments)}}();function Pn(n){if(3===(n=n.replace("#","")).length||6===n.length){3===n.length&&(n=n.split("").map((function(n){return n+n})).join(""));var e=["r","g","b"].map((function(e,t){return parseInt(n.slice(2*t,2*t+2),16)}));return{r:e[0],g:e[1],b:e[2]}}}function Nn(n,e){var t=function(n){if(/\#[a-fA-F0-9]{6}/.test(n)){var e=sn(n);return{light:e.light,dark:e.dark}}return{light:{},dark:{}}}(e)[r],o="*{";for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){o+="--".concat(n,"-").concat(i,":").concat(t[i],";");var a=Pn(t[i]);void 0!==a&&(o+="--".concat(n,"-").concat(i,"-rgb:").concat(a.r,",").concat(a.g,",").concat(a.b,";"))}return{css:o+="}",theme2x:r}}!function(){var n=g(f().mark((function n(e){var t,r,o,i,a,l,u,c,s,d,h,m,v,g,b,F,w,E,C,k,A,x,S,M,B,D,P,N,T,O,V,I,j,L,G,R,_,U,H,q,$,W,z,Y,X,J,K,Q,Z,nn,en,tn,rn,on,an,ln,un,cn,sn,gn,pn,yn,bn,Fn,wn,An,xn,Sn,Mn,Bn,Pn,Nn,Tn,On,Vn,In,jn,Ln,Gn,Rn,_n,Un,Hn,qn,$n,Wn,zn,Yn,Xn,Jn,Kn,Qn,Zn,ne,ee,te,re;return f().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if("string"!=typeof e){n.next=8;break}return n.next=3,fetch(e);case 3:return n.next=5,n.sent.arrayBuffer();case 5:n.t0=n.sent,n.next=9;break;case 8:n.t0=e;case 9:return t=n.t0,n.next=12,Dn(t);case 12:for(r=n.sent,(o=new kn).weights=Array.from({length:35937}).fill(0),o.momentsR=Array.from({length:35937}).fill(0),o.momentsG=Array.from({length:35937}).fill(0),o.momentsB=Array.from({length:35937}).fill(0),o.moments=Array.from({length:35937}).fill(0),l=new Map,u=0;u(4278190080&(c=r[u]))>>24>>>0||l.set(c,(null!==(a=l.get(c))&&void 0!==a?a:0)+1);s=y(l.entries());try{for(s.s();!(d=s.n()).done;)h=p(d.value,2),m=h[0],v=h[1],b=v,C=Cn(1+((F=(16711680&(g=m))>>16)>>3),1+((w=(65280&g)>>8)>>3),1+((E=255&g)>>3)),o.weights[C]=(null!==(i=o.weights[C])&&void 0!==i?i:0)+b,o.momentsR[C]+=b*F,o.momentsG[C]+=b*w,o.momentsB[C]+=b*E,o.moments[C]+=b*(F*F+w*w+E*E)}catch(n){s.e(n)}finally{s.f()}for(k=1;33>k;k++)for(A=Array.from({length:33}).fill(0),x=Array.from({length:33}).fill(0),S=Array.from({length:33}).fill(0),M=Array.from({length:33}).fill(0),B=Array.from({length:33}).fill(0),D=1;33>D;D++)for(P=0,N=0,T=0,O=0,V=0,I=1;33>I;I++)j=Cn(k,D,I),P+=o.weights[j],N+=o.momentsR[j],T+=o.momentsG[j],O+=o.momentsB[j],V+=o.moments[j],A[I]+=P,x[I]+=N,S[I]+=T,M[I]+=O,B[I]+=V,L=Cn(k-1,D,I),o.weights[j]=o.weights[L]+A[I],o.momentsR[j]=o.momentsR[L]+x[I],o.momentsG[j]=o.momentsG[L]+S[I],o.momentsB[j]=o.momentsB[L]+M[I],o.moments[j]=o.moments[L]+B[I];for(G=En(o).resultCount,R=[],_=0;_Mn)){n.next=76;break}for(Bn=0;Bn=4*Ln)){n.next=58;break}return n.abrupt("continue",60);case 58:(Un=J.distance(In,an[_n]))0&&o[o.length-1])||6!==l[0]&&2!==l[0])){a=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]t.length)&&(r=t.length);for(var n=0,e=new Array(r);n>8,e=255&t,o=[((16711680&t)>>16).toString(16),n.toString(16),e.toString(16)],i=function(t,r){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=b(t))||r&&t&&"number"==typeof t.length){n&&(t=n);var e=0,o=function(){};return{s:o,n:function(){return e>=t.length?{done:!0}:{done:!1,value:t[e++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(o.entries());try{for(i.s();!(r=i.n()).done;){var a=p(r.value,2),u=a[0],c=a[1],s=u,l=c;1===l.length&&(o[s]="0"+l)}}catch(t){i.e(t)}finally{i.f()}return"#"+o.join("")}(t)}catch(t){return"#000000"}}function A(t,r,n){var e,o=null!==(e=t.props.overrides.tonalGroups)&&void 0!==e?e:{},i=Object(o)[r];return tt.is1p&&!t.props.isBaseline||!i?function(t){var r={};return[100,99,98,95,90,80,70,60,50,40,35,30,25,20,10,0].forEach((function(n){r["luminance".concat(n)]=k(t.tone(n))})),r}(n):i}function B(t,r){var n=new Map;return[100,99,98,95,90,80,70,60,50,40,35,30,25,20,10,0].forEach((function(e){n.set("".concat(t,"-").concat(e),r["luminance".concat(e)])})),n}function S(t){var r=(t+16)/116,n=24389/27,e=r*r*r>216/24389,o=[(e?r*r*r:(116*r-16)/n)*Q[0],(8=t?12.92*t:1.055*Math.pow(t,1/2.4)-.055}function j(t,r,n){return t/=100,r/=100,n/=100,function(t){return(-16777216|(255&t[0])<<16|(255&t[1])<<8|255&t[2])>>>0}([Math.round(N(255,255*P(3.2406*t+-1.5372*r+-.4986*n))),Math.round(N(255,255*P(-.9689*t+1.8758*r+.0415*n))),Math.round(N(255,255*P(.0557*t+-.204*r+1.057*n)))])}function I(t,r,n){var e=n*Math.PI/180,o=1/.0228*Math.log(1+.0228*r*Y.fLRoot);return new J(n,r,t,4/Y.c*Math.sqrt(t/100)*(Y.aw+4)*Y.fLRoot,50*Math.sqrt(r/Math.sqrt(t/100)*Y.c/(Y.aw+4)),(1+100*.007)*t/(1+.007*t),o*Math.cos(e),o*Math.sin(e))}function O(t){var r=Math.pow((0===t.chroma||0===t.j?0:t.chroma/Math.sqrt(t.j/100))/Math.pow(1.64-Math.pow(.29,Y.n),.73),1/.9),n=t.hue*Math.PI/180,e=Y.aw*Math.pow(t.j/100,1/Y.c/Y.z)/Y.nbb,o=Math.sin(n),i=Math.cos(n),a=23*(e+.305)*r/(5e4/13*(Math.cos(n+2)+3.8)*5.75*Y.nc*Y.ncb+11*r*i+108*r*o),u=a*i,c=a*o,s=(460*e+451*u+288*c)/1403,l=(460*e-891*u-261*c)/1403,f=(460*e-220*u-6300*c)/1403,h=100/Y.fl*q(s)*Math.pow(Math.max(0,27.13*Math.abs(s)/(400-Math.abs(s))),1/.42)/Y.rgbD[0],p=100/Y.fl*q(l)*Math.pow(Math.max(0,27.13*Math.abs(l)/(400-Math.abs(l))),1/.42)/Y.rgbD[1],F=100/Y.fl*q(f)*Math.pow(Math.max(0,27.13*Math.abs(f)/(400-Math.abs(f))),1/.42)/Y.rgbD[2];return j(1.86206786*h-1.01125463*p+.14918677*F,.38752654*h+.62144744*p-.00897398*F,-.0158415*h-.03412294*p+1.04996444*F)}function N(t,r){return Math.min(Math.max(r,0),t)}function V(t){return 0>t?t%360+360:360<=t?t%360:t}function x(t,r,n){if(1>r||0>=Math.round(n)||100<=Math.round(n))return S(n);t=V(t);for(var e=r,o=r,i=0,a=!0,u=null;.4<=Math.abs(i-e);){for(var c=t,s=o,l=n,f=0,h=100,p=void 0,F=1e3,y=1e3,d=null;.01b){var g=H(v),E=g.distance(I(g.j,g.chroma,c));1>=E&&E<=y&&(F=b,y=E,d=g)}if(0===F&&0===y)break;m>16)/255)+71.52*L(((65280&t)>>8)/255)+7.22*L((255&t)/255);return(r/=100)<=216/24389?24389/27*r:116*Math.pow(r,1/3)-16}function q(t){return 0>t?-1:0===t?0:1}function L(t){return.04045>=t?t/12.92:Math.pow((t+.055)/1.055,2.4)}function H(t){var r=100*L(((16711680&t)>>16)/255),n=100*L(((65280&t)>>8)/255),e=100*L((255&t)/255),o=.41233895*r+.35762064*n+.18051042*e,i=.2126*r+.7152*n+.0722*e,a=.01932141*r+.11916382*n+.95034478*e,u=Y.rgbD[0]*(.401288*o+.650173*i-.051461*a),c=Y.rgbD[1]*(-.250268*o+1.204414*i+.045854*a),s=Y.rgbD[2]*(-.002079*o+.048952*i+.953127*a),l=Math.pow(Y.fl*Math.abs(u)/100,.42),f=Math.pow(Y.fl*Math.abs(c)/100,.42),h=Math.pow(Y.fl*Math.abs(s)/100,.42),p=400*q(u)*l/(l+27.13),F=400*q(c)*f/(f+27.13),y=400*q(s)*h/(h+27.13),d=(11*p+-12*F+y)/11,v=(p+F-2*y)/9,m=180*Math.atan2(v,d)/Math.PI,b=0>m?m+360:360<=m?m-360:m,g=b*Math.PI/180,E=100*Math.pow((40*p+20*F+y)/20*Y.nbb/Y.aw,Y.c*Y.z),w=Math.pow(5e4/13*.25*(Math.cos((20.14>b?b+360:b)*Math.PI/180+2)+3.8)*Y.nc*Y.ncb*Math.sqrt(d*d+v*v)/((20*p+20*F+21*y)/20+.305),.9)*Math.pow(1.64-Math.pow(.29,Y.n),.73),C=w*Math.sqrt(E/100),M=1/.0228*Math.log(1+.0228*C*Y.fLRoot);return new J(b,C,E,4/Y.c*Math.sqrt(E/100)*(Y.aw+4)*Y.fLRoot,50*Math.sqrt(w*Y.c/(Y.aw+4)),(1+100*.007)*E/(1+.007*E),M*Math.cos(g),M*Math.sin(g))}function U(t){var r=tt.is3p,n=new Z(function(t){var r=3===(t=t.replace("#","")).length,n=6===t.length,e=8===t.length;if(!r&&!n&&!e)throw Error("unexpected hex "+t);var o=0,i=0,a=0;return r?(o=parseInt(t.slice(0,1).repeat(2),16),i=parseInt(t.slice(1,2).repeat(2),16),a=parseInt(t.slice(2,3).repeat(2),16)):n?(o=parseInt(t.slice(0,2),16),i=parseInt(t.slice(2,4),16),a=parseInt(t.slice(4,6),16)):e&&(o=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16),a=parseInt(t.slice(6,8),16)),(-16777216|(255&o)<<16|(255&i)<<8|255&a)>>>0}(t));return new W({tones:n,seed:t,is3p:r,overrides:{},blend:!1,isBaseline:!1})}h();var _={light:{background:"#FFFFFF",surface:"#FFFFFF"},dark:{},neutral:{},neutralVariant:{},primary:{},secondary:{},tertiary:{},error:{}};[[100,"#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF"],[99,"#FDFCFB","#FAFDFB","#FAFBFF","#F7FCFF","#F2FFEE","#FFFBF9"],[98,"#FAF9F9","#F8FAF8","#F8F9FF","#E3FFF6","#E8FFE7","#FFF8F6"],[95,"#F2F2F2","#EFF2EF","#ECF3FE","#DFF3FF","#E7F8ED","#FCEEEE"],[90,"#E3E3E3","#E1E3E1","#D3E3FD","#C2E7FF","#C4EED0","#F9DEDC"],[80,"#C7C7C7","#C4C7C5","#A8C7FA","#7FCFFF","#6DD58C","#F2B8B5"],[70,"#ABABAB","#A9ACAA","#7CACF8","#5AB3F0","#37BE5F","#EC928E"],[60,"#8F8F8F","#8E918F","#4C8DF6","#3998D3","#1EA446","#E46962"],[50,"#757575","#747775","#1B6EF3","#047DB7","#198639","#DC362E"],[40,"#5E5E5E","#5C5F5E","#0B57D0","#00639B","#146C2E","#B3261E"],[35,"#525252","#4F5351","#155298","#005E4E","#006024","#833D3B"],[30,"#474747","#444746","#0842A0","#004A77","#0F5223","#8C1D18"],[25,"#3A3C3C","#393C3B","#003B77","#004438","#004618","#662726"],[20,"#303030","#2D312F","#062E6F","#003355","#0A3818","#601410"],[10,"#1F1F1F","#191D1C","#041E49","#001D35","#072711","#410E0B"],[0,"#000000","#000000","#000000","#000000","#000000","#000000"]].forEach((function(t){var r="luminance".concat(t[0]);_.neutral[r]=t[1],_.neutralVariant[r]=t[2],_.primary[r]=t[3],_.secondary[r]=t[4],_.tertiary[r]=t[5],_.error[r]=t[6]}));var z={light:{},dark:{},neutral:{},neutralVariant:{},primary:{},secondary:{},tertiary:{}};z.error=_.error,[[100,"#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF"],[99,"#FFFBFE","#FFFBFE","#FFFBFE","#FFFBFE","#FFFBFA"],[98,"#FDF8FC","#FEF7FF","#FEF7FF","#FEF7FF","#FFF8F9"],[95,"#F4EFF4","#F5EEFA","#F6EDFF","#F6EDFF","#FFECF1"],[90,"#E6E1E5","#E7E0EC","#EADDFF","#E8DEF8","#FFD8E4"],[80,"#C9C5CA","#CAC4D0","#D0BCFF","#CCC2DC","#EFB8C8"],[70,"#AEAAAE","#AEA9B4","#B69DF8","#B0A7C0","#D29DAC"],[60,"#939094","#938F99","#9A82DB","#958DA5","#B58392"],[50,"#787579","#79747E","#7F67BE","#7A7289","#986977"],[40,"#605D62","#605D66","#6750A4","#625B71","#7D5260"],[35,"#545255","#54515A","#5B4497","#564F65","#704653"],[30,"#484649","#49454F","#4F378B","#4A4458","#633B48"],[25,"#3D3B3E","#3D3A43","#432B7E","#3E384D","#57303D"],[20,"#313033","#322F37","#381E72","#332D41","#492532"],[10,"#1C1B1F","#1D1A22","#21005D","#1D192B","#31111D"],[0,"#000000","#000000","#000000","#000000","#000000"]].forEach((function(t){var r="luminance".concat(t[0]);z.neutral[r]=t[1],z.neutralVariant[r]=t[2],z.primary[r]=t[3],z.secondary[r]=t[4],z.tertiary[r]=t[5]}));var W=function(t){function r(){return E(this,r),n.apply(this,arguments)}!function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),r&&F(t,r)}(r,t);var n=y(r);return C(r)}(function(){function t(r){E(this,t),this.props=r}return C(t,[{key:"isBaseline",get:function(){return function(t){function r(t,r,e){var o;n&&((o=D(r.luminance0,e.luminance0))&&(o=D(r.luminance10,e.luminance10)),[20,30,40,50,60,70,80,90,95,98,100].forEach((function(t){o&&(o=D(r["luminance".concat(t)],e["luminance".concat(t)]))})),n=o)}var n=!0,e=function(t){var r,n;return"Roboto"===(null===(n=null===(r=null==t?void 0:t.styles)||void 0===r?void 0:r.headline1)||void 0===n?void 0:n.fontFamilyName)}(t)?z:_;return["primary","secondary","tertiary","neutral","neutralVariant","error"].forEach((function(n){r(0,t[n],e[n])})),n}(this.save())}},{key:"is3p",get:function(){return this.props.is3p}},{key:"imageUrl",get:function(){return this.props.imageUrl}},{key:"light",get:function(){var t,r,n,e,o,i,a,u,c,s,l,f,h,p,F,y,d,v,m,b,g,E,w,C,M,D,k,A,B,S,P=this.props.isBaseline?null===(t=tt.is1p?_:z)||void 0===t?void 0:t.light:null!==(n=null===(r=this.props.overrides)||void 0===r?void 0:r.light)&&void 0!==n?n:{},j=this.palettes,I={};return[[e,"primary","P-40"],[o,"onPrimary","P-100"],[i,"primaryContainer","P-90"],[a,"onPrimaryContainer","P-10"],[u,"secondary","S-40"],[c,"onSecondary","S-100"],[s,"secondaryContainer","S-90"],[l,"onSecondaryContainer","S-10"],[f,"tertiary","T-40"],[h,"onTertiary","T-100"],[p,"tertiaryContainer","T-90"],[F,"onTertiaryContainer","T-10"],[y,"error","E-40"],[d,"errorContainer","E-90"],[v,"onError","E-100"],[m,"onErrorContainer","E-10"],[b,"background","N-99"],[g,"onBackground","N-10"],[E,"surface","N-99"],[w,"onSurface","N-10"],[C,"surfaceVariant","NV-90"],[M,"onSurfaceVariant","NV-30"],[D,"outline","NV-50"],[k,"inverseOnSurface","N-95"],[A,"inverseSurface","N-20"],[B,"inversePrimary","P-80"],[S,"shadow","N-0"]].forEach((function(t){I[t[1]]=T(t[0],t[1],t[2],P,j)})),I}},{key:"dark",get:function(){var t,r,n,e,o,i,a,u,c,s,l,f,h,p,F,y,d,v,m,b,g,E,w,C,M,D,k,A,B,S,P=this.props.isBaseline?null===(t=tt.is1p?_:z)||void 0===t?void 0:t.dark:null!==(n=null===(r=this.props.overrides)||void 0===r?void 0:r.dark)&&void 0!==n?n:{},j=this.palettes,I={};return[[e,"primary","P-80"],[o,"onPrimary","P-20"],[i,"primaryContainer","P-30"],[a,"onPrimaryContainer","P-90"],[u,"secondary","S-80"],[c,"onSecondary","S-20"],[s,"secondaryContainer","S-30"],[l,"onSecondaryContainer","S-90"],[f,"tertiary","T-80"],[h,"onTertiary","T-20"],[p,"tertiaryContainer","T-30"],[F,"onTertiaryContainer","T-90"],[y,"error","E-80"],[d,"errorContainer","E-30"],[v,"onError","E-20"],[m,"onErrorContainer","E-90"],[b,"background","N-10"],[g,"onBackground","N-90"],[E,"surface","N-10"],[w,"onSurface","N-90"],[C,"surfaceVariant","NV-30"],[M,"onSurfaceVariant","NV-80"],[D,"outline","NV-60"],[k,"inverseOnSurface","N-10"],[A,"inverseSurface","N-90"],[B,"inversePrimary","P-40"],[S,"shadow","N-0"]].forEach((function(t){I[t[1]]=T(t[0],t[1],t[2],P,j)})),I}},{key:"tonalGroups",get:function(){var t=this,r={};return["primary","secondary","tertiary","neutral","neutralVariant","error"].forEach((function(n){r[n]=t["".concat(n,"Group")]})),Object.assign(r,this.props.overrides.tonalGroups)}},{key:"primaryGroup",get:function(){return A(this,"primary",this.props.tones.a1)}},{key:"secondaryGroup",get:function(){return A(this,"secondary",this.props.tones.a2)}},{key:"tertiaryGroup",get:function(){return A(this,"tertiary",this.props.tones.a3)}},{key:"neutralGroup",get:function(){return A(this,"neutral",this.props.tones.n1)}},{key:"neutralVariantGroup",get:function(){return A(this,"neutralVariant",this.props.tones.n2)}},{key:"errorGroup",get:function(){return A(this,"error",this.props.tones.error)}},{key:"primary",get:function(){return B("P",this.primaryGroup)}},{key:"secondary",get:function(){return B("S",this.secondaryGroup)}},{key:"tertiary",get:function(){return B("T",this.tertiaryGroup)}},{key:"neutral",get:function(){return B("N",this.neutralGroup)}},{key:"neutralVariant",get:function(){return B("NV",this.neutralVariantGroup)}},{key:"error",get:function(){return B("E",this.errorGroup)}},{key:"palettes",get:function(){var t=this,r=[];return["primary","secondary","tertiary","neutral","neutralVariant","error"].forEach((function(n){r=r.concat(Array.from(t[n].entries()))})),new Map(r)}},{key:"seedValue",get:function(){return this.props.seed}},{key:"source",get:function(){var t,r,n,e,o,i,a=this,u=this.palettes,c=this.props.overrides.source,s={seed:this.seedValue,imageUrl:this.imageUrl};return[[t,"primary","P"],[r,"secondary","S"],[n,"tertiary","T"],[e,"neutral","N"],[o,"neutralVariant","NV"],[i,"error","E"]].forEach((function(t){s[t[1]]=function(t,r,n){return null!==(t=null==c?void 0:c[r])&&void 0!==t?t:n}(t[0],t[1],function(t,r,n){return(null!=n?n:t.palettes).get("".concat(r,"-40"))}(a,t[2],u))})),Object.assign(Object.assign({},c),s)}},{key:"customColors",get:function(){var t,r;return m(null!==(r=null===(t=this.props.overrides)||void 0===t?void 0:t.customColors)&&void 0!==r?r:[])}},{key:"save",value:function(){return{light:this.light,dark:this.dark}}}]),t}()),$=function(){function t(r,n){var e=arguments,o=this;E(this,t),["hue","chroma"].forEach((function(t,r){o[t]=e[r]})),this.cache=new Map}return C(t,[{key:"tone",value:function(t){var r=this.cache.get(t);return void 0===r&&(r=new X(this.hue,this.chroma,t).toInt(),this.cache.set(t,r)),r}}]),t}(),X=function(){function t(){var r=arguments,n=this;E(this,t),["internalHue","internalChroma","internalTone"].forEach((function(t,e){n[t]=r[e]})),G(this,this.toInt())}return C(t,[{key:"toInt",value:function(){return x(V(this.internalHue),this.internalChroma,N(100,this.internalTone))}},{key:"hue",get:function(){return this.internalHue},set:function(t){G(this,x(V(V(t)),this.internalChroma,N(100,this.internalTone)))}},{key:"chroma",get:function(){return this.internalChroma},set:function(t){G(this,x(V(this.internalHue),t,N(100,this.internalTone)))}},{key:"tone",get:function(){return this.internalTone},set:function(t){G(this,x(V(this.internalHue),this.internalChroma,N(100,t)))}}]),t}(),J=function(){function t(){var r=arguments,n=this;E(this,t),["hue","chroma","j","q","s","jstar","astar","bstar"].forEach((function(t,e){n[t]=r[e]}))}return C(t,[{key:"distance",value:function(t){var r=this.jstar-t.jstar,n=this.astar-t.astar,e=this.bstar-t.bstar;return 1.41*Math.pow(Math.sqrt(r*r+n*n+e*e),.63)}}]),t}(),K=C((function t(){var r=arguments,n=this;E(this,t),["n","aw","nbb","ncb","c","nc","rgbD","fl","fLRoot","z"].forEach((function(t,e){n[t]=r[e]}))})),Q=[95.047,100,108.883],Y=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Q,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200/Math.PI*100*Math.pow(66/116,3)/100,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:50,e=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2,o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],i=.401288*t[0]+.650173*t[1]+-.051461*t[2],a=-.250268*t[0]+1.204414*t[1]+.045854*t[2],u=-.002079*t[0]+.048952*t[1]+.953127*t[2],c=.8+e/10;if(.9<=c)var s=10*(c-.9),l=.59*(1-s)+.69*s;else{var f=10*(c-.8);l=.525*(1-f)+.59*f}var h=o?1:c*(1-1/3.6*Math.exp((-r-42)/92)),p=[100/i*(h=1h?0:h)+1-h,100/a*h+1-h,100/u*h+1-h],F=1/(5*r+1),y=F*F*F*F,d=1-y,v=y*r+.1*d*d*Math.cbrt(5*r),m=(80&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]` tag: +Alternatively, you can include [Dynnamic Colors's IIFE file](https://cdn.jsdelivr.net/gh/patelka2211/dynamic-colors@1.1.2/DynamicColors.js) in your website using a ` + ``` ## Available APIs diff --git a/package-lock.json b/package-lock.json index 4c8a3f5..ea8a00d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "dynamic-colors", - "version": "1.1.1", + "version": "1.1.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "dynamic-colors", - "version": "1.1.1", + "version": "1.1.2", "license": "MIT", "devDependencies": { "rollup": "^3.25.1", diff --git a/package.json b/package.json index 53a1196..039be8a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dynamic-colors", - "version": "1.1.1", + "version": "1.1.2", "description": "Dynamic Colors is a JavaScript library that can dynamically generate color theme from a single HEX color and it provides a range of useful APIs for creating, managing, and manipulating color themes.", "main": "index.js", "module": "index.js", diff --git a/src/dynamicColors.ts b/src/dynamicColors.ts index 779bb3c..98b4e83 100644 --- a/src/dynamicColors.ts +++ b/src/dynamicColors.ts @@ -1,3 +1,4 @@ +import { theme2x } from "./OSTheme"; import { getThemeCSSFromColor } from "./getColor"; import { addInstance, dcIDList, instances, removeInstance } from "./instances"; import { addLock, isLocked, removeLock } from "./lockMechanism"; @@ -51,8 +52,7 @@ export class DynamicColors { if (this.id === undefined) return; - const { css, theme2x } = getThemeCSSFromColor(this.id, color); - this.styleTag.innerHTML = css; + this.styleTag.innerHTML = getThemeCSSFromColor(this.id, color); this.styleTag.setAttribute("dc-color", color); this.styleTag.setAttribute("dc-theme", theme2x); } diff --git a/src/getColor.ts b/src/getColor.ts index 3379af4..4cf0e2e 100644 --- a/src/getColor.ts +++ b/src/getColor.ts @@ -1,21 +1,15 @@ -import materialDynamicColors from "./helper/mdc"; +import { fromHEX } from "./helper/mdc"; import { hex2rgb } from "./hex2rgb"; -import { LightOrDark, theme2x } from "./OSTheme"; +import { theme2x } from "./OSTheme"; /** * Retrieves the theme CSS string for a given color. * @param {string} id The ID associated with the DynamicColors. * @param {string} color The color value. - * @returns {Object} An object containing the CSS string and theme value. + * @returns {string} CSS string. */ -export function getThemeCSSFromColor( - id: string, - color: string -): { - css: string; - theme2x: LightOrDark; -} { - let themeObj = materialDynamicColors(color)[theme2x] as { +export function getThemeCSSFromColor(id: string, color: string): string { + let themeObj = fromHEX(color)[theme2x] as { [_: string]: string; }, css = "*{"; @@ -28,6 +22,5 @@ export function getThemeCSSFromColor( css += `--${id}-${colorName}-rgb:${rgb.r},${rgb.g},${rgb.b};`; } css += "}"; - - return { css, theme2x }; + return css; } diff --git a/src/helper/mdc.js b/src/helper/mdc.js index c411917..f65dc60 100644 --- a/src/helper/mdc.js +++ b/src/helper/mdc.js @@ -1,2 +1 @@ -"use strict";function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}function _regeneratorRuntime(){function e(e,n,t){return Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}),e[n]}function n(e,n,t,o){var i=n&&n.prototype instanceof r?n:r,a=Object.create(i.prototype),l=new d(o||[]);return y(a,"_invoke",{value:u(e,t,l)}),a}function t(e,n,t){try{return{type:"normal",arg:e.call(n,t)}}catch(e){return{type:"throw",arg:e}}}function r(){}function o(){}function i(){}function a(n){["next","throw","return"].forEach(function(t){e(n,t,function(e){return this._invoke(t,e)})})}function l(e,n){function r(o,i,a,l){var u=t(e[o],e,i);if("throw"!==u.type){var c=u.arg,s=c.value;return s&&"object"==_typeof(s)&&p.call(s,"__await")?n.resolve(s.__await).then(function(e){r("next",e,a,l)},function(e){r("throw",e,a,l)}):n.resolve(s).then(function(e){c.value=e,a(c)},function(e){return r("throw",e,a,l)})}l(u.arg)}var o;y(this,"_invoke",{value:function(e,t){function i(){return new n(function(n,o){r(e,t,n,o)})}return o=o?o.then(i,i):i()}})}function u(e,n,r){var o="suspendedStart";return function(i,a){if("executing"===o)throw new Error("Generator is already running");if("completed"===o){if("throw"===i)throw a;return f()}for(r.method=i,r.arg=a;;){var l=r.delegate;if(l){var u=c(l,r);if(u){if(u===x)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===o)throw o="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o="executing";var s=t(e,n,r);if("normal"===s.type){if(o=r.done?"completed":"suspendedYield",s.arg===x)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o="completed",r.method="throw",r.arg=s.arg)}}}function c(e,n){var r=n.method,o=e.iterator[r];if(void 0===o)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=void 0,c(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),x;var i=t(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,x;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=void 0),n.delegate=null,x):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,x)}function s(e){var n={tryLoc:e[0]};1 in e&&(n.catchLoc=e[1]),2 in e&&(n.finallyLoc=e[2],n.afterLoc=e[3]),this.tryEntries.push(n)}function m(e){var n=e.completion||{};n.type="normal",delete n.arg,e.completion=n}function d(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(s,this),this.reset(!0)}function h(e){if(e){var n=e[b];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var t=-1,r=function n(){for(;++t=0;--r){var o=this.tryEntries[r],i=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var a=p.call(o,"catchLoc"),l=p.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--t){var r=this.tryEntries[t];if(r.tryLoc<=this.prev&&p.call(r,"finallyLoc")&&this.prev=0;--n){var t=this.tryEntries[n];if(t.finallyLoc===e)return this.complete(t.completion,t.afterLoc),m(t),x}},catch:function(e){for(var n=this.tryEntries.length-1;n>=0;--n){var t=this.tryEntries[n];if(t.tryLoc===e){var r=t.completion;if("throw"===r.type){var o=r.arg;m(t)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,t){return this.delegate={iterator:h(e),resultName:n,nextLoc:t},"next"===this.method&&(this.arg=void 0),x}},v}function asyncGeneratorStep(e,n,t,r,o,i,a){try{var l=e[i](a),u=l.value}catch(e){return void t(e)}l.done?n(u):Promise.resolve(u).then(r,o)}function _asyncToGenerator(e){return function(){var n=this,t=arguments;return new Promise(function(r,o){function i(e){asyncGeneratorStep(l,r,o,i,a,"next",e)}function a(e){asyncGeneratorStep(l,r,o,i,a,"throw",e)}var l=e.apply(n,t);i(void 0)})}}function _slicedToArray(e,n){return _arrayWithHoles(e)||_iterableToArrayLimit(e,n)||_unsupportedIterableToArray(e,n)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArrayLimit(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i,a,l=[],u=!0,c=!1;try{if(i=(t=t.call(e)).next,0===n){if(Object(t)!==t)return;u=!1}else for(;!(u=(r=i.call(t)).done)&&(l.push(r.value),l.length!==n);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(c)throw o}}return l}}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _createForOfIteratorHelper(e,n){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=_unsupportedIterableToArray(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){l=!0,i=e},f:function(){try{a||null==t.return||t.return()}finally{if(l)throw i}}}}function _inherits(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),n&&_setPrototypeOf(e,n)}function _setPrototypeOf(e,n){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},_setPrototypeOf(e,n)}function _createSuper(e){var n=_isNativeReflectConstruct();return function(){var t,r=_getPrototypeOf(e);if(n){var o=_getPrototypeOf(this).constructor;t=Reflect.construct(r,arguments,o)}else t=r.apply(this,arguments);return _possibleConstructorReturn(this,t)}}function _possibleConstructorReturn(e,n){if(n&&("object"===_typeof(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function _getPrototypeOf(e){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_getPrototypeOf(e)}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,n){if(e){if("string"==typeof e)return _arrayLikeToArray(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,n):void 0}}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t216/24389,o=[(r?n*n*n:(116*n-16)/t)*WHITE_POINT_D65[0],(8=e?12.92*e:1.055*Math.pow(e,1/2.4)-.055},intFromRgb=function(e){return(-16777216|(255&e[0])<<16|(255&e[1])<<8|255&e[2])>>>0},intFromXyzComponents=function(e,n,t){return e/=100,n/=100,t/=100,intFromRgb([Math.round(math_utils_clamp(255,255*delinearized(3.2406*e+-1.5372*n+-.4986*t))),Math.round(math_utils_clamp(255,255*delinearized(-.9689*e+1.8758*n+.0415*t))),Math.round(math_utils_clamp(255,255*delinearized(.0557*e+-.204*n+1.057*t)))])},fromJchInViewingConditions=function(e,n,t){var r=t*Math.PI/180,o=1/.0228*Math.log(1+.0228*n*DEFAULT.fLRoot);return new CAM16(t,n,e,4/DEFAULT.c*Math.sqrt(e/100)*(DEFAULT.aw+4)*DEFAULT.fLRoot,50*Math.sqrt(n/Math.sqrt(e/100)*DEFAULT.c/(DEFAULT.aw+4)),(1+100*.007)*e/(1+.007*e),o*Math.cos(r),o*Math.sin(r))},viewed=function(e){var n=Math.pow((0===e.chroma||0===e.j?0:e.chroma/Math.sqrt(e.j/100))/Math.pow(1.64-Math.pow(.29,DEFAULT.n),.73),1/.9),t=e.hue*Math.PI/180,r=DEFAULT.aw*Math.pow(e.j/100,1/DEFAULT.c/DEFAULT.z)/DEFAULT.nbb,o=Math.sin(t),i=Math.cos(t),a=23*(r+.305)*n/(5e4/13*(Math.cos(t+2)+3.8)*5.75*DEFAULT.nc*DEFAULT.ncb+11*n*i+108*n*o),l=a*i,u=a*o,c=(460*r+451*l+288*u)/1403,s=(460*r-891*l-261*u)/1403,m=(460*r-220*l-6300*u)/1403,d=100/DEFAULT.fl*math_utils_signum(c)*Math.pow(Math.max(0,27.13*Math.abs(c)/(400-Math.abs(c))),1/.42)/DEFAULT.rgbD[0],h=100/DEFAULT.fl*math_utils_signum(s)*Math.pow(Math.max(0,27.13*Math.abs(s)/(400-Math.abs(s))),1/.42)/DEFAULT.rgbD[1],f=100/DEFAULT.fl*math_utils_signum(m)*Math.pow(Math.max(0,27.13*Math.abs(m)/(400-Math.abs(m))),1/.42)/DEFAULT.rgbD[2];return intFromXyzComponents(1.86206786*d-1.01125463*h+.14918677*f,.38752654*d+.62144744*h-.00897398*f,-.0158415*d-.03412294*h+1.04996444*f)},math_utils_clamp=function(e,n){return Math.min(Math.max(n,0),e)},math_utils_sanitizeDegrees=function(e){return 0>e?e%360+360:360<=e?e%360:e},hct_getIntInViewingConditions=function(e,n,t){if(1>n||0>=Math.round(t)||100<=Math.round(t))return intFromLstar(t);e=math_utils_sanitizeDegrees(e);for(var r=n,o=n,i=0,a=!0,l=null;.4<=Math.abs(i-r);){for(var u=e,c=o,s=t,m=0,d=100,h=void 0,f=1e3,v=1e3,g=null;.01_){var b=fromIntInViewingConditions(p),F=b.distance(fromJchInViewingConditions(b.j,b.chroma,u));1>=F&&F<=v&&(f=_,v=F,g=b)}if(0===f&&0===v)break;y>16)/255)+71.52*linearized(((65280&e)>>8)/255)+7.22*linearized((255&e)/255);return n/=100,n<=216/24389?24389/27*n:116*Math.pow(n,1/3)-16},HCT=function(){function e(n,t,r){_classCallCheck(this,e),this.internalHue=n,this.internalChroma=t,this.internalTone=r,setInternalState(this,this.toInt())}return _createClass(e,[{key:"toInt",value:function(){return hct_getIntInViewingConditions(math_utils_sanitizeDegrees(this.internalHue),this.internalChroma,math_utils_clamp(100,this.internalTone))}},{key:"hue",get:function(){return this.internalHue},set:function(e){setInternalState(this,hct_getIntInViewingConditions(math_utils_sanitizeDegrees(math_utils_sanitizeDegrees(e)),this.internalChroma,math_utils_clamp(100,this.internalTone)))}},{key:"chroma",get:function(){return this.internalChroma},set:function(e){setInternalState(this,hct_getIntInViewingConditions(math_utils_sanitizeDegrees(this.internalHue),e,math_utils_clamp(100,this.internalTone)))}},{key:"tone",get:function(){return this.internalTone},set:function(e){setInternalState(this,hct_getIntInViewingConditions(math_utils_sanitizeDegrees(this.internalHue),this.internalChroma,math_utils_clamp(100,e)))}}]),e}(),CAM16=function(){function e(n,t,r,o,i,a,l,u){_classCallCheck(this,e),this.hue=n,this.chroma=t,this.j=r,this.q=o,this.s=i,this.jstar=a,this.astar=l,this.bstar=u}return _createClass(e,[{key:"distance",value:function(e){var n=this.jstar-e.jstar,t=this.astar-e.astar,r=this.bstar-e.bstar;return 1.41*Math.pow(Math.sqrt(n*n+t*t+r*r),.63)}}]),e}(),math_utils_signum=function(e){return 0>e?-1:0===e?0:1},ViewingConditions=_createClass(function e(n,t,r,o,i,a,l,u,c,s){_classCallCheck(this,e),this.n=n,this.aw=t,this.nbb=r,this.ncb=o,this.c=i,this.nc=a,this.rgbD=l,this.fl=u,this.fLRoot=c,this.z=s}),WHITE_POINT_D65=[95.047,100,108.883],DEFAULT=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:WHITE_POINT_D65,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200/Math.PI*100*Math.pow(66/116,3)/100,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:50,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2,o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],i=.401288*e[0]+.650173*e[1]+-.051461*e[2],a=-.250268*e[0]+1.204414*e[1]+.045854*e[2],l=-.002079*e[0]+.048952*e[1]+.953127*e[2],u=.8+r/10;if(.9<=u)var c=10*(u-.9),s=.59*(1-c)+.69*c;else{var m=10*(u-.8);s=.525*(1-m)+.59*m}var d=o?1:u*(1-1/3.6*Math.exp((-n-42)/92));d=1d?0:d;var h=[100/i*d+1-d,100/a*d+1-d,100/l*d+1-d],f=1/(5*n+1),v=f*f*f*f,g=1-v,p=v*n+.1*g*g*Math.cbrt(5*n),y=(8=e?e/12.92:Math.pow((e+.055)/1.055,2.4)},fromIntInViewingConditions=function(e){var n=100*linearized(((16711680&e)>>16)/255),t=100*linearized(((65280&e)>>8)/255),r=100*linearized((255&e)/255),o=.41233895*n+.35762064*t+.18051042*r,i=.2126*n+.7152*t+.0722*r,a=.01932141*n+.11916382*t+.95034478*r,l=DEFAULT.rgbD[0]*(.401288*o+.650173*i-.051461*a),u=DEFAULT.rgbD[1]*(-.250268*o+1.204414*i+.045854*a),c=DEFAULT.rgbD[2]*(-.002079*o+.048952*i+.953127*a),s=Math.pow(DEFAULT.fl*Math.abs(l)/100,.42),m=Math.pow(DEFAULT.fl*Math.abs(u)/100,.42),d=Math.pow(DEFAULT.fl*Math.abs(c)/100,.42),h=400*math_utils_signum(l)*s/(s+27.13),f=400*math_utils_signum(u)*m/(m+27.13),v=400*math_utils_signum(c)*d/(d+27.13),g=(11*h+-12*f+v)/11,p=(h+f-2*v)/9,y=180*Math.atan2(p,g)/Math.PI,_=0>y?y+360:360<=y?y-360:y,b=_*Math.PI/180,F=100*Math.pow((40*h+20*f+v)/20*DEFAULT.nbb/DEFAULT.aw,DEFAULT.c*DEFAULT.z),T=Math.pow(5e4/13*.25*(Math.cos((20.14>_?_+360:_)*Math.PI/180+2)+3.8)*DEFAULT.nc*DEFAULT.ncb*Math.sqrt(g*g+p*p)/((20*h+20*f+21*v)/20+.305),.9)*Math.pow(1.64-Math.pow(.29,DEFAULT.n),.73),x=T*Math.sqrt(F/100),C=1/.0228*Math.log(1+.0228*x*DEFAULT.fLRoot);return new CAM16(_,x,F,4/DEFAULT.c*Math.sqrt(F/100)*(DEFAULT.aw+4)*DEFAULT.fLRoot,50*Math.sqrt(T*DEFAULT.c/(DEFAULT.aw+4)),(1+100*.007)*F/(1+.007*F),C*Math.cos(b),C*Math.sin(b))},fromInt=function(e){var n=fromIntInViewingConditions(e);return new HCT(n.hue,n.chroma,lstarFromInt(e))},intFromHex=function(e){e=e.replace("#","");var n=3===e.length,t=6===e.length,r=8===e.length;if(!n&&!t&&!r)throw Error("unexpected hex "+e);var o=0,i=0,a=0;return n?(o=parseInt(e.slice(0,1).repeat(2),16),i=parseInt(e.slice(1,2).repeat(2),16),a=parseInt(e.slice(2,3).repeat(2),16)):t?(o=parseInt(e.slice(0,2),16),i=parseInt(e.slice(2,4),16),a=parseInt(e.slice(4,6),16)):r&&(o=parseInt(e.slice(2,4),16),i=parseInt(e.slice(4,6),16),a=parseInt(e.slice(6,8),16)),(-16777216|(255&o)<<16|(255&i)<<8|255&a)>>>0},CorePalette=_createClass(function e(n){_classCallCheck(this,e);var t=fromInt(n),r=t.hue;this.a1=new TonalPalette(r,Math.max(48,t.chroma)),this.a2=new TonalPalette(r,16),this.a3=new TonalPalette(r+60,24),this.n1=new TonalPalette(r,4),this.n2=new TonalPalette(r,8),this.error=new TonalPalette(25,84)}),Flags=function(){function e(){_classCallCheck(this,e)}return _createClass(e,[{key:"internal",get:function(){return!1}},{key:"is3p",get:function(){return!this.internal}},{key:"is1p",get:function(){return this.internal}},{key:"enableDsp",get:function(){return!this.is1p}},{key:"enableAndroid",get:function(){return this.is1p}},{key:"enableWebExport",get:function(){return this.is3p}},{key:"enableExtendedColors",get:function(){return!0}},{key:"enableColorShift",get:function(){return this.is1p}}]),e}(),flags=new Flags,SHOW_DSP=flags.enableDsp,SHOW_ANDROID=flags.enableAndroid,SHOW_WEB_EXPORT=flags.enableWebExport,ENABLE_EXTENDED_COLOR_SHIFT=flags.enableColorShift,fromColor=function(e){var n=flags.is3p,t=new CorePalette(intFromHex(e));return new ThemeAdapter({tones:t,seed:e,is3p:n,overrides:{},blend:!1,isBaseline:!1})},hexFromInt=function(e){var n,t=(65280&e)>>8,r=255&e,o=[((16711680&e)>>16).toString(16),t.toString(16),r.toString(16)],i=_createForOfIteratorHelper(o.entries());try{for(i.s();!(n=i.n()).done;){var a=_slicedToArray(n.value,2),l=a[0],u=a[1],c=l,s=u;1===s.length&&(o[c]="0"+s)}}catch(e){i.e(e)}finally{i.f()}return"#"+o.join("")},filter=function(e,n){var t,r=[],o=_createForOfIteratorHelper(n.entries());try{for(o.s();!(t=o.n()).done;){var i=_slicedToArray(t.value,2),a=i[0],l=i[1],u=a,c=l,s=e.get(u);15<=c.chroma&&10<=lstarFromInt(u)&&.01<=s&&r.push(u)}}catch(e){o.e(e)}finally{o.f()}return r},score=function(e){var n,t=0,r=_createForOfIteratorHelper(e.values());try{for(r.s();!(n=r.n()).done;){var o=n.value;t+=o}}catch(e){r.e(e)}finally{r.f()}var i,a=new Map,l=new Map,u=Array(360).fill(0),c=_createForOfIteratorHelper(e.entries());try{for(c.s();!(i=c.n()).done;){var s=_slicedToArray(i.value,2),m=s[0],d=s[1],h=m,f=d/t;a.set(h,f);var v=fromIntInViewingConditions(h);l.set(h,v),u[Math.round(v.hue)]+=f}}catch(e){c.e(e)}finally{c.f()}var g,p=new Map,y=_createForOfIteratorHelper(l.entries());try{for(y.s();!(g=y.n()).done;){for(var _=_slicedToArray(g.value,2),b=_[0],F=_[1],T=b,x=Math.round(F.hue),C=0,E=x-15;EM.chroma?.1:.3))}}catch(e){I.e(e)}finally{I.f()}var B,L=filter(p,l),N=new Map,O=_createForOfIteratorHelper(L);try{for(O.s();!(B=O.n()).done;){var V,G=B.value,U=!1,j=l.get(G).hue,R=_createForOfIteratorHelper(N);try{for(R.s();!(V=R.n()).done;){var z=_slicedToArray(V.value,1),W=z[0],q=l.get(W).hue;if(15>180-Math.abs(Math.abs(j-q)-180)){U=!0;break}}}catch(e){R.e(e)}finally{R.f()}U||N.set(G,A.get(G))}}catch(e){O.e(e)}finally{O.f()}var $=Array.from(N.entries());$.sort(function(e,n){return n[1]-e[1]});var X=$.map(function(e){return e[0]});return 0===X.length&&X.push(4282549748),X},quantizer_wsmeans_DistanceAndIndex=_createClass(function e(){_classCallCheck(this,e),this.index=this.distance=-1}),labFromInt=function(e){var n,t=216/24389,r=24389/27,o=100*linearized(((16711680&e)>>16)/255),i=100*linearized(((65280&e)>>8)/255),a=100*linearized((255&e)/255),l=(.2126*o+.7152*i+.0722*a)/WHITE_POINT_D65[1];n=l>t?Math.pow(l,1/3):(r*l+16)/116;var u=(.41233895*o+.35762064*i+.18051042*a)/WHITE_POINT_D65[0],c=(.01932141*o+.11916382*i+.95034478*a)/WHITE_POINT_D65[2];return[116*n-16,500*((u>t?Math.pow(u,1/3):(r*u+16)/116)-n),200*(n-(c>t?Math.pow(c,1/3):(r*c+16)/116))]},LabPointProvider=function(){function e(){_classCallCheck(this,e)}return _createClass(e,[{key:"toInt",value:function(e){var n=e[0],t=216/24389,r=24389/27,o=(n+16)/116,i=e[1]/500+o,a=o-e[2]/200,l=i*i*i,u=a*a*a,c=[(l>t?l:(116*i-16)/r)*WHITE_POINT_D65[0],(8t?u:(116*a-16)/r)*WHITE_POINT_D65[2]];return intFromXyzComponents(c[0],c[1],c[2])}},{key:"distance",value:function(e,n){var t=e[0]-n[0],r=e[1]-n[1],o=e[2]-n[2];return t*t+r*r+o*o}}]),e}(),quantizer_wu_CreateBoxesResult=_createClass(function e(n){_classCallCheck(this,e),this.resultCount=n}),variance=function(e,n){var t=e.volume(n,e.momentsR),r=e.volume(n,e.momentsG),o=e.volume(n,e.momentsB),i=e.moments[getIndex(n.r1,n.g1,n.b1)]-e.moments[getIndex(n.r1,n.g1,n.b0)]-e.moments[getIndex(n.r1,n.g0,n.b1)]+e.moments[getIndex(n.r1,n.g0,n.b0)]-e.moments[getIndex(n.r0,n.g1,n.b1)]+e.moments[getIndex(n.r0,n.g1,n.b0)]+e.moments[getIndex(n.r0,n.g0,n.b1)]-e.moments[getIndex(n.r0,n.g0,n.b0)],a=t*t+r*r+o*o,l=e.volume(n,e.weights);return i-a/l},quantizer_wu_MaximizeResult=_createClass(function e(n,t){_classCallCheck(this,e),this.cutLocation=n,this.maximum=t}),maximize=function(e,n,t,r,o,i,a,l,u){for(var c,s,m,d,h=e.bottom(n,t,e.momentsR),f=e.bottom(n,t,e.momentsG),v=e.bottom(n,t,e.momentsB),g=e.bottom(n,t,e.weights),p=0,y=-1,_=r;_p&&(p=T,y=_))}return new quantizer_wu_MaximizeResult(y,p)},cut=function(e,n,t){var r,o=e.volume(n,e.momentsR),i=e.volume(n,e.momentsG),a=e.volume(n,e.momentsB),l=e.volume(n,e.weights),u=maximize(e,n,"red",n.r0+1,n.r1,o,i,a,l),c=maximize(e,n,"green",n.g0+1,n.g1,o,i,a,l),s=maximize(e,n,"blue",n.b0+1,n.b1,o,i,a,l),m=u.maximum,d=c.maximum,h=s.maximum;if(m>=d&&m>=h){if(0>u.cutLocation)return!1;r="red"}else r=d>=m&&d>=h?"green":"blue";switch(t.r1=n.r1,t.g1=n.g1,t.b1=n.b1,r){case"red":n.r1=u.cutLocation,t.r0=n.r1,t.g0=n.g0,t.b0=n.b0;break;case"green":n.g1=c.cutLocation,t.r0=n.r0,t.g0=n.g1,t.b0=n.b0;break;case"blue":n.b1=s.cutLocation,t.r0=n.r0,t.g0=n.g0,t.b0=n.b1;break;default:throw Error("unexpected direction "+r)}return n.vol=(n.r1-n.r0)*(n.g1-n.g0)*(n.b1-n.b0),t.vol=(t.r1-t.r0)*(t.g1-t.g0)*(t.b1-t.b0),!0},quantizer_wu_Box=_createClass(function e(){_classCallCheck(this,e),this.vol=this.b1=this.b0=this.g1=this.g0=this.r1=this.r0=0}),createBoxes=function(e){e.cubes=Array.from({length:256}).fill(0).map(function(){return new quantizer_wu_Box});var n=Array.from({length:256}).fill(0);e.cubes[0].r0=0,e.cubes[0].g0=0,e.cubes[0].b0=0,e.cubes[0].r1=32,e.cubes[0].g1=32,e.cubes[0].b1=32;for(var t=256,r=0,o=1;256>o;o++){cut(e,e.cubes[r],e.cubes[o])?(n[r]=1i&&(i=n[a],r=a);if(0>=i){t=o+1;break}}return new quantizer_wu_CreateBoxesResult(t)},getIndex=function(e,n,t){return(e<<10)+(e<<6)+e+(n<<5)+n+t},QuantizerWu=function(){function e(){_classCallCheck(this,e),this.weights=[],this.momentsR=[],this.momentsG=[],this.momentsB=[],this.moments=[],this.cubes=[]}return _createClass(e,[{key:"volume",value:function(e,n){return n[getIndex(e.r1,e.g1,e.b1)]-n[getIndex(e.r1,e.g1,e.b0)]-n[getIndex(e.r1,e.g0,e.b1)]+n[getIndex(e.r1,e.g0,e.b0)]-n[getIndex(e.r0,e.g1,e.b1)]+n[getIndex(e.r0,e.g1,e.b0)]+n[getIndex(e.r0,e.g0,e.b1)]-n[getIndex(e.r0,e.g0,e.b0)]}},{key:"bottom",value:function(e,n,t){switch(n){case"red":return-t[getIndex(e.r0,e.g1,e.b1)]+t[getIndex(e.r0,e.g1,e.b0)]+t[getIndex(e.r0,e.g0,e.b1)]-t[getIndex(e.r0,e.g0,e.b0)];case"green":return-t[getIndex(e.r1,e.g0,e.b1)]+t[getIndex(e.r1,e.g0,e.b0)]+t[getIndex(e.r0,e.g0,e.b1)]-t[getIndex(e.r0,e.g0,e.b0)];case"blue":return-t[getIndex(e.r1,e.g1,e.b0)]+t[getIndex(e.r1,e.g0,e.b0)]+t[getIndex(e.r0,e.g1,e.b0)]-t[getIndex(e.r0,e.g0,e.b0)];default:throw Error("unexpected direction $direction")}}},{key:"top",value:function(e,n,t,r){switch(n){case"red":return r[getIndex(t,e.g1,e.b1)]-r[getIndex(t,e.g1,e.b0)]-r[getIndex(t,e.g0,e.b1)]+r[getIndex(t,e.g0,e.b0)];case"green":return r[getIndex(e.r1,t,e.b1)]-r[getIndex(e.r1,t,e.b0)]-r[getIndex(e.r0,t,e.b1)]+r[getIndex(e.r0,t,e.b0)];case"blue":return r[getIndex(e.r1,e.g1,t)]-r[getIndex(e.r1,e.g0,t)]-r[getIndex(e.r0,e.g1,t)]+r[getIndex(e.r0,e.g0,t)];default:throw Error("unexpected direction $direction")}}}]),e}(),index_unwrapSafeUrl=function(e){if(e instanceof SafeUrl){if(!(e instanceof safe_url_impl_SafeUrlImpl))throw Error("Unexpected type when unwrapping SafeUrl");var n=e.privateDoNotAccessOrElseWrappedUrl}else n=unwrap(e);return n},secretToken={},SafeUrl=_createClass(function e(){_classCallCheck(this,e)}),safe_url_impl_SafeUrlImpl=function(e){function n(e){var r;if(_classCallCheck(this,n),r=t.call(this),secretToken!=secretToken)throw Error("Bad secret");return r.privateDoNotAccessOrElseWrappedUrl=e,r}_inherits(n,e);var t=_createSuper(n);return _createClass(n,[{key:"toString",value:function(){return this.privateDoNotAccessOrElseWrappedUrl}}]),n}(SafeUrl),safe_url_builders_fromBlob=function(e){var n=e.type.match(/^([^;]+)(?:;\w+=(?:\w+|"[\w;,= ]+"))*$/i);if(2!==(null==n?void 0:n.length)||!(/^image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp|x-icon)$/i.test(n[1])||/^video\/(?:mpeg|mp4|ogg|webm|x-matroska|quicktime|x-ms-wmv)$/i.test(n[1])||/^audio\/(?:3gpp2|3gpp|aac|L16|midi|mp3|mp4|mpeg|oga|ogg|opus|x-m4a|x-matroska|x-wav|wav|webm)$/i.test(n[1])))throw Error("unsafe blob MIME type: ".concat(e.type));return new safe_url_impl_SafeUrlImpl(URL.createObjectURL(e))},image_utils_decodeToImageData=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark(function e(n){var t,r,o;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=safe_url_builders_fromBlob(new Blob([n],{type:"image/png"})),e.next=3,new Promise(function(e,n){var r=new Image;r.onload=function(){e(r)},r.onerror=function(){n()},r.src=index_unwrapSafeUrl(t)});case 3:return r=e.sent,o=document.createElement("canvas").getContext("2d"),o.canvas.width=112,o.canvas.height=112,o.drawImage(r,0,0,r.width,r.height,0,0,o.canvas.width,o.canvas.height),e.abrupt("return",o.getImageData(0,0,r.width,r.height));case 9:case"end":return e.stop()}},e)}));return function(n){return e.apply(this,arguments)}}(),image_utils_bufferToPixels=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark(function e(n){var t,r,o,i;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=new Uint8Array(n),e.next=3,image_utils_decodeToImageData(t);case 3:for(r=e.sent,o=[],i=0;ir.data[i+3]||o.push(intFromRgb([r.data[i],r.data[i+1],r.data[i+2]]));return e.abrupt("return",o);case 7:case"end":return e.stop()}},e)}));return function(n){return e.apply(this,arguments)}}(),index_seedFromImage=function(){var e=_asyncToGenerator(_regeneratorRuntime().mark(function e(n){var t,r,o,i,a,l,u,c,s,m,d,h,f,v,g,p,y,_,b,F,T,x,C,E,w,A,I,S,k,D,P,M,H,B,L,N,O,V,G,U,j,R,z,W,q,$,X,J,K,Q,Y,Z,ee,ne,te,re,oe,ie,ae,le,ue,ce,se,me,de,he,fe,ve,ge,pe,ye,_e,be,Fe,Te,xe,Ce,Ee,we,Ae,Ie,Se,ke,De,Pe,Me,He,Be,Le,Ne,Oe,Ve,Ge,Ue,je,Re,ze;return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("string"!=typeof n){e.next=8;break}return e.next=3,fetch(n);case 3:return e.next=5,e.sent.arrayBuffer();case 5:e.t0=e.sent,e.next=9;break;case 8:e.t0=n;case 9:return t=e.t0,e.next=12,image_utils_bufferToPixels(t);case 12:for(r=e.sent,o=new QuantizerWu,o.weights=Array.from({length:35937}).fill(0),o.momentsR=Array.from({length:35937}).fill(0),o.momentsG=Array.from({length:35937}).fill(0),o.momentsB=Array.from({length:35937}).fill(0),o.moments=Array.from({length:35937}).fill(0),l=new Map,u=0;u(4278190080&c)>>24>>>0||l.set(c,(null!==(a=l.get(c))&&void 0!==a?a:0)+1);s=_createForOfIteratorHelper(l.entries());try{for(s.s();!(m=s.n()).done;)d=_slicedToArray(m.value,2),h=d[0],f=d[1],v=h,g=f,p=(16711680&v)>>16,y=(65280&v)>>8,_=255&v,b=getIndex(1+(p>>3),1+(y>>3),1+(_>>3)),o.weights[b]=(null!==(i=o.weights[b])&&void 0!==i?i:0)+g,o.momentsR[b]+=g*p,o.momentsG[b]+=g*y,o.momentsB[b]+=g*_,o.moments[b]+=g*(p*p+y*y+_*_)}catch(e){s.e(e)}finally{s.f()}for(F=1;33>F;F++)for(T=Array.from({length:33}).fill(0),x=Array.from({length:33}).fill(0),C=Array.from({length:33}).fill(0),E=Array.from({length:33}).fill(0),w=Array.from({length:33}).fill(0),A=1;33>A;A++)for(I=0,S=0,k=0,D=0,P=0,M=1;33>M;M++)H=getIndex(F,A,M),I+=o.weights[H],S+=o.momentsR[H],k+=o.momentsG[H],D+=o.momentsB[H],P+=o.moments[H],T[M]+=I,x[M]+=S,C[M]+=k,E[M]+=D,w[M]+=P,B=getIndex(F-1,A,M),o.weights[H]=o.weights[B]+T[M],o.momentsR[H]=o.momentsR[B]+x[M],o.momentsG[H]=o.momentsG[B]+C[M],o.momentsB[H]=o.momentsB[B]+E[M],o.moments[H]=o.moments[B]+w[M];for(L=createBoxes(o).resultCount,N=[],O=0;Oge)){e.next=76;break}for(pe=0;pe=4*Ee)){e.next=58;break}return e.abrupt("continue",60);case 58:Se=$.distance(xe,te[Ie]),Se=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,u=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return i=t.done,t},e:function(t){u=!0,a=t},f:function(){try{i||null==e.return||e.return()}finally{if(u)throw a}}}}function _inherits(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),r&&_setPrototypeOf(t,r)}function _setPrototypeOf(t,r){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},_setPrototypeOf(t,r)}function _createSuper(t){var r=_isNativeReflectConstruct();return function(){var e,n=_getPrototypeOf(t);if(r){var o=_getPrototypeOf(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return _possibleConstructorReturn(this,e)}}function _possibleConstructorReturn(t,r){if(r&&("object"===_typeof(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t)}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},_getPrototypeOf(t)}function _typeof(t){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof(t)}function _toConsumableArray(t){return _arrayWithoutHoles(t)||_iterableToArray(t)||_unsupportedIterableToArray(t)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,r){if(t){if("string"==typeof t)return _arrayLikeToArray(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?_arrayLikeToArray(t,r):void 0}}function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}function _arrayLikeToArray(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e216/24389,o=[(n?r*r*r:(116*r-16)/e)*WHITE_POINT_D65[0],(8=t?12.92*t:1.055*Math.pow(t,1/2.4)-.055}function intFromRgb(t){return(-16777216|(255&t[0])<<16|(255&t[1])<<8|255&t[2])>>>0}function intFromXyzComponents(t,r,e){return t/=100,r/=100,e/=100,intFromRgb([Math.round(math_utils_clamp(255,255*delinearized(3.2406*t+-1.5372*r+-.4986*e))),Math.round(math_utils_clamp(255,255*delinearized(-.9689*t+1.8758*r+.0415*e))),Math.round(math_utils_clamp(255,255*delinearized(.0557*t+-.204*r+1.057*e)))])}function fromJchInViewingConditions(t,r,e){var n=e*Math.PI/180,o=1/.0228*Math.log(1+.0228*r*DEFAULT.fLRoot);return new CAM16(e,r,t,4/DEFAULT.c*Math.sqrt(t/100)*(DEFAULT.aw+4)*DEFAULT.fLRoot,50*Math.sqrt(r/Math.sqrt(t/100)*DEFAULT.c/(DEFAULT.aw+4)),(1+100*.007)*t/(1+.007*t),o*Math.cos(n),o*Math.sin(n))}function viewed(t){var r=Math.pow((0===t.chroma||0===t.j?0:t.chroma/Math.sqrt(t.j/100))/Math.pow(1.64-Math.pow(.29,DEFAULT.n),.73),1/.9),e=t.hue*Math.PI/180,n=DEFAULT.aw*Math.pow(t.j/100,1/DEFAULT.c/DEFAULT.z)/DEFAULT.nbb,o=Math.sin(e),a=Math.cos(e),i=23*(n+.305)*r/(5e4/13*(Math.cos(e+2)+3.8)*5.75*DEFAULT.nc*DEFAULT.ncb+11*r*a+108*r*o),u=i*a,s=i*o,l=(460*n+451*u+288*s)/1403,c=(460*n-891*u-261*s)/1403,h=(460*n-220*u-6300*s)/1403,f=100/DEFAULT.fl*math_utils_signum(l)*Math.pow(Math.max(0,27.13*Math.abs(l)/(400-Math.abs(l))),1/.42)/DEFAULT.rgbD[0],F=100/DEFAULT.fl*math_utils_signum(c)*Math.pow(Math.max(0,27.13*Math.abs(c)/(400-Math.abs(c))),1/.42)/DEFAULT.rgbD[1],p=100/DEFAULT.fl*math_utils_signum(h)*Math.pow(Math.max(0,27.13*Math.abs(h)/(400-Math.abs(h))),1/.42)/DEFAULT.rgbD[2];return intFromXyzComponents(1.86206786*f-1.01125463*F+.14918677*p,.38752654*f+.62144744*F-.00897398*p,-.0158415*f-.03412294*F+1.04996444*p)}function math_utils_clamp(t,r){return Math.min(Math.max(r,0),t)}function math_utils_sanitizeDegrees(t){return 0>t?t%360+360:360<=t?t%360:t}function hct_getIntInViewingConditions(t,r,e){if(1>r||0>=Math.round(e)||100<=Math.round(e))return intFromLstar(e);t=math_utils_sanitizeDegrees(t);for(var n=r,o=r,a=0,i=!0,u=null;.4<=Math.abs(a-n);){for(var s=t,l=o,c=e,h=0,f=100,F=void 0,p=1e3,y=1e3,E=null;.01d){var g=fromIntInViewingConditions(_),v=g.distance(fromJchInViewingConditions(g.j,g.chroma,s));1>=v&&v<=y&&(p=d,y=v,E=g)}if(0===p&&0===y)break;m>16)/255)+71.52*linearized(((65280&t)>>8)/255)+7.22*linearized((255&t)/255);return r/=100,r<=216/24389?24389/27*r:116*Math.pow(r,1/3)-16}function math_utils_signum(t){return 0>t?-1:0===t?0:1}function linearized(t){return.04045>=t?t/12.92:Math.pow((t+.055)/1.055,2.4)}function fromIntInViewingConditions(t){var r=100*linearized(((16711680&t)>>16)/255),e=100*linearized(((65280&t)>>8)/255),n=100*linearized((255&t)/255),o=.41233895*r+.35762064*e+.18051042*n,a=.2126*r+.7152*e+.0722*n,i=.01932141*r+.11916382*e+.95034478*n,u=DEFAULT.rgbD[0]*(.401288*o+.650173*a-.051461*i),s=DEFAULT.rgbD[1]*(-.250268*o+1.204414*a+.045854*i),l=DEFAULT.rgbD[2]*(-.002079*o+.048952*a+.953127*i),c=Math.pow(DEFAULT.fl*Math.abs(u)/100,.42),h=Math.pow(DEFAULT.fl*Math.abs(s)/100,.42),f=Math.pow(DEFAULT.fl*Math.abs(l)/100,.42),F=400*math_utils_signum(u)*c/(c+27.13),p=400*math_utils_signum(s)*h/(h+27.13),y=400*math_utils_signum(l)*f/(f+27.13),E=(11*F+-12*p+y)/11,_=(F+p-2*y)/9,m=180*Math.atan2(_,E)/Math.PI,d=0>m?m+360:360<=m?m-360:m,g=d*Math.PI/180,v=100*Math.pow((40*F+20*p+y)/20*DEFAULT.nbb/DEFAULT.aw,DEFAULT.c*DEFAULT.z),C=Math.pow(5e4/13*.25*(Math.cos((20.14>d?d+360:d)*Math.PI/180+2)+3.8)*DEFAULT.nc*DEFAULT.ncb*Math.sqrt(E*E+_*_)/((20*F+20*p+21*y)/20+.305),.9)*Math.pow(1.64-Math.pow(.29,DEFAULT.n),.73),A=C*Math.sqrt(v/100),b=1/.0228*Math.log(1+.0228*A*DEFAULT.fLRoot);return new CAM16(d,A,v,4/DEFAULT.c*Math.sqrt(v/100)*(DEFAULT.aw+4)*DEFAULT.fLRoot,50*Math.sqrt(C*DEFAULT.c/(DEFAULT.aw+4)),(1+100*.007)*v/(1+.007*v),b*Math.cos(g),b*Math.sin(g))}function fromInt(t){var r=fromIntInViewingConditions(t);return new HCT(r.hue,r.chroma,lstarFromInt(t))}function intFromHex(t){t=t.replace("#","");var r=3===t.length,e=6===t.length,n=8===t.length;if(!r&&!e&&!n)throw Error("unexpected hex "+t);var o=0,a=0,i=0;return r?(o=parseInt(t.slice(0,1).repeat(2),16),a=parseInt(t.slice(1,2).repeat(2),16),i=parseInt(t.slice(2,3).repeat(2),16)):e?(o=parseInt(t.slice(0,2),16),a=parseInt(t.slice(2,4),16),i=parseInt(t.slice(4,6),16)):n&&(o=parseInt(t.slice(2,4),16),a=parseInt(t.slice(4,6),16),i=parseInt(t.slice(6,8),16)),(-16777216|(255&o)<<16|(255&a)<<8|255&i)>>>0}function fromColor(t){var r=flags.is3p,e=new CorePalette(intFromHex(t));return new ThemeAdapter({tones:e,seed:t,is3p:r,overrides:{},blend:!1,isBaseline:!1})}function hexFromInt(t){var r,e=(65280&t)>>8,n=255&t,o=[((16711680&t)>>16).toString(16),e.toString(16),n.toString(16)],a=_createForOfIteratorHelper(o.entries());try{for(a.s();!(r=a.n()).done;){var i=_slicedToArray(r.value,2),u=i[0],s=i[1],l=u,c=s;1===c.length&&(o[l]="0"+c)}}catch(t){a.e(t)}finally{a.f()}return"#"+o.join("")}var BASELINE_1P={light:{background:"#FFFFFF",surface:"#FFFFFF"},dark:{},neutral:{},neutralVariant:{},primary:{},secondary:{},tertiary:{},error:{}};[[100,"#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF"],[99,"#FDFCFB","#FAFDFB","#FAFBFF","#F7FCFF","#F2FFEE","#FFFBF9"],[98,"#FAF9F9","#F8FAF8","#F8F9FF","#E3FFF6","#E8FFE7","#FFF8F6"],[95,"#F2F2F2","#EFF2EF","#ECF3FE","#DFF3FF","#E7F8ED","#FCEEEE"],[90,"#E3E3E3","#E1E3E1","#D3E3FD","#C2E7FF","#C4EED0","#F9DEDC"],[80,"#C7C7C7","#C4C7C5","#A8C7FA","#7FCFFF","#6DD58C","#F2B8B5"],[70,"#ABABAB","#A9ACAA","#7CACF8","#5AB3F0","#37BE5F","#EC928E"],[60,"#8F8F8F","#8E918F","#4C8DF6","#3998D3","#1EA446","#E46962"],[50,"#757575","#747775","#1B6EF3","#047DB7","#198639","#DC362E"],[40,"#5E5E5E","#5C5F5E","#0B57D0","#00639B","#146C2E","#B3261E"],[35,"#525252","#4F5351","#155298","#005E4E","#006024","#833D3B"],[30,"#474747","#444746","#0842A0","#004A77","#0F5223","#8C1D18"],[25,"#3A3C3C","#393C3B","#003B77","#004438","#004618","#662726"],[20,"#303030","#2D312F","#062E6F","#003355","#0A3818","#601410"],[10,"#1F1F1F","#191D1C","#041E49","#001D35","#072711","#410E0B"],[0,"#000000","#000000","#000000","#000000","#000000","#000000"]].forEach(function(t){var r="luminance".concat(t[0]);BASELINE_1P.neutral[r]=t[1],BASELINE_1P.neutralVariant[r]=t[2],BASELINE_1P.primary[r]=t[3],BASELINE_1P.secondary[r]=t[4],BASELINE_1P.tertiary[r]=t[5],BASELINE_1P.error[r]=t[6]});var BASELINE_3P={light:{},dark:{},neutral:{},neutralVariant:{},primary:{},secondary:{},tertiary:{}};BASELINE_3P.error=BASELINE_1P.error,[[100,"#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF"],[99,"#FFFBFE","#FFFBFE","#FFFBFE","#FFFBFE","#FFFBFA"],[98,"#FDF8FC","#FEF7FF","#FEF7FF","#FEF7FF","#FFF8F9"],[95,"#F4EFF4","#F5EEFA","#F6EDFF","#F6EDFF","#FFECF1"],[90,"#E6E1E5","#E7E0EC","#EADDFF","#E8DEF8","#FFD8E4"],[80,"#C9C5CA","#CAC4D0","#D0BCFF","#CCC2DC","#EFB8C8"],[70,"#AEAAAE","#AEA9B4","#B69DF8","#B0A7C0","#D29DAC"],[60,"#939094","#938F99","#9A82DB","#958DA5","#B58392"],[50,"#787579","#79747E","#7F67BE","#7A7289","#986977"],[40,"#605D62","#605D66","#6750A4","#625B71","#7D5260"],[35,"#545255","#54515A","#5B4497","#564F65","#704653"],[30,"#484649","#49454F","#4F378B","#4A4458","#633B48"],[25,"#3D3B3E","#3D3A43","#432B7E","#3E384D","#57303D"],[20,"#313033","#322F37","#381E72","#332D41","#492532"],[10,"#1C1B1F","#1D1A22","#21005D","#1D192B","#31111D"],[0,"#000000","#000000","#000000","#000000","#000000"]].forEach(function(t){var r="luminance".concat(t[0]);BASELINE_3P.neutral[r]=t[1],BASELINE_3P.neutralVariant[r]=t[2],BASELINE_3P.primary[r]=t[3],BASELINE_3P.secondary[r]=t[4],BASELINE_3P.tertiary[r]=t[5]});var ThemeAdapterBase=function(){function t(r){_classCallCheck(this,t),this.props=r}return _createClass(t,[{key:"isBaseline",get:function(){return checks_isThemeBaseline(this.save())}},{key:"is3p",get:function(){return this.props.is3p}},{key:"imageUrl",get:function(){return this.props.imageUrl}},{key:"light",get:function(){var t,r,e,n,o,a,i,u,s,l,c,h,f,F,p,y,E,_,m,d,g,v,C,A,b,T,D,I,w,M,P=this.props.isBaseline?null===(t=flags.is1p?BASELINE_1P:BASELINE_3P)||void 0===t?void 0:t.light:null!==(e=null===(r=this.props.overrides)||void 0===r?void 0:r.light)&&void 0!==e?e:{},S=this.palettes,k={};return[[n,"primary","P-40"],[o,"onPrimary","P-100"],[a,"primaryContainer","P-90"],[i,"onPrimaryContainer","P-10"],[u,"secondary","S-40"],[s,"onSecondary","S-100"],[l,"secondaryContainer","S-90"],[c,"onSecondaryContainer","S-10"],[h,"tertiary","T-40"],[f,"onTertiary","T-100"],[F,"tertiaryContainer","T-90"],[p,"onTertiaryContainer","T-10"],[y,"error","E-40"],[E,"errorContainer","E-90"],[_,"onError","E-100"],[m,"onErrorContainer","E-10"],[d,"background","N-99"],[g,"onBackground","N-10"],[v,"surface","N-99"],[C,"onSurface","N-10"],[A,"surfaceVariant","NV-90"],[b,"onSurfaceVariant","NV-30"],[T,"outline","NV-50"],[D,"inverseOnSurface","N-95"],[I,"inverseSurface","N-20"],[w,"inversePrimary","P-80"],[M,"shadow","N-0"]].forEach(function(t){k[t[1]]=unknown_function1(t[0],t[1],t[2],P,S)}),k}},{key:"dark",get:function(){var t,r,e,n,o,a,i,u,s,l,c,h,f,F,p,y,E,_,m,d,g,v,C,A,b,T,D,I,w,M,P=this.props.isBaseline?null===(t=flags.is1p?BASELINE_1P:BASELINE_3P)||void 0===t?void 0:t.dark:null!==(e=null===(r=this.props.overrides)||void 0===r?void 0:r.dark)&&void 0!==e?e:{},S=this.palettes,k={};return[[n,"primary","P-80"],[o,"onPrimary","P-20"],[a,"primaryContainer","P-30"],[i,"onPrimaryContainer","P-90"],[u,"secondary","S-80"],[s,"onSecondary","S-20"],[l,"secondaryContainer","S-30"],[c,"onSecondaryContainer","S-90"],[h,"tertiary","T-80"],[f,"onTertiary","T-20"],[F,"tertiaryContainer","T-30"],[p,"onTertiaryContainer","T-90"],[y,"error","E-80"],[E,"errorContainer","E-30"],[_,"onError","E-20"],[m,"onErrorContainer","E-90"],[d,"background","N-10"],[g,"onBackground","N-90"],[v,"surface","N-10"],[C,"onSurface","N-90"],[A,"surfaceVariant","NV-30"],[b,"onSurfaceVariant","NV-80"],[T,"outline","NV-60"],[D,"inverseOnSurface","N-10"],[I,"inverseSurface","N-90"],[w,"inversePrimary","P-40"],[M,"shadow","N-0"]].forEach(function(t){k[t[1]]=unknown_function1(t[0],t[1],t[2],P,S)}),k}},{key:"tonalGroups",get:function(){var t=this,r={};return["primary","secondary","tertiary","neutral","neutralVariant","error"].forEach(function(e){r[e]=t["".concat(e,"Group")]}),Object.assign(r,this.props.overrides.tonalGroups)}},{key:"primaryGroup",get:function(){return getColorGroup(this,"primary",this.props.tones.a1)}},{key:"secondaryGroup",get:function(){return getColorGroup(this,"secondary",this.props.tones.a2)}},{key:"tertiaryGroup",get:function(){return getColorGroup(this,"tertiary",this.props.tones.a3)}},{key:"neutralGroup",get:function(){return getColorGroup(this,"neutral",this.props.tones.n1)}},{key:"neutralVariantGroup",get:function(){return getColorGroup(this,"neutralVariant",this.props.tones.n2)}},{key:"errorGroup",get:function(){return getColorGroup(this,"error",this.props.tones.error)}},{key:"primary",get:function(){return tonal_group_convertTonalGroupToMap("P",this.primaryGroup)}},{key:"secondary",get:function(){return tonal_group_convertTonalGroupToMap("S",this.secondaryGroup)}},{key:"tertiary",get:function(){return tonal_group_convertTonalGroupToMap("T",this.tertiaryGroup)}},{key:"neutral",get:function(){return tonal_group_convertTonalGroupToMap("N",this.neutralGroup)}},{key:"neutralVariant",get:function(){return tonal_group_convertTonalGroupToMap("NV",this.neutralVariantGroup)}},{key:"error",get:function(){return tonal_group_convertTonalGroupToMap("E",this.errorGroup)}},{key:"palettes",get:function(){var t=this,r=[];return["primary","secondary","tertiary","neutral","neutralVariant","error"].forEach(function(e){r=r.concat(Array.from(t[e].entries()))}),new Map(r)}},{key:"seedValue",get:function(){return this.props.seed}},{key:"source",get:function(){function t(t,r,e){return null!==(t=null==l?void 0:l[r])&&void 0!==t?t:e}var r,e,n,o,a,i,u=this,s=this.palettes,l=this.props.overrides.source,c={seed:this.seedValue,imageUrl:this.imageUrl};return[[r,"primary","P"],[e,"secondary","S"],[n,"tertiary","T"],[o,"neutral","N"],[a,"neutralVariant","NV"],[i,"error","E"]].forEach(function(r){c[r[1]]=t(r[0],r[1],getPrimaryTonal(u,r[2],s))}),Object.assign(Object.assign({},l),c)}},{key:"customColors",get:function(){var t,r;return _toConsumableArray(null!==(r=null===(t=this.props.overrides)||void 0===t?void 0:t.customColors)&&void 0!==r?r:[])}},{key:"save",value:function(){var t={light:this.light,dark:this.dark};return t}}]),t}(),ThemeAdapter=function(t){function r(){return _classCallCheck(this,r),e.apply(this,arguments)}_inherits(r,t);var e=_createSuper(r);return _createClass(r)}(ThemeAdapterBase),TonalPalette=function(){function t(r,e){var n=arguments,o=this;_classCallCheck(this,t),["hue","chroma"].forEach(function(t,r){o[t]=n[r]}),this.cache=new Map}return _createClass(t,[{key:"tone",value:function(t){var r=this.cache.get(t);return void 0===r&&(r=new HCT(this.hue,this.chroma,t).toInt(),this.cache.set(t,r)),r}}]),t}(),HCT=function(){function t(){var r=arguments,e=this;_classCallCheck(this,t),["internalHue","internalChroma","internalTone"].forEach(function(t,n){e[t]=r[n]}),setInternalState(this,this.toInt())}return _createClass(t,[{key:"toInt",value:function(){return hct_getIntInViewingConditions(math_utils_sanitizeDegrees(this.internalHue),this.internalChroma,math_utils_clamp(100,this.internalTone))}},{key:"hue",get:function(){return this.internalHue},set:function(t){setInternalState(this,hct_getIntInViewingConditions(math_utils_sanitizeDegrees(math_utils_sanitizeDegrees(t)),this.internalChroma,math_utils_clamp(100,this.internalTone)))}},{key:"chroma",get:function(){return this.internalChroma},set:function(t){setInternalState(this,hct_getIntInViewingConditions(math_utils_sanitizeDegrees(this.internalHue),t,math_utils_clamp(100,this.internalTone)))}},{key:"tone",get:function(){return this.internalTone},set:function(t){setInternalState(this,hct_getIntInViewingConditions(math_utils_sanitizeDegrees(this.internalHue),this.internalChroma,math_utils_clamp(100,t)))}}]),t}(),CAM16=function(){function t(){var r=arguments,e=this;_classCallCheck(this,t),["hue","chroma","j","q","s","jstar","astar","bstar"].forEach(function(t,n){e[t]=r[n]})}return _createClass(t,[{key:"distance",value:function(t){var r=this.jstar-t.jstar,e=this.astar-t.astar,n=this.bstar-t.bstar;return 1.41*Math.pow(Math.sqrt(r*r+e*e+n*n),.63)}}]),t}(),ViewingConditions=_createClass(function t(){var r=arguments,e=this;_classCallCheck(this,t),["n","aw","nbb","ncb","c","nc","rgbD","fl","fLRoot","z"].forEach(function(t,n){e[t]=r[n]})}),WHITE_POINT_D65=[95.047,100,108.883],DEFAULT=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:WHITE_POINT_D65,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200/Math.PI*100*Math.pow(66/116,3)/100,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:50,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2,o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],a=.401288*t[0]+.650173*t[1]+-.051461*t[2],i=-.250268*t[0]+1.204414*t[1]+.045854*t[2],u=-.002079*t[0]+.048952*t[1]+.953127*t[2],s=.8+n/10;if(.9<=s)var l=10*(s-.9),c=.59*(1-l)+.69*l;else{var h=10*(s-.8);c=.525*(1-h)+.59*h}var f=o?1:s*(1-1/3.6*Math.exp((-r-42)/92));f=1f?0:f;var F=[100/a*f+1-f,100/i*f+1-f,100/u*f+1-f],p=1/(5*r+1),y=p*p*p*p,E=1-y,_=y*r+.1*E*E*Math.cbrt(5*r),m=(8