site_oueb_2/wp-includes/js/jquery/jquery.color.min.js

3 lines
6.9 KiB
JavaScript
Raw Normal View History

2022-11-22 20:23:31 +01:00
/*! jQuery Color v2.2.0 http://github.com/jquery/jquery-color | jquery.org/license */
!function(r,n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof exports?module.exports=n(require("jquery")):n(r.jQuery)}(this,function(l,f){var c,t={},n=t.toString,p=/^([\-+])=\s*(\d+\.?\d*)/,r=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(r){return[r[1],r[2],r[3],r[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(r){return[2.55*r[1],2.55*r[2],2.55*r[3],r[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?/,parse:function(r){return[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16),r[4]?(parseInt(r[4],16)/255).toFixed(2):1]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])?/,parse:function(r){return[parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16),r[4]?(parseInt(r[4]+r[4],16)/255).toFixed(2):1]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(r){return[r[1],r[2]/100,r[3]/100,r[4]]}}],d=l.Color=function(r,n,t,e){return new l.Color.fn.parse(r,n,t,e)},h={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},b={byte:{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},i=d.support={},e=l("<p>")[0],g=l.each;function x(r){return null==r?r+"":"object"==typeof r?t[n.call(r)]||"object":typeof r}function y(r,n,t){var e=b[n.type]||{};return null==r?t||!n.def?null:n.def:(r=e.floor?~~r:parseFloat(r),isNaN(r)?n.def:e.mod?(r+e.mod)%e.mod:Math.min(e.max,Math.max(0,r)))}function s(i){var s=d(),u=s._rgba=[];return i=i.toLowerCase(),g(r,function(r,n){var t,e=n.re.exec(i),o=e&&n.parse(e),a=n.space||"rgba";if(o)return t=s[a](o),s[h[a].cache]=t[h[a].cache],u=s._rgba=t._rgba,!1}),u.length?("0,0,0,0"===u.join()&&l.extend(u,c.transparent),s):c[i]}function u(r,n,t){return 6*(t=(t+1)%1)<1?r+(n-r)*t*6:2*t<1?n:3*t<2?r+(n-r)*(2/3-t)*6:r}e.style.cssText="background-color:rgba(1,1,1,.5)",i.rgba=-1<e.style.backgroundColor.indexOf("rgba"),g(h,function(r,n){n.cache="_"+r,n.props.alpha={idx:3,type:"percent",def:1}}),l.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(r,n){t["[object "+n+"]"]=n.toLowerCase()}),d.fn=l.extend(d.prototype,{parse:function(o,r,n,t){if(o===f)return this._rgba=[null,null,null,null],this;(o.jquery||o.nodeType)&&(o=l(o).css(r),r=f);var a=this,e=x(o),i=this._rgba=[];return r!==f&&(o=[o,r,n,t],e="array"),"string"===e?this.parse(s(o)||c._default):"array"===e?(g(h.rgba.props,function(r,n){i[n.idx]=y(o[n.idx],n)}),this):"object"===e?(g(h,o instanceof d?function(r,n){o[n.cache]&&(a[n.cache]=o[n.cache].slice())}:function(r,t){var e=t.cache;g(t.props,function(r,n){if(!a[e]&&t.to){if("alpha"===r||null==o[r])return;a[e]=t.to(a._rgba)}a[e][n.idx]=y(o[r],n,!0)}),a[e]&&l.inArray(null,a[e].slice(0,3))<0&&(null==a[e][3]&&(a[e][3]=1),t.from&&(a._rgba=t.from(a[e])))}),this):void 0},is:function(r){var o=d(r),a=!0,i=this;return g(h,function(r,n){var t,e=o[n.cache];return e&&(t=i[n.cache]||n.to&&n.to(i._rgba)||[],g(n.props,function(r,n){if(null!=e[n.idx])return a=e[n.idx]===t[n.idx]})),a}),a},_space:function(){var t=[],e=this;return g(h,function(r,n){e[n.cache]&&t.push(r)}),t.pop()},transition:function(r,i){var n=(l=d(r))._space(),t=h[n],e=0===this.alpha()?d("transparent"):this,s=e[t.cache]||t.to(e._rgba),u=s.slice(),l=l[t.cache];return g(t.props,function(r,n){var t=n.idx,e=s[t],o=l[t],a=b[n.type]||{};null!==o&&(null===e?u[t]=o:(a.mod&&(a.mod/2<o-e?e+=a.mod:a.mod/2<e-o&&(e-=a.mod)),u[t]=y((o-e)*i+e,n)))}),this[n](u)},blend:function(r){if(1===this._rgba[3])return this;var n=this._rgba.slice(),t=n.pop(),e=d(r)._rgba;return d(l.map(n,function(r,n){return(1-t)*e[n]+t*r}))},toRgbaString:function(){var r="rgba(",n=l.map(this._rgba,function(r,n){return null!=r?r:2<n?1:0});return 1===n[3]&&(n.pop(),r="rgb("),r+n.join()+")"},toHslaString:function(){var r="hsla(",n=l.