platypush/platypush/backend/http/webapp/dist/static/js/4848.67b4ebfe.js

2 lines
35 KiB
JavaScript
Raw Normal View History

2022-11-12 16:31:35 +01:00
"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[4848],{4212:function(e,t,s){s.d(t,{N:function(){return i}});class i{constructor(e){if(this.ranges={hue:[0,360],sat:[0,100],bri:[0,100],ct:[154,500]},e)for(const t of Object.keys(this.ranges))e[t]&&(this.ranges[t]=e[t])}normalize(e,t,s){return s[0]+(e-t[0])*(s[1]-s[0])/(t[1]-t[0])}hslToRgb(e,t,s){[e,t,s]=[this.normalize(e,this.ranges.hue,[0,360]),this.normalize(t,this.ranges.sat,[0,100]),this.normalize(s,this.ranges.bri,[0,100])],s/=100;const i=t*Math.min(s,1-s)/100,a=t=>{const a=(t+e/30)%12,n=s-i*Math.max(Math.min(a-3,9-a,1),-1);return Math.round(255*n)};return[a(0),a(8),a(4)]}rgbToHsl(e,t,s){e/=255,t/=255,s/=255;const i=Math.max(e,t,s),a=Math.min(e,t,s);let n,l,r=(i+a)/2;if(i===a)n=l=0;else{const o=i-a;switch(l=r>.5?o/(2-i-a):o/(i+a),i){case e:n=(t-s)/o+(t<s?6:0);break;case t:n=(s-e)/o+2;break;case s:n=(e-t)/o+4;break}n/=6}return[parseInt(this.normalize(n,[0,1],this.ranges.hue)),parseInt(this.normalize(l,[0,1],this.ranges.sat)),parseInt(this.normalize(r,[0,1],this.ranges.bri))]}xyToRgb(e,t,s){null==s&&(s=this.ranges.bri[1]);const i=1-e-t,a=(s/(this.ranges.bri[1]-1)).toFixed(2),n=a/t*e,l=a/t*i;let r=1.656492*n-.354851*a-.255038*l,o=.707196*-n+1.655397*a+.036152*l,d=.051713*n-.121364*a+1.01153*l;return r>d&&r>o&&r>1?(o/=r,d/=r,r=1):o>d&&o>r&&o>1?(r/=o,d/=o,o=1):d>r&&d>o&&d>1&&(r/=d,o/=d,d=1),r=r<=.0031308?12.92*r:1.055*Math.pow(r,1/2.4)-.055,o=o<=.0031308?12.92*o:1.055*Math.pow(o,1/2.4)-.055,d=d<=.0031308?12.92*d:1.055*Math.pow(d,1/2.4)-.055,r=Math.round(255*r),o=Math.round(255*o),d=Math.round(255*d),isNaN(r)&&(r=0),isNaN(o)&&(o=0),isNaN(d)&&(d=0),[r,o,d].map((e=>Math.min(Math.max(0,e),255)))}rgbToXY(e,t,s){e>1&&(e/=255),t>1&&(t/=255),s>1&&(s/=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,s=s>.04045?Math.pow((s+.055)/1.055,2.4):s/12.92;const i=.664511*e+.154324*t+.162028*s,a=.283881*e+.668433*t+.047685*s,n=88e-6*e+.07231*t+.986039*s;let l=parseFloat((i/(i+a+n)).toFixed(4)),r=parseFloat((a/(i+a+n)).toFixed(4));return isNaN(l)&&(l=0),isNaN(r)&&(r=0),[l,r]}rgbToBri(e,t,s){return Math.min(2*this.rgbToHsl(e,t,s)[2],this.ranges.bri[1])}getRGB(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}getXY(e){return null!=e.x&&null!=e.y?[e.x,e.y]:e.xy?e.xy:void 0}toRGB(e){const t=this.getRGB(e);if(t)return t;const s=this.getXY(e);return s&&e.bri?this.xyToRgb(...s,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))}toXY(e){const t=this.getXY(e);if(t&&e.bri)return[t[0],t[1],e.bri];const s=this.getRGB(e);if(s)return this.rgbToXY(...s);if(e.hue&&e.sat&&e.bri){const t=this.hslToRgb(e.hue,e.sat,e.bri);return this.rgbToXY(...t)}console.debug("Could not determine color space"),console.debug(e)}toHSL(e){if(e.hue&&e.sat&&e.bri)return[e.hue,e.sat,e.bri];const t=this.getRGB(e);if(t)return this.rgbToHsl(...t);const s=this.getXY(e);if(s&&e.bri){const t=this.xyToRgb(...s,e.bri);return this.rgbToHsl(...t)}console.debug("Could not determine color space"),console.debug(e)}hexToRgb(e){return[e.slice(1,3),e.slice(3,5),e.slice(5,7)].map((e=>parseInt(e,16)))}rgbToHex(e){return"#"+e.map((e=>{let t=e.toString(16);return t.length<2&&(t="0"+t),t})).join("")}}},6237:function(e,t,s){s.d(t,{Z:function(){return m}});var i=s(6252),a=s(3577),n=s(9963);const l={class:"slider-wrapper"},r=["min","max","step","disabled","value"],o={class:"track-inner",ref:"track"},d={class:"thumb",ref:"thumb"},u=["textContent"];function c(e,t,s,c,v,p){return(0,i.wg)(),(0,i.iD)("label",l,[(0,i._)("input",{class:(0,a.C_)(["slider",{"with-label":s.withLabel}]),type:"range",min:s.range[0],max:s.range[1],step:s.step,disabled:s.disabled,value:s.value,ref:"range",onInput:t[0]||(t[0]=(0,n.iM)(((...e)=>p.onUpdate&&p.onUpdate(...e)),["stop"])),onChange:t[1]||(t[1]=(0,n.iM)(((...e)=>p.onUpdate&&p.onUpdate(...e)),["stop"]))},null,42,r),(0,i._)("div",{class:(0,a.C_)(["track",{"with-label":s.with
//# sourceMappingURL=4848.67b4ebfe.js.map