platypush/platypush/backend/http/webapp/dist/static/js/chunk-cc8a6536.a5da26b6.js

2 lines
33 KiB
JavaScript
Raw Normal View History

2021-04-06 21:10:48 +02:00
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-cc8a6536"],{"084e":function(e,t,n){"use strict";n("1015")},1015:function(e,t,n){},1804:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));n("99af"),n("d81d"),n("b680"),n("b64b");var i=n("2909");function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function c(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}var a=function(){function e(t){if(o(this,e),this.ranges={hue:[0,360],sat:[0,100],bri:[0,100],ct:[154,500]},t)for(var n=0,i=Object.keys(this.ranges);n<i.length;n++){var r=i[n];t[r]&&(this.ranges[r]=t[r])}}return c(e,[{key:"normalize",value:function(e,t,n){return n[0]+(e-t[0])*(n[1]-n[0])/(t[1]-t[0])}},{key:"hslToRgb",value:function(e,t,n){var i=[this.normalize(e,this.ranges.hue,[0,360]),this.normalize(t,this.ranges.sat,[0,100]),this.normalize(n,this.ranges.bri,[0,100])];e=i[0],t=i[1],n=i[2],n/=100;var o=t*Math.min(n,1-n)/100,r=function(t){var i=(t+e/30)%12,r=n-o*Math.max(Math.min(i-3,9-i,1),-1);return Math.round(255*r)};return[r(0),r(8),r(4)]}},{key:"rgbToHsl",value:function(e,t,n){e/=255,t/=255,n/=255;var i,o,r=Math.max(e,t,n),c=Math.min(e,t,n),a=(r+c)/2;if(r===c)i=o=0;else{var s=r-c;switch(o=a>.5?s/(2-r-c):s/(r+c),r){case e:i=(t-n)/s+(t<n?6:0);break;case t:i=(n-e)/s+2;break;case n:i=(e-t)/s+4;break}i/=6}return[parseInt(this.normalize(i,[0,1],this.ranges.hue)),parseInt(this.normalize(o,[0,1],this.ranges.sat)),parseInt(this.normalize(a,[0,1],this.ranges.bri))]}},{key:"xyToRgb",value:function(e,t,n){null==n&&(n=this.ranges.bri[1]);var i=1-e-t,o=(n/(this.ranges.bri[1]-1)).toFixed(2),r=o/t*e,c=o/t*i,a=1.656492*r-.354851*o-.255038*c,s=.707196*-r+1.655397*o+.036152*c,l=.051713*r-.121364*o+1.01153*c;return a>l&&a>s&&a>1?(s/=a,l/=a,a=1):s>l&&s>a&&s>1?(a/=s,l/=s,s=1):l>a&&l>s&&l>1&&(a/=l,s/=l,l=1),a=a<=.0031308?12.92*a:1.055*Math.pow(a,1/2.4)-.055,s=s<=.0031308?12.92*s:1.055*Math.pow(s,1/2.4)-.055,l=l<=.0031308?12.92*l:1.055*Math.pow(l,1/2.4)-.055,a=Math.round(255*a),s=Math.round(255*s),l=Math.round(255*l),isNaN(a)&&(a=0),isNaN(s)&&(s=0),isNaN(l)&&(l=0),[a,s,l].map((function(e){return Math.min(Math.max(0,e),255)}))}},{key:"rgbToXY",value:function(e,t,n){e>1&&(e/=255),t>1&&(t/=255),n>1&&(n/=255),e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92,t=t>.04045?Math.pow((t+.055)/1.055,2.4):t/12.92,n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92;var i=.664511*e+.154324*t+.162028*n,o=.283881*e+.668433*t+.047685*n,r=88e-6*e+.07231*t+.986039*n,c=parseFloat((i/(i+o+r)).toFixed(4)),a=parseFloat((o/(i+o+r)).toFixed(4));return isNaN(c)&&(c=0),isNaN(a)&&(a=0),[c,a]}},{key:"rgbToBri",value:function(e,t,n){return Math.min(2*this.rgbToHsl(e,t,n)[2],this.ranges.bri[1])}},{key:"getRGB",value:function(e){return null!=e.red&&null!=e.green&&null!=e.blue?[e.red,e.green,e.blue]:null!=e.r&&null!=e.g&&null!=e.b?[e.r,e.g,e.b]:e.rgb?e.rgb:void 0}},{key:"getXY",value:function(e){return null!=e.x&&null!=e.y?[e.x,e.y]:e.xy?e.xy:void 0}},{key:"toRGB",value:function(e){var t=this.getRGB(e);if(t)return t;var n=this.getXY(e);return n&&e.bri?this.xyToRgb.apply(this,Object(i["a"])(n).concat([e.bri])):e.hue&&e.sat&&e.bri?this.hslToRgb(e.hue,e.sat,e.bri):(console.debug("Could not determine color space"),void console.debug(e))}},{key:"toXY",value:function(e){var t=this.getXY(e);if(t&&e.bri)return[t[0],t[1],e.bri];var n=this.getRGB(e);if(n)return this.rgbToXY.apply(this,Object(i["a"])(n));if(e.hue&&e.sat&&e.bri){var o=this.hslToRgb(e.hue,e.sat,e.bri);return this.rgbToXY.apply(this,Object(i["a"])(o))}console.debug("Could not determine color space"),console.debug(e)}},{key:"toHSL",value:function(e){if(e.hue&&e.sat&&e.bri)return[e.hue,e.sat,e.bri];var t=this.getRGB(e);if(t)return this.rgbToHsl.apply(this,Object(i["a"])(t));var n=this.getXY(e);if(n&&e.bri){var o=this.xyToRgb.apply(this,Object(i["a"])(n).concat([e.bri]));return this.rgbToHsl.apply(this,Object(i["a"])(o))}console.debug("Could not dete
//# sourceMappingURL=chunk-cc8a6536.a5da26b6.js.map