From 5cc5d0d1ea0051560b0563373b7bbaa9a7db11b6 Mon Sep 17 00:00:00 2001 From: Niels Holt Date: Sat, 16 Dec 2023 18:32:18 +0100 Subject: [PATCH] New main version - see readme.md --- README.md | 37 +- bower.json | 13 +- demo/bower_components.js | 5749 ++++++++++++++++++++++------ demo/demo.css | 58 +- demo/demo.css.map | 2 +- demo/demo.scss | 14 + demo/index.html | 28 +- dist/fcoo-colors.css | 135 + dist/fcoo-colors.js | 101 +- gruntfile.js | 2 +- package.json | 4 +- src/_fcoo-colors-include.scss | 25 + src/_fcoo-colors-mixin.scss | 77 +- src/_fcoo-colors-variables.css | 48 + src/_fcoo-colors-variables.css.map | 1 + src/_fcoo-colors-variables.scss | 95 + src/fcoo-colors.css | 135 + src/fcoo-colors.css.map | 1 + src/fcoo-colors.js | 101 +- src/fcoo-colors.scss | 67 + yarn.lock | 245 +- 21 files changed, 5512 insertions(+), 1426 deletions(-) create mode 100644 dist/fcoo-colors.css create mode 100644 src/_fcoo-colors-include.scss create mode 100644 src/_fcoo-colors-variables.css create mode 100644 src/_fcoo-colors-variables.css.map create mode 100644 src/_fcoo-colors-variables.scss create mode 100644 src/fcoo-colors.css create mode 100644 src/fcoo-colors.css.map create mode 100644 src/fcoo-colors.scss diff --git a/README.md b/README.md index 6bbfefa..9fb1a90 100644 --- a/README.md +++ b/README.md @@ -19,10 +19,35 @@ This packages contains JS and SCSS variables defining the different colors and a To include the variables and functions in a SCSS-file add - @import "../bower-components/fcoo-colors/src/fcoo-colors-mixin"; + @import "../bower-components/fcoo-colors/src/fcoo-colors-include"; +### chroma.js +Include [chroma.js](https://github.com/gka/chroma.js) to adjust colors + + +### "Time" colors + +Includes scss-variables, css-var, scss-functions and css-classes for colors representing the past, the present (now), and the future. + +See `src/fcoo-colors.scss` for details + +### FCOO Application Base Color + +Includes scss-variables, css-var, scss-functions and css-classes for the basic color for FCOO Web Applications. + +By default it is DALO color in "Forsvarsministeriets koncernfælles Designmanual 2018" + +See `src/fcoo-colors.scss` for details + +### Methods + + window.fcoo.setRootVar(id, value) //Sets :root {--id: value} + window.fcoo.getRootVar(id) //Gets value form :root {id: value} + + window.fcoo.color.setApplicationBaseColor(baseColor) //Sets new value for FCOO Application Base Color + ## Installation ### bower `bower install https://github.com/FCOO/fcoo-colors.git --save` @@ -33,7 +58,7 @@ http://FCOO.github.io/fcoo-colors/demo/ ## Usage ###In SCSS-files - @import "../bower-components/fcoo-colors/src/fcoo-colors-mixin"; + @import "../bower-components/fcoo-colors/src/fcoo-colors-include"; .color-pink { background-color: fc-get-color($fc-pink); @@ -54,10 +79,10 @@ http://FCOO.github.io/fcoo-colors/demo/ window.fcoo.color.defaultOrder // = ["blue", "red", "green", "yellow", "gray", "purple", "pink", "cyan", "orange"]; window.fcoo.color.getColor("blue") //Return "#123456" - window.fcoo.color.getColor(2); //Same as getColor("green") + window.fcoo.color.getColor(2); //Same as getColor("green") - window.fcoo.color.getColorRGB("blue") //Return {red:NUMBER, green:NUMBER, blue:NUMBER, alpha:NUMBER} - window.fcoo.color.getColorRGBArray("blue") //Return [red, green, blue, alpha] + window.fcoo.color.getColorRGB("blue") //Return {red:NUMBER, green:NUMBER, blue:NUMBER, alpha:NUMBER} + window.fcoo.color.getColorRGBArray("blue") //Return [red, green, blue, alpha] window.fcoo.color.getDeltaColor("blue", 3); //Return "blue" 3 gradiants darker that the default gradiant @@ -72,7 +97,7 @@ http://FCOO.github.io/fcoo-colors/demo/ ## Copyright and License This plugin is licensed under the [MIT license](https://github.com/FCOO/fcoo-colors/LICENSE). -Copyright (c) 2021 [FCOO](https://github.com/FCOO) +Copyright (c) 2023 [FCOO](https://github.com/FCOO) ## Contact information diff --git a/bower.json b/bower.json index 2af0d02..d8c7f35 100644 --- a/bower.json +++ b/bower.json @@ -1,19 +1,26 @@ { "name": "fcoo-colors", - "version": "1.2.0", + "version": "2.0.0", "homepage": "https://github.com/FCOO/fcoo-colors", "authors": [ "Niels Holt" ], "description": "", - "main": "dist/fcoo-colors.js", + "main": [ + "dist/fcoo-colors.js", + "dist/fcoo-colors.css" + ], "repository": { "type": "git", "url": "git://github.com/FCOO/fcoo-colors.git" }, "dependencies": { + "jquery": "latest", "sass-color-helpers": "latest", - "javascript-utilities": "fcoo/javascript-utilities#latest" + "javascript-utilities": "fcoo/javascript-utilities#latest", + "chroma.js": "gka/chroma.js#^2.4.0", + "leaflet-bootstrap-marker-mixin": "fcoo/leaflet-bootstrap-marker-mixin#latest", + "leaflet-polyline-mixin": "fcoo/leaflet-polyline-mixin#latest" }, "devDependencies": {}, "license": "MIT", diff --git a/demo/bower_components.js b/demo/bower_components.js index 4087daf..d6cef40 100644 --- a/demo/bower_components.js +++ b/demo/bower_components.js @@ -1,15 +1,3588 @@ +/** + * chroma.js - JavaScript library for color conversions + * + * Copyright (c) 2011-2019, Gregor Aisch + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. The name Gregor Aisch may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL GREGOR AISCH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ------------------------------------------------------- + * + * chroma.js includes colors from colorbrewer2.org, which are released under + * the following license: + * + * Copyright (c) 2002 Cynthia Brewer, Mark Harrower, + * and The Pennsylvania State University. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the License. + * + * ------------------------------------------------------ + * + * Named colors are taken from X11 Color Names. + * http://www.w3.org/TR/css3-color/#svg-color + * + * @preserve + */ + +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.chroma = factory()); +})(this, (function () { 'use strict'; + + var limit$2 = function (x, min, max) { + if ( min === void 0 ) min=0; + if ( max === void 0 ) max=1; + + return x < min ? min : x > max ? max : x; + }; + + var limit$1 = limit$2; + + var clip_rgb$3 = function (rgb) { + rgb._clipped = false; + rgb._unclipped = rgb.slice(0); + for (var i=0; i<=3; i++) { + if (i < 3) { + if (rgb[i] < 0 || rgb[i] > 255) { rgb._clipped = true; } + rgb[i] = limit$1(rgb[i], 0, 255); + } else if (i === 3) { + rgb[i] = limit$1(rgb[i], 0, 1); + } + } + return rgb; + }; + + // ported from jQuery's $.type + var classToType = {}; + for (var i$1 = 0, list$1 = ['Boolean', 'Number', 'String', 'Function', 'Array', 'Date', 'RegExp', 'Undefined', 'Null']; i$1 < list$1.length; i$1 += 1) { + var name = list$1[i$1]; + + classToType[("[object " + name + "]")] = name.toLowerCase(); + } + var type$p = function(obj) { + return classToType[Object.prototype.toString.call(obj)] || "object"; + }; + + var type$o = type$p; + + var unpack$B = function (args, keyOrder) { + if ( keyOrder === void 0 ) keyOrder=null; + + // if called with more than 3 arguments, we return the arguments + if (args.length >= 3) { return Array.prototype.slice.call(args); } + // with less than 3 args we check if first arg is object + // and use the keyOrder string to extract and sort properties + if (type$o(args[0]) == 'object' && keyOrder) { + return keyOrder.split('') + .filter(function (k) { return args[0][k] !== undefined; }) + .map(function (k) { return args[0][k]; }); + } + // otherwise we just return the first argument + // (which we suppose is an array of args) + return args[0]; + }; + + var type$n = type$p; + + var last$4 = function (args) { + if (args.length < 2) { return null; } + var l = args.length-1; + if (type$n(args[l]) == 'string') { return args[l].toLowerCase(); } + return null; + }; + + var PI$2 = Math.PI; + + var utils = { + clip_rgb: clip_rgb$3, + limit: limit$2, + type: type$p, + unpack: unpack$B, + last: last$4, + PI: PI$2, + TWOPI: PI$2*2, + PITHIRD: PI$2/3, + DEG2RAD: PI$2 / 180, + RAD2DEG: 180 / PI$2 + }; + + var input$h = { + format: {}, + autodetect: [] + }; + + var last$3 = utils.last; + var clip_rgb$2 = utils.clip_rgb; + var type$m = utils.type; + var _input = input$h; + + var Color$D = function Color() { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + var me = this; + if (type$m(args[0]) === 'object' && + args[0].constructor && + args[0].constructor === this.constructor) { + // the argument is already a Color instance + return args[0]; + } + + // last argument could be the mode + var mode = last$3(args); + var autodetect = false; + + if (!mode) { + autodetect = true; + if (!_input.sorted) { + _input.autodetect = _input.autodetect.sort(function (a,b) { return b.p - a.p; }); + _input.sorted = true; + } + // auto-detect format + for (var i = 0, list = _input.autodetect; i < list.length; i += 1) { + var chk = list[i]; + + mode = chk.test.apply(chk, args); + if (mode) { break; } + } + } + + if (_input.format[mode]) { + var rgb = _input.format[mode].apply(null, autodetect ? args : args.slice(0,-1)); + me._rgb = clip_rgb$2(rgb); + } else { + throw new Error('unknown format: '+args); + } + + // add alpha channel + if (me._rgb.length === 3) { me._rgb.push(1); } + }; + + Color$D.prototype.toString = function toString () { + if (type$m(this.hex) == 'function') { return this.hex(); } + return ("[" + (this._rgb.join(',')) + "]"); + }; + + var Color_1 = Color$D; + + var chroma$k = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + return new (Function.prototype.bind.apply( chroma$k.Color, [ null ].concat( args) )); + }; + + chroma$k.Color = Color_1; + chroma$k.version = '2.3.0'; + + var chroma_1 = chroma$k; + + var unpack$A = utils.unpack; + var max$2 = Math.max; + + var rgb2cmyk$1 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + var ref = unpack$A(args, 'rgb'); + var r = ref[0]; + var g = ref[1]; + var b = ref[2]; + r = r / 255; + g = g / 255; + b = b / 255; + var k = 1 - max$2(r,max$2(g,b)); + var f = k < 1 ? 1 / (1-k) : 0; + var c = (1-r-k) * f; + var m = (1-g-k) * f; + var y = (1-b-k) * f; + return [c,m,y,k]; + }; + + var rgb2cmyk_1 = rgb2cmyk$1; + + var unpack$z = utils.unpack; + + var cmyk2rgb = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + args = unpack$z(args, 'cmyk'); + var c = args[0]; + var m = args[1]; + var y = args[2]; + var k = args[3]; + var alpha = args.length > 4 ? args[4] : 1; + if (k === 1) { return [0,0,0,alpha]; } + return [ + c >= 1 ? 0 : 255 * (1-c) * (1-k), // r + m >= 1 ? 0 : 255 * (1-m) * (1-k), // g + y >= 1 ? 0 : 255 * (1-y) * (1-k), // b + alpha + ]; + }; + + var cmyk2rgb_1 = cmyk2rgb; + + var chroma$j = chroma_1; + var Color$C = Color_1; + var input$g = input$h; + var unpack$y = utils.unpack; + var type$l = utils.type; + + var rgb2cmyk = rgb2cmyk_1; + + Color$C.prototype.cmyk = function() { + return rgb2cmyk(this._rgb); + }; + + chroma$j.cmyk = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + return new (Function.prototype.bind.apply( Color$C, [ null ].concat( args, ['cmyk']) )); + }; + + input$g.format.cmyk = cmyk2rgb_1; + + input$g.autodetect.push({ + p: 2, + test: function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + args = unpack$y(args, 'cmyk'); + if (type$l(args) === 'array' && args.length === 4) { + return 'cmyk'; + } + } + }); + + var unpack$x = utils.unpack; + var last$2 = utils.last; + var rnd = function (a) { return Math.round(a*100)/100; }; + + /* + * supported arguments: + * - hsl2css(h,s,l) + * - hsl2css(h,s,l,a) + * - hsl2css([h,s,l], mode) + * - hsl2css([h,s,l,a], mode) + * - hsl2css({h,s,l,a}, mode) + */ + var hsl2css$1 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + var hsla = unpack$x(args, 'hsla'); + var mode = last$2(args) || 'lsa'; + hsla[0] = rnd(hsla[0] || 0); + hsla[1] = rnd(hsla[1]*100) + '%'; + hsla[2] = rnd(hsla[2]*100) + '%'; + if (mode === 'hsla' || (hsla.length > 3 && hsla[3]<1)) { + hsla[3] = hsla.length > 3 ? hsla[3] : 1; + mode = 'hsla'; + } else { + hsla.length = 3; + } + return (mode + "(" + (hsla.join(',')) + ")"); + }; + + var hsl2css_1 = hsl2css$1; + + var unpack$w = utils.unpack; + + /* + * supported arguments: + * - rgb2hsl(r,g,b) + * - rgb2hsl(r,g,b,a) + * - rgb2hsl([r,g,b]) + * - rgb2hsl([r,g,b,a]) + * - rgb2hsl({r,g,b,a}) + */ + var rgb2hsl$3 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + args = unpack$w(args, 'rgba'); + var r = args[0]; + var g = args[1]; + var b = args[2]; + + r /= 255; + g /= 255; + b /= 255; + + var min = Math.min(r, g, b); + var max = Math.max(r, g, b); + + var l = (max + min) / 2; + var s, h; + + if (max === min){ + s = 0; + h = Number.NaN; + } else { + s = l < 0.5 ? (max - min) / (max + min) : (max - min) / (2 - max - min); + } + + if (r == max) { h = (g - b) / (max - min); } + else if (g == max) { h = 2 + (b - r) / (max - min); } + else if (b == max) { h = 4 + (r - g) / (max - min); } + + h *= 60; + if (h < 0) { h += 360; } + if (args.length>3 && args[3]!==undefined) { return [h,s,l,args[3]]; } + return [h,s,l]; + }; + + var rgb2hsl_1 = rgb2hsl$3; + + var unpack$v = utils.unpack; + var last$1 = utils.last; + var hsl2css = hsl2css_1; + var rgb2hsl$2 = rgb2hsl_1; + var round$6 = Math.round; + + /* + * supported arguments: + * - rgb2css(r,g,b) + * - rgb2css(r,g,b,a) + * - rgb2css([r,g,b], mode) + * - rgb2css([r,g,b,a], mode) + * - rgb2css({r,g,b,a}, mode) + */ + var rgb2css$1 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + var rgba = unpack$v(args, 'rgba'); + var mode = last$1(args) || 'rgb'; + if (mode.substr(0,3) == 'hsl') { + return hsl2css(rgb2hsl$2(rgba), mode); + } + rgba[0] = round$6(rgba[0]); + rgba[1] = round$6(rgba[1]); + rgba[2] = round$6(rgba[2]); + if (mode === 'rgba' || (rgba.length > 3 && rgba[3]<1)) { + rgba[3] = rgba.length > 3 ? rgba[3] : 1; + mode = 'rgba'; + } + return (mode + "(" + (rgba.slice(0,mode==='rgb'?3:4).join(',')) + ")"); + }; + + var rgb2css_1 = rgb2css$1; + + var unpack$u = utils.unpack; + var round$5 = Math.round; + + var hsl2rgb$1 = function () { + var assign; + + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + args = unpack$u(args, 'hsl'); + var h = args[0]; + var s = args[1]; + var l = args[2]; + var r,g,b; + if (s === 0) { + r = g = b = l*255; + } else { + var t3 = [0,0,0]; + var c = [0,0,0]; + var t2 = l < 0.5 ? l * (1+s) : l+s-l*s; + var t1 = 2 * l - t2; + var h_ = h / 360; + t3[0] = h_ + 1/3; + t3[1] = h_; + t3[2] = h_ - 1/3; + for (var i=0; i<3; i++) { + if (t3[i] < 0) { t3[i] += 1; } + if (t3[i] > 1) { t3[i] -= 1; } + if (6 * t3[i] < 1) + { c[i] = t1 + (t2 - t1) * 6 * t3[i]; } + else if (2 * t3[i] < 1) + { c[i] = t2; } + else if (3 * t3[i] < 2) + { c[i] = t1 + (t2 - t1) * ((2 / 3) - t3[i]) * 6; } + else + { c[i] = t1; } + } + (assign = [round$5(c[0]*255),round$5(c[1]*255),round$5(c[2]*255)], r = assign[0], g = assign[1], b = assign[2]); + } + if (args.length > 3) { + // keep alpha channel + return [r,g,b,args[3]]; + } + return [r,g,b,1]; + }; + + var hsl2rgb_1 = hsl2rgb$1; + + var hsl2rgb = hsl2rgb_1; + var input$f = input$h; + + var RE_RGB = /^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/; + var RE_RGBA = /^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/; + var RE_RGB_PCT = /^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/; + var RE_RGBA_PCT = /^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/; + var RE_HSL = /^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/; + var RE_HSLA = /^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/; + + var round$4 = Math.round; + + var css2rgb$1 = function (css) { + css = css.toLowerCase().trim(); + var m; + + if (input$f.format.named) { + try { + return input$f.format.named(css); + } catch (e) { + // eslint-disable-next-line + } + } + + // rgb(250,20,0) + if ((m = css.match(RE_RGB))) { + var rgb = m.slice(1,4); + for (var i=0; i<3; i++) { + rgb[i] = +rgb[i]; + } + rgb[3] = 1; // default alpha + return rgb; + } + + // rgba(250,20,0,0.4) + if ((m = css.match(RE_RGBA))) { + var rgb$1 = m.slice(1,5); + for (var i$1=0; i$1<4; i$1++) { + rgb$1[i$1] = +rgb$1[i$1]; + } + return rgb$1; + } + + // rgb(100%,0%,0%) + if ((m = css.match(RE_RGB_PCT))) { + var rgb$2 = m.slice(1,4); + for (var i$2=0; i$2<3; i$2++) { + rgb$2[i$2] = round$4(rgb$2[i$2] * 2.55); + } + rgb$2[3] = 1; // default alpha + return rgb$2; + } + + // rgba(100%,0%,0%,0.4) + if ((m = css.match(RE_RGBA_PCT))) { + var rgb$3 = m.slice(1,5); + for (var i$3=0; i$3<3; i$3++) { + rgb$3[i$3] = round$4(rgb$3[i$3] * 2.55); + } + rgb$3[3] = +rgb$3[3]; + return rgb$3; + } + + // hsl(0,100%,50%) + if ((m = css.match(RE_HSL))) { + var hsl = m.slice(1,4); + hsl[1] *= 0.01; + hsl[2] *= 0.01; + var rgb$4 = hsl2rgb(hsl); + rgb$4[3] = 1; + return rgb$4; + } + + // hsla(0,100%,50%,0.5) + if ((m = css.match(RE_HSLA))) { + var hsl$1 = m.slice(1,4); + hsl$1[1] *= 0.01; + hsl$1[2] *= 0.01; + var rgb$5 = hsl2rgb(hsl$1); + rgb$5[3] = +m[4]; // default alpha = 1 + return rgb$5; + } + }; + + css2rgb$1.test = function (s) { + return RE_RGB.test(s) || + RE_RGBA.test(s) || + RE_RGB_PCT.test(s) || + RE_RGBA_PCT.test(s) || + RE_HSL.test(s) || + RE_HSLA.test(s); + }; + + var css2rgb_1 = css2rgb$1; + + var chroma$i = chroma_1; + var Color$B = Color_1; + var input$e = input$h; + var type$k = utils.type; + + var rgb2css = rgb2css_1; + var css2rgb = css2rgb_1; + + Color$B.prototype.css = function(mode) { + return rgb2css(this._rgb, mode); + }; + + chroma$i.css = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + return new (Function.prototype.bind.apply( Color$B, [ null ].concat( args, ['css']) )); + }; + + input$e.format.css = css2rgb; + + input$e.autodetect.push({ + p: 5, + test: function (h) { + var rest = [], len = arguments.length - 1; + while ( len-- > 0 ) rest[ len ] = arguments[ len + 1 ]; + + if (!rest.length && type$k(h) === 'string' && css2rgb.test(h)) { + return 'css'; + } + } + }); + + var Color$A = Color_1; + var chroma$h = chroma_1; + var input$d = input$h; + var unpack$t = utils.unpack; + + input$d.format.gl = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + var rgb = unpack$t(args, 'rgba'); + rgb[0] *= 255; + rgb[1] *= 255; + rgb[2] *= 255; + return rgb; + }; + + chroma$h.gl = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + return new (Function.prototype.bind.apply( Color$A, [ null ].concat( args, ['gl']) )); + }; + + Color$A.prototype.gl = function() { + var rgb = this._rgb; + return [rgb[0]/255, rgb[1]/255, rgb[2]/255, rgb[3]]; + }; + + var unpack$s = utils.unpack; + + var rgb2hcg$1 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + var ref = unpack$s(args, 'rgb'); + var r = ref[0]; + var g = ref[1]; + var b = ref[2]; + var min = Math.min(r, g, b); + var max = Math.max(r, g, b); + var delta = max - min; + var c = delta * 100 / 255; + var _g = min / (255 - delta) * 100; + var h; + if (delta === 0) { + h = Number.NaN; + } else { + if (r === max) { h = (g - b) / delta; } + if (g === max) { h = 2+(b - r) / delta; } + if (b === max) { h = 4+(r - g) / delta; } + h *= 60; + if (h < 0) { h += 360; } + } + return [h, c, _g]; + }; + + var rgb2hcg_1 = rgb2hcg$1; + + var unpack$r = utils.unpack; + var floor$3 = Math.floor; + + /* + * this is basically just HSV with some minor tweaks + * + * hue.. [0..360] + * chroma .. [0..1] + * grayness .. [0..1] + */ + + var hcg2rgb = function () { + var assign, assign$1, assign$2, assign$3, assign$4, assign$5; + + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + args = unpack$r(args, 'hcg'); + var h = args[0]; + var c = args[1]; + var _g = args[2]; + var r,g,b; + _g = _g * 255; + var _c = c * 255; + if (c === 0) { + r = g = b = _g; + } else { + if (h === 360) { h = 0; } + if (h > 360) { h -= 360; } + if (h < 0) { h += 360; } + h /= 60; + var i = floor$3(h); + var f = h - i; + var p = _g * (1 - c); + var q = p + _c * (1 - f); + var t = p + _c * f; + var v = p + _c; + switch (i) { + case 0: (assign = [v, t, p], r = assign[0], g = assign[1], b = assign[2]); break + case 1: (assign$1 = [q, v, p], r = assign$1[0], g = assign$1[1], b = assign$1[2]); break + case 2: (assign$2 = [p, v, t], r = assign$2[0], g = assign$2[1], b = assign$2[2]); break + case 3: (assign$3 = [p, q, v], r = assign$3[0], g = assign$3[1], b = assign$3[2]); break + case 4: (assign$4 = [t, p, v], r = assign$4[0], g = assign$4[1], b = assign$4[2]); break + case 5: (assign$5 = [v, p, q], r = assign$5[0], g = assign$5[1], b = assign$5[2]); break + } + } + return [r, g, b, args.length > 3 ? args[3] : 1]; + }; + + var hcg2rgb_1 = hcg2rgb; + + var unpack$q = utils.unpack; + var type$j = utils.type; + var chroma$g = chroma_1; + var Color$z = Color_1; + var input$c = input$h; + + var rgb2hcg = rgb2hcg_1; + + Color$z.prototype.hcg = function() { + return rgb2hcg(this._rgb); + }; + + chroma$g.hcg = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + return new (Function.prototype.bind.apply( Color$z, [ null ].concat( args, ['hcg']) )); + }; + + input$c.format.hcg = hcg2rgb_1; + + input$c.autodetect.push({ + p: 1, + test: function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + args = unpack$q(args, 'hcg'); + if (type$j(args) === 'array' && args.length === 3) { + return 'hcg'; + } + } + }); + + var unpack$p = utils.unpack; + var last = utils.last; + var round$3 = Math.round; + + var rgb2hex$2 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + var ref = unpack$p(args, 'rgba'); + var r = ref[0]; + var g = ref[1]; + var b = ref[2]; + var a = ref[3]; + var mode = last(args) || 'auto'; + if (a === undefined) { a = 1; } + if (mode === 'auto') { + mode = a < 1 ? 'rgba' : 'rgb'; + } + r = round$3(r); + g = round$3(g); + b = round$3(b); + var u = r << 16 | g << 8 | b; + var str = "000000" + u.toString(16); //#.toUpperCase(); + str = str.substr(str.length - 6); + var hxa = '0' + round$3(a * 255).toString(16); + hxa = hxa.substr(hxa.length - 2); + switch (mode.toLowerCase()) { + case 'rgba': return ("#" + str + hxa); + case 'argb': return ("#" + hxa + str); + default: return ("#" + str); + } + }; + + var rgb2hex_1 = rgb2hex$2; + + var RE_HEX = /^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/; + var RE_HEXA = /^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/; + + var hex2rgb$1 = function (hex) { + if (hex.match(RE_HEX)) { + // remove optional leading # + if (hex.length === 4 || hex.length === 7) { + hex = hex.substr(1); + } + // expand short-notation to full six-digit + if (hex.length === 3) { + hex = hex.split(''); + hex = hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2]; + } + var u = parseInt(hex, 16); + var r = u >> 16; + var g = u >> 8 & 0xFF; + var b = u & 0xFF; + return [r,g,b,1]; + } + + // match rgba hex format, eg #FF000077 + if (hex.match(RE_HEXA)) { + if (hex.length === 5 || hex.length === 9) { + // remove optional leading # + hex = hex.substr(1); + } + // expand short-notation to full eight-digit + if (hex.length === 4) { + hex = hex.split(''); + hex = hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2]+hex[3]+hex[3]; + } + var u$1 = parseInt(hex, 16); + var r$1 = u$1 >> 24 & 0xFF; + var g$1 = u$1 >> 16 & 0xFF; + var b$1 = u$1 >> 8 & 0xFF; + var a = Math.round((u$1 & 0xFF) / 0xFF * 100) / 100; + return [r$1,g$1,b$1,a]; + } + + // we used to check for css colors here + // if _input.css? and rgb = _input.css hex + // return rgb + + throw new Error(("unknown hex color: " + hex)); + }; + + var hex2rgb_1 = hex2rgb$1; + + var chroma$f = chroma_1; + var Color$y = Color_1; + var type$i = utils.type; + var input$b = input$h; + + var rgb2hex$1 = rgb2hex_1; + + Color$y.prototype.hex = function(mode) { + return rgb2hex$1(this._rgb, mode); + }; + + chroma$f.hex = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + return new (Function.prototype.bind.apply( Color$y, [ null ].concat( args, ['hex']) )); + }; + + input$b.format.hex = hex2rgb_1; + input$b.autodetect.push({ + p: 4, + test: function (h) { + var rest = [], len = arguments.length - 1; + while ( len-- > 0 ) rest[ len ] = arguments[ len + 1 ]; + + if (!rest.length && type$i(h) === 'string' && [3,4,5,6,7,8,9].indexOf(h.length) >= 0) { + return 'hex'; + } + } + }); + + var unpack$o = utils.unpack; + var TWOPI$2 = utils.TWOPI; + var min$2 = Math.min; + var sqrt$4 = Math.sqrt; + var acos = Math.acos; + + var rgb2hsi$1 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + /* + borrowed from here: + http://hummer.stanford.edu/museinfo/doc/examples/humdrum/keyscape2/rgb2hsi.cpp + */ + var ref = unpack$o(args, 'rgb'); + var r = ref[0]; + var g = ref[1]; + var b = ref[2]; + r /= 255; + g /= 255; + b /= 255; + var h; + var min_ = min$2(r,g,b); + var i = (r+g+b) / 3; + var s = i > 0 ? 1 - min_/i : 0; + if (s === 0) { + h = NaN; + } else { + h = ((r-g)+(r-b)) / 2; + h /= sqrt$4((r-g)*(r-g) + (r-b)*(g-b)); + h = acos(h); + if (b > g) { + h = TWOPI$2 - h; + } + h /= TWOPI$2; + } + return [h*360,s,i]; + }; + + var rgb2hsi_1 = rgb2hsi$1; + + var unpack$n = utils.unpack; + var limit = utils.limit; + var TWOPI$1 = utils.TWOPI; + var PITHIRD = utils.PITHIRD; + var cos$4 = Math.cos; + + /* + * hue [0..360] + * saturation [0..1] + * intensity [0..1] + */ + var hsi2rgb = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + /* + borrowed from here: + http://hummer.stanford.edu/museinfo/doc/examples/humdrum/keyscape2/hsi2rgb.cpp + */ + args = unpack$n(args, 'hsi'); + var h = args[0]; + var s = args[1]; + var i = args[2]; + var r,g,b; + + if (isNaN(h)) { h = 0; } + if (isNaN(s)) { s = 0; } + // normalize hue + if (h > 360) { h -= 360; } + if (h < 0) { h += 360; } + h /= 360; + if (h < 1/3) { + b = (1-s)/3; + r = (1+s*cos$4(TWOPI$1*h)/cos$4(PITHIRD-TWOPI$1*h))/3; + g = 1 - (b+r); + } else if (h < 2/3) { + h -= 1/3; + r = (1-s)/3; + g = (1+s*cos$4(TWOPI$1*h)/cos$4(PITHIRD-TWOPI$1*h))/3; + b = 1 - (r+g); + } else { + h -= 2/3; + g = (1-s)/3; + b = (1+s*cos$4(TWOPI$1*h)/cos$4(PITHIRD-TWOPI$1*h))/3; + r = 1 - (g+b); + } + r = limit(i*r*3); + g = limit(i*g*3); + b = limit(i*b*3); + return [r*255, g*255, b*255, args.length > 3 ? args[3] : 1]; + }; + + var hsi2rgb_1 = hsi2rgb; + + var unpack$m = utils.unpack; + var type$h = utils.type; + var chroma$e = chroma_1; + var Color$x = Color_1; + var input$a = input$h; + + var rgb2hsi = rgb2hsi_1; + + Color$x.prototype.hsi = function() { + return rgb2hsi(this._rgb); + }; + + chroma$e.hsi = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + return new (Function.prototype.bind.apply( Color$x, [ null ].concat( args, ['hsi']) )); + }; + + input$a.format.hsi = hsi2rgb_1; + + input$a.autodetect.push({ + p: 2, + test: function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + args = unpack$m(args, 'hsi'); + if (type$h(args) === 'array' && args.length === 3) { + return 'hsi'; + } + } + }); + + var unpack$l = utils.unpack; + var type$g = utils.type; + var chroma$d = chroma_1; + var Color$w = Color_1; + var input$9 = input$h; + + var rgb2hsl$1 = rgb2hsl_1; + + Color$w.prototype.hsl = function() { + return rgb2hsl$1(this._rgb); + }; + + chroma$d.hsl = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + return new (Function.prototype.bind.apply( Color$w, [ null ].concat( args, ['hsl']) )); + }; + + input$9.format.hsl = hsl2rgb_1; + + input$9.autodetect.push({ + p: 2, + test: function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + args = unpack$l(args, 'hsl'); + if (type$g(args) === 'array' && args.length === 3) { + return 'hsl'; + } + } + }); + + var unpack$k = utils.unpack; + var min$1 = Math.min; + var max$1 = Math.max; + + /* + * supported arguments: + * - rgb2hsv(r,g,b) + * - rgb2hsv([r,g,b]) + * - rgb2hsv({r,g,b}) + */ + var rgb2hsl = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + args = unpack$k(args, 'rgb'); + var r = args[0]; + var g = args[1]; + var b = args[2]; + var min_ = min$1(r, g, b); + var max_ = max$1(r, g, b); + var delta = max_ - min_; + var h,s,v; + v = max_ / 255.0; + if (max_ === 0) { + h = Number.NaN; + s = 0; + } else { + s = delta / max_; + if (r === max_) { h = (g - b) / delta; } + if (g === max_) { h = 2+(b - r) / delta; } + if (b === max_) { h = 4+(r - g) / delta; } + h *= 60; + if (h < 0) { h += 360; } + } + return [h, s, v] + }; + + var rgb2hsv$1 = rgb2hsl; + + var unpack$j = utils.unpack; + var floor$2 = Math.floor; + + var hsv2rgb = function () { + var assign, assign$1, assign$2, assign$3, assign$4, assign$5; + + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + args = unpack$j(args, 'hsv'); + var h = args[0]; + var s = args[1]; + var v = args[2]; + var r,g,b; + v *= 255; + if (s === 0) { + r = g = b = v; + } else { + if (h === 360) { h = 0; } + if (h > 360) { h -= 360; } + if (h < 0) { h += 360; } + h /= 60; + + var i = floor$2(h); + var f = h - i; + var p = v * (1 - s); + var q = v * (1 - s * f); + var t = v * (1 - s * (1 - f)); + + switch (i) { + case 0: (assign = [v, t, p], r = assign[0], g = assign[1], b = assign[2]); break + case 1: (assign$1 = [q, v, p], r = assign$1[0], g = assign$1[1], b = assign$1[2]); break + case 2: (assign$2 = [p, v, t], r = assign$2[0], g = assign$2[1], b = assign$2[2]); break + case 3: (assign$3 = [p, q, v], r = assign$3[0], g = assign$3[1], b = assign$3[2]); break + case 4: (assign$4 = [t, p, v], r = assign$4[0], g = assign$4[1], b = assign$4[2]); break + case 5: (assign$5 = [v, p, q], r = assign$5[0], g = assign$5[1], b = assign$5[2]); break + } + } + return [r,g,b,args.length > 3?args[3]:1]; + }; + + var hsv2rgb_1 = hsv2rgb; + + var unpack$i = utils.unpack; + var type$f = utils.type; + var chroma$c = chroma_1; + var Color$v = Color_1; + var input$8 = input$h; + + var rgb2hsv = rgb2hsv$1; + + Color$v.prototype.hsv = function() { + return rgb2hsv(this._rgb); + }; + + chroma$c.hsv = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + return new (Function.prototype.bind.apply( Color$v, [ null ].concat( args, ['hsv']) )); + }; + + input$8.format.hsv = hsv2rgb_1; + + input$8.autodetect.push({ + p: 2, + test: function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + args = unpack$i(args, 'hsv'); + if (type$f(args) === 'array' && args.length === 3) { + return 'hsv'; + } + } + }); + + var labConstants = { + // Corresponds roughly to RGB brighter/darker + Kn: 18, + + // D65 standard referent + Xn: 0.950470, + Yn: 1, + Zn: 1.088830, + + t0: 0.137931034, // 4 / 29 + t1: 0.206896552, // 6 / 29 + t2: 0.12841855, // 3 * t1 * t1 + t3: 0.008856452, // t1 * t1 * t1 + }; + + var LAB_CONSTANTS$3 = labConstants; + var unpack$h = utils.unpack; + var pow$a = Math.pow; + + var rgb2lab$2 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + var ref = unpack$h(args, 'rgb'); + var r = ref[0]; + var g = ref[1]; + var b = ref[2]; + var ref$1 = rgb2xyz(r,g,b); + var x = ref$1[0]; + var y = ref$1[1]; + var z = ref$1[2]; + var l = 116 * y - 16; + return [l < 0 ? 0 : l, 500 * (x - y), 200 * (y - z)]; + }; + + var rgb_xyz = function (r) { + if ((r /= 255) <= 0.04045) { return r / 12.92; } + return pow$a((r + 0.055) / 1.055, 2.4); + }; + + var xyz_lab = function (t) { + if (t > LAB_CONSTANTS$3.t3) { return pow$a(t, 1 / 3); } + return t / LAB_CONSTANTS$3.t2 + LAB_CONSTANTS$3.t0; + }; + + var rgb2xyz = function (r,g,b) { + r = rgb_xyz(r); + g = rgb_xyz(g); + b = rgb_xyz(b); + var x = xyz_lab((0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / LAB_CONSTANTS$3.Xn); + var y = xyz_lab((0.2126729 * r + 0.7151522 * g + 0.0721750 * b) / LAB_CONSTANTS$3.Yn); + var z = xyz_lab((0.0193339 * r + 0.1191920 * g + 0.9503041 * b) / LAB_CONSTANTS$3.Zn); + return [x,y,z]; + }; + + var rgb2lab_1 = rgb2lab$2; + + var LAB_CONSTANTS$2 = labConstants; + var unpack$g = utils.unpack; + var pow$9 = Math.pow; + + /* + * L* [0..100] + * a [-100..100] + * b [-100..100] + */ + var lab2rgb$1 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + args = unpack$g(args, 'lab'); + var l = args[0]; + var a = args[1]; + var b = args[2]; + var x,y,z, r,g,b_; + + y = (l + 16) / 116; + x = isNaN(a) ? y : y + a / 500; + z = isNaN(b) ? y : y - b / 200; + + y = LAB_CONSTANTS$2.Yn * lab_xyz(y); + x = LAB_CONSTANTS$2.Xn * lab_xyz(x); + z = LAB_CONSTANTS$2.Zn * lab_xyz(z); + + r = xyz_rgb(3.2404542 * x - 1.5371385 * y - 0.4985314 * z); // D65 -> sRGB + g = xyz_rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z); + b_ = xyz_rgb(0.0556434 * x - 0.2040259 * y + 1.0572252 * z); + + return [r,g,b_,args.length > 3 ? args[3] : 1]; + }; + + var xyz_rgb = function (r) { + return 255 * (r <= 0.00304 ? 12.92 * r : 1.055 * pow$9(r, 1 / 2.4) - 0.055) + }; + + var lab_xyz = function (t) { + return t > LAB_CONSTANTS$2.t1 ? t * t * t : LAB_CONSTANTS$2.t2 * (t - LAB_CONSTANTS$2.t0) + }; + + var lab2rgb_1 = lab2rgb$1; + + var unpack$f = utils.unpack; + var type$e = utils.type; + var chroma$b = chroma_1; + var Color$u = Color_1; + var input$7 = input$h; + + var rgb2lab$1 = rgb2lab_1; + + Color$u.prototype.lab = function() { + return rgb2lab$1(this._rgb); + }; + + chroma$b.lab = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + return new (Function.prototype.bind.apply( Color$u, [ null ].concat( args, ['lab']) )); + }; + + input$7.format.lab = lab2rgb_1; + + input$7.autodetect.push({ + p: 2, + test: function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + args = unpack$f(args, 'lab'); + if (type$e(args) === 'array' && args.length === 3) { + return 'lab'; + } + } + }); + + var unpack$e = utils.unpack; + var RAD2DEG = utils.RAD2DEG; + var sqrt$3 = Math.sqrt; + var atan2$2 = Math.atan2; + var round$2 = Math.round; + + var lab2lch$2 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + var ref = unpack$e(args, 'lab'); + var l = ref[0]; + var a = ref[1]; + var b = ref[2]; + var c = sqrt$3(a * a + b * b); + var h = (atan2$2(b, a) * RAD2DEG + 360) % 360; + if (round$2(c*10000) === 0) { h = Number.NaN; } + return [l, c, h]; + }; + + var lab2lch_1 = lab2lch$2; + + var unpack$d = utils.unpack; + var rgb2lab = rgb2lab_1; + var lab2lch$1 = lab2lch_1; + + var rgb2lch$1 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + var ref = unpack$d(args, 'rgb'); + var r = ref[0]; + var g = ref[1]; + var b = ref[2]; + var ref$1 = rgb2lab(r,g,b); + var l = ref$1[0]; + var a = ref$1[1]; + var b_ = ref$1[2]; + return lab2lch$1(l,a,b_); + }; + + var rgb2lch_1 = rgb2lch$1; + + var unpack$c = utils.unpack; + var DEG2RAD = utils.DEG2RAD; + var sin$3 = Math.sin; + var cos$3 = Math.cos; + + var lch2lab$2 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + /* + Convert from a qualitative parameter h and a quantitative parameter l to a 24-bit pixel. + These formulas were invented by David Dalrymple to obtain maximum contrast without going + out of gamut if the parameters are in the range 0-1. + + A saturation multiplier was added by Gregor Aisch + */ + var ref = unpack$c(args, 'lch'); + var l = ref[0]; + var c = ref[1]; + var h = ref[2]; + if (isNaN(h)) { h = 0; } + h = h * DEG2RAD; + return [l, cos$3(h) * c, sin$3(h) * c] + }; + + var lch2lab_1 = lch2lab$2; + + var unpack$b = utils.unpack; + var lch2lab$1 = lch2lab_1; + var lab2rgb = lab2rgb_1; + + var lch2rgb$1 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + args = unpack$b(args, 'lch'); + var l = args[0]; + var c = args[1]; + var h = args[2]; + var ref = lch2lab$1 (l,c,h); + var L = ref[0]; + var a = ref[1]; + var b_ = ref[2]; + var ref$1 = lab2rgb (L,a,b_); + var r = ref$1[0]; + var g = ref$1[1]; + var b = ref$1[2]; + return [r, g, b, args.length > 3 ? args[3] : 1]; + }; + + var lch2rgb_1 = lch2rgb$1; + + var unpack$a = utils.unpack; + var lch2rgb = lch2rgb_1; + + var hcl2rgb = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + var hcl = unpack$a(args, 'hcl').reverse(); + return lch2rgb.apply(void 0, hcl); + }; + + var hcl2rgb_1 = hcl2rgb; + + var unpack$9 = utils.unpack; + var type$d = utils.type; + var chroma$a = chroma_1; + var Color$t = Color_1; + var input$6 = input$h; + + var rgb2lch = rgb2lch_1; + + Color$t.prototype.lch = function() { return rgb2lch(this._rgb); }; + Color$t.prototype.hcl = function() { return rgb2lch(this._rgb).reverse(); }; + + chroma$a.lch = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + return new (Function.prototype.bind.apply( Color$t, [ null ].concat( args, ['lch']) )); + }; + chroma$a.hcl = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + return new (Function.prototype.bind.apply( Color$t, [ null ].concat( args, ['hcl']) )); + }; + + input$6.format.lch = lch2rgb_1; + input$6.format.hcl = hcl2rgb_1; + + ['lch','hcl'].forEach(function (m) { return input$6.autodetect.push({ + p: 2, + test: function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + args = unpack$9(args, m); + if (type$d(args) === 'array' && args.length === 3) { + return m; + } + } + }); }); + + /** + X11 color names + + http://www.w3.org/TR/css3-color/#svg-color + */ + + var w3cx11$1 = { + aliceblue: '#f0f8ff', + antiquewhite: '#faebd7', + aqua: '#00ffff', + aquamarine: '#7fffd4', + azure: '#f0ffff', + beige: '#f5f5dc', + bisque: '#ffe4c4', + black: '#000000', + blanchedalmond: '#ffebcd', + blue: '#0000ff', + blueviolet: '#8a2be2', + brown: '#a52a2a', + burlywood: '#deb887', + cadetblue: '#5f9ea0', + chartreuse: '#7fff00', + chocolate: '#d2691e', + coral: '#ff7f50', + cornflower: '#6495ed', + cornflowerblue: '#6495ed', + cornsilk: '#fff8dc', + crimson: '#dc143c', + cyan: '#00ffff', + darkblue: '#00008b', + darkcyan: '#008b8b', + darkgoldenrod: '#b8860b', + darkgray: '#a9a9a9', + darkgreen: '#006400', + darkgrey: '#a9a9a9', + darkkhaki: '#bdb76b', + darkmagenta: '#8b008b', + darkolivegreen: '#556b2f', + darkorange: '#ff8c00', + darkorchid: '#9932cc', + darkred: '#8b0000', + darksalmon: '#e9967a', + darkseagreen: '#8fbc8f', + darkslateblue: '#483d8b', + darkslategray: '#2f4f4f', + darkslategrey: '#2f4f4f', + darkturquoise: '#00ced1', + darkviolet: '#9400d3', + deeppink: '#ff1493', + deepskyblue: '#00bfff', + dimgray: '#696969', + dimgrey: '#696969', + dodgerblue: '#1e90ff', + firebrick: '#b22222', + floralwhite: '#fffaf0', + forestgreen: '#228b22', + fuchsia: '#ff00ff', + gainsboro: '#dcdcdc', + ghostwhite: '#f8f8ff', + gold: '#ffd700', + goldenrod: '#daa520', + gray: '#808080', + green: '#008000', + greenyellow: '#adff2f', + grey: '#808080', + honeydew: '#f0fff0', + hotpink: '#ff69b4', + indianred: '#cd5c5c', + indigo: '#4b0082', + ivory: '#fffff0', + khaki: '#f0e68c', + laserlemon: '#ffff54', + lavender: '#e6e6fa', + lavenderblush: '#fff0f5', + lawngreen: '#7cfc00', + lemonchiffon: '#fffacd', + lightblue: '#add8e6', + lightcoral: '#f08080', + lightcyan: '#e0ffff', + lightgoldenrod: '#fafad2', + lightgoldenrodyellow: '#fafad2', + lightgray: '#d3d3d3', + lightgreen: '#90ee90', + lightgrey: '#d3d3d3', + lightpink: '#ffb6c1', + lightsalmon: '#ffa07a', + lightseagreen: '#20b2aa', + lightskyblue: '#87cefa', + lightslategray: '#778899', + lightslategrey: '#778899', + lightsteelblue: '#b0c4de', + lightyellow: '#ffffe0', + lime: '#00ff00', + limegreen: '#32cd32', + linen: '#faf0e6', + magenta: '#ff00ff', + maroon: '#800000', + maroon2: '#7f0000', + maroon3: '#b03060', + mediumaquamarine: '#66cdaa', + mediumblue: '#0000cd', + mediumorchid: '#ba55d3', + mediumpurple: '#9370db', + mediumseagreen: '#3cb371', + mediumslateblue: '#7b68ee', + mediumspringgreen: '#00fa9a', + mediumturquoise: '#48d1cc', + mediumvioletred: '#c71585', + midnightblue: '#191970', + mintcream: '#f5fffa', + mistyrose: '#ffe4e1', + moccasin: '#ffe4b5', + navajowhite: '#ffdead', + navy: '#000080', + oldlace: '#fdf5e6', + olive: '#808000', + olivedrab: '#6b8e23', + orange: '#ffa500', + orangered: '#ff4500', + orchid: '#da70d6', + palegoldenrod: '#eee8aa', + palegreen: '#98fb98', + paleturquoise: '#afeeee', + palevioletred: '#db7093', + papayawhip: '#ffefd5', + peachpuff: '#ffdab9', + peru: '#cd853f', + pink: '#ffc0cb', + plum: '#dda0dd', + powderblue: '#b0e0e6', + purple: '#800080', + purple2: '#7f007f', + purple3: '#a020f0', + rebeccapurple: '#663399', + red: '#ff0000', + rosybrown: '#bc8f8f', + royalblue: '#4169e1', + saddlebrown: '#8b4513', + salmon: '#fa8072', + sandybrown: '#f4a460', + seagreen: '#2e8b57', + seashell: '#fff5ee', + sienna: '#a0522d', + silver: '#c0c0c0', + skyblue: '#87ceeb', + slateblue: '#6a5acd', + slategray: '#708090', + slategrey: '#708090', + snow: '#fffafa', + springgreen: '#00ff7f', + steelblue: '#4682b4', + tan: '#d2b48c', + teal: '#008080', + thistle: '#d8bfd8', + tomato: '#ff6347', + turquoise: '#40e0d0', + violet: '#ee82ee', + wheat: '#f5deb3', + white: '#ffffff', + whitesmoke: '#f5f5f5', + yellow: '#ffff00', + yellowgreen: '#9acd32' + }; + + var w3cx11_1 = w3cx11$1; + + var Color$s = Color_1; + var input$5 = input$h; + var type$c = utils.type; + + var w3cx11 = w3cx11_1; + var hex2rgb = hex2rgb_1; + var rgb2hex = rgb2hex_1; + + Color$s.prototype.name = function() { + var hex = rgb2hex(this._rgb, 'rgb'); + for (var i = 0, list = Object.keys(w3cx11); i < list.length; i += 1) { + var n = list[i]; + + if (w3cx11[n] === hex) { return n.toLowerCase(); } + } + return hex; + }; + + input$5.format.named = function (name) { + name = name.toLowerCase(); + if (w3cx11[name]) { return hex2rgb(w3cx11[name]); } + throw new Error('unknown color name: '+name); + }; + + input$5.autodetect.push({ + p: 5, + test: function (h) { + var rest = [], len = arguments.length - 1; + while ( len-- > 0 ) rest[ len ] = arguments[ len + 1 ]; + + if (!rest.length && type$c(h) === 'string' && w3cx11[h.toLowerCase()]) { + return 'named'; + } + } + }); + + var unpack$8 = utils.unpack; + + var rgb2num$1 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + var ref = unpack$8(args, 'rgb'); + var r = ref[0]; + var g = ref[1]; + var b = ref[2]; + return (r << 16) + (g << 8) + b; + }; + + var rgb2num_1 = rgb2num$1; + + var type$b = utils.type; + + var num2rgb = function (num) { + if (type$b(num) == "number" && num >= 0 && num <= 0xFFFFFF) { + var r = num >> 16; + var g = (num >> 8) & 0xFF; + var b = num & 0xFF; + return [r,g,b,1]; + } + throw new Error("unknown num color: "+num); + }; + + var num2rgb_1 = num2rgb; + + var chroma$9 = chroma_1; + var Color$r = Color_1; + var input$4 = input$h; + var type$a = utils.type; + + var rgb2num = rgb2num_1; + + Color$r.prototype.num = function() { + return rgb2num(this._rgb); + }; + + chroma$9.num = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + return new (Function.prototype.bind.apply( Color$r, [ null ].concat( args, ['num']) )); + }; + + input$4.format.num = num2rgb_1; + + input$4.autodetect.push({ + p: 5, + test: function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + if (args.length === 1 && type$a(args[0]) === 'number' && args[0] >= 0 && args[0] <= 0xFFFFFF) { + return 'num'; + } + } + }); + + var chroma$8 = chroma_1; + var Color$q = Color_1; + var input$3 = input$h; + var unpack$7 = utils.unpack; + var type$9 = utils.type; + var round$1 = Math.round; + + Color$q.prototype.rgb = function(rnd) { + if ( rnd === void 0 ) rnd=true; + + if (rnd === false) { return this._rgb.slice(0,3); } + return this._rgb.slice(0,3).map(round$1); + }; + + Color$q.prototype.rgba = function(rnd) { + if ( rnd === void 0 ) rnd=true; + + return this._rgb.slice(0,4).map(function (v,i) { + return i<3 ? (rnd === false ? v : round$1(v)) : v; + }); + }; + + chroma$8.rgb = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + return new (Function.prototype.bind.apply( Color$q, [ null ].concat( args, ['rgb']) )); + }; + + input$3.format.rgb = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + var rgba = unpack$7(args, 'rgba'); + if (rgba[3] === undefined) { rgba[3] = 1; } + return rgba; + }; + + input$3.autodetect.push({ + p: 3, + test: function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + args = unpack$7(args, 'rgba'); + if (type$9(args) === 'array' && (args.length === 3 || + args.length === 4 && type$9(args[3]) == 'number' && args[3] >= 0 && args[3] <= 1)) { + return 'rgb'; + } + } + }); + + /* + * Based on implementation by Neil Bartlett + * https://github.com/neilbartlett/color-temperature + */ + + var log$1 = Math.log; + + var temperature2rgb$1 = function (kelvin) { + var temp = kelvin / 100; + var r,g,b; + if (temp < 66) { + r = 255; + g = temp < 6 ? 0 : -155.25485562709179 - 0.44596950469579133 * (g = temp-2) + 104.49216199393888 * log$1(g); + b = temp < 20 ? 0 : -254.76935184120902 + 0.8274096064007395 * (b = temp-10) + 115.67994401066147 * log$1(b); + } else { + r = 351.97690566805693 + 0.114206453784165 * (r = temp-55) - 40.25366309332127 * log$1(r); + g = 325.4494125711974 + 0.07943456536662342 * (g = temp-50) - 28.0852963507957 * log$1(g); + b = 255; + } + return [r,g,b,1]; + }; + + var temperature2rgb_1 = temperature2rgb$1; + + /* + * Based on implementation by Neil Bartlett + * https://github.com/neilbartlett/color-temperature + **/ + + var temperature2rgb = temperature2rgb_1; + var unpack$6 = utils.unpack; + var round = Math.round; + + var rgb2temperature$1 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + var rgb = unpack$6(args, 'rgb'); + var r = rgb[0], b = rgb[2]; + var minTemp = 1000; + var maxTemp = 40000; + var eps = 0.4; + var temp; + while (maxTemp - minTemp > eps) { + temp = (maxTemp + minTemp) * 0.5; + var rgb$1 = temperature2rgb(temp); + if ((rgb$1[2] / rgb$1[0]) >= (b / r)) { + maxTemp = temp; + } else { + minTemp = temp; + } + } + return round(temp); + }; + + var rgb2temperature_1 = rgb2temperature$1; + + var chroma$7 = chroma_1; + var Color$p = Color_1; + var input$2 = input$h; + + var rgb2temperature = rgb2temperature_1; + + Color$p.prototype.temp = + Color$p.prototype.kelvin = + Color$p.prototype.temperature = function() { + return rgb2temperature(this._rgb); + }; + + chroma$7.temp = + chroma$7.kelvin = + chroma$7.temperature = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + return new (Function.prototype.bind.apply( Color$p, [ null ].concat( args, ['temp']) )); + }; + + input$2.format.temp = + input$2.format.kelvin = + input$2.format.temperature = temperature2rgb_1; + + var unpack$5 = utils.unpack; + var cbrt = Math.cbrt; + var pow$8 = Math.pow; + var sign$1 = Math.sign; + + var rgb2oklab$2 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + // OKLab color space implementation taken from + // https://bottosson.github.io/posts/oklab/ + var ref = unpack$5(args, 'rgb'); + var r = ref[0]; + var g = ref[1]; + var b = ref[2]; + var ref$1 = [rgb2lrgb(r / 255), rgb2lrgb(g / 255), rgb2lrgb(b / 255)]; + var lr = ref$1[0]; + var lg = ref$1[1]; + var lb = ref$1[2]; + var l = cbrt(0.4122214708 * lr + 0.5363325363 * lg + 0.0514459929 * lb); + var m = cbrt(0.2119034982 * lr + 0.6806995451 * lg + 0.1073969566 * lb); + var s = cbrt(0.0883024619 * lr + 0.2817188376 * lg + 0.6299787005 * lb); + + return [ + 0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s, + 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s, + 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s + ]; + }; + + var rgb2oklab_1 = rgb2oklab$2; + + function rgb2lrgb(c) { + var abs = Math.abs(c); + if (abs < 0.04045) { + return c / 12.92; + } + return (sign$1(c) || 1) * pow$8((abs + 0.055) / 1.055, 2.4); + } + + var unpack$4 = utils.unpack; + var pow$7 = Math.pow; + var sign = Math.sign; + + /* + * L* [0..100] + * a [-100..100] + * b [-100..100] + */ + var oklab2rgb$1 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + args = unpack$4(args, 'lab'); + var L = args[0]; + var a = args[1]; + var b = args[2]; + + var l = pow$7(L + 0.3963377774 * a + 0.2158037573 * b, 3); + var m = pow$7(L - 0.1055613458 * a - 0.0638541728 * b, 3); + var s = pow$7(L - 0.0894841775 * a - 1.291485548 * b, 3); + + return [ + 255 * lrgb2rgb(+4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s), + 255 * lrgb2rgb(-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s), + 255 * lrgb2rgb(-0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s), + args.length > 3 ? args[3] : 1 + ]; + }; + + var oklab2rgb_1 = oklab2rgb$1; + + function lrgb2rgb(c) { + var abs = Math.abs(c); + if (abs > 0.0031308) { + return (sign(c) || 1) * (1.055 * pow$7(abs, 1 / 2.4) - 0.055); + } + return c * 12.92; + } + + var unpack$3 = utils.unpack; + var type$8 = utils.type; + var chroma$6 = chroma_1; + var Color$o = Color_1; + var input$1 = input$h; + + var rgb2oklab$1 = rgb2oklab_1; + + Color$o.prototype.oklab = function () { + return rgb2oklab$1(this._rgb); + }; + + chroma$6.oklab = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + return new (Function.prototype.bind.apply( Color$o, [ null ].concat( args, ['oklab']) )); + }; + + input$1.format.oklab = oklab2rgb_1; + + input$1.autodetect.push({ + p: 3, + test: function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + args = unpack$3(args, 'oklab'); + if (type$8(args) === 'array' && args.length === 3) { + return 'oklab'; + } + } + }); + + var unpack$2 = utils.unpack; + var rgb2oklab = rgb2oklab_1; + var lab2lch = lab2lch_1; + + var rgb2oklch$1 = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + var ref = unpack$2(args, 'rgb'); + var r = ref[0]; + var g = ref[1]; + var b = ref[2]; + var ref$1 = rgb2oklab(r, g, b); + var l = ref$1[0]; + var a = ref$1[1]; + var b_ = ref$1[2]; + return lab2lch(l, a, b_); + }; + + var rgb2oklch_1 = rgb2oklch$1; + + var unpack$1 = utils.unpack; + var lch2lab = lch2lab_1; + var oklab2rgb = oklab2rgb_1; + + var oklch2rgb = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + args = unpack$1(args, 'lch'); + var l = args[0]; + var c = args[1]; + var h = args[2]; + var ref = lch2lab(l, c, h); + var L = ref[0]; + var a = ref[1]; + var b_ = ref[2]; + var ref$1 = oklab2rgb(L, a, b_); + var r = ref$1[0]; + var g = ref$1[1]; + var b = ref$1[2]; + return [r, g, b, args.length > 3 ? args[3] : 1]; + }; + + var oklch2rgb_1 = oklch2rgb; + + var unpack = utils.unpack; + var type$7 = utils.type; + var chroma$5 = chroma_1; + var Color$n = Color_1; + var input = input$h; + + var rgb2oklch = rgb2oklch_1; + + Color$n.prototype.oklch = function () { + return rgb2oklch(this._rgb); + }; + + chroma$5.oklch = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + return new (Function.prototype.bind.apply( Color$n, [ null ].concat( args, ['oklch']) )); + }; + + input.format.oklch = oklch2rgb_1; + + input.autodetect.push({ + p: 3, + test: function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + args = unpack(args, 'oklch'); + if (type$7(args) === 'array' && args.length === 3) { + return 'oklch'; + } + } + }); + + var Color$m = Color_1; + var type$6 = utils.type; + + Color$m.prototype.alpha = function(a, mutate) { + if ( mutate === void 0 ) mutate=false; + + if (a !== undefined && type$6(a) === 'number') { + if (mutate) { + this._rgb[3] = a; + return this; + } + return new Color$m([this._rgb[0], this._rgb[1], this._rgb[2], a], 'rgb'); + } + return this._rgb[3]; + }; + + var Color$l = Color_1; + + Color$l.prototype.clipped = function() { + return this._rgb._clipped || false; + }; + + var Color$k = Color_1; + var LAB_CONSTANTS$1 = labConstants; + + Color$k.prototype.darken = function(amount) { + if ( amount === void 0 ) amount=1; + + var me = this; + var lab = me.lab(); + lab[0] -= LAB_CONSTANTS$1.Kn * amount; + return new Color$k(lab, 'lab').alpha(me.alpha(), true); + }; + + Color$k.prototype.brighten = function(amount) { + if ( amount === void 0 ) amount=1; + + return this.darken(-amount); + }; + + Color$k.prototype.darker = Color$k.prototype.darken; + Color$k.prototype.brighter = Color$k.prototype.brighten; + + var Color$j = Color_1; + + Color$j.prototype.get = function(mc) { + var ref = mc.split('.'); + var mode = ref[0]; + var channel = ref[1]; + var src = this[mode](); + if (channel) { + var i = mode.indexOf(channel); + if (i > -1) { return src[i]; } + throw new Error(("unknown channel " + channel + " in mode " + mode)); + } else { + return src; + } + }; + + var Color$i = Color_1; + var type$5 = utils.type; + var pow$6 = Math.pow; + + var EPS = 1e-7; + var MAX_ITER = 20; + + Color$i.prototype.luminance = function(lum) { + if (lum !== undefined && type$5(lum) === 'number') { + if (lum === 0) { + // return pure black + return new Color$i([0,0,0,this._rgb[3]], 'rgb'); + } + if (lum === 1) { + // return pure white + return new Color$i([255,255,255,this._rgb[3]], 'rgb'); + } + // compute new color using... + var cur_lum = this.luminance(); + var mode = 'rgb'; + var max_iter = MAX_ITER; + + var test = function (low, high) { + var mid = low.interpolate(high, 0.5, mode); + var lm = mid.luminance(); + if (Math.abs(lum - lm) < EPS || !max_iter--) { + // close enough + return mid; + } + return lm > lum ? test(low, mid) : test(mid, high); + }; + + var rgb = (cur_lum > lum ? test(new Color$i([0,0,0]), this) : test(this, new Color$i([255,255,255]))).rgb(); + return new Color$i(rgb.concat( [this._rgb[3]])); + } + return rgb2luminance.apply(void 0, (this._rgb).slice(0,3)); + }; + + + var rgb2luminance = function (r,g,b) { + // relative luminance + // see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef + r = luminance_x(r); + g = luminance_x(g); + b = luminance_x(b); + return 0.2126 * r + 0.7152 * g + 0.0722 * b; + }; + + var luminance_x = function (x) { + x /= 255; + return x <= 0.03928 ? x/12.92 : pow$6((x+0.055)/1.055, 2.4); + }; + + var interpolator$1 = {}; + + var Color$h = Color_1; + var type$4 = utils.type; + var interpolator = interpolator$1; + + var mix$1 = function (col1, col2, f) { + if ( f === void 0 ) f=0.5; + var rest = [], len = arguments.length - 3; + while ( len-- > 0 ) rest[ len ] = arguments[ len + 3 ]; + + var mode = rest[0] || 'lrgb'; + if (!interpolator[mode] && !rest.length) { + // fall back to the first supported mode + mode = Object.keys(interpolator)[0]; + } + if (!interpolator[mode]) { + throw new Error(("interpolation mode " + mode + " is not defined")); + } + if (type$4(col1) !== 'object') { col1 = new Color$h(col1); } + if (type$4(col2) !== 'object') { col2 = new Color$h(col2); } + return interpolator[mode](col1, col2, f) + .alpha(col1.alpha() + f * (col2.alpha() - col1.alpha())); + }; + + var Color$g = Color_1; + var mix = mix$1; + + Color$g.prototype.mix = + Color$g.prototype.interpolate = function(col2, f) { + if ( f === void 0 ) f=0.5; + var rest = [], len = arguments.length - 2; + while ( len-- > 0 ) rest[ len ] = arguments[ len + 2 ]; + + return mix.apply(void 0, [ this, col2, f ].concat( rest )); + }; + + var Color$f = Color_1; + + Color$f.prototype.premultiply = function(mutate) { + if ( mutate === void 0 ) mutate=false; + + var rgb = this._rgb; + var a = rgb[3]; + if (mutate) { + this._rgb = [rgb[0]*a, rgb[1]*a, rgb[2]*a, a]; + return this; + } else { + return new Color$f([rgb[0]*a, rgb[1]*a, rgb[2]*a, a], 'rgb'); + } + }; + + var Color$e = Color_1; + var LAB_CONSTANTS = labConstants; + + Color$e.prototype.saturate = function(amount) { + if ( amount === void 0 ) amount=1; + + var me = this; + var lch = me.lch(); + lch[1] += LAB_CONSTANTS.Kn * amount; + if (lch[1] < 0) { lch[1] = 0; } + return new Color$e(lch, 'lch').alpha(me.alpha(), true); + }; + + Color$e.prototype.desaturate = function(amount) { + if ( amount === void 0 ) amount=1; + + return this.saturate(-amount); + }; + + var Color$d = Color_1; + var type$3 = utils.type; + + Color$d.prototype.set = function(mc, value, mutate) { + if ( mutate === void 0 ) mutate=false; + + var ref = mc.split('.'); + var mode = ref[0]; + var channel = ref[1]; + var src = this[mode](); + if (channel) { + var i = mode.indexOf(channel); + if (i > -1) { + if (type$3(value) == 'string') { + switch(value.charAt(0)) { + case '+': src[i] += +value; break; + case '-': src[i] += +value; break; + case '*': src[i] *= +(value.substr(1)); break; + case '/': src[i] /= +(value.substr(1)); break; + default: src[i] = +value; + } + } else if (type$3(value) === 'number') { + src[i] = value; + } else { + throw new Error("unsupported value for Color.set"); + } + var out = new Color$d(src, mode); + if (mutate) { + this._rgb = out._rgb; + return this; + } + return out; + } + throw new Error(("unknown channel " + channel + " in mode " + mode)); + } else { + return src; + } + }; + + var Color$c = Color_1; + + var rgb = function (col1, col2, f) { + var xyz0 = col1._rgb; + var xyz1 = col2._rgb; + return new Color$c( + xyz0[0] + f * (xyz1[0]-xyz0[0]), + xyz0[1] + f * (xyz1[1]-xyz0[1]), + xyz0[2] + f * (xyz1[2]-xyz0[2]), + 'rgb' + ) + }; + + // register interpolator + interpolator$1.rgb = rgb; + + var Color$b = Color_1; + var sqrt$2 = Math.sqrt; + var pow$5 = Math.pow; + + var lrgb = function (col1, col2, f) { + var ref = col1._rgb; + var x1 = ref[0]; + var y1 = ref[1]; + var z1 = ref[2]; + var ref$1 = col2._rgb; + var x2 = ref$1[0]; + var y2 = ref$1[1]; + var z2 = ref$1[2]; + return new Color$b( + sqrt$2(pow$5(x1,2) * (1-f) + pow$5(x2,2) * f), + sqrt$2(pow$5(y1,2) * (1-f) + pow$5(y2,2) * f), + sqrt$2(pow$5(z1,2) * (1-f) + pow$5(z2,2) * f), + 'rgb' + ) + }; + + // register interpolator + interpolator$1.lrgb = lrgb; + + var Color$a = Color_1; + + var lab = function (col1, col2, f) { + var xyz0 = col1.lab(); + var xyz1 = col2.lab(); + return new Color$a( + xyz0[0] + f * (xyz1[0]-xyz0[0]), + xyz0[1] + f * (xyz1[1]-xyz0[1]), + xyz0[2] + f * (xyz1[2]-xyz0[2]), + 'lab' + ) + }; + + // register interpolator + interpolator$1.lab = lab; + + var Color$9 = Color_1; + + var _hsx = function (col1, col2, f, m) { + var assign, assign$1; + + var xyz0, xyz1; + if (m === 'hsl') { + xyz0 = col1.hsl(); + xyz1 = col2.hsl(); + } else if (m === 'hsv') { + xyz0 = col1.hsv(); + xyz1 = col2.hsv(); + } else if (m === 'hcg') { + xyz0 = col1.hcg(); + xyz1 = col2.hcg(); + } else if (m === 'hsi') { + xyz0 = col1.hsi(); + xyz1 = col2.hsi(); + } else if (m === 'lch' || m === 'hcl') { + m = 'hcl'; + xyz0 = col1.hcl(); + xyz1 = col2.hcl(); + } else if (m === 'oklch') { + xyz0 = col1.oklch().reverse(); + xyz1 = col2.oklch().reverse(); + } + + var hue0, hue1, sat0, sat1, lbv0, lbv1; + if (m.substr(0, 1) === 'h' || m === 'oklch') { + (assign = xyz0, hue0 = assign[0], sat0 = assign[1], lbv0 = assign[2]); + (assign$1 = xyz1, hue1 = assign$1[0], sat1 = assign$1[1], lbv1 = assign$1[2]); + } + + var sat, hue, lbv, dh; + + if (!isNaN(hue0) && !isNaN(hue1)) { + // both colors have hue + if (hue1 > hue0 && hue1 - hue0 > 180) { + dh = hue1 - (hue0 + 360); + } else if (hue1 < hue0 && hue0 - hue1 > 180) { + dh = hue1 + 360 - hue0; + } else { + dh = hue1 - hue0; + } + hue = hue0 + f * dh; + } else if (!isNaN(hue0)) { + hue = hue0; + if ((lbv1 == 1 || lbv1 == 0) && m != 'hsv') { sat = sat0; } + } else if (!isNaN(hue1)) { + hue = hue1; + if ((lbv0 == 1 || lbv0 == 0) && m != 'hsv') { sat = sat1; } + } else { + hue = Number.NaN; + } + + if (sat === undefined) { sat = sat0 + f * (sat1 - sat0); } + lbv = lbv0 + f * (lbv1 - lbv0); + return m === 'oklch' ? new Color$9([lbv, sat, hue], m) : new Color$9([hue, sat, lbv], m); + }; + + var interpolate_hsx$5 = _hsx; + + var lch = function (col1, col2, f) { + return interpolate_hsx$5(col1, col2, f, 'lch'); + }; + + // register interpolator + interpolator$1.lch = lch; + interpolator$1.hcl = lch; + + var Color$8 = Color_1; + + var num = function (col1, col2, f) { + var c1 = col1.num(); + var c2 = col2.num(); + return new Color$8(c1 + f * (c2-c1), 'num') + }; + + // register interpolator + interpolator$1.num = num; + + var interpolate_hsx$4 = _hsx; + + var hcg = function (col1, col2, f) { + return interpolate_hsx$4(col1, col2, f, 'hcg'); + }; + + // register interpolator + interpolator$1.hcg = hcg; + + var interpolate_hsx$3 = _hsx; + + var hsi = function (col1, col2, f) { + return interpolate_hsx$3(col1, col2, f, 'hsi'); + }; + + // register interpolator + interpolator$1.hsi = hsi; + + var interpolate_hsx$2 = _hsx; + + var hsl = function (col1, col2, f) { + return interpolate_hsx$2(col1, col2, f, 'hsl'); + }; + + // register interpolator + interpolator$1.hsl = hsl; + + var interpolate_hsx$1 = _hsx; + + var hsv = function (col1, col2, f) { + return interpolate_hsx$1(col1, col2, f, 'hsv'); + }; + + // register interpolator + interpolator$1.hsv = hsv; + + var Color$7 = Color_1; + + var oklab = function (col1, col2, f) { + var xyz0 = col1.oklab(); + var xyz1 = col2.oklab(); + return new Color$7( + xyz0[0] + f * (xyz1[0] - xyz0[0]), + xyz0[1] + f * (xyz1[1] - xyz0[1]), + xyz0[2] + f * (xyz1[2] - xyz0[2]), + 'oklab' + ); + }; + + // register interpolator + interpolator$1.oklab = oklab; + + var interpolate_hsx = _hsx; + + var oklch = function (col1, col2, f) { + return interpolate_hsx(col1, col2, f, 'oklch'); + }; + + // register interpolator + interpolator$1.oklch = oklch; + + var Color$6 = Color_1; + var clip_rgb$1 = utils.clip_rgb; + var pow$4 = Math.pow; + var sqrt$1 = Math.sqrt; + var PI$1 = Math.PI; + var cos$2 = Math.cos; + var sin$2 = Math.sin; + var atan2$1 = Math.atan2; + + var average = function (colors, mode, weights) { + if ( mode === void 0 ) mode='lrgb'; + if ( weights === void 0 ) weights=null; + + var l = colors.length; + if (!weights) { weights = Array.from(new Array(l)).map(function () { return 1; }); } + // normalize weights + var k = l / weights.reduce(function(a, b) { return a + b; }); + weights.forEach(function (w,i) { weights[i] *= k; }); + // convert colors to Color objects + colors = colors.map(function (c) { return new Color$6(c); }); + if (mode === 'lrgb') { + return _average_lrgb(colors, weights) + } + var first = colors.shift(); + var xyz = first.get(mode); + var cnt = []; + var dx = 0; + var dy = 0; + // initial color + for (var i=0; i= 360) { A$1 -= 360; } + xyz[i$1] = A$1; + } else { + xyz[i$1] = xyz[i$1]/cnt[i$1]; + } + } + alpha /= l; + return (new Color$6(xyz, mode)).alpha(alpha > 0.99999 ? 1 : alpha, true); + }; + + + var _average_lrgb = function (colors, weights) { + var l = colors.length; + var xyz = [0,0,0,0]; + for (var i=0; i < colors.length; i++) { + var col = colors[i]; + var f = weights[i] / l; + var rgb = col._rgb; + xyz[0] += pow$4(rgb[0],2) * f; + xyz[1] += pow$4(rgb[1],2) * f; + xyz[2] += pow$4(rgb[2],2) * f; + xyz[3] += rgb[3] * f; + } + xyz[0] = sqrt$1(xyz[0]); + xyz[1] = sqrt$1(xyz[1]); + xyz[2] = sqrt$1(xyz[2]); + if (xyz[3] > 0.9999999) { xyz[3] = 1; } + return new Color$6(clip_rgb$1(xyz)); + }; + + // minimal multi-purpose interface + + // @requires utils color analyze + + var chroma$4 = chroma_1; + var type$2 = utils.type; + + var pow$3 = Math.pow; + + var scale$2 = function(colors) { + + // constructor + var _mode = 'rgb'; + var _nacol = chroma$4('#ccc'); + var _spread = 0; + // const _fixed = false; + var _domain = [0, 1]; + var _pos = []; + var _padding = [0,0]; + var _classes = false; + var _colors = []; + var _out = false; + var _min = 0; + var _max = 1; + var _correctLightness = false; + var _colorCache = {}; + var _useCache = true; + var _gamma = 1; + + // private methods + + var setColors = function(colors) { + colors = colors || ['#fff', '#000']; + if (colors && type$2(colors) === 'string' && chroma$4.brewer && + chroma$4.brewer[colors.toLowerCase()]) { + colors = chroma$4.brewer[colors.toLowerCase()]; + } + if (type$2(colors) === 'array') { + // handle single color + if (colors.length === 1) { + colors = [colors[0], colors[0]]; + } + // make a copy of the colors + colors = colors.slice(0); + // convert to chroma classes + for (var c=0; c= _classes[i]) { + i++; + } + return i-1; + } + return 0; + }; + + var tMapLightness = function (t) { return t; }; + var tMapDomain = function (t) { return t; }; + + // const classifyValue = function(value) { + // let val = value; + // if (_classes.length > 2) { + // const n = _classes.length-1; + // const i = getClass(value); + // const minc = _classes[0] + ((_classes[1]-_classes[0]) * (0 + (_spread * 0.5))); // center of 1st class + // const maxc = _classes[n-1] + ((_classes[n]-_classes[n-1]) * (1 - (_spread * 0.5))); // center of last class + // val = _min + ((((_classes[i] + ((_classes[i+1] - _classes[i]) * 0.5)) - minc) / (maxc-minc)) * (_max - _min)); + // } + // return val; + // }; + + var getColor = function(val, bypassMap) { + var col, t; + if (bypassMap == null) { bypassMap = false; } + if (isNaN(val) || (val === null)) { return _nacol; } + if (!bypassMap) { + if (_classes && (_classes.length > 2)) { + // find the class + var c = getClass(val); + t = c / (_classes.length-2); + } else if (_max !== _min) { + // just interpolate between min/max + t = (val - _min) / (_max - _min); + } else { + t = 1; + } + } else { + t = val; + } + + // domain map + t = tMapDomain(t); + + if (!bypassMap) { + t = tMapLightness(t); // lightness correction + } + + if (_gamma !== 1) { t = pow$3(t, _gamma); } + + t = _padding[0] + (t * (1 - _padding[0] - _padding[1])); + + t = Math.min(1, Math.max(0, t)); + + var k = Math.floor(t * 10000); + + if (_useCache && _colorCache[k]) { + col = _colorCache[k]; + } else { + if (type$2(_colors) === 'array') { + //for i in [0.._pos.length-1] + for (var i=0; i<_pos.length; i++) { + var p = _pos[i]; + if (t <= p) { + col = _colors[i]; + break; + } + if ((t >= p) && (i === (_pos.length-1))) { + col = _colors[i]; + break; + } + if (t > p && t < _pos[i+1]) { + t = (t-p)/(_pos[i+1]-p); + col = chroma$4.interpolate(_colors[i], _colors[i+1], t, _mode); + break; + } + } + } else if (type$2(_colors) === 'function') { + col = _colors(t); + } + if (_useCache) { _colorCache[k] = col; } + } + return col; + }; + + var resetCache = function () { return _colorCache = {}; }; + + setColors(colors); + + // public interface + + var f = function(v) { + var c = chroma$4(getColor(v)); + if (_out && c[_out]) { return c[_out](); } else { return c; } + }; + + f.classes = function(classes) { + if (classes != null) { + if (type$2(classes) === 'array') { + _classes = classes; + _domain = [classes[0], classes[classes.length-1]]; + } else { + var d = chroma$4.analyze(_domain); + if (classes === 0) { + _classes = [d.min, d.max]; + } else { + _classes = chroma$4.limits(d, 'e', classes); + } + } + return f; + } + return _classes; + }; + + + f.domain = function(domain) { + if (!arguments.length) { + return _domain; + } + _min = domain[0]; + _max = domain[domain.length-1]; + _pos = []; + var k = _colors.length; + if ((domain.length === k) && (_min !== _max)) { + // update positions + for (var i = 0, list = Array.from(domain); i < list.length; i += 1) { + var d = list[i]; + + _pos.push((d-_min) / (_max-_min)); + } + } else { + for (var c=0; c 2) { + // set domain map + var tOut = domain.map(function (d,i) { return i/(domain.length-1); }); + var tBreaks = domain.map(function (d) { return (d - _min) / (_max - _min); }); + if (!tBreaks.every(function (val, i) { return tOut[i] === val; })) { + tMapDomain = function (t) { + if (t <= 0 || t >= 1) { return t; } + var i = 0; + while (t >= tBreaks[i+1]) { i++; } + var f = (t - tBreaks[i]) / (tBreaks[i+1] - tBreaks[i]); + var out = tOut[i] + f * (tOut[i+1] - tOut[i]); + return out; + }; + } + + } + } + _domain = [_min, _max]; + return f; + }; + + f.mode = function(_m) { + if (!arguments.length) { + return _mode; + } + _mode = _m; + resetCache(); + return f; + }; + + f.range = function(colors, _pos) { + setColors(colors); + return f; + }; + + f.out = function(_o) { + _out = _o; + return f; + }; + + f.spread = function(val) { + if (!arguments.length) { + return _spread; + } + _spread = val; + return f; + }; + + f.correctLightness = function(v) { + if (v == null) { v = true; } + _correctLightness = v; + resetCache(); + if (_correctLightness) { + tMapLightness = function(t) { + var L0 = getColor(0, true).lab()[0]; + var L1 = getColor(1, true).lab()[0]; + var pol = L0 > L1; + var L_actual = getColor(t, true).lab()[0]; + var L_ideal = L0 + ((L1 - L0) * t); + var L_diff = L_actual - L_ideal; + var t0 = 0; + var t1 = 1; + var max_iter = 20; + while ((Math.abs(L_diff) > 1e-2) && (max_iter-- > 0)) { + (function() { + if (pol) { L_diff *= -1; } + if (L_diff < 0) { + t0 = t; + t += (t1 - t) * 0.5; + } else { + t1 = t; + t += (t0 - t) * 0.5; + } + L_actual = getColor(t, true).lab()[0]; + return L_diff = L_actual - L_ideal; + })(); + } + return t; + }; + } else { + tMapLightness = function (t) { return t; }; + } + return f; + }; + + f.padding = function(p) { + if (p != null) { + if (type$2(p) === 'number') { + p = [p,p]; + } + _padding = p; + return f; + } else { + return _padding; + } + }; + + f.colors = function(numColors, out) { + // If no arguments are given, return the original colors that were provided + if (arguments.length < 2) { out = 'hex'; } + var result = []; + + if (arguments.length === 0) { + result = _colors.slice(0); + + } else if (numColors === 1) { + result = [f(0.5)]; + + } else if (numColors > 1) { + var dm = _domain[0]; + var dd = _domain[1] - dm; + result = __range__(0, numColors, false).map(function (i) { return f( dm + ((i/(numColors-1)) * dd) ); }); + + } else { // returns all colors based on the defined classes + colors = []; + var samples = []; + if (_classes && (_classes.length > 2)) { + for (var i = 1, end = _classes.length, asc = 1 <= end; asc ? i < end : i > end; asc ? i++ : i--) { + samples.push((_classes[i-1]+_classes[i])*0.5); + } + } else { + samples = _domain; + } + result = samples.map(function (v) { return f(v); }); + } + + if (chroma$4[out]) { + result = result.map(function (c) { return c[out](); }); + } + return result; + }; + + f.cache = function(c) { + if (c != null) { + _useCache = c; + return f; + } else { + return _useCache; + } + }; + + f.gamma = function(g) { + if (g != null) { + _gamma = g; + return f; + } else { + return _gamma; + } + }; + + f.nodata = function(d) { + if (d != null) { + _nacol = chroma$4(d); + return f; + } else { + return _nacol; + } + }; + + return f; + }; + + function __range__(left, right, inclusive) { + var range = []; + var ascending = left < right; + var end = !inclusive ? right : ascending ? right + 1 : right - 1; + for (var i = left; ascending ? i < end : i > end; ascending ? i++ : i--) { + range.push(i); + } + return range; + } + + // + // interpolates between a set of colors uzing a bezier spline + // + + // @requires utils lab + var Color$5 = Color_1; + + var scale$1 = scale$2; + + // nth row of the pascal triangle + var binom_row = function(n) { + var row = [1, 1]; + for (var i = 1; i < n; i++) { + var newrow = [1]; + for (var j = 1; j <= row.length; j++) { + newrow[j] = (row[j] || 0) + row[j - 1]; + } + row = newrow; + } + return row; + }; + + var bezier = function(colors) { + var assign, assign$1, assign$2; + + var I, lab0, lab1, lab2; + colors = colors.map(function (c) { return new Color$5(c); }); + if (colors.length === 2) { + // linear interpolation + (assign = colors.map(function (c) { return c.lab(); }), lab0 = assign[0], lab1 = assign[1]); + I = function(t) { + var lab = ([0, 1, 2].map(function (i) { return lab0[i] + (t * (lab1[i] - lab0[i])); })); + return new Color$5(lab, 'lab'); + }; + } else if (colors.length === 3) { + // quadratic bezier interpolation + (assign$1 = colors.map(function (c) { return c.lab(); }), lab0 = assign$1[0], lab1 = assign$1[1], lab2 = assign$1[2]); + I = function(t) { + var lab = ([0, 1, 2].map(function (i) { return ((1-t)*(1-t) * lab0[i]) + (2 * (1-t) * t * lab1[i]) + (t * t * lab2[i]); })); + return new Color$5(lab, 'lab'); + }; + } else if (colors.length === 4) { + // cubic bezier interpolation + var lab3; + (assign$2 = colors.map(function (c) { return c.lab(); }), lab0 = assign$2[0], lab1 = assign$2[1], lab2 = assign$2[2], lab3 = assign$2[3]); + I = function(t) { + var lab = ([0, 1, 2].map(function (i) { return ((1-t)*(1-t)*(1-t) * lab0[i]) + (3 * (1-t) * (1-t) * t * lab1[i]) + (3 * (1-t) * t * t * lab2[i]) + (t*t*t * lab3[i]); })); + return new Color$5(lab, 'lab'); + }; + } else if (colors.length >= 5) { + // general case (degree n bezier) + var labs, row, n; + labs = colors.map(function (c) { return c.lab(); }); + n = colors.length - 1; + row = binom_row(n); + I = function (t) { + var u = 1 - t; + var lab = ([0, 1, 2].map(function (i) { return labs.reduce(function (sum, el, j) { return (sum + row[j] * Math.pow( u, (n - j) ) * Math.pow( t, j ) * el[i]); }, 0); })); + return new Color$5(lab, 'lab'); + }; + } else { + throw new RangeError("No point in running bezier with only one color.") + } + return I; + }; + + var bezier_1 = function (colors) { + var f = bezier(colors); + f.scale = function () { return scale$1(f); }; + return f; + }; + + /* + * interpolates between a set of colors uzing a bezier spline + * blend mode formulas taken from http://www.venture-ware.com/kevin/coding/lets-learn-math-photoshop-blend-modes/ + */ + + var chroma$3 = chroma_1; + + var blend = function (bottom, top, mode) { + if (!blend[mode]) { + throw new Error('unknown blend mode ' + mode); + } + return blend[mode](bottom, top); + }; + + var blend_f = function (f) { return function (bottom,top) { + var c0 = chroma$3(top).rgb(); + var c1 = chroma$3(bottom).rgb(); + return chroma$3.rgb(f(c0, c1)); + }; }; + + var each = function (f) { return function (c0, c1) { + var out = []; + out[0] = f(c0[0], c1[0]); + out[1] = f(c0[1], c1[1]); + out[2] = f(c0[2], c1[2]); + return out; + }; }; + + var normal = function (a) { return a; }; + var multiply = function (a,b) { return a * b / 255; }; + var darken = function (a,b) { return a > b ? b : a; }; + var lighten = function (a,b) { return a > b ? a : b; }; + var screen = function (a,b) { return 255 * (1 - (1-a/255) * (1-b/255)); }; + var overlay = function (a,b) { return b < 128 ? 2 * a * b / 255 : 255 * (1 - 2 * (1 - a / 255 ) * ( 1 - b / 255 )); }; + var burn = function (a,b) { return 255 * (1 - (1 - b / 255) / (a/255)); }; + var dodge = function (a,b) { + if (a === 255) { return 255; } + a = 255 * (b / 255) / (1 - a / 255); + return a > 255 ? 255 : a + }; + + // # add = (a,b) -> + // # if (a + b > 255) then 255 else a + b + + blend.normal = blend_f(each(normal)); + blend.multiply = blend_f(each(multiply)); + blend.screen = blend_f(each(screen)); + blend.overlay = blend_f(each(overlay)); + blend.darken = blend_f(each(darken)); + blend.lighten = blend_f(each(lighten)); + blend.dodge = blend_f(each(dodge)); + blend.burn = blend_f(each(burn)); + // blend.add = blend_f(each(add)); + + var blend_1 = blend; + + // cubehelix interpolation + // based on D.A. Green "A colour scheme for the display of astronomical intensity images" + // http://astron-soc.in/bulletin/11June/289392011.pdf + + var type$1 = utils.type; + var clip_rgb = utils.clip_rgb; + var TWOPI = utils.TWOPI; + var pow$2 = Math.pow; + var sin$1 = Math.sin; + var cos$1 = Math.cos; + var chroma$2 = chroma_1; + + var cubehelix = function(start, rotations, hue, gamma, lightness) { + if ( start === void 0 ) start=300; + if ( rotations === void 0 ) rotations=-1.5; + if ( hue === void 0 ) hue=1; + if ( gamma === void 0 ) gamma=1; + if ( lightness === void 0 ) lightness=[0,1]; + + var dh = 0, dl; + if (type$1(lightness) === 'array') { + dl = lightness[1] - lightness[0]; + } else { + dl = 0; + lightness = [lightness, lightness]; + } + + var f = function(fract) { + var a = TWOPI * (((start+120)/360) + (rotations * fract)); + var l = pow$2(lightness[0] + (dl * fract), gamma); + var h = dh !== 0 ? hue[0] + (fract * dh) : hue; + var amp = (h * l * (1-l)) / 2; + var cos_a = cos$1(a); + var sin_a = sin$1(a); + var r = l + (amp * ((-0.14861 * cos_a) + (1.78277* sin_a))); + var g = l + (amp * ((-0.29227 * cos_a) - (0.90649* sin_a))); + var b = l + (amp * (+1.97294 * cos_a)); + return chroma$2(clip_rgb([r*255,g*255,b*255,1])); + }; + + f.start = function(s) { + if ((s == null)) { return start; } + start = s; + return f; + }; + + f.rotations = function(r) { + if ((r == null)) { return rotations; } + rotations = r; + return f; + }; + + f.gamma = function(g) { + if ((g == null)) { return gamma; } + gamma = g; + return f; + }; + + f.hue = function(h) { + if ((h == null)) { return hue; } + hue = h; + if (type$1(hue) === 'array') { + dh = hue[1] - hue[0]; + if (dh === 0) { hue = hue[1]; } + } else { + dh = 0; + } + return f; + }; + + f.lightness = function(h) { + if ((h == null)) { return lightness; } + if (type$1(h) === 'array') { + lightness = h; + dl = h[1] - h[0]; + } else { + lightness = [h,h]; + dl = 0; + } + return f; + }; + + f.scale = function () { return chroma$2.scale(f); }; + + f.hue(hue); + + return f; + }; + + var Color$4 = Color_1; + var digits = '0123456789abcdef'; + + var floor$1 = Math.floor; + var random = Math.random; + + var random_1 = function () { + var code = '#'; + for (var i=0; i<6; i++) { + code += digits.charAt(floor$1(random() * 16)); + } + return new Color$4(code, 'hex'); + }; + + var type = type$p; + var log = Math.log; + var pow$1 = Math.pow; + var floor = Math.floor; + var abs$1 = Math.abs; + + + var analyze = function (data, key) { + if ( key === void 0 ) key=null; + + var r = { + min: Number.MAX_VALUE, + max: Number.MAX_VALUE*-1, + sum: 0, + values: [], + count: 0 + }; + if (type(data) === 'object') { + data = Object.values(data); + } + data.forEach(function (val) { + if (key && type(val) === 'object') { val = val[key]; } + if (val !== undefined && val !== null && !isNaN(val)) { + r.values.push(val); + r.sum += val; + if (val < r.min) { r.min = val; } + if (val > r.max) { r.max = val; } + r.count += 1; + } + }); + + r.domain = [r.min, r.max]; + + r.limits = function (mode, num) { return limits(r, mode, num); }; + + return r; + }; + + + var limits = function (data, mode, num) { + if ( mode === void 0 ) mode='equal'; + if ( num === void 0 ) num=7; + + if (type(data) == 'array') { + data = analyze(data); + } + var min = data.min; + var max = data.max; + var values = data.values.sort(function (a,b) { return a-b; }); + + if (num === 1) { return [min,max]; } + + var limits = []; + + if (mode.substr(0,1) === 'c') { // continuous + limits.push(min); + limits.push(max); + } + + if (mode.substr(0,1) === 'e') { // equal interval + limits.push(min); + for (var i=1; i 0'); + } + var min_log = Math.LOG10E * log(min); + var max_log = Math.LOG10E * log(max); + limits.push(min); + for (var i$1=1; i$1 pb + var pr = p - pb; + limits.push((values[pb]*(1-pr)) + (values[pb+1]*pr)); + } + } + limits.push(max); + + } + + else if (mode.substr(0,1) === 'k') { // k-means clustering + /* + implementation based on + http://code.google.com/p/figue/source/browse/trunk/figue.js#336 + simplified for 1-d input values + */ + var cluster; + var n = values.length; + var assignments = new Array(n); + var clusterSizes = new Array(num); + var repeat = true; + var nb_iters = 0; + var centroids = null; + + // get seed values + centroids = []; + centroids.push(min); + for (var i$3=1; i$3 200) { + repeat = false; + } + } + + // finished k-means clustering + // the next part is borrowed from gabrielflor.it + var kClusters = {}; + for (var j$5=0; j$5 l2 ? (l1 + 0.05) / (l2 + 0.05) : (l2 + 0.05) / (l1 + 0.05); + }; + + var Color$2 = Color_1; + var sqrt = Math.sqrt; + var pow = Math.pow; + var min = Math.min; + var max = Math.max; + var atan2 = Math.atan2; + var abs = Math.abs; + var cos = Math.cos; + var sin = Math.sin; + var exp = Math.exp; + var PI = Math.PI; + + var deltaE = function(a, b, Kl, Kc, Kh) { + if ( Kl === void 0 ) Kl=1; + if ( Kc === void 0 ) Kc=1; + if ( Kh === void 0 ) Kh=1; + + // Delta E (CIE 2000) + // see http://www.brucelindbloom.com/index.html?Eqn_DeltaE_CIE2000.html + var rad2deg = function(rad) { + return 360 * rad / (2 * PI); + }; + var deg2rad = function(deg) { + return (2 * PI * deg) / 360; + }; + a = new Color$2(a); + b = new Color$2(b); + var ref = Array.from(a.lab()); + var L1 = ref[0]; + var a1 = ref[1]; + var b1 = ref[2]; + var ref$1 = Array.from(b.lab()); + var L2 = ref$1[0]; + var a2 = ref$1[1]; + var b2 = ref$1[2]; + var avgL = (L1 + L2)/2; + var C1 = sqrt(pow(a1, 2) + pow(b1, 2)); + var C2 = sqrt(pow(a2, 2) + pow(b2, 2)); + var avgC = (C1 + C2)/2; + var G = 0.5*(1-sqrt(pow(avgC, 7)/(pow(avgC, 7) + pow(25, 7)))); + var a1p = a1*(1+G); + var a2p = a2*(1+G); + var C1p = sqrt(pow(a1p, 2) + pow(b1, 2)); + var C2p = sqrt(pow(a2p, 2) + pow(b2, 2)); + var avgCp = (C1p + C2p)/2; + var arctan1 = rad2deg(atan2(b1, a1p)); + var arctan2 = rad2deg(atan2(b2, a2p)); + var h1p = arctan1 >= 0 ? arctan1 : arctan1 + 360; + var h2p = arctan2 >= 0 ? arctan2 : arctan2 + 360; + var avgHp = abs(h1p - h2p) > 180 ? (h1p + h2p + 360)/2 : (h1p + h2p)/2; + var T = 1 - 0.17*cos(deg2rad(avgHp - 30)) + 0.24*cos(deg2rad(2*avgHp)) + 0.32*cos(deg2rad(3*avgHp + 6)) - 0.2*cos(deg2rad(4*avgHp - 63)); + var deltaHp = h2p - h1p; + deltaHp = abs(deltaHp) <= 180 ? deltaHp : h2p <= h1p ? deltaHp + 360 : deltaHp - 360; + deltaHp = 2*sqrt(C1p*C2p)*sin(deg2rad(deltaHp)/2); + var deltaL = L2 - L1; + var deltaCp = C2p - C1p; + var sl = 1 + (0.015*pow(avgL - 50, 2))/sqrt(20 + pow(avgL - 50, 2)); + var sc = 1 + 0.045*avgCp; + var sh = 1 + 0.015*avgCp*T; + var deltaTheta = 30*exp(-pow((avgHp - 275)/25, 2)); + var Rc = 2*sqrt(pow(avgCp, 7)/(pow(avgCp, 7) + pow(25, 7))); + var Rt = -Rc*sin(2*deg2rad(deltaTheta)); + var result = sqrt(pow(deltaL/(Kl*sl), 2) + pow(deltaCp/(Kc*sc), 2) + pow(deltaHp/(Kh*sh), 2) + Rt*(deltaCp/(Kc*sc))*(deltaHp/(Kh*sh))); + return max(0, min(100, result)); + }; + + var Color$1 = Color_1; + + // simple Euclidean distance + var distance = function(a, b, mode) { + if ( mode === void 0 ) mode='lab'; + + // Delta E (CIE 1976) + // see http://www.brucelindbloom.com/index.html?Equations.html + a = new Color$1(a); + b = new Color$1(b); + var l1 = a.get(mode); + var l2 = b.get(mode); + var sum_sq = 0; + for (var i in l1) { + var d = (l1[i] || 0) - (l2[i] || 0); + sum_sq += d*d; + } + return Math.sqrt(sum_sq); + }; + + var Color = Color_1; + + var valid = function () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + try { + new (Function.prototype.bind.apply( Color, [ null ].concat( args) )); + return true; + } catch (e) { + return false; + } + }; + + // some pre-defined color scales: + var chroma$1 = chroma_1; + + var scale = scale$2; + + var scales = { + cool: function cool() { return scale([chroma$1.hsl(180,1,.9), chroma$1.hsl(250,.7,.4)]) }, + hot: function hot() { return scale(['#000','#f00','#ff0','#fff']).mode('rgb') } + }; + + /** + ColorBrewer colors for chroma.js + + Copyright (c) 2002 Cynthia Brewer, Mark Harrower, and The + Pennsylvania State University. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software distributed + under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. See the License for the + specific language governing permissions and limitations under the License. + */ + + var colorbrewer = { + // sequential + OrRd: ['#fff7ec', '#fee8c8', '#fdd49e', '#fdbb84', '#fc8d59', '#ef6548', '#d7301f', '#b30000', '#7f0000'], + PuBu: ['#fff7fb', '#ece7f2', '#d0d1e6', '#a6bddb', '#74a9cf', '#3690c0', '#0570b0', '#045a8d', '#023858'], + BuPu: ['#f7fcfd', '#e0ecf4', '#bfd3e6', '#9ebcda', '#8c96c6', '#8c6bb1', '#88419d', '#810f7c', '#4d004b'], + Oranges: ['#fff5eb', '#fee6ce', '#fdd0a2', '#fdae6b', '#fd8d3c', '#f16913', '#d94801', '#a63603', '#7f2704'], + BuGn: ['#f7fcfd', '#e5f5f9', '#ccece6', '#99d8c9', '#66c2a4', '#41ae76', '#238b45', '#006d2c', '#00441b'], + YlOrBr: ['#ffffe5', '#fff7bc', '#fee391', '#fec44f', '#fe9929', '#ec7014', '#cc4c02', '#993404', '#662506'], + YlGn: ['#ffffe5', '#f7fcb9', '#d9f0a3', '#addd8e', '#78c679', '#41ab5d', '#238443', '#006837', '#004529'], + Reds: ['#fff5f0', '#fee0d2', '#fcbba1', '#fc9272', '#fb6a4a', '#ef3b2c', '#cb181d', '#a50f15', '#67000d'], + RdPu: ['#fff7f3', '#fde0dd', '#fcc5c0', '#fa9fb5', '#f768a1', '#dd3497', '#ae017e', '#7a0177', '#49006a'], + Greens: ['#f7fcf5', '#e5f5e0', '#c7e9c0', '#a1d99b', '#74c476', '#41ab5d', '#238b45', '#006d2c', '#00441b'], + YlGnBu: ['#ffffd9', '#edf8b1', '#c7e9b4', '#7fcdbb', '#41b6c4', '#1d91c0', '#225ea8', '#253494', '#081d58'], + Purples: ['#fcfbfd', '#efedf5', '#dadaeb', '#bcbddc', '#9e9ac8', '#807dba', '#6a51a3', '#54278f', '#3f007d'], + GnBu: ['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081'], + Greys: ['#ffffff', '#f0f0f0', '#d9d9d9', '#bdbdbd', '#969696', '#737373', '#525252', '#252525', '#000000'], + YlOrRd: ['#ffffcc', '#ffeda0', '#fed976', '#feb24c', '#fd8d3c', '#fc4e2a', '#e31a1c', '#bd0026', '#800026'], + PuRd: ['#f7f4f9', '#e7e1ef', '#d4b9da', '#c994c7', '#df65b0', '#e7298a', '#ce1256', '#980043', '#67001f'], + Blues: ['#f7fbff', '#deebf7', '#c6dbef', '#9ecae1', '#6baed6', '#4292c6', '#2171b5', '#08519c', '#08306b'], + PuBuGn: ['#fff7fb', '#ece2f0', '#d0d1e6', '#a6bddb', '#67a9cf', '#3690c0', '#02818a', '#016c59', '#014636'], + Viridis: ['#440154', '#482777', '#3f4a8a', '#31678e', '#26838f', '#1f9d8a', '#6cce5a', '#b6de2b', '#fee825'], + + // diverging + + Spectral: ['#9e0142', '#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#e6f598', '#abdda4', '#66c2a5', '#3288bd', '#5e4fa2'], + RdYlGn: ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850', '#006837'], + RdBu: ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#f7f7f7', '#d1e5f0', '#92c5de', '#4393c3', '#2166ac', '#053061'], + PiYG: ['#8e0152', '#c51b7d', '#de77ae', '#f1b6da', '#fde0ef', '#f7f7f7', '#e6f5d0', '#b8e186', '#7fbc41', '#4d9221', '#276419'], + PRGn: ['#40004b', '#762a83', '#9970ab', '#c2a5cf', '#e7d4e8', '#f7f7f7', '#d9f0d3', '#a6dba0', '#5aae61', '#1b7837', '#00441b'], + RdYlBu: ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee090', '#ffffbf', '#e0f3f8', '#abd9e9', '#74add1', '#4575b4', '#313695'], + BrBG: ['#543005', '#8c510a', '#bf812d', '#dfc27d', '#f6e8c3', '#f5f5f5', '#c7eae5', '#80cdc1', '#35978f', '#01665e', '#003c30'], + RdGy: ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#ffffff', '#e0e0e0', '#bababa', '#878787', '#4d4d4d', '#1a1a1a'], + PuOr: ['#7f3b08', '#b35806', '#e08214', '#fdb863', '#fee0b6', '#f7f7f7', '#d8daeb', '#b2abd2', '#8073ac', '#542788', '#2d004b'], + + // qualitative + + Set2: ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3', '#a6d854', '#ffd92f', '#e5c494', '#b3b3b3'], + Accent: ['#7fc97f', '#beaed4', '#fdc086', '#ffff99', '#386cb0', '#f0027f', '#bf5b17', '#666666'], + Set1: ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00', '#ffff33', '#a65628', '#f781bf', '#999999'], + Set3: ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5', '#d9d9d9', '#bc80bd', '#ccebc5', '#ffed6f'], + Dark2: ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e', '#e6ab02', '#a6761d', '#666666'], + Paired: ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00', '#cab2d6', '#6a3d9a', '#ffff99', '#b15928'], + Pastel2: ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4', '#e6f5c9', '#fff2ae', '#f1e2cc', '#cccccc'], + Pastel1: ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6', '#ffffcc', '#e5d8bd', '#fddaec', '#f2f2f2'], + }; + + // add lowercase aliases for case-insensitive matches + for (var i = 0, list = Object.keys(colorbrewer); i < list.length; i += 1) { + var key = list[i]; + + colorbrewer[key.toLowerCase()] = colorbrewer[key]; + } + + var colorbrewer_1 = colorbrewer; + + var chroma = chroma_1; + + // feel free to comment out anything to rollup + // a smaller chroma.js built + + // io --> convert colors + + + + + + + + + + + + + + + + + + // operators --> modify existing Colors + + + + + + + + + + + // interpolators + + + + + + + + + + + + + // generators -- > create new colors + chroma.average = average; + chroma.bezier = bezier_1; + chroma.blend = blend_1; + chroma.cubehelix = cubehelix; + chroma.mix = chroma.interpolate = mix$1; + chroma.random = random_1; + chroma.scale = scale$2; + + // other utility methods + chroma.analyze = analyze_1.analyze; + chroma.contrast = contrast; + chroma.deltaE = deltaE; + chroma.distance = distance; + chroma.limits = analyze_1.limits; + chroma.valid = valid; + + // scale + chroma.scales = scales; + + // colors + chroma.colors = w3cx11_1; + chroma.brewer = colorbrewer_1; + + var chroma_js = chroma; + + return chroma_js; + +})); + +; /*! - * jQuery JavaScript Library v3.6.0 + * jQuery JavaScript Library v3.7.1 * https://jquery.com/ * - * Includes Sizzle.js - * https://sizzlejs.com/ - * * Copyright OpenJS Foundation and other contributors * Released under the MIT license * https://jquery.org/license * - * Date: 2021-03-02T17:08Z + * Date: 2023-08-28T13:37Z */ ( function( global, factory ) { @@ -23,7 +3596,7 @@ // (such as Node.js), expose a factory as module.exports. // This accentuates the need for the creation of a real `window`. // e.g. var jQuery = require("jquery")(window); - // See ticket #14549 for more info. + // See ticket trac-14549 for more info. module.exports = global.document ? factory( global, true ) : function( w ) { @@ -150,8 +3723,9 @@ function toType( obj ) { -var - version = "3.6.0", +var version = "3.7.1", + + rhtmlSuffix = /HTML$/i, // Define a local copy of jQuery jQuery = function( selector, context ) { @@ -397,6 +3971,38 @@ jQuery.extend( { return obj; }, + + // Retrieve the text value of an array of DOM nodes + text: function( elem ) { + var node, + ret = "", + i = 0, + nodeType = elem.nodeType; + + if ( !nodeType ) { + + // If no nodeType, this is expected to be an array + while ( ( node = elem[ i++ ] ) ) { + + // Do not traverse comment nodes + ret += jQuery.text( node ); + } + } + if ( nodeType === 1 || nodeType === 11 ) { + return elem.textContent; + } + if ( nodeType === 9 ) { + return elem.documentElement.textContent; + } + if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + + // Do not include comment or processing instruction nodes + + return ret; + }, + // results is for internal usage only makeArray: function( arr, results ) { var ret = results || []; @@ -419,6 +4025,15 @@ jQuery.extend( { return arr == null ? -1 : indexOf.call( arr, elem, i ); }, + isXMLDoc: function( elem ) { + var namespace = elem && elem.namespaceURI, + docElem = elem && ( elem.ownerDocument || elem ).documentElement; + + // Assume HTML when documentElement doesn't yet exist, such as inside + // document fragments. + return !rhtmlSuffix.test( namespace || docElem && docElem.nodeName || "HTML" ); + }, + // Support: Android <=4.0 only, PhantomJS 1 only // push.apply(_, arraylike) throws on ancient WebKit merge: function( first, second ) { @@ -482,81 +4097,136 @@ jQuery.extend( { } } - // Flatten any nested arrays - return flat( ret ); - }, + // Flatten any nested arrays + return flat( ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // jQuery.support is not used in Core but other projects attach their + // properties to it so it needs to exist. + support: support +} ); + +if ( typeof Symbol === "function" ) { + jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; +} + +// Populate the class2type map +jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), + function( _i, name ) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); + } ); + +function isArrayLike( obj ) { + + // Support: real iOS 8.2 only (not reproducible in simulator) + // `in` check used to prevent JIT error (gh-2145) + // hasOwn isn't used here due to false negatives + // regarding Nodelist length in IE + var length = !!obj && "length" in obj && obj.length, + type = toType( obj ); + + if ( isFunction( obj ) || isWindow( obj ) ) { + return false; + } + + return type === "array" || length === 0 || + typeof length === "number" && length > 0 && ( length - 1 ) in obj; +} + + +function nodeName( elem, name ) { + + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); + +} +var pop = arr.pop; + + +var sort = arr.sort; + + +var splice = arr.splice; + + +var whitespace = "[\\x20\\t\\r\\n\\f]"; + + +var rtrimCSS = new RegExp( + "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", + "g" +); + + + + +// Note: an element does not contain itself +jQuery.contains = function( a, b ) { + var bup = b && b.parentNode; + + return a === bup || !!( bup && bup.nodeType === 1 && ( + + // Support: IE 9 - 11+ + // IE doesn't have `contains` on SVG. + a.contains ? + a.contains( bup ) : + a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 + ) ); +}; - // A global GUID counter for objects - guid: 1, - // jQuery.support is not used in Core but other projects attach their - // properties to it so it needs to exist. - support: support -} ); -if ( typeof Symbol === "function" ) { - jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; -} -// Populate the class2type map -jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), - function( _i, name ) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); - } ); +// CSS string/identifier serialization +// https://drafts.csswg.org/cssom/#common-serializing-idioms +var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g; -function isArrayLike( obj ) { +function fcssescape( ch, asCodePoint ) { + if ( asCodePoint ) { - // Support: real iOS 8.2 only (not reproducible in simulator) - // `in` check used to prevent JIT error (gh-2145) - // hasOwn isn't used here due to false negatives - // regarding Nodelist length in IE - var length = !!obj && "length" in obj && obj.length, - type = toType( obj ); + // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER + if ( ch === "\0" ) { + return "\uFFFD"; + } - if ( isFunction( obj ) || isWindow( obj ) ) { - return false; + // Control characters and (dependent upon position) numbers get escaped as code points + return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; } - return type === "array" || length === 0 || - typeof length === "number" && length > 0 && ( length - 1 ) in obj; + // Other potentially-special ASCII characters get backslash-escaped + return "\\" + ch; } -var Sizzle = -/*! - * Sizzle CSS Selector Engine v2.3.6 - * https://sizzlejs.com/ - * - * Copyright JS Foundation and other contributors - * Released under the MIT license - * https://js.foundation/ - * - * Date: 2021-02-16 - */ -( function( window ) { + +jQuery.escapeSelector = function( sel ) { + return ( sel + "" ).replace( rcssescape, fcssescape ); +}; + + + + +var preferredDoc = document, + pushNative = push; + +( function() { + var i, - support, Expr, - getText, - isXML, - tokenize, - compile, - select, outermostContext, sortInput, hasDuplicate, + push = pushNative, // Local document vars - setDocument, document, - docElem, + documentElement, documentIsHTML, rbuggyQSA, - rbuggyMatches, matches, - contains, // Instance-specific data - expando = "sizzle" + 1 * new Date(), - preferredDoc = window.document, + expando = jQuery.expando, dirruns = 0, done = 0, classCache = createCache(), @@ -570,47 +4240,22 @@ var i, return 0; }, - // Instance methods - hasOwn = ( {} ).hasOwnProperty, - arr = [], - pop = arr.pop, - pushNative = arr.push, - push = arr.push, - slice = arr.slice, - - // Use a stripped-down indexOf as it's faster than native - // https://jsperf.com/thor-indexof-vs-for/5 - indexOf = function( list, elem ) { - var i = 0, - len = list.length; - for ( ; i < len; i++ ) { - if ( list[ i ] === elem ) { - return i; - } - } - return -1; - }, - - booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" + - "ismap|loop|multiple|open|readonly|required|scoped", + booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|" + + "loop|multiple|open|readonly|required|scoped", // Regular expressions - // http://www.w3.org/TR/css3-selectors/#whitespace - whitespace = "[\\x20\\t\\r\\n\\f]", - // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", - // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors + // Attribute selectors: https://www.w3.org/TR/selectors/#attribute-selectors attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + // Operator (capture 2) "*([*^$|!~]?=)" + whitespace + - // "Attribute values must be CSS identifiers [capture 5] - // or strings [capture 3 or capture 4]" + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]", @@ -629,101 +4274,88 @@ var i, // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter rwhitespace = new RegExp( whitespace + "+", "g" ), - rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + - whitespace + "+$", "g" ), rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), - rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + - "*" ), + rleadingCombinator = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + + whitespace + "*" ), rdescend = new RegExp( whitespace + "|>" ), rpseudo = new RegExp( pseudos ), ridentifier = new RegExp( "^" + identifier + "$" ), matchExpr = { - "ID": new RegExp( "^#(" + identifier + ")" ), - "CLASS": new RegExp( "^\\.(" + identifier + ")" ), - "TAG": new RegExp( "^(" + identifier + "|[*])" ), - "ATTR": new RegExp( "^" + attributes ), - "PSEUDO": new RegExp( "^" + pseudos ), - "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + - whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + - whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), - "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), + ID: new RegExp( "^#(" + identifier + ")" ), + CLASS: new RegExp( "^\\.(" + identifier + ")" ), + TAG: new RegExp( "^(" + identifier + "|[*])" ), + ATTR: new RegExp( "^" + attributes ), + PSEUDO: new RegExp( "^" + pseudos ), + CHILD: new RegExp( + "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), + bool: new RegExp( "^(?:" + booleans + ")$", "i" ), // For use in libraries implementing .is() // We use this for POS matching in `select` - "needsContext": new RegExp( "^" + whitespace + + needsContext: new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) }, - rhtml = /HTML$/i, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, - rnative = /^[^{]+\{\s*\[native \w/, - // Easily-parseable/retrievable ID or TAG or CLASS selectors rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rsibling = /[+~]/, // CSS escapes - // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters - runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ), + // https://www.w3.org/TR/CSS21/syndata.html#escaped-characters + runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + + "?|\\\\([^\\r\\n\\f])", "g" ), funescape = function( escape, nonHex ) { var high = "0x" + escape.slice( 1 ) - 0x10000; - return nonHex ? + if ( nonHex ) { // Strip the backslash prefix from a non-hex escape sequence - nonHex : - - // Replace a hexadecimal escape sequence with the encoded Unicode code point - // Support: IE <=11+ - // For values outside the Basic Multilingual Plane (BMP), manually construct a - // surrogate pair - high < 0 ? - String.fromCharCode( high + 0x10000 ) : - String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); - }, - - // CSS string/identifier serialization - // https://drafts.csswg.org/cssom/#common-serializing-idioms - rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, - fcssescape = function( ch, asCodePoint ) { - if ( asCodePoint ) { - - // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER - if ( ch === "\0" ) { - return "\uFFFD"; - } - - // Control characters and (dependent upon position) numbers get escaped as code points - return ch.slice( 0, -1 ) + "\\" + - ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; + return nonHex; } - // Other potentially-special ASCII characters get backslash-escaped - return "\\" + ch; + // Replace a hexadecimal escape sequence with the encoded Unicode code point + // Support: IE <=11+ + // For values outside the Basic Multilingual Plane (BMP), manually construct a + // surrogate pair + return high < 0 ? + String.fromCharCode( high + 0x10000 ) : + String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); }, - // Used for iframes - // See setDocument() + // Used for iframes; see `setDocument`. + // Support: IE 9 - 11+, Edge 12 - 18+ // Removing the function wrapper causes a "Permission Denied" - // error in IE + // error in IE/Edge. unloadHandler = function() { setDocument(); }, inDisabledFieldset = addCombinator( function( elem ) { - return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset"; + return elem.disabled === true && nodeName( elem, "fieldset" ); }, { dir: "parentNode", next: "legend" } ); +// Support: IE <=9 only +// Accessing document.activeElement can throw unexpectedly +// https://bugs.jquery.com/ticket/13393 +function safeActiveElement() { + try { + return document.activeElement; + } catch ( err ) { } +} + // Optimize for push.apply( _, NodeList ) try { push.apply( @@ -731,32 +4363,22 @@ try { preferredDoc.childNodes ); - // Support: Android<4.0 + // Support: Android <=4.0 // Detect silently failing push.apply // eslint-disable-next-line no-unused-expressions arr[ preferredDoc.childNodes.length ].nodeType; } catch ( e ) { - push = { apply: arr.length ? - - // Leverage slice if possible - function( target, els ) { + push = { + apply: function( target, els ) { pushNative.apply( target, slice.call( els ) ); - } : - - // Support: IE<9 - // Otherwise append directly - function( target, els ) { - var j = target.length, - i = 0; - - // Can't trust NodeList.length - while ( ( target[ j++ ] = els[ i++ ] ) ) {} - target.length = j - 1; + }, + call: function( target ) { + pushNative.apply( target, slice.call( arguments, 1 ) ); } }; } -function Sizzle( selector, context, results, seed ) { +function find( selector, context, results, seed ) { var m, i, elem, nid, match, groups, newSelector, newContext = context && context.ownerDocument, @@ -790,11 +4412,10 @@ function Sizzle( selector, context, results, seed ) { if ( nodeType === 9 ) { if ( ( elem = context.getElementById( m ) ) ) { - // Support: IE, Opera, Webkit - // TODO: identify versions + // Support: IE 9 only // getElementById can match elements by name instead of ID if ( elem.id === m ) { - results.push( elem ); + push.call( results, elem ); return results; } } else { @@ -804,14 +4425,13 @@ function Sizzle( selector, context, results, seed ) { // Element context } else { - // Support: IE, Opera, Webkit - // TODO: identify versions + // Support: IE 9 only // getElementById can match elements by name instead of ID if ( newContext && ( elem = newContext.getElementById( m ) ) && - contains( context, elem ) && + find.contains( context, elem ) && elem.id === m ) { - results.push( elem ); + push.call( results, elem ); return results; } } @@ -822,22 +4442,15 @@ function Sizzle( selector, context, results, seed ) { return results; // Class selector - } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName && - context.getElementsByClassName ) { - + } else if ( ( m = match[ 3 ] ) && context.getElementsByClassName ) { push.apply( results, context.getElementsByClassName( m ) ); return results; } } // Take advantage of querySelectorAll - if ( support.qsa && - !nonnativeSelectorCache[ selector + " " ] && - ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) && - - // Support: IE 8 only - // Exclude object elements - ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) { + if ( !nonnativeSelectorCache[ selector + " " ] && + ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) ) { newSelector = selector; newContext = context; @@ -850,7 +4463,7 @@ function Sizzle( selector, context, results, seed ) { // as such selectors are not recognized by querySelectorAll. // Thanks to Andrew Dupont for this technique. if ( nodeType === 1 && - ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) { + ( rdescend.test( selector ) || rleadingCombinator.test( selector ) ) ) { // Expand context for sibling selectors newContext = rsibling.test( selector ) && testContext( context.parentNode ) || @@ -858,11 +4471,15 @@ function Sizzle( selector, context, results, seed ) { // We can use :scope instead of the ID hack if the browser // supports it & if we're not changing the context. - if ( newContext !== context || !support.scope ) { + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when + // strict-comparing two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + if ( newContext != context || !support.scope ) { // Capture the context ID, setting it first if necessary if ( ( nid = context.getAttribute( "id" ) ) ) { - nid = nid.replace( rcssescape, fcssescape ); + nid = jQuery.escapeSelector( nid ); } else { context.setAttribute( "id", ( nid = expando ) ); } @@ -895,7 +4512,7 @@ function Sizzle( selector, context, results, seed ) { } // All others - return select( selector.replace( rtrim, "$1" ), context, results, seed ); + return select( selector.replace( rtrimCSS, "$1" ), context, results, seed ); } /** @@ -909,7 +4526,8 @@ function createCache() { function cache( key, value ) { - // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) + // Use (key + " ") to avoid collision with native prototype properties + // (see https://github.com/jquery/sizzle/issues/157) if ( keys.push( key + " " ) > Expr.cacheLength ) { // Only keep the most recent entries @@ -921,7 +4539,7 @@ function createCache() { } /** - * Mark a function for special use by Sizzle + * Mark a function for special use by jQuery selector module * @param {Function} fn The function to mark */ function markFunction( fn ) { @@ -952,56 +4570,13 @@ function assert( fn ) { } } -/** - * Adds the same handler for all of the specified attrs - * @param {String} attrs Pipe-separated list of attributes - * @param {Function} handler The method that will be applied - */ -function addHandle( attrs, handler ) { - var arr = attrs.split( "|" ), - i = arr.length; - - while ( i-- ) { - Expr.attrHandle[ arr[ i ] ] = handler; - } -} - -/** - * Checks document order of two siblings - * @param {Element} a - * @param {Element} b - * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b - */ -function siblingCheck( a, b ) { - var cur = b && a, - diff = cur && a.nodeType === 1 && b.nodeType === 1 && - a.sourceIndex - b.sourceIndex; - - // Use IE sourceIndex if available on both nodes - if ( diff ) { - return diff; - } - - // Check if b follows a - if ( cur ) { - while ( ( cur = cur.nextSibling ) ) { - if ( cur === b ) { - return -1; - } - } - } - - return a ? 1 : -1; -} - /** * Returns a function to use in pseudos for input types * @param {String} type */ function createInputPseudo( type ) { return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === type; + return nodeName( elem, "input" ) && elem.type === type; }; } @@ -1011,8 +4586,8 @@ function createInputPseudo( type ) { */ function createButtonPseudo( type ) { return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return ( name === "input" || name === "button" ) && elem.type === type; + return ( nodeName( elem, "input" ) || nodeName( elem, "button" ) ) && + elem.type === type; }; } @@ -1048,14 +4623,13 @@ function createDisabledPseudo( disabled ) { } } - // Support: IE 6 - 11 + // Support: IE 6 - 11+ // Use the isDisabled shortcut property to check for disabled fieldset ancestors return elem.isDisabled === disabled || // Where there is no isDisabled, check manually - /* jshint -W018 */ elem.isDisabled !== !disabled && - inDisabledFieldset( elem ) === disabled; + inDisabledFieldset( elem ) === disabled; } return elem.disabled === disabled; @@ -1095,7 +4669,7 @@ function createPositionalPseudo( fn ) { } /** - * Checks a node for validity as a Sizzle context + * Checks a node for validity as a jQuery selector context * @param {Element|Object=} context * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value */ @@ -1103,31 +4677,13 @@ function testContext( context ) { return context && typeof context.getElementsByTagName !== "undefined" && context; } -// Expose support vars for convenience -support = Sizzle.support = {}; - -/** - * Detects XML nodes - * @param {Element|Object} elem An element or a document - * @returns {Boolean} True iff elem is a non-HTML XML node - */ -isXML = Sizzle.isXML = function( elem ) { - var namespace = elem && elem.namespaceURI, - docElem = elem && ( elem.ownerDocument || elem ).documentElement; - - // Support: IE <=8 - // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes - // https://bugs.jquery.com/ticket/4833 - return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" ); -}; - /** * Sets document-related variables once based on the current document - * @param {Element|Object} [doc] An element or document object to use to set the document + * @param {Element|Object} [node] An element or document object to use to set the document * @returns {Object} Returns the current document */ -setDocument = Sizzle.setDocument = function( node ) { - var hasCompare, subWindow, +function setDocument( node ) { + var subWindow, doc = node ? node.ownerDocument || node : preferredDoc; // Return early if doc is invalid or already selected @@ -1141,87 +4697,90 @@ setDocument = Sizzle.setDocument = function( node ) { // Update global variables document = doc; - docElem = document.documentElement; - documentIsHTML = !isXML( document ); + documentElement = document.documentElement; + documentIsHTML = !jQuery.isXMLDoc( document ); + + // Support: iOS 7 only, IE 9 - 11+ + // Older browsers didn't support unprefixed `matches`. + matches = documentElement.matches || + documentElement.webkitMatchesSelector || + documentElement.msMatchesSelector; // Support: IE 9 - 11+, Edge 12 - 18+ - // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - // eslint-disable-next-line eqeqeq - if ( preferredDoc != document && - ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { + // Accessing iframe documents after unload throws "permission denied" errors + // (see trac-13936). + // Limit the fix to IE & Edge Legacy; despite Edge 15+ implementing `matches`, + // all IE 9+ and Edge Legacy versions implement `msMatchesSelector` as well. + if ( documentElement.msMatchesSelector && - // Support: IE 11, Edge - if ( subWindow.addEventListener ) { - subWindow.addEventListener( "unload", unloadHandler, false ); + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + preferredDoc != document && + ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { - // Support: IE 9 - 10 only - } else if ( subWindow.attachEvent ) { - subWindow.attachEvent( "onunload", unloadHandler ); - } + // Support: IE 9 - 11+, Edge 12 - 18+ + subWindow.addEventListener( "unload", unloadHandler ); } - // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only, - // Safari 4 - 5 only, Opera <=11.6 - 12.x only - // IE/Edge & older browsers don't support the :scope pseudo-class. - // Support: Safari 6.0 only - // Safari 6.0 supports :scope but it's an alias of :root there. - support.scope = assert( function( el ) { - docElem.appendChild( el ).appendChild( document.createElement( "div" ) ); - return typeof el.querySelectorAll !== "undefined" && - !el.querySelectorAll( ":scope fieldset div" ).length; + // Support: IE <10 + // Check if getElementById returns elements by name + // The broken getElementById methods don't pick up programmatically-set names, + // so use a roundabout getElementsByName test + support.getById = assert( function( el ) { + documentElement.appendChild( el ).id = jQuery.expando; + return !document.getElementsByName || + !document.getElementsByName( jQuery.expando ).length; } ); - /* Attributes - ---------------------------------------------------------------------- */ - - // Support: IE<8 - // Verify that getAttribute really returns attributes and not properties - // (excepting IE8 booleans) - support.attributes = assert( function( el ) { - el.className = "i"; - return !el.getAttribute( "className" ); + // Support: IE 9 only + // Check to see if it's possible to do matchesSelector + // on a disconnected node. + support.disconnectedMatch = assert( function( el ) { + return matches.call( el, "*" ); } ); - /* getElement(s)By* - ---------------------------------------------------------------------- */ - - // Check if getElementsByTagName("*") returns only elements - support.getElementsByTagName = assert( function( el ) { - el.appendChild( document.createComment( "" ) ); - return !el.getElementsByTagName( "*" ).length; + // Support: IE 9 - 11+, Edge 12 - 18+ + // IE/Edge don't support the :scope pseudo-class. + support.scope = assert( function() { + return document.querySelectorAll( ":scope" ); } ); - // Support: IE<9 - support.getElementsByClassName = rnative.test( document.getElementsByClassName ); - - // Support: IE<10 - // Check if getElementById returns elements by name - // The broken getElementById methods don't pick up programmatically-set names, - // so use a roundabout getElementsByName test - support.getById = assert( function( el ) { - docElem.appendChild( el ).id = expando; - return !document.getElementsByName || !document.getElementsByName( expando ).length; + // Support: Chrome 105 - 111 only, Safari 15.4 - 16.3 only + // Make sure the `:has()` argument is parsed unforgivingly. + // We include `*` in the test to detect buggy implementations that are + // _selectively_ forgiving (specifically when the list includes at least + // one valid selector). + // Note that we treat complete lack of support for `:has()` as if it were + // spec-compliant support, which is fine because use of `:has()` in such + // environments will fail in the qSA path and fall back to jQuery traversal + // anyway. + support.cssHas = assert( function() { + try { + document.querySelector( ":has(*,:jqfake)" ); + return false; + } catch ( e ) { + return true; + } } ); // ID filter and find if ( support.getById ) { - Expr.filter[ "ID" ] = function( id ) { + Expr.filter.ID = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { return elem.getAttribute( "id" ) === attrId; }; }; - Expr.find[ "ID" ] = function( id, context ) { + Expr.find.ID = function( id, context ) { if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { var elem = context.getElementById( id ); return elem ? [ elem ] : []; } }; } else { - Expr.filter[ "ID" ] = function( id ) { + Expr.filter.ID = function( id ) { var attrId = id.replace( runescape, funescape ); return function( elem ) { var node = typeof elem.getAttributeNode !== "undefined" && @@ -1232,7 +4791,7 @@ setDocument = Sizzle.setDocument = function( node ) { // Support: IE 6 - 7 only // getElementById is not reliable as a find shortcut - Expr.find[ "ID" ] = function( id, context ) { + Expr.find.ID = function( id, context ) { if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { var node, i, elems, elem = context.getElementById( id ); @@ -1262,40 +4821,18 @@ setDocument = Sizzle.setDocument = function( node ) { } // Tag - Expr.find[ "TAG" ] = support.getElementsByTagName ? - function( tag, context ) { - if ( typeof context.getElementsByTagName !== "undefined" ) { - return context.getElementsByTagName( tag ); - - // DocumentFragment nodes don't have gEBTN - } else if ( support.qsa ) { - return context.querySelectorAll( tag ); - } - } : - - function( tag, context ) { - var elem, - tmp = [], - i = 0, - - // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too - results = context.getElementsByTagName( tag ); + Expr.find.TAG = function( tag, context ) { + if ( typeof context.getElementsByTagName !== "undefined" ) { + return context.getElementsByTagName( tag ); - // Filter out possible comments - if ( tag === "*" ) { - while ( ( elem = results[ i++ ] ) ) { - if ( elem.nodeType === 1 ) { - tmp.push( elem ); - } - } - - return tmp; - } - return results; - }; + // DocumentFragment nodes don't have gEBTN + } else { + return context.querySelectorAll( tag ); + } + }; // Class - Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) { + Expr.find.CLASS = function( className, context ) { if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { return context.getElementsByClassName( className ); } @@ -1306,177 +4843,94 @@ setDocument = Sizzle.setDocument = function( node ) { // QSA and matchesSelector support - // matchesSelector(:active) reports false when true (IE9/Opera 11.5) - rbuggyMatches = []; - - // qSa(:focus) reports false when true (Chrome 21) - // We allow this because of a bug in IE8/9 that throws an error - // whenever `document.activeElement` is accessed on an iframe - // So, we allow :focus to pass through QSA all the time to avoid the IE error - // See https://bugs.jquery.com/ticket/13378 rbuggyQSA = []; - if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) { - - // Build QSA regex - // Regex strategy adopted from Diego Perini - assert( function( el ) { - - var input; - - // Select is set to empty string on purpose - // This is to test IE's treatment of not explicitly - // setting a boolean content attribute, - // since its presence should be enough - // https://bugs.jquery.com/ticket/12359 - docElem.appendChild( el ).innerHTML = "" + - ""; - - // Support: IE8, Opera 11-12.16 - // Nothing should be selected when empty strings follow ^= or $= or *= - // The test attribute must be unknown in Opera but "safe" for WinRT - // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section - if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) { - rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); - } - - // Support: IE8 - // Boolean attributes and "value" are not treated correctly - if ( !el.querySelectorAll( "[selected]" ).length ) { - rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); - } - - // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ - if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { - rbuggyQSA.push( "~=" ); - } - - // Support: IE 11+, Edge 15 - 18+ - // IE 11/Edge don't find elements on a `[name='']` query in some cases. - // Adding a temporary attribute to the document before the selection works - // around the issue. - // Interestingly, IE 10 & older don't seem to have the issue. - input = document.createElement( "input" ); - input.setAttribute( "name", "" ); - el.appendChild( input ); - if ( !el.querySelectorAll( "[name='']" ).length ) { - rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + - whitespace + "*(?:''|\"\")" ); - } - - // Webkit/Opera - :checked should return selected option elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - // IE8 throws error here and will not see later tests - if ( !el.querySelectorAll( ":checked" ).length ) { - rbuggyQSA.push( ":checked" ); - } - - // Support: Safari 8+, iOS 8+ - // https://bugs.webkit.org/show_bug.cgi?id=136851 - // In-page `selector#id sibling-combinator selector` fails - if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { - rbuggyQSA.push( ".#.+[+~]" ); - } - - // Support: Firefox <=3.6 - 5 only - // Old Firefox doesn't throw on a badly-escaped identifier. - el.querySelectorAll( "\\\f" ); - rbuggyQSA.push( "[\\r\\n\\f]" ); - } ); - - assert( function( el ) { - el.innerHTML = "" + - ""; + // Build QSA regex + // Regex strategy adopted from Diego Perini + assert( function( el ) { - // Support: Windows 8 Native Apps - // The type and name attributes are restricted during .innerHTML assignment - var input = document.createElement( "input" ); - input.setAttribute( "type", "hidden" ); - el.appendChild( input ).setAttribute( "name", "D" ); + var input; - // Support: IE8 - // Enforce case-sensitivity of name attribute - if ( el.querySelectorAll( "[name=d]" ).length ) { - rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); - } + documentElement.appendChild( el ).innerHTML = + "" + + ""; - // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) - // IE8 throws error here and will not see later tests - if ( el.querySelectorAll( ":enabled" ).length !== 2 ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } + // Support: iOS <=7 - 8 only + // Boolean attributes and "value" are not treated correctly in some XML documents + if ( !el.querySelectorAll( "[selected]" ).length ) { + rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); + } - // Support: IE9-11+ - // IE's :disabled selector does not pick up the children of disabled fieldsets - docElem.appendChild( el ).disabled = true; - if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } + // Support: iOS <=7 - 8 only + if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { + rbuggyQSA.push( "~=" ); + } - // Support: Opera 10 - 11 only - // Opera 10-11 does not throw on post-comma invalid pseudos - el.querySelectorAll( "*,:x" ); - rbuggyQSA.push( ",.*:" ); - } ); - } + // Support: iOS 8 only + // https://bugs.webkit.org/show_bug.cgi?id=136851 + // In-page `selector#id sibling-combinator selector` fails + if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { + rbuggyQSA.push( ".#.+[+~]" ); + } - if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches || - docElem.webkitMatchesSelector || - docElem.mozMatchesSelector || - docElem.oMatchesSelector || - docElem.msMatchesSelector ) ) ) ) { + // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+ + // In some of the document kinds, these selectors wouldn't work natively. + // This is probably OK but for backwards compatibility we want to maintain + // handling them through jQuery traversal in jQuery 3.x. + if ( !el.querySelectorAll( ":checked" ).length ) { + rbuggyQSA.push( ":checked" ); + } - assert( function( el ) { + // Support: Windows 8 Native Apps + // The type and name attributes are restricted during .innerHTML assignment + input = document.createElement( "input" ); + input.setAttribute( "type", "hidden" ); + el.appendChild( input ).setAttribute( "name", "D" ); + + // Support: IE 9 - 11+ + // IE's :disabled selector does not pick up the children of disabled fieldsets + // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+ + // In some of the document kinds, these selectors wouldn't work natively. + // This is probably OK but for backwards compatibility we want to maintain + // handling them through jQuery traversal in jQuery 3.x. + documentElement.appendChild( el ).disabled = true; + if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { + rbuggyQSA.push( ":enabled", ":disabled" ); + } + + // Support: IE 11+, Edge 15 - 18+ + // IE 11/Edge don't find elements on a `[name='']` query in some cases. + // Adding a temporary attribute to the document before the selection works + // around the issue. + // Interestingly, IE 10 & older don't seem to have the issue. + input = document.createElement( "input" ); + input.setAttribute( "name", "" ); + el.appendChild( input ); + if ( !el.querySelectorAll( "[name='']" ).length ) { + rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + + whitespace + "*(?:''|\"\")" ); + } + } ); - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9) - support.disconnectedMatch = matches.call( el, "*" ); + if ( !support.cssHas ) { - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( el, "[s!='']:x" ); - rbuggyMatches.push( "!=", pseudos ); - } ); + // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+ + // Our regular `try-catch` mechanism fails to detect natively-unsupported + // pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`) + // in browsers that parse the `:has()` argument as a forgiving selector list. + // https://drafts.csswg.org/selectors/#relational now requires the argument + // to be parsed unforgivingly, but browsers have not yet fully adjusted. + rbuggyQSA.push( ":has" ); } rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); - rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) ); - - /* Contains - ---------------------------------------------------------------------- */ - hasCompare = rnative.test( docElem.compareDocumentPosition ); - - // Element contains another - // Purposefully self-exclusive - // As in, an element does not contain itself - contains = hasCompare || rnative.test( docElem.contains ) ? - function( a, b ) { - var adown = a.nodeType === 9 ? a.documentElement : a, - bup = b && b.parentNode; - return a === bup || !!( bup && bup.nodeType === 1 && ( - adown.contains ? - adown.contains( bup ) : - a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 - ) ); - } : - function( a, b ) { - if ( b ) { - while ( ( b = b.parentNode ) ) { - if ( b === a ) { - return true; - } - } - } - return false; - }; /* Sorting ---------------------------------------------------------------------- */ // Document order sorting - sortOrder = hasCompare ? - function( a, b ) { + sortOrder = function( a, b ) { // Flag for duplicate removal if ( a === b ) { @@ -1510,8 +4964,8 @@ setDocument = Sizzle.setDocument = function( node ) { // IE/Edge sometimes throw a "Permission denied" error when strict-comparing // two documents; shallow comparisons work. // eslint-disable-next-line eqeqeq - if ( a == document || a.ownerDocument == preferredDoc && - contains( preferredDoc, a ) ) { + if ( a === document || a.ownerDocument == preferredDoc && + find.contains( preferredDoc, a ) ) { return -1; } @@ -1519,100 +4973,33 @@ setDocument = Sizzle.setDocument = function( node ) { // IE/Edge sometimes throw a "Permission denied" error when strict-comparing // two documents; shallow comparisons work. // eslint-disable-next-line eqeqeq - if ( b == document || b.ownerDocument == preferredDoc && - contains( preferredDoc, b ) ) { + if ( b === document || b.ownerDocument == preferredDoc && + find.contains( preferredDoc, b ) ) { return 1; } // Maintain original order return sortInput ? - ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : + ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : 0; } return compare & 4 ? -1 : 1; - } : - function( a, b ) { - - // Exit early if the nodes are identical - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - var cur, - i = 0, - aup = a.parentNode, - bup = b.parentNode, - ap = [ a ], - bp = [ b ]; - - // Parentless nodes are either documents or disconnected - if ( !aup || !bup ) { - - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - /* eslint-disable eqeqeq */ - return a == document ? -1 : - b == document ? 1 : - /* eslint-enable eqeqeq */ - aup ? -1 : - bup ? 1 : - sortInput ? - ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : - 0; - - // If the nodes are siblings, we can do a quick check - } else if ( aup === bup ) { - return siblingCheck( a, b ); - } - - // Otherwise we need full lists of their ancestors for comparison - cur = a; - while ( ( cur = cur.parentNode ) ) { - ap.unshift( cur ); - } - cur = b; - while ( ( cur = cur.parentNode ) ) { - bp.unshift( cur ); - } - - // Walk down the tree looking for a discrepancy - while ( ap[ i ] === bp[ i ] ) { - i++; - } - - return i ? - - // Do a sibling check if the nodes have a common ancestor - siblingCheck( ap[ i ], bp[ i ] ) : - - // Otherwise nodes in our document sort first - // Support: IE 11+, Edge 17 - 18+ - // IE/Edge sometimes throw a "Permission denied" error when strict-comparing - // two documents; shallow comparisons work. - /* eslint-disable eqeqeq */ - ap[ i ] == preferredDoc ? -1 : - bp[ i ] == preferredDoc ? 1 : - /* eslint-enable eqeqeq */ - 0; }; return document; -}; +} -Sizzle.matches = function( expr, elements ) { - return Sizzle( expr, null, null, elements ); +find.matches = function( expr, elements ) { + return find( expr, null, null, elements ); }; -Sizzle.matchesSelector = function( elem, expr ) { +find.matchesSelector = function( elem, expr ) { setDocument( elem ); - if ( support.matchesSelector && documentIsHTML && + if ( documentIsHTML && !nonnativeSelectorCache[ expr + " " ] && - ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && - ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { + ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { try { var ret = matches.call( elem, expr ); @@ -1620,9 +5007,9 @@ Sizzle.matchesSelector = function( elem, expr ) { // IE 9's matchesSelector returns false on disconnected nodes if ( ret || support.disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9 - elem.document && elem.document.nodeType !== 11 ) { + // As well, disconnected nodes are said to be in a document + // fragment in IE 9 + elem.document && elem.document.nodeType !== 11 ) { return ret; } } catch ( e ) { @@ -1630,10 +5017,10 @@ Sizzle.matchesSelector = function( elem, expr ) { } } - return Sizzle( expr, document, null, [ elem ] ).length > 0; + return find( expr, document, null, [ elem ] ).length > 0; }; -Sizzle.contains = function( context, elem ) { +find.contains = function( context, elem ) { // Set document vars if needed // Support: IE 11+, Edge 17 - 18+ @@ -1643,10 +5030,11 @@ Sizzle.contains = function( context, elem ) { if ( ( context.ownerDocument || context ) != document ) { setDocument( context ); } - return contains( context, elem ); + return jQuery.contains( context, elem ); }; -Sizzle.attr = function( elem, name ) { + +find.attr = function( elem, name ) { // Set document vars if needed // Support: IE 11+, Edge 17 - 18+ @@ -1659,25 +5047,19 @@ Sizzle.attr = function( elem, name ) { var fn = Expr.attrHandle[ name.toLowerCase() ], - // Don't get fooled by Object.prototype properties (jQuery #13807) + // Don't get fooled by Object.prototype properties (see trac-13807) val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? fn( elem, name, !documentIsHTML ) : undefined; - return val !== undefined ? - val : - support.attributes || !documentIsHTML ? - elem.getAttribute( name ) : - ( val = elem.getAttributeNode( name ) ) && val.specified ? - val.value : - null; -}; + if ( val !== undefined ) { + return val; + } -Sizzle.escape = function( sel ) { - return ( sel + "" ).replace( rcssescape, fcssescape ); + return elem.getAttribute( name ); }; -Sizzle.error = function( msg ) { +find.error = function( msg ) { throw new Error( "Syntax error, unrecognized expression: " + msg ); }; @@ -1685,76 +5067,44 @@ Sizzle.error = function( msg ) { * Document sorting and removing duplicates * @param {ArrayLike} results */ -Sizzle.uniqueSort = function( results ) { +jQuery.uniqueSort = function( results ) { var elem, duplicates = [], j = 0, i = 0; // Unless we *know* we can detect duplicates, assume their presence - hasDuplicate = !support.detectDuplicates; - sortInput = !support.sortStable && results.slice( 0 ); - results.sort( sortOrder ); + // + // Support: Android <=4.0+ + // Testing for detecting duplicates is unpredictable so instead assume we can't + // depend on duplicate detection in all browsers without a stable sort. + hasDuplicate = !support.sortStable; + sortInput = !support.sortStable && slice.call( results, 0 ); + sort.call( results, sortOrder ); if ( hasDuplicate ) { - while ( ( elem = results[ i++ ] ) ) { - if ( elem === results[ i ] ) { - j = duplicates.push( i ); - } - } - while ( j-- ) { - results.splice( duplicates[ j ], 1 ); - } - } - - // Clear input after sorting to release objects - // See https://github.com/jquery/sizzle/pull/225 - sortInput = null; - - return results; -}; - -/** - * Utility function for retrieving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -getText = Sizzle.getText = function( elem ) { - var node, - ret = "", - i = 0, - nodeType = elem.nodeType; - - if ( !nodeType ) { - - // If no nodeType, this is expected to be an array - while ( ( node = elem[ i++ ] ) ) { - - // Do not traverse comment nodes - ret += getText( node ); - } - } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - - // Use textContent for elements - // innerText usage removed for consistency of new lines (jQuery #11153) - if ( typeof elem.textContent === "string" ) { - return elem.textContent; - } else { - - // Traverse its children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - ret += getText( elem ); + while ( ( elem = results[ i++ ] ) ) { + if ( elem === results[ i ] ) { + j = duplicates.push( i ); } } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; + while ( j-- ) { + splice.call( results, duplicates[ j ], 1 ); + } } - // Do not include comment or processing instruction nodes + // Clear input after sorting to release objects + // See https://github.com/jquery/sizzle/pull/225 + sortInput = null; + + return results; +}; - return ret; +jQuery.fn.uniqueSort = function() { + return this.pushStack( jQuery.uniqueSort( slice.apply( this ) ) ); }; -Expr = Sizzle.selectors = { +Expr = jQuery.expr = { // Can be adjusted by the user cacheLength: 50, @@ -1775,12 +5125,12 @@ Expr = Sizzle.selectors = { }, preFilter: { - "ATTR": function( match ) { + ATTR: function( match ) { match[ 1 ] = match[ 1 ].replace( runescape, funescape ); // Move the given value to match[3] whether quoted or unquoted - match[ 3 ] = ( match[ 3 ] || match[ 4 ] || - match[ 5 ] || "" ).replace( runescape, funescape ); + match[ 3 ] = ( match[ 3 ] || match[ 4 ] || match[ 5 ] || "" ) + .replace( runescape, funescape ); if ( match[ 2 ] === "~=" ) { match[ 3 ] = " " + match[ 3 ] + " "; @@ -1789,7 +5139,7 @@ Expr = Sizzle.selectors = { return match.slice( 0, 4 ); }, - "CHILD": function( match ) { + CHILD: function( match ) { /* matches from matchExpr["CHILD"] 1 type (only|nth|...) @@ -1807,29 +5157,30 @@ Expr = Sizzle.selectors = { // nth-* requires argument if ( !match[ 3 ] ) { - Sizzle.error( match[ 0 ] ); + find.error( match[ 0 ] ); } // numeric x and y parameters for Expr.filter.CHILD // remember that false/true cast respectively to 0/1 match[ 4 ] = +( match[ 4 ] ? match[ 5 ] + ( match[ 6 ] || 1 ) : - 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) ); + 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) + ); match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); - // other types prohibit arguments + // other types prohibit arguments } else if ( match[ 3 ] ) { - Sizzle.error( match[ 0 ] ); + find.error( match[ 0 ] ); } return match; }, - "PSEUDO": function( match ) { + PSEUDO: function( match ) { var excess, unquoted = !match[ 6 ] && match[ 2 ]; - if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) { + if ( matchExpr.CHILD.test( match[ 0 ] ) ) { return null; } @@ -1858,36 +5209,36 @@ Expr = Sizzle.selectors = { filter: { - "TAG": function( nodeNameSelector ) { - var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); + TAG: function( nodeNameSelector ) { + var expectedNodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); return nodeNameSelector === "*" ? function() { return true; } : function( elem ) { - return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; + return nodeName( elem, expectedNodeName ); }; }, - "CLASS": function( className ) { + CLASS: function( className ) { var pattern = classCache[ className + " " ]; return pattern || - ( pattern = new RegExp( "(^|" + whitespace + - ")" + className + "(" + whitespace + "|$)" ) ) && classCache( - className, function( elem ) { - return pattern.test( - typeof elem.className === "string" && elem.className || - typeof elem.getAttribute !== "undefined" && - elem.getAttribute( "class" ) || - "" - ); + ( pattern = new RegExp( "(^|" + whitespace + ")" + className + + "(" + whitespace + "|$)" ) ) && + classCache( className, function( elem ) { + return pattern.test( + typeof elem.className === "string" && elem.className || + typeof elem.getAttribute !== "undefined" && + elem.getAttribute( "class" ) || + "" + ); } ); }, - "ATTR": function( name, operator, check ) { + ATTR: function( name, operator, check ) { return function( elem ) { - var result = Sizzle.attr( elem, name ); + var result = find.attr( elem, name ); if ( result == null ) { return operator === "!="; @@ -1898,22 +5249,34 @@ Expr = Sizzle.selectors = { result += ""; - /* eslint-disable max-len */ - - return operator === "=" ? result === check : - operator === "!=" ? result !== check : - operator === "^=" ? check && result.indexOf( check ) === 0 : - operator === "*=" ? check && result.indexOf( check ) > -1 : - operator === "$=" ? check && result.slice( -check.length ) === check : - operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : - operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : - false; - /* eslint-enable max-len */ + if ( operator === "=" ) { + return result === check; + } + if ( operator === "!=" ) { + return result !== check; + } + if ( operator === "^=" ) { + return check && result.indexOf( check ) === 0; + } + if ( operator === "*=" ) { + return check && result.indexOf( check ) > -1; + } + if ( operator === "$=" ) { + return check && result.slice( -check.length ) === check; + } + if ( operator === "~=" ) { + return ( " " + result.replace( rwhitespace, " " ) + " " ) + .indexOf( check ) > -1; + } + if ( operator === "|=" ) { + return result === check || result.slice( 0, check.length + 1 ) === check + "-"; + } + return false; }; }, - "CHILD": function( type, what, _argument, first, last ) { + CHILD: function( type, what, _argument, first, last ) { var simple = type.slice( 0, 3 ) !== "nth", forward = type.slice( -4 ) !== "last", ofType = what === "of-type"; @@ -1926,7 +5289,7 @@ Expr = Sizzle.selectors = { } : function( elem, _context, xml ) { - var cache, uniqueCache, outerCache, node, nodeIndex, start, + var cache, outerCache, node, nodeIndex, start, dir = simple !== forward ? "nextSibling" : "previousSibling", parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), @@ -1941,7 +5304,7 @@ Expr = Sizzle.selectors = { node = elem; while ( ( node = node[ dir ] ) ) { if ( ofType ? - node.nodeName.toLowerCase() === name : + nodeName( node, name ) : node.nodeType === 1 ) { return false; @@ -1960,17 +5323,8 @@ Expr = Sizzle.selectors = { if ( forward && useCache ) { // Seek `elem` from a previously-cached index - - // ...in a gzip-friendly way - node = parent; - outerCache = node[ expando ] || ( node[ expando ] = {} ); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - ( outerCache[ node.uniqueID ] = {} ); - - cache = uniqueCache[ type ] || []; + outerCache = parent[ expando ] || ( parent[ expando ] = {} ); + cache = outerCache[ type ] || []; nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; diff = nodeIndex && cache[ 2 ]; node = nodeIndex && parent.childNodes[ nodeIndex ]; @@ -1982,7 +5336,7 @@ Expr = Sizzle.selectors = { // When found, cache indexes on `parent` and break if ( node.nodeType === 1 && ++diff && node === elem ) { - uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; + outerCache[ type ] = [ dirruns, nodeIndex, diff ]; break; } } @@ -1991,17 +5345,8 @@ Expr = Sizzle.selectors = { // Use previously-cached element index if available if ( useCache ) { - - // ...in a gzip-friendly way - node = elem; - outerCache = node[ expando ] || ( node[ expando ] = {} ); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - ( outerCache[ node.uniqueID ] = {} ); - - cache = uniqueCache[ type ] || []; + outerCache = elem[ expando ] || ( elem[ expando ] = {} ); + cache = outerCache[ type ] || []; nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; diff = nodeIndex; } @@ -2015,7 +5360,7 @@ Expr = Sizzle.selectors = { ( diff = nodeIndex = 0 ) || start.pop() ) ) { if ( ( ofType ? - node.nodeName.toLowerCase() === name : + nodeName( node, name ) : node.nodeType === 1 ) && ++diff ) { @@ -2023,13 +5368,7 @@ Expr = Sizzle.selectors = { if ( useCache ) { outerCache = node[ expando ] || ( node[ expando ] = {} ); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - ( outerCache[ node.uniqueID ] = {} ); - - uniqueCache[ type ] = [ dirruns, diff ]; + outerCache[ type ] = [ dirruns, diff ]; } if ( node === elem ) { @@ -2047,19 +5386,19 @@ Expr = Sizzle.selectors = { }; }, - "PSEUDO": function( pseudo, argument ) { + PSEUDO: function( pseudo, argument ) { // pseudo-class names are case-insensitive - // http://www.w3.org/TR/selectors/#pseudo-classes + // https://www.w3.org/TR/selectors/#pseudo-classes // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters // Remember that setFilters inherits from pseudos var args, fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || - Sizzle.error( "unsupported pseudo: " + pseudo ); + find.error( "unsupported pseudo: " + pseudo ); // The user may use createPseudo to indicate that // arguments are needed to create the filter function - // just as Sizzle does + // just as jQuery does if ( fn[ expando ] ) { return fn( argument ); } @@ -2073,7 +5412,7 @@ Expr = Sizzle.selectors = { matched = fn( seed, argument ), i = matched.length; while ( i-- ) { - idx = indexOf( seed, matched[ i ] ); + idx = indexOf.call( seed, matched[ i ] ); seed[ idx ] = !( matches[ idx ] = matched[ i ] ); } } ) : @@ -2089,14 +5428,14 @@ Expr = Sizzle.selectors = { pseudos: { // Potentially complex pseudos - "not": markFunction( function( selector ) { + not: markFunction( function( selector ) { // Trim the selector passed to compile // to avoid treating leading and trailing // spaces as combinators var input = [], results = [], - matcher = compile( selector.replace( rtrim, "$1" ) ); + matcher = compile( selector.replace( rtrimCSS, "$1" ) ); return matcher[ expando ] ? markFunction( function( seed, matches, _context, xml ) { @@ -2115,22 +5454,23 @@ Expr = Sizzle.selectors = { input[ 0 ] = elem; matcher( input, null, xml, results ); - // Don't keep the element (issue #299) + // Don't keep the element + // (see https://github.com/jquery/sizzle/issues/299) input[ 0 ] = null; return !results.pop(); }; } ), - "has": markFunction( function( selector ) { + has: markFunction( function( selector ) { return function( elem ) { - return Sizzle( selector, elem ).length > 0; + return find( selector, elem ).length > 0; }; } ), - "contains": markFunction( function( text ) { + contains: markFunction( function( text ) { text = text.replace( runescape, funescape ); return function( elem ) { - return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1; + return ( elem.textContent || jQuery.text( elem ) ).indexOf( text ) > -1; }; } ), @@ -2140,12 +5480,12 @@ Expr = Sizzle.selectors = { // or beginning with the identifier C immediately followed by "-". // The matching of C against the element's language value is performed case-insensitively. // The identifier C does not have to be a valid language name." - // http://www.w3.org/TR/selectors/#lang-pseudo - "lang": markFunction( function( lang ) { + // https://www.w3.org/TR/selectors/#lang-pseudo + lang: markFunction( function( lang ) { // lang value must be a valid identifier if ( !ridentifier.test( lang || "" ) ) { - Sizzle.error( "unsupported lang: " + lang ); + find.error( "unsupported lang: " + lang ); } lang = lang.replace( runescape, funescape ).toLowerCase(); return function( elem ) { @@ -2164,38 +5504,39 @@ Expr = Sizzle.selectors = { } ), // Miscellaneous - "target": function( elem ) { + target: function( elem ) { var hash = window.location && window.location.hash; return hash && hash.slice( 1 ) === elem.id; }, - "root": function( elem ) { - return elem === docElem; + root: function( elem ) { + return elem === documentElement; }, - "focus": function( elem ) { - return elem === document.activeElement && - ( !document.hasFocus || document.hasFocus() ) && + focus: function( elem ) { + return elem === safeActiveElement() && + document.hasFocus() && !!( elem.type || elem.href || ~elem.tabIndex ); }, // Boolean properties - "enabled": createDisabledPseudo( false ), - "disabled": createDisabledPseudo( true ), + enabled: createDisabledPseudo( false ), + disabled: createDisabledPseudo( true ), - "checked": function( elem ) { + checked: function( elem ) { // In CSS3, :checked should return both checked and selected elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - var nodeName = elem.nodeName.toLowerCase(); - return ( nodeName === "input" && !!elem.checked ) || - ( nodeName === "option" && !!elem.selected ); + // https://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + return ( nodeName( elem, "input" ) && !!elem.checked ) || + ( nodeName( elem, "option" ) && !!elem.selected ); }, - "selected": function( elem ) { + selected: function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly + // Support: IE <=11+ + // Accessing the selectedIndex property + // forces the browser to treat the default option as + // selected when in an optgroup. if ( elem.parentNode ) { // eslint-disable-next-line no-unused-expressions elem.parentNode.selectedIndex; @@ -2205,9 +5546,9 @@ Expr = Sizzle.selectors = { }, // Contents - "empty": function( elem ) { + empty: function( elem ) { - // http://www.w3.org/TR/selectors/#empty-pseudo + // https://www.w3.org/TR/selectors/#empty-pseudo // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), // but not by others (comment: 8; processing instruction: 7; etc.) // nodeType < 6 works because attributes (2) do not appear as children @@ -2219,49 +5560,49 @@ Expr = Sizzle.selectors = { return true; }, - "parent": function( elem ) { - return !Expr.pseudos[ "empty" ]( elem ); + parent: function( elem ) { + return !Expr.pseudos.empty( elem ); }, // Element/input types - "header": function( elem ) { + header: function( elem ) { return rheader.test( elem.nodeName ); }, - "input": function( elem ) { + input: function( elem ) { return rinputs.test( elem.nodeName ); }, - "button": function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === "button" || name === "button"; + button: function( elem ) { + return nodeName( elem, "input" ) && elem.type === "button" || + nodeName( elem, "button" ); }, - "text": function( elem ) { + text: function( elem ) { var attr; - return elem.nodeName.toLowerCase() === "input" && - elem.type === "text" && + return nodeName( elem, "input" ) && elem.type === "text" && - // Support: IE<8 - // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" + // Support: IE <10 only + // New HTML5 attribute values (e.g., "search") appear + // with elem.type === "text" ( ( attr = elem.getAttribute( "type" ) ) == null || attr.toLowerCase() === "text" ); }, // Position-in-collection - "first": createPositionalPseudo( function() { + first: createPositionalPseudo( function() { return [ 0 ]; } ), - "last": createPositionalPseudo( function( _matchIndexes, length ) { + last: createPositionalPseudo( function( _matchIndexes, length ) { return [ length - 1 ]; } ), - "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) { + eq: createPositionalPseudo( function( _matchIndexes, length, argument ) { return [ argument < 0 ? argument + length : argument ]; } ), - "even": createPositionalPseudo( function( matchIndexes, length ) { + even: createPositionalPseudo( function( matchIndexes, length ) { var i = 0; for ( ; i < length; i += 2 ) { matchIndexes.push( i ); @@ -2269,7 +5610,7 @@ Expr = Sizzle.selectors = { return matchIndexes; } ), - "odd": createPositionalPseudo( function( matchIndexes, length ) { + odd: createPositionalPseudo( function( matchIndexes, length ) { var i = 1; for ( ; i < length; i += 2 ) { matchIndexes.push( i ); @@ -2277,19 +5618,24 @@ Expr = Sizzle.selectors = { return matchIndexes; } ), - "lt": createPositionalPseudo( function( matchIndexes, length, argument ) { - var i = argument < 0 ? - argument + length : - argument > length ? - length : - argument; + lt: createPositionalPseudo( function( matchIndexes, length, argument ) { + var i; + + if ( argument < 0 ) { + i = argument + length; + } else if ( argument > length ) { + i = length; + } else { + i = argument; + } + for ( ; --i >= 0; ) { matchIndexes.push( i ); } return matchIndexes; } ), - "gt": createPositionalPseudo( function( matchIndexes, length, argument ) { + gt: createPositionalPseudo( function( matchIndexes, length, argument ) { var i = argument < 0 ? argument + length : argument; for ( ; ++i < length; ) { matchIndexes.push( i ); @@ -2299,7 +5645,7 @@ Expr = Sizzle.selectors = { } }; -Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ]; +Expr.pseudos.nth = Expr.pseudos.eq; // Add button/input type pseudos for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { @@ -2314,7 +5660,7 @@ function setFilters() {} setFilters.prototype = Expr.filters = Expr.pseudos; Expr.setFilters = new setFilters(); -tokenize = Sizzle.tokenize = function( selector, parseOnly ) { +function tokenize( selector, parseOnly ) { var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[ selector + " " ]; @@ -2342,13 +5688,13 @@ tokenize = Sizzle.tokenize = function( selector, parseOnly ) { matched = false; // Combinators - if ( ( match = rcombinators.exec( soFar ) ) ) { + if ( ( match = rleadingCombinator.exec( soFar ) ) ) { matched = match.shift(); tokens.push( { value: matched, // Cast descendant combinators to space - type: match[ 0 ].replace( rtrim, " " ) + type: match[ 0 ].replace( rtrimCSS, " " ) } ); soFar = soFar.slice( matched.length ); } @@ -2375,14 +5721,16 @@ tokenize = Sizzle.tokenize = function( selector, parseOnly ) { // Return the length of the invalid excess // if we're just parsing // Otherwise, throw an error or return tokens - return parseOnly ? - soFar.length : - soFar ? - Sizzle.error( selector ) : + if ( parseOnly ) { + return soFar.length; + } - // Cache the tokens - tokenCache( selector, groups ).slice( 0 ); -}; + return soFar ? + find.error( selector ) : + + // Cache the tokens + tokenCache( selector, groups ).slice( 0 ); +} function toSelector( tokens ) { var i = 0, @@ -2415,7 +5763,7 @@ function addCombinator( matcher, combinator, base ) { // Check against all ancestor/preceding elements function( elem, context, xml ) { - var oldCache, uniqueCache, outerCache, + var oldCache, outerCache, newCache = [ dirruns, doneName ]; // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching @@ -2432,14 +5780,9 @@ function addCombinator( matcher, combinator, base ) { if ( elem.nodeType === 1 || checkNonElements ) { outerCache = elem[ expando ] || ( elem[ expando ] = {} ); - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ elem.uniqueID ] || - ( outerCache[ elem.uniqueID ] = {} ); - - if ( skip && skip === elem.nodeName.toLowerCase() ) { + if ( skip && nodeName( elem, skip ) ) { elem = elem[ dir ] || elem; - } else if ( ( oldCache = uniqueCache[ key ] ) && + } else if ( ( oldCache = outerCache[ key ] ) && oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { // Assign to newCache so results back-propagate to previous elements @@ -2447,7 +5790,7 @@ function addCombinator( matcher, combinator, base ) { } else { // Reuse newcache so results back-propagate to previous elements - uniqueCache[ key ] = newCache; + outerCache[ key ] = newCache; // A match means we're done; a fail means we have to keep checking if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { @@ -2479,7 +5822,7 @@ function multipleContexts( selector, contexts, results ) { var i = 0, len = contexts.length; for ( ; i < len; i++ ) { - Sizzle( selector, contexts[ i ], results ); + find( selector, contexts[ i ], results ); } return results; } @@ -2513,38 +5856,37 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS postFinder = setMatcher( postFinder, postSelector ); } return markFunction( function( seed, results, context, xml ) { - var temp, i, elem, + var temp, i, elem, matcherOut, preMap = [], postMap = [], preexisting = results.length, // Get initial elements from seed or context - elems = seed || multipleContexts( - selector || "*", - context.nodeType ? [ context ] : context, - [] - ), + elems = seed || + multipleContexts( selector || "*", + context.nodeType ? [ context ] : context, [] ), // Prefilter to get matcher input, preserving a map for seed-results synchronization matcherIn = preFilter && ( seed || !selector ) ? condense( elems, preMap, preFilter, context, xml ) : - elems, + elems; - matcherOut = matcher ? + if ( matcher ) { - // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, - postFinder || ( seed ? preFilter : preexisting || postFilter ) ? + // If we have a postFinder, or filtered seed, or non-seed postFilter + // or preexisting results, + matcherOut = postFinder || ( seed ? preFilter : preexisting || postFilter ) ? - // ...intermediate processing is necessary - [] : + // ...intermediate processing is necessary + [] : - // ...otherwise use results directly - results : - matcherIn; + // ...otherwise use results directly + results; - // Find primary matches - if ( matcher ) { + // Find primary matches matcher( matcherIn, matcherOut, context, xml ); + } else { + matcherOut = matcherIn; } // Apply postFilter @@ -2582,7 +5924,7 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS i = matcherOut.length; while ( i-- ) { if ( ( elem = matcherOut[ i ] ) && - ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) { + ( temp = postFinder ? indexOf.call( seed, elem ) : preMap[ i ] ) > -1 ) { seed[ temp ] = !( results[ temp ] = elem ); } @@ -2617,15 +5959,21 @@ function matcherFromTokens( tokens ) { return elem === checkContext; }, implicitRelative, true ), matchAnyContext = addCombinator( function( elem ) { - return indexOf( checkContext, elem ) > -1; + return indexOf.call( checkContext, elem ) > -1; }, implicitRelative, true ), matchers = [ function( elem, context, xml ) { - var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( + + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + var ret = ( !leadingRelative && ( xml || context != outermostContext ) ) || ( ( checkContext = context ).nodeType ? matchContext( elem, context, xml ) : matchAnyContext( elem, context, xml ) ); - // Avoid hanging onto element (issue #299) + // Avoid hanging onto element + // (see https://github.com/jquery/sizzle/issues/299) checkContext = null; return ret; } ]; @@ -2650,11 +5998,10 @@ function matcherFromTokens( tokens ) { i > 1 && elementMatcher( matchers ), i > 1 && toSelector( - // If the preceding token was a descendant combinator, insert an implicit any-element `*` - tokens - .slice( 0, i - 1 ) - .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) - ).replace( rtrim, "$1" ), + // If the preceding token was a descendant combinator, insert an implicit any-element `*` + tokens.slice( 0, i - 1 ) + .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) + ).replace( rtrimCSS, "$1" ), matcher, i < j && matcherFromTokens( tokens.slice( i, j ) ), j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), @@ -2680,7 +6027,7 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) { contextBackup = outermostContext, // We must always have either seed elements or outermost context - elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ), + elems = seed || byElement && Expr.find.TAG( "*", outermost ), // Use integer dirruns iff this is the outermost matcher dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), @@ -2696,8 +6043,9 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) { } // Add elements passing elementMatchers directly to results - // Support: IE<9, Safari - // Tolerate NodeList properties (IE: "length"; Safari: ) matching elements by id + // Support: iOS <=7 - 9 only + // Tolerate NodeList properties (IE: "length"; Safari: ) matching + // elements by id. (see trac-14142) for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { if ( byElement && elem ) { j = 0; @@ -2712,7 +6060,7 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) { } while ( ( matcher = elementMatchers[ j++ ] ) ) { if ( matcher( elem, context || document, xml ) ) { - results.push( elem ); + push.call( results, elem ); break; } } @@ -2775,7 +6123,7 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) { if ( outermost && !seed && setMatched.length > 0 && ( matchedCount + setMatchers.length ) > 1 ) { - Sizzle.uniqueSort( results ); + jQuery.uniqueSort( results ); } } @@ -2793,7 +6141,7 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) { superMatcher; } -compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { +function compile( selector, match /* Internal Use Only */ ) { var i, setMatchers = [], elementMatchers = [], @@ -2816,27 +6164,25 @@ compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { } // Cache the compiled function - cached = compilerCache( - selector, - matcherFromGroupMatchers( elementMatchers, setMatchers ) - ); + cached = compilerCache( selector, + matcherFromGroupMatchers( elementMatchers, setMatchers ) ); // Save selector and tokenization cached.selector = selector; } return cached; -}; +} /** - * A low-level selection function that works with Sizzle's compiled + * A low-level selection function that works with jQuery's compiled * selector functions * @param {String|Function} selector A selector or a pre-compiled - * selector function built with Sizzle.compile + * selector function built with jQuery selector compile * @param {Element} context * @param {Array} [results] * @param {Array} [seed] A set of elements to match against */ -select = Sizzle.select = function( selector, context, results, seed ) { +function select( selector, context, results, seed ) { var i, tokens, token, type, find, compiled = typeof selector === "function" && selector, match = !seed && tokenize( ( selector = compiled.selector || selector ) ); @@ -2850,10 +6196,12 @@ select = Sizzle.select = function( selector, context, results, seed ) { // Reduce context if the leading compound selector is an ID tokens = match[ 0 ] = match[ 0 ].slice( 0 ); if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && - context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { + context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { - context = ( Expr.find[ "ID" ]( token.matches[ 0 ] - .replace( runescape, funescape ), context ) || [] )[ 0 ]; + context = ( Expr.find.ID( + token.matches[ 0 ].replace( runescape, funescape ), + context + ) || [] )[ 0 ]; if ( !context ) { return results; @@ -2866,7 +6214,7 @@ select = Sizzle.select = function( selector, context, results, seed ) { } // Fetch a seed set for right-to-left matching - i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length; + i = matchExpr.needsContext.test( selector ) ? 0 : tokens.length; while ( i-- ) { token = tokens[ i ]; @@ -2879,8 +6227,8 @@ select = Sizzle.select = function( selector, context, results, seed ) { // Search, expanding context for leading sibling combinators if ( ( seed = find( token.matches[ 0 ].replace( runescape, funescape ), - rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) || - context + rsibling.test( tokens[ 0 ].type ) && + testContext( context.parentNode ) || context ) ) ) { // If seed is empty or no tokens remain, we can return early @@ -2907,21 +6255,18 @@ select = Sizzle.select = function( selector, context, results, seed ) { !context || rsibling.test( selector ) && testContext( context.parentNode ) || context ); return results; -}; +} // One-time assignments +// Support: Android <=4.0 - 4.1+ // Sort stability support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; -// Support: Chrome 14-35+ -// Always assume duplicates if they aren't passed to the comparison function -support.detectDuplicates = !!hasDuplicate; - // Initialize against the default document setDocument(); -// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) +// Support: Android <=4.0 - 4.1+ // Detached nodes confoundingly follow *each other* support.sortDetached = assert( function( el ) { @@ -2929,68 +6274,29 @@ support.sortDetached = assert( function( el ) { return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; } ); -// Support: IE<8 -// Prevent attribute/property "interpolation" -// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx -if ( !assert( function( el ) { - el.innerHTML = ""; - return el.firstChild.getAttribute( "href" ) === "#"; -} ) ) { - addHandle( "type|href|height|width", function( elem, name, isXML ) { - if ( !isXML ) { - return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); - } - } ); -} - -// Support: IE<9 -// Use defaultValue in place of getAttribute("value") -if ( !support.attributes || !assert( function( el ) { - el.innerHTML = ""; - el.firstChild.setAttribute( "value", "" ); - return el.firstChild.getAttribute( "value" ) === ""; -} ) ) { - addHandle( "value", function( elem, _name, isXML ) { - if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { - return elem.defaultValue; - } - } ); -} - -// Support: IE<9 -// Use getAttributeNode to fetch booleans when getAttribute lies -if ( !assert( function( el ) { - return el.getAttribute( "disabled" ) == null; -} ) ) { - addHandle( booleans, function( elem, name, isXML ) { - var val; - if ( !isXML ) { - return elem[ name ] === true ? name.toLowerCase() : - ( val = elem.getAttributeNode( name ) ) && val.specified ? - val.value : - null; - } - } ); -} - -return Sizzle; - -} )( window ); - - - -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; +jQuery.find = find; // Deprecated jQuery.expr[ ":" ] = jQuery.expr.pseudos; -jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; -jQuery.escapeSelector = Sizzle.escape; +jQuery.unique = jQuery.uniqueSort; + +// These have always been private, but they used to be documented as part of +// Sizzle so let's maintain them for now for backwards compatibility purposes. +find.compile = compile; +find.select = select; +find.setDocument = setDocument; +find.tokenize = tokenize; + +find.escape = jQuery.escapeSelector; +find.getText = jQuery.text; +find.isXML = jQuery.isXMLDoc; +find.selectors = jQuery.expr; +find.support = jQuery.support; +find.uniqueSort = jQuery.uniqueSort; + /* eslint-enable */ +} )(); var dir = function( elem, dir, until ) { @@ -3024,13 +6330,6 @@ var siblings = function( n, elem ) { var rneedsContext = jQuery.expr.match.needsContext; - - -function nodeName( elem, name ) { - - return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); - -} var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); @@ -3129,8 +6428,8 @@ jQuery.fn.extend( { var rootjQuery, // A simple way to check for HTML strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - // Strict HTML recognition (#11290: must start with <) + // Prioritize #id over to avoid XSS via location.hash (trac-9521) + // Strict HTML recognition (trac-11290: must start with <) // Shortcut simple #id case for speed rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, @@ -3281,7 +6580,7 @@ jQuery.fn.extend( { if ( cur.nodeType < 11 && ( targets ? targets.index( cur ) > -1 : - // Don't pass non-elements to Sizzle + // Don't pass non-elements to jQuery#find cur.nodeType === 1 && jQuery.find.matchesSelector( cur, selectors ) ) ) { @@ -3836,7 +7135,7 @@ jQuery.extend( { if ( jQuery.Deferred.exceptionHook ) { jQuery.Deferred.exceptionHook( e, - process.stackTrace ); + process.error ); } // Support: Promises/A+ section 2.3.3.3.4.1 @@ -3864,10 +7163,17 @@ jQuery.extend( { process(); } else { - // Call an optional hook to record the stack, in case of exception + // Call an optional hook to record the error, in case of exception // since it's otherwise lost when execution goes async - if ( jQuery.Deferred.getStackHook ) { - process.stackTrace = jQuery.Deferred.getStackHook(); + if ( jQuery.Deferred.getErrorHook ) { + process.error = jQuery.Deferred.getErrorHook(); + + // The deprecated alias of the above. While the name suggests + // returning the stack, not an error instance, jQuery just passes + // it directly to `console.warn` so both will work; an instance + // just better cooperates with source maps. + } else if ( jQuery.Deferred.getStackHook ) { + process.error = jQuery.Deferred.getStackHook(); } window.setTimeout( process ); } @@ -4042,12 +7348,16 @@ jQuery.extend( { // warn about them ASAP rather than swallowing them by default. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; -jQuery.Deferred.exceptionHook = function( error, stack ) { +// If `jQuery.Deferred.getErrorHook` is defined, `asyncError` is an error +// captured before the async barrier to get the original error cause +// which may otherwise be hidden. +jQuery.Deferred.exceptionHook = function( error, asyncError ) { // Support: IE 8 - 9 only // Console exists when dev tools are open, which can happen at any time if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { - window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); + window.console.warn( "jQuery.Deferred exception: " + error.message, + error.stack, asyncError ); } }; @@ -4087,7 +7397,7 @@ jQuery.extend( { isReady: false, // A counter to track how many items to wait for before - // the ready event fires. See #6781 + // the ready event fires. See trac-6781 readyWait: 1, // Handle when the DOM is ready @@ -4215,7 +7525,7 @@ function fcamelCase( _all, letter ) { // Convert dashed to camelCase; used by the css and data modules // Support: IE <=9 - 11, Edge 12 - 15 -// Microsoft forgot to hump their vendor prefix (#9572) +// Microsoft forgot to hump their vendor prefix (trac-9572) function camelCase( string ) { return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); } @@ -4251,7 +7561,7 @@ Data.prototype = { value = {}; // We can accept data for non-element nodes in modern browsers, - // but we should not, see #8335. + // but we should not, see trac-8335. // Always return an empty object. if ( acceptData( owner ) ) { @@ -4490,7 +7800,7 @@ jQuery.fn.extend( { while ( i-- ) { // Support: IE 11 only - // The attrs elements can be null (#14894) + // The attrs elements can be null (trac-14894) if ( attrs[ i ] ) { name = attrs[ i ].name; if ( name.indexOf( "data-" ) === 0 ) { @@ -4913,9 +8223,9 @@ var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); input = document.createElement( "input" ); // Support: Android 4.0 - 4.3 only - // Check state lost if the name is set (#11217) + // Check state lost if the name is set (trac-11217) // Support: Windows Web Apps (WWA) - // `name` and `type` must use .setAttribute for WWA (#14901) + // `name` and `type` must use .setAttribute for WWA (trac-14901) input.setAttribute( "type", "radio" ); input.setAttribute( "checked", "checked" ); input.setAttribute( "name", "t" ); @@ -4939,7 +8249,7 @@ var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); } )(); -// We have to close these tags to support XHTML (#13200) +// We have to close these tags to support XHTML (trac-13200) var wrapMap = { // XHTML parsers do not magically insert elements in the @@ -4965,7 +8275,7 @@ if ( !support.option ) { function getAll( context, tag ) { // Support: IE <=9 - 11 only - // Use typeof to avoid zero-argument method invocation on host objects (#15151) + // Use typeof to avoid zero-argument method invocation on host objects (trac-15151) var ret; if ( typeof context.getElementsByTagName !== "undefined" ) { @@ -5048,7 +8358,7 @@ function buildFragment( elems, context, scripts, selection, ignored ) { // Remember the top-level container tmp = fragment.firstChild; - // Ensure the created nodes are orphaned (#12392) + // Ensure the created nodes are orphaned (trac-12392) tmp.textContent = ""; } } @@ -5103,25 +8413,6 @@ function returnFalse() { return false; } -// Support: IE <=9 - 11+ -// focus() and blur() are asynchronous, except when they are no-op. -// So expect focus to be synchronous when the element is already active, -// and blur to be synchronous when the element is not already active. -// (focus and blur are always synchronous in other supported browsers, -// this just defines when we can count on it). -function expectSync( elem, type ) { - return ( elem === safeActiveElement() ) === ( type === "focus" ); -} - -// Support: IE <=9 only -// Accessing document.activeElement can throw unexpectedly -// https://bugs.jquery.com/ticket/13393 -function safeActiveElement() { - try { - return document.activeElement; - } catch ( err ) { } -} - function on( elem, types, selector, data, fn, one ) { var origFn, type; @@ -5469,15 +8760,15 @@ jQuery.event = { for ( ; cur !== this; cur = cur.parentNode || this ) { - // Don't check non-elements (#13208) - // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) + // Don't check non-elements (trac-13208) + // Don't process clicks on disabled elements (trac-6911, trac-8165, trac-11382, trac-11764) if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { matchedHandlers = []; matchedSelectors = {}; for ( i = 0; i < delegateCount; i++ ) { handleObj = handlers[ i ]; - // Don't conflict with Object.prototype properties (#13203) + // Don't conflict with Object.prototype properties (trac-13203) sel = handleObj.selector + " "; if ( matchedSelectors[ sel ] === undefined ) { @@ -5559,7 +8850,7 @@ jQuery.event = { el.click && nodeName( el, "input" ) ) { // dataPriv.set( el, "click", ... ) - leverageNative( el, "click", returnTrue ); + leverageNative( el, "click", true ); } // Return false to allow normal processing in the caller @@ -5610,10 +8901,10 @@ jQuery.event = { // synthetic events by interrupting progress until reinvoked in response to // *native* events that it fires directly, ensuring that state changes have // already occurred before other listeners are invoked. -function leverageNative( el, type, expectSync ) { +function leverageNative( el, type, isSetup ) { - // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add - if ( !expectSync ) { + // Missing `isSetup` indicates a trigger call, which must force setup through jQuery.event.add + if ( !isSetup ) { if ( dataPriv.get( el, type ) === undefined ) { jQuery.event.add( el, type, returnTrue ); } @@ -5625,15 +8916,13 @@ function leverageNative( el, type, expectSync ) { jQuery.event.add( el, type, { namespace: false, handler: function( event ) { - var notAsync, result, + var result, saved = dataPriv.get( this, type ); if ( ( event.isTrigger & 1 ) && this[ type ] ) { // Interrupt processing of the outer synthetic .trigger()ed event - // Saved data should be false in such cases, but might be a leftover capture object - // from an async native handler (gh-4350) - if ( !saved.length ) { + if ( !saved ) { // Store arguments for use when handling the inner native event // There will always be at least one argument (an event object), so this array @@ -5642,33 +8931,22 @@ function leverageNative( el, type, expectSync ) { dataPriv.set( this, type, saved ); // Trigger the native event and capture its result - // Support: IE <=9 - 11+ - // focus() and blur() are asynchronous - notAsync = expectSync( this, type ); this[ type ](); result = dataPriv.get( this, type ); - if ( saved !== result || notAsync ) { - dataPriv.set( this, type, false ); - } else { - result = {}; - } + dataPriv.set( this, type, false ); + if ( saved !== result ) { // Cancel the outer synthetic event event.stopImmediatePropagation(); event.preventDefault(); - // Support: Chrome 86+ - // In Chrome, if an element having a focusout handler is blurred by - // clicking outside of it, it invokes the handler synchronously. If - // that handler calls `.remove()` on the element, the data is cleared, - // leaving `result` undefined. We need to guard against this. - return result && result.value; + return result; } // If this is an inner synthetic event for an event with a bubbling surrogate - // (focus or blur), assume that the surrogate already propagated from triggering the - // native event and prevent that from happening again here. + // (focus or blur), assume that the surrogate already propagated from triggering + // the native event and prevent that from happening again here. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the // bubbling surrogate propagates *after* the non-bubbling base), but that seems // less bad than duplication. @@ -5678,22 +8956,25 @@ function leverageNative( el, type, expectSync ) { // If this is a native event triggered above, everything is now in order // Fire an inner synthetic event with the original arguments - } else if ( saved.length ) { + } else if ( saved ) { // ...and capture the result - dataPriv.set( this, type, { - value: jQuery.event.trigger( - - // Support: IE <=9 - 11+ - // Extend with the prototype to reset the above stopImmediatePropagation() - jQuery.extend( saved[ 0 ], jQuery.Event.prototype ), - saved.slice( 1 ), - this - ) - } ); - - // Abort handling of the native event - event.stopImmediatePropagation(); + dataPriv.set( this, type, jQuery.event.trigger( + saved[ 0 ], + saved.slice( 1 ), + this + ) ); + + // Abort handling of the native event by all jQuery handlers while allowing + // native handlers on the same element to run. On target, this is achieved + // by stopping immediate propagation just on the jQuery event. However, + // the native event is re-wrapped by a jQuery one on each level of the + // propagation so the only way to stop it for jQuery is to stop it for + // everyone via native `stopPropagation()`. This is not a problem for + // focus/blur which don't bubble, but it does also stop click on checkboxes + // and radios. We accept this limitation. + event.stopPropagation(); + event.isImmediatePropagationStopped = returnTrue; } } } ); @@ -5731,7 +9012,7 @@ jQuery.Event = function( src, props ) { // Create target properties // Support: Safari <=6 - 7 only - // Target should not be a text node (#504, #13143) + // Target should not be a text node (trac-504, trac-13143) this.target = ( src.target && src.target.nodeType === 3 ) ? src.target.parentNode : src.target; @@ -5832,18 +9113,73 @@ jQuery.each( { }, jQuery.event.addProp ); jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { + + function focusMappedHandler( nativeEvent ) { + if ( document.documentMode ) { + + // Support: IE 11+ + // Attach a single focusin/focusout handler on the document while someone wants + // focus/blur. This is because the former are synchronous in IE while the latter + // are async. In other browsers, all those handlers are invoked synchronously. + + // `handle` from private data would already wrap the event, but we need + // to change the `type` here. + var handle = dataPriv.get( this, "handle" ), + event = jQuery.event.fix( nativeEvent ); + event.type = nativeEvent.type === "focusin" ? "focus" : "blur"; + event.isSimulated = true; + + // First, handle focusin/focusout + handle( nativeEvent ); + + // ...then, handle focus/blur + // + // focus/blur don't bubble while focusin/focusout do; simulate the former by only + // invoking the handler at the lower level. + if ( event.target === event.currentTarget ) { + + // The setup part calls `leverageNative`, which, in turn, calls + // `jQuery.event.add`, so event handle will already have been set + // by this point. + handle( event ); + } + } else { + + // For non-IE browsers, attach a single capturing handler on the document + // while someone wants focusin/focusout. + jQuery.event.simulate( delegateType, nativeEvent.target, + jQuery.event.fix( nativeEvent ) ); + } + } + jQuery.event.special[ type ] = { // Utilize native event if possible so blur/focus sequence is correct setup: function() { + var attaches; + // Claim the first handler // dataPriv.set( this, "focus", ... ) // dataPriv.set( this, "blur", ... ) - leverageNative( this, type, expectSync ); + leverageNative( this, type, true ); - // Return false to allow normal processing in the caller - return false; + if ( document.documentMode ) { + + // Support: IE 9 - 11+ + // We use the same native handler for focusin & focus (and focusout & blur) + // so we need to coordinate setup & teardown parts between those events. + // Use `delegateType` as the key as `type` is already used by `leverageNative`. + attaches = dataPriv.get( this, delegateType ); + if ( !attaches ) { + this.addEventListener( delegateType, focusMappedHandler ); + } + dataPriv.set( this, delegateType, ( attaches || 0 ) + 1 ); + } else { + + // Return false to allow normal processing in the caller + return false; + } }, trigger: function() { @@ -5854,14 +9190,84 @@ jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateTyp return true; }, - // Suppress native focus or blur as it's already being fired - // in leverageNative. - _default: function() { - return true; + teardown: function() { + var attaches; + + if ( document.documentMode ) { + attaches = dataPriv.get( this, delegateType ) - 1; + if ( !attaches ) { + this.removeEventListener( delegateType, focusMappedHandler ); + dataPriv.remove( this, delegateType ); + } else { + dataPriv.set( this, delegateType, attaches ); + } + } else { + + // Return false to indicate standard teardown should be applied + return false; + } + }, + + // Suppress native focus or blur if we're currently inside + // a leveraged native-event stack + _default: function( event ) { + return dataPriv.get( event.target, type ); }, delegateType: delegateType }; + + // Support: Firefox <=44 + // Firefox doesn't have focus(in | out) events + // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 + // + // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 + // focus(in | out) events fire after focus & blur events, + // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order + // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 + // + // Support: IE 9 - 11+ + // To preserve relative focusin/focus & focusout/blur event order guaranteed on the 3.x branch, + // attach a single handler for both events in IE. + jQuery.event.special[ delegateType ] = { + setup: function() { + + // Handle: regular nodes (via `this.ownerDocument`), window + // (via `this.document`) & document (via `this`). + var doc = this.ownerDocument || this.document || this, + dataHolder = document.documentMode ? this : doc, + attaches = dataPriv.get( dataHolder, delegateType ); + + // Support: IE 9 - 11+ + // We use the same native handler for focusin & focus (and focusout & blur) + // so we need to coordinate setup & teardown parts between those events. + // Use `delegateType` as the key as `type` is already used by `leverageNative`. + if ( !attaches ) { + if ( document.documentMode ) { + this.addEventListener( delegateType, focusMappedHandler ); + } else { + doc.addEventListener( type, focusMappedHandler, true ); + } + } + dataPriv.set( dataHolder, delegateType, ( attaches || 0 ) + 1 ); + }, + teardown: function() { + var doc = this.ownerDocument || this.document || this, + dataHolder = document.documentMode ? this : doc, + attaches = dataPriv.get( dataHolder, delegateType ) - 1; + + if ( !attaches ) { + if ( document.documentMode ) { + this.removeEventListener( delegateType, focusMappedHandler ); + } else { + doc.removeEventListener( type, focusMappedHandler, true ); + } + dataPriv.remove( dataHolder, delegateType ); + } else { + dataPriv.set( dataHolder, delegateType, attaches ); + } + } + }; } ); // Create mouseenter/leave events using mouseover/out and event-time checks @@ -5956,7 +9362,8 @@ var // checked="checked" or checked rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, - rcleanScript = /^\s*\s*$/g; + + rcleanScript = /^\s*\s*$/g; // Prefer a tbody over its parent table for containing new rows function manipulationTarget( elem, content ) { @@ -6070,7 +9477,7 @@ function domManip( collection, args, callback, ignored ) { // Use the original fragment for the last item // instead of the first because it can end up - // being emptied incorrectly in certain situations (#8070). + // being emptied incorrectly in certain situations (trac-8070). for ( ; i < l; i++ ) { node = fragment; @@ -6092,7 +9499,7 @@ function domManip( collection, args, callback, ignored ) { if ( hasScripts ) { doc = scripts[ scripts.length - 1 ].ownerDocument; - // Reenable scripts + // Re-enable scripts jQuery.map( scripts, restoreScript ); // Evaluate executable scripts on first document insertion @@ -6111,6 +9518,12 @@ function domManip( collection, args, callback, ignored ) { }, doc ); } } else { + + // Unwrap a CDATA section containing script contents. This shouldn't be + // needed as in XML documents they're already not visible when + // inspecting element contents and in HTML documents they have no + // meaning but we're preserving that logic for backwards compatibility. + // This will be removed completely in 4.0. See gh-4904. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); } } @@ -6157,7 +9570,8 @@ jQuery.extend( { if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && !jQuery.isXMLDoc( elem ) ) { - // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 + // We eschew jQuery#find here for performance reasons: + // https://jsperf.com/getall-vs-sizzle/2 destElements = getAll( clone ); srcElements = getAll( elem ); @@ -6393,9 +9807,12 @@ jQuery.each( { } ); var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); +var rcustomProp = /^--/; + + var getStyles = function( elem ) { - // Support: IE <=11 only, Firefox <=30 (#15098, #14150) + // Support: IE <=11 only, Firefox <=30 (trac-15098, trac-14150) // IE throws on elements created in popups // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" var view = elem.ownerDocument.defaultView; @@ -6495,7 +9912,7 @@ var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); } // Support: IE <=9 - 11 only - // Style of cloned element affects source element cloned (#8908) + // Style of cloned element affects source element cloned (trac-8908) div.style.backgroundClip = "content-box"; div.cloneNode( true ).style.backgroundClip = ""; support.clearCloneStyle = div.style.backgroundClip === "content-box"; @@ -6539,7 +9956,7 @@ var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); trChild = document.createElement( "div" ); table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; - tr.style.cssText = "border:1px solid"; + tr.style.cssText = "box-sizing:content-box;border:1px solid"; // Support: Chrome 86+ // Height set through cssText does not get applied. @@ -6551,7 +9968,7 @@ var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); // In our bodyBackground.html iframe, // display for all div elements is set to "inline", // which causes a problem only in Android 8 Chrome 86. - // Ensuring the div is display: block + // Ensuring the div is `display: block` // gets around this issue. trChild.style.display = "block"; @@ -6575,6 +9992,7 @@ var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); function curCSS( elem, name, computed ) { var width, minWidth, maxWidth, ret, + isCustomProp = rcustomProp.test( name ), // Support: Firefox 51+ // Retrieving style before computed somehow @@ -6585,11 +10003,42 @@ function curCSS( elem, name, computed ) { computed = computed || getStyles( elem ); // getPropertyValue is needed for: - // .css('filter') (IE 9 only, #12537) - // .css('--customProperty) (#3144) + // .css('filter') (IE 9 only, trac-12537) + // .css('--customProperty) (gh-3144) if ( computed ) { + + // Support: IE <=9 - 11+ + // IE only supports `"float"` in `getPropertyValue`; in computed styles + // it's only available as `"cssFloat"`. We no longer modify properties + // sent to `.css()` apart from camelCasing, so we need to check both. + // Normally, this would create difference in behavior: if + // `getPropertyValue` returns an empty string, the value returned + // by `.css()` would be `undefined`. This is usually the case for + // disconnected elements. However, in IE even disconnected elements + // with no styles return `"none"` for `getPropertyValue( "float" )` ret = computed.getPropertyValue( name ) || computed[ name ]; + if ( isCustomProp && ret ) { + + // Support: Firefox 105+, Chrome <=105+ + // Spec requires trimming whitespace for custom properties (gh-4926). + // Firefox only trims leading whitespace. Chrome just collapses + // both leading & trailing whitespace to a single space. + // + // Fall back to `undefined` if empty string returned. + // This collapses a missing definition with property defined + // and set to an empty string but there's no standard API + // allowing us to differentiate them without a performance penalty + // and returning `undefined` aligns with older jQuery. + // + // rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED + // as whitespace while CSS does not, but this is not a problem + // because CSS preprocessing replaces them with U+000A LINE FEED + // (which *is* CSS whitespace) + // https://www.w3.org/TR/css-syntax-3/#input-preprocessing + ret = ret.replace( rtrimCSS, "$1" ) || undefined; + } + if ( ret === "" && !isAttached( elem ) ) { ret = jQuery.style( elem, name ); } @@ -6685,7 +10134,6 @@ var // except "table", "table-cell", or "table-caption" // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display rdisplayswap = /^(none|table(?!-c[ea]).+)/, - rcustomProp = /^--/, cssShow = { position: "absolute", visibility: "hidden", display: "block" }, cssNormalTransform = { letterSpacing: "0", @@ -6707,7 +10155,8 @@ function setPositiveNumber( _elem, value, subtract ) { function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { var i = dimension === "width" ? 1 : 0, extra = 0, - delta = 0; + delta = 0, + marginDelta = 0; // Adjustment may not be necessary if ( box === ( isBorderBox ? "border" : "content" ) ) { @@ -6717,8 +10166,10 @@ function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computed for ( ; i < 4; i += 2 ) { // Both box models exclude margin + // Count margin delta separately to only add it after scroll gutter adjustment. + // This is needed to make negative margins work with `outerHeight( true )` (gh-3982). if ( box === "margin" ) { - delta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); + marginDelta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); } // If we get here with a content-box, we're seeking "padding" or "border" or "margin" @@ -6769,7 +10220,7 @@ function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computed ) ) || 0; } - return delta; + return delta + marginDelta; } function getWidthOrHeight( elem, dimension, extra ) { @@ -6867,26 +10318,35 @@ jQuery.extend( { // Don't automatically add "px" to these possibly-unitless properties cssNumber: { - "animationIterationCount": true, - "columnCount": true, - "fillOpacity": true, - "flexGrow": true, - "flexShrink": true, - "fontWeight": true, - "gridArea": true, - "gridColumn": true, - "gridColumnEnd": true, - "gridColumnStart": true, - "gridRow": true, - "gridRowEnd": true, - "gridRowStart": true, - "lineHeight": true, - "opacity": true, - "order": true, - "orphans": true, - "widows": true, - "zIndex": true, - "zoom": true + animationIterationCount: true, + aspectRatio: true, + borderImageSlice: true, + columnCount: true, + flexGrow: true, + flexShrink: true, + fontWeight: true, + gridArea: true, + gridColumn: true, + gridColumnEnd: true, + gridColumnStart: true, + gridRow: true, + gridRowEnd: true, + gridRowStart: true, + lineHeight: true, + opacity: true, + order: true, + orphans: true, + scale: true, + widows: true, + zIndex: true, + zoom: true, + + // SVG-related + fillOpacity: true, + floodOpacity: true, + stopOpacity: true, + strokeMiterlimit: true, + strokeOpacity: true }, // Add in properties whose names you wish to fix before @@ -6921,15 +10381,15 @@ jQuery.extend( { if ( value !== undefined ) { type = typeof value; - // Convert "+=" or "-=" to relative numbers (#7345) + // Convert "+=" or "-=" to relative numbers (trac-7345) if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { value = adjustCSS( elem, name, ret ); - // Fixes bug #9237 + // Fixes bug trac-9237 type = "number"; } - // Make sure that null and NaN values aren't set (#7116) + // Make sure that null and NaN values aren't set (trac-7116) if ( value == null || value !== value ) { return; } @@ -7553,7 +11013,7 @@ function Animation( elem, properties, options ) { remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), // Support: Android 2.3 only - // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) + // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (trac-12497) temp = remaining / animation.duration || 0, percent = 1 - temp, index = 0, @@ -7943,7 +11403,6 @@ jQuery.fx.speeds = { // Based off of the plugin by Clint Helfers, with permission. -// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ jQuery.fn.delay = function( time, type ) { time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; type = type || "fx"; @@ -8168,8 +11627,7 @@ jQuery.extend( { // Support: IE <=9 - 11 only // elem.tabIndex doesn't always return the // correct value when it hasn't been explicitly set - // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - // Use proper attribute retrieval(#12072) + // Use proper attribute retrieval (trac-12072) var tabindex = jQuery.find.attr( elem, "tabindex" ); if ( tabindex ) { @@ -8273,8 +11731,7 @@ function classesToArray( value ) { jQuery.fn.extend( { addClass: function( value ) { - var classes, elem, cur, curValue, clazz, j, finalValue, - i = 0; + var classNames, cur, curValue, className, i, finalValue; if ( isFunction( value ) ) { return this.each( function( j ) { @@ -8282,36 +11739,35 @@ jQuery.fn.extend( { } ); } - classes = classesToArray( value ); + classNames = classesToArray( value ); - if ( classes.length ) { - while ( ( elem = this[ i++ ] ) ) { - curValue = getClass( elem ); - cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); + if ( classNames.length ) { + return this.each( function() { + curValue = getClass( this ); + cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); if ( cur ) { - j = 0; - while ( ( clazz = classes[ j++ ] ) ) { - if ( cur.indexOf( " " + clazz + " " ) < 0 ) { - cur += clazz + " "; + for ( i = 0; i < classNames.length; i++ ) { + className = classNames[ i ]; + if ( cur.indexOf( " " + className + " " ) < 0 ) { + cur += className + " "; } } // Only assign if different to avoid unneeded rendering. finalValue = stripAndCollapse( cur ); if ( curValue !== finalValue ) { - elem.setAttribute( "class", finalValue ); + this.setAttribute( "class", finalValue ); } } - } + } ); } return this; }, removeClass: function( value ) { - var classes, elem, cur, curValue, clazz, j, finalValue, - i = 0; + var classNames, cur, curValue, className, i, finalValue; if ( isFunction( value ) ) { return this.each( function( j ) { @@ -8323,45 +11779,42 @@ jQuery.fn.extend( { return this.attr( "class", "" ); } - classes = classesToArray( value ); + classNames = classesToArray( value ); - if ( classes.length ) { - while ( ( elem = this[ i++ ] ) ) { - curValue = getClass( elem ); + if ( classNames.length ) { + return this.each( function() { + curValue = getClass( this ); // This expression is here for better compressibility (see addClass) - cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); + cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); if ( cur ) { - j = 0; - while ( ( clazz = classes[ j++ ] ) ) { + for ( i = 0; i < classNames.length; i++ ) { + className = classNames[ i ]; // Remove *all* instances - while ( cur.indexOf( " " + clazz + " " ) > -1 ) { - cur = cur.replace( " " + clazz + " ", " " ); + while ( cur.indexOf( " " + className + " " ) > -1 ) { + cur = cur.replace( " " + className + " ", " " ); } } // Only assign if different to avoid unneeded rendering. finalValue = stripAndCollapse( cur ); if ( curValue !== finalValue ) { - elem.setAttribute( "class", finalValue ); + this.setAttribute( "class", finalValue ); } } - } + } ); } return this; }, toggleClass: function( value, stateVal ) { - var type = typeof value, + var classNames, className, i, self, + type = typeof value, isValidValue = type === "string" || Array.isArray( value ); - if ( typeof stateVal === "boolean" && isValidValue ) { - return stateVal ? this.addClass( value ) : this.removeClass( value ); - } - if ( isFunction( value ) ) { return this.each( function( i ) { jQuery( this ).toggleClass( @@ -8371,17 +11824,20 @@ jQuery.fn.extend( { } ); } - return this.each( function() { - var className, i, self, classNames; + if ( typeof stateVal === "boolean" && isValidValue ) { + return stateVal ? this.addClass( value ) : this.removeClass( value ); + } + classNames = classesToArray( value ); + + return this.each( function() { if ( isValidValue ) { // Toggle individual class names - i = 0; self = jQuery( this ); - classNames = classesToArray( value ); - while ( ( className = classNames[ i++ ] ) ) { + for ( i = 0; i < classNames.length; i++ ) { + className = classNames[ i ]; // Check each className given, space separated list if ( self.hasClass( className ) ) { @@ -8515,7 +11971,7 @@ jQuery.extend( { val : // Support: IE <=10 - 11 only - // option.text throws exceptions (#14686, #14858) + // option.text throws exceptions (trac-14686, trac-14858) // Strip and collapse whitespace // https://html.spec.whatwg.org/#strip-and-collapse-whitespace stripAndCollapse( jQuery.text( elem ) ); @@ -8542,7 +11998,7 @@ jQuery.extend( { option = options[ i ]; // Support: IE <=9 only - // IE8-9 doesn't update selected after form reset (#2551) + // IE8-9 doesn't update selected after form reset (trac-2551) if ( ( option.selected || i === index ) && // Don't return options that are disabled or in a disabled optgroup @@ -8616,9 +12072,39 @@ jQuery.each( [ "radio", "checkbox" ], function() { // Return jQuery for attributes-only inclusion +var location = window.location; + +var nonce = { guid: Date.now() }; +var rquery = ( /\?/ ); + + + +// Cross-browser xml parsing +jQuery.parseXML = function( data ) { + var xml, parserErrorElem; + if ( !data || typeof data !== "string" ) { + return null; + } + + // Support: IE 9 - 11 only + // IE throws on parseFromString with invalid input. + try { + xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); + } catch ( e ) {} -support.focusin = "onfocusin" in window; + parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ]; + if ( !xml || parserErrorElem ) { + jQuery.error( "Invalid XML: " + ( + parserErrorElem ? + jQuery.map( parserErrorElem.childNodes, function( el ) { + return el.textContent; + } ).join( "\n" ) : + data + ) ); + } + return xml; +}; var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, @@ -8685,8 +12171,8 @@ jQuery.extend( jQuery.event, { return; } - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) + // Determine event propagation path in advance, per W3C events spec (trac-9951) + // Bubble up to document, then to window; watch for a global ownerDocument var (trac-9724) if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { bubbleType = special.delegateType || type; @@ -8738,7 +12224,7 @@ jQuery.extend( jQuery.event, { acceptData( elem ) ) { // Call a native DOM method on the target with the same name as the event. - // Don't do default actions on window, that's where global variables be (#6170) + // Don't do default actions on window, that's where global variables be (trac-6170) if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { // Don't re-trigger an onFOO event when we call its FOO() method @@ -8806,85 +12292,6 @@ jQuery.fn.extend( { } ); -// Support: Firefox <=44 -// Firefox doesn't have focus(in | out) events -// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 -// -// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 -// focus(in | out) events fire after focus & blur events, -// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order -// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 -if ( !support.focusin ) { - jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler on the document while someone wants focusin/focusout - var handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - - // Handle: regular nodes (via `this.ownerDocument`), window - // (via `this.document`) & document (via `this`). - var doc = this.ownerDocument || this.document || this, - attaches = dataPriv.access( doc, fix ); - - if ( !attaches ) { - doc.addEventListener( orig, handler, true ); - } - dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); - }, - teardown: function() { - var doc = this.ownerDocument || this.document || this, - attaches = dataPriv.access( doc, fix ) - 1; - - if ( !attaches ) { - doc.removeEventListener( orig, handler, true ); - dataPriv.remove( doc, fix ); - - } else { - dataPriv.access( doc, fix, attaches ); - } - } - }; - } ); -} -var location = window.location; - -var nonce = { guid: Date.now() }; - -var rquery = ( /\?/ ); - - - -// Cross-browser xml parsing -jQuery.parseXML = function( data ) { - var xml, parserErrorElem; - if ( !data || typeof data !== "string" ) { - return null; - } - - // Support: IE 9 - 11 only - // IE throws on parseFromString with invalid input. - try { - xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); - } catch ( e ) {} - - parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ]; - if ( !xml || parserErrorElem ) { - jQuery.error( "Invalid XML: " + ( - parserErrorElem ? - jQuery.map( parserErrorElem.childNodes, function( el ) { - return el.textContent; - } ).join( "\n" ) : - data - ) ); - } - return xml; -}; - - var rbracket = /\[\]$/, rCRLF = /\r?\n/g, @@ -9012,7 +12419,7 @@ var rantiCache = /([?&])_=[^&]*/, rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, - // #7653, #8125, #8152: local protocol detection + // trac-7653, trac-8125, trac-8152: local protocol detection rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, rnoContent = /^(?:GET|HEAD)$/, rprotocol = /^\/\//, @@ -9035,7 +12442,7 @@ var */ transports = {}, - // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression + // Avoid comment-prolog char sequence (trac-10098); must appease lint and evade compression allTypes = "*/".concat( "*" ), // Anchor tag for parsing the document origin @@ -9106,7 +12513,7 @@ function inspectPrefiltersOrTransports( structure, options, originalOptions, jqX // A special extend for ajax options // that takes "flat" options (not to be deep extended) -// Fixes #9887 +// Fixes trac-9887 function ajaxExtend( target, src ) { var key, deep, flatOptions = jQuery.ajaxSettings.flatOptions || {}; @@ -9517,12 +12924,12 @@ jQuery.extend( { deferred.promise( jqXHR ); // Add protocol if not provided (prefilters might expect it) - // Handle falsy url in the settings object (#10093: consistency with old signature) + // Handle falsy url in the settings object (trac-10093: consistency with old signature) // We also use the url parameter if available s.url = ( ( url || s.url || location.href ) + "" ) .replace( rprotocol, location.protocol + "//" ); - // Alias method option to type as per ticket #12004 + // Alias method option to type as per ticket trac-12004 s.type = options.method || options.type || s.method || s.type; // Extract dataTypes list @@ -9565,7 +12972,7 @@ jQuery.extend( { } // We can fire global events as of now if asked to - // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) + // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (trac-15118) fireGlobals = jQuery.event && s.global; // Watch for a new set of requests @@ -9594,7 +13001,7 @@ jQuery.extend( { if ( s.data && ( s.processData || typeof s.data === "string" ) ) { cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; - // #9682: remove data so that it's not used in an eventual retry + // trac-9682: remove data so that it's not used in an eventual retry delete s.data; } @@ -9867,7 +13274,7 @@ jQuery._evalUrl = function( url, options, doc ) { return jQuery.ajax( { url: url, - // Make this explicit, since user can override this through ajaxSetup (#11264) + // Make this explicit, since user can override this through ajaxSetup (trac-11264) type: "GET", dataType: "script", cache: true, @@ -9976,7 +13383,7 @@ var xhrSuccessStatus = { 0: 200, // Support: IE <=9 only - // #1450: sometimes IE returns 1223 when it should be 204 + // trac-1450: sometimes IE returns 1223 when it should be 204 1223: 204 }, xhrSupported = jQuery.ajaxSettings.xhr(); @@ -10048,7 +13455,7 @@ jQuery.ajaxTransport( function( options ) { } else { complete( - // File: protocol always yields status 0; see #8605, #14207 + // File: protocol always yields status 0; see trac-8605, trac-14207 xhr.status, xhr.statusText ); @@ -10109,7 +13516,7 @@ jQuery.ajaxTransport( function( options ) { xhr.send( options.hasContent && options.data || null ); } catch ( e ) { - // #14683: Only rethrow if this hasn't been notified as an error yet + // trac-14683: Only rethrow if this hasn't been notified as an error yet if ( callback ) { throw e; } @@ -10729,7 +14136,9 @@ jQuery.fn.extend( { }, hover: function( fnOver, fnOut ) { - return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); + return this + .on( "mouseenter", fnOver ) + .on( "mouseleave", fnOut || fnOver ); } } ); @@ -10753,7 +14162,9 @@ jQuery.each( // Support: Android <=4.0 only // Make sure we trim BOM and NBSP -var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g; +// Require that the "whitespace run" starts from a non-whitespace +// to avoid O(N^2) behavior when the engine would try matching "\s+$" at each space position. +var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g; // Bind a function to a context, optionally partially applying any // arguments. @@ -10820,7 +14231,7 @@ jQuery.isNumeric = function( obj ) { jQuery.trim = function( text ) { return text == null ? "" : - ( text + "" ).replace( rtrim, "" ); + ( text + "" ).replace( rtrim, "$1" ); }; @@ -10868,8 +14279,8 @@ jQuery.noConflict = function( deep ) { }; // Expose jQuery and $ identifiers, even in AMD -// (#7102#comment:10, https://github.com/jquery/jquery/pull/557) -// and CommonJS for browser emulators (#13566) +// (trac-7102#comment:10, https://github.com/jquery/jquery/pull/557) +// and CommonJS for browser emulators (trac-13566) if ( typeof noGlobal === "undefined" ) { window.jQuery = window.$ = jQuery; } diff --git a/demo/demo.css b/demo/demo.css index ddf410a..4410772 100644 --- a/demo/demo.css +++ b/demo/demo.css @@ -1,16 +1,63 @@ /* Demo for fcoo-colors */ +/*********************************************************************** + +leaflet-bootstrap-marker-mixin.scss + +*************************************************************************/ +/*********************************************************************** +marker-circle-color +Create style for bsMarkerCircle in different colors +*************************************************************************/ +/*********************************************************************** +lbm-circle-and-icon-classes +Create class for bsMarkerCircle named $name with color and color-border +*************************************************************************/ +/*********************************************************************** +lbm-marker-and-icon-classes +Create class for bsMarkerCircle named $name with color and color-border +*************************************************************************/ +/*********************************************************************** +fa-lbm-color +Create class for color and border-color used by L.bsMarkerAsIcon (and $.bsMarkerAsIcon) +to create fa-icon looking like the marker +*************************************************************************/ /*********************************************** - fcoo-colors-mixin.scss, + _leaflet-polyline-mixin.scss + + (c) 2018, FCOO - (c) 2021, FCOO + https://github.com/FCOO/leaflet-polyline + https://github.com/FCOO + +************************************************/ +/********************************************************** + fcoo-colors-variables.scss, https://github.com/FCOO/fcoo-colors https://github.com/FCOO +**********************************************************/ +/********************************************************** +The color scheme is from LinkedIn and shown in linkedin-palette-screen.pdf +**********************************************************/ +/********************************************************** +Color for time = tree colors for the past, now, and the future +**********************************************************/ +/********************************************************** + fcoo-colors-mixin.scss + https://github.com/FCOO/fcoo-colors + https://github.com/FCOO -************************************************/ +**********************************************************/ +/********************************************************** +Functions to get colors in different (relative) gradients +**********************************************************/ +/********************************************************** +marker-and-polygon-color +create color-classes for bsMarker and bsPolyline +**********************************************************/ .color-pink { background-color: #ED4795; } @@ -23,4 +70,9 @@ Demo for fcoo-colors background-color: #8B6700; } +.test-time-past { + color: var(--fc-time-past-color); + background-color: var(--fc-time-past-bg-color); +} + /*# sourceMappingURL=demo.css.map */ diff --git a/demo/demo.css.map b/demo/demo.css.map index 9596329..b3b8749 100644 --- a/demo/demo.css.map +++ b/demo/demo.css.map @@ -1 +1 @@ -{"version":3,"sourceRoot":"","sources":["demo.scss","../src/_fcoo-colors-mixin.scss"],"names":[],"mappings":"AAAA;AAAA;AAAA;ACAA;AAAA;;AAAA;;AAAA;AAAA;;;AAAA;ADQA;EACI;;;AAGJ;EACI;;;AAGJ;EACI","file":"demo.css"} \ No newline at end of file +{"version":3,"sourceRoot":"","sources":["demo.scss","../bower_components/leaflet-bootstrap-marker-mixin/dist/_leaflet-bootstrap-marker-mixin.scss","../bower_components/leaflet-polyline-mixin/dist/_leaflet-polyline-mixin.scss","../src/_fcoo-colors-variables.scss","../src/_fcoo-colors-mixin.scss"],"names":[],"mappings":"AAAA;AAAA;AAAA;ACAA;;AAAA;;AAAA;AAmCA;AAAA;AAAA;AAAA;AAwBA;AAAA;AAAA;AAAA;AAeA;AAAA;AAAA;AAAA;AAaA;AAAA;AAAA;AAAA;AAAA;ACvFA;AAAA;;AAAA;;AAAA;AAAA;;AAAA;ACAA;AAAA;;AAAA;AAAA;AAAA;AAOA;AAAA;AAAA;AAuCA;AAAA;AAAA;AC9CA;AAAA;;AAAA;AAAA;;AAAA;AASA;AAAA;AAAA;AAiBA;AAAA;AAAA;AAAA;AJJA;EACI;;;AAGJ;EACI;;;AAGJ;EACI;;;AAGJ;EACI,OGqCsB;EHpCtB,kBGmCsB","file":"demo.css"} \ No newline at end of file diff --git a/demo/demo.scss b/demo/demo.scss index 2c0e478..21d79d3 100644 --- a/demo/demo.scss +++ b/demo/demo.scss @@ -3,9 +3,23 @@ Demo for fcoo-colors */ + +@import "../bower_components/sass-color-helpers/stylesheets/color-helpers"; + +//LEAFLET-BOOTSTRAP-MARKER-MIXIN - mixin to create colors for marker (bsMarker) +@import "../bower_components/leaflet-bootstrap-marker-mixin/dist/leaflet-bootstrap-marker-mixin"; + +//LEAFLET-POLYLINE-MIXIN - mixin to create colors for polyline and polygon +@import "../bower_components/leaflet-polyline-mixin/dist/leaflet-polyline-mixin"; + + +//FCOO-COLORS-VARIABLES and FCOO-COLORS-MIXIN +@import "../src/fcoo-colors-variables"; @import "../src/fcoo-colors-mixin"; + + .color-pink { background-color: fc-get-color($fc-pink); } diff --git a/demo/index.html b/demo/index.html index f335eef..f3ad933 100644 --- a/demo/index.html +++ b/demo/index.html @@ -9,25 +9,47 @@ - + + +

Click n a colormto change application base color = body background-color

color-pink
color-blue-3
color-yellow-8
+
Past
+
Now
+
Future
+
fcoo-app-base-color
+ diff --git a/dist/fcoo-colors.css b/dist/fcoo-colors.css new file mode 100644 index 0000000..d663ff1 --- /dev/null +++ b/dist/fcoo-colors.css @@ -0,0 +1,135 @@ +@charset "UTF-8"; +/*********************************************** + fcoo-colors.scss, + + (c) 2023, FCOO + + https://github.com/fcoo/fcoo-colors + https://github.com/fcoo + + +************************************************/ +/*********************************************************************** + +leaflet-bootstrap-marker-mixin.scss + +*************************************************************************/ +/*********************************************************************** +marker-circle-color +Create style for bsMarkerCircle in different colors +*************************************************************************/ +/*********************************************************************** +lbm-circle-and-icon-classes +Create class for bsMarkerCircle named $name with color and color-border +*************************************************************************/ +/*********************************************************************** +lbm-marker-and-icon-classes +Create class for bsMarkerCircle named $name with color and color-border +*************************************************************************/ +/*********************************************************************** +fa-lbm-color +Create class for color and border-color used by L.bsMarkerAsIcon (and $.bsMarkerAsIcon) +to create fa-icon looking like the marker +*************************************************************************/ +/*********************************************** + _leaflet-polyline-mixin.scss + + (c) 2018, FCOO + + https://github.com/FCOO/leaflet-polyline + https://github.com/FCOO + +************************************************/ +/********************************************************** + fcoo-colors-variables.scss, + + https://github.com/FCOO/fcoo-colors + https://github.com/FCOO +**********************************************************/ +/********************************************************** +The color scheme is from LinkedIn and shown in linkedin-palette-screen.pdf +**********************************************************/ +/********************************************************** +Color for time = tree colors for the past, now, and the future +**********************************************************/ +/********************************************************** +Application color +Defaults is = DALO color in "Forsvarsministeriets koncernfælles Designmanual 2018" +Can be changed by mixin application-base-color( new-color ) +in src/_fcoo-color-mixin.scss +**********************************************************/ +/********************************************************** + fcoo-colors-mixin.scss + + https://github.com/FCOO/fcoo-colors + https://github.com/FCOO + +**********************************************************/ +/********************************************************** +Functions to get colors in different (relative) gradients +**********************************************************/ +/********************************************************** +marker-and-polygon-color +create color-classes for bsMarker and bsPolyline +**********************************************************/ +/********************************************************** +Application color +Defaults is = DALO color in "Forsvarsministeriets koncernfælles Designmanual 2018" +Can be changed by mixin application-base-color( new-color ) +**********************************************************/ +/********************************************************** +Color for time = tree colors for the past, now, and the future +**********************************************************/ +:root { + --fc-time-past-color: #EADCC1; + --fc-time-past-text-color: #000; + --fc-time-now-color: #3B7511; + --fc-time-now-text-color: #fff; + --fc-time-future-color: #94B5C2; + --fc-time-future-text-color: #000; +} + +.time-past-text-color { + color: var(--fc-time-past-text-color); +} + +.time-past-color { + background-color: var(--fc-time-past-color); +} + +.time-now-text-color { + color: var(--fc-time-now-text-color); +} + +.time-now-color { + background-color: var(--fc-time-now-color); +} + +.time-future-text-color { + color: var(--fc-time-future-text-color); +} + +.time-future-color { + background-color: var(--fc-time-future-color); +} + +/********************************************************** +Application color +Defaults is = DALO color in "Forsvarsministeriets koncernfælles Designmanual 2018" +Can be changed by mixin application-base-color( new-color ) +in src/_fcoo-color-mixin.scss +**********************************************************/ +:root { + --_fcoo-default-app-base-color: #3f5b58; + --fcoo-app-base-color: var(--_fcoo-app-base-color, var(--_fcoo-default-app-base-color)); + --_fcoo-default-app-base-text-color: #ffffff; + --fcoo-app-base-text-color: var(--_fcoo-app-base-text-color, var(--_fcoo-default-app-base-text-color)); +} + +.fcoo-app-base-text-color { + color: var(--fcoo-app-base-text-color); +} + +.fcoo-app-base-color { + background-color: var(--fcoo-app-base-color); +} \ No newline at end of file diff --git a/dist/fcoo-colors.js b/dist/fcoo-colors.js index 48d3f91..ce43b54 100644 --- a/dist/fcoo-colors.js +++ b/dist/fcoo-colors.js @@ -6,6 +6,8 @@ https://github.com/FCOO/fcoo-colors https://github.com/FCOO + Constants and methods to name, get and modify different colors used by FCOO Web Applications + ****************************************************************************/ (function ($, window/*, document, undefined*/) { @@ -15,7 +17,32 @@ var ns = window.fcoo = window.fcoo || {}, nsColor = ns.color = ns.color || {}; - + //nsColor.colorNames = {id}{da:STRING, en:STRING} + nsColor.colorNames = { + blue : {da: 'blå', en: 'blue' }, + purple : {da: 'lilla', en: 'purple' }, + red : {da: 'rød', en: 'red' }, + orange : {da: 'orange', en: 'orange' }, + cyan : {da: 'cyan', en: 'cyan' }, + yellow : {da: 'Gul', en: 'yellow' }, + pink : {da: 'pink', en: 'pink' }, + green : {da: 'grøn', en: 'green' }, + gray : {da: 'grå', en: 'gray' } + }; + + //nsColor.colorList = []{id, name: {da:STRING, en:STRING}} ordred by nsColor.defaultOrder + nsColor.colorList = []; + + $.each(nsColor.defaultOrder, function(index, colorId){ + nsColor.colorList.push({ + id : colorId, + name: nsColor.colorNames[colorId] + }); + }); + + + //The color scheme is from LinkedIn and shown in linkedin-palette-screen.pdf + //nsColor.colorArray = The colors defined in linkedin-palette-screen.pdf = [gradiant][color]. Eg. colorArray[3, 4] = gradiant 3 of orange nsColor.colorArray = [ //0:Blue 1:Purple 2:Red 3:Orange 4:Cyan 5:Yellow 6:Pink 7:Green 8:Gray ['#CFEDFB', '#EBE4FF', '#FFE0DA', '#FFE7BB', '#D2ECEB', '#FFF2B6', '#FFDFF2', '#E0F4BE', '#E6E9EC'], @@ -31,11 +58,11 @@ var colorName2Index = ['blue', 'purple', 'red', 'orange', 'cyan', 'yellow', 'pink', 'green', 'gray']; - nsColor.defaultGradient = 4; nsColor.defaultOrder = ["blue", "red", "green", "yellow", "gray", "purple", "pink", "cyan", "orange"]; + //Methods to get the value of different color-names and gradiants. nsColor.getColor = function(color, gradient, fromSortedList){ var colorIndex = typeof color == 'string' ? colorName2Index.indexOf(color) : color; return nsColor.getColorList(fromSortedList, gradient)[colorIndex]; @@ -78,4 +105,74 @@ return result; }; + + /**************************************************************************** + Using chroma.js (https://github.com/gka/chroma.js) + Create js-versions of sass functions darken, lighten, tint and shade + + chromaBestContrast( color, contrastColors = ['#000000', '#ffffff'] ) + returns the color from contrastColors with the best contrast + ****************************************************************************/ + + //HSL manipulators - from https://github.com/gka/chroma.js/issues/217 + const lighten = (color, hslPercent) => color.set("hsl.l", color.get("hsl.l") + hslPercent); + const darken = (color, hslPercent) => lighten(color, -hslPercent); + const sassLightenDarken = (color, percent, dark) => { + let hslPercent = window.numeral(percent).value(); + if (hslPercent === null) + hslPercent = 1; + color = window.chroma(color); + return dark ? darken(color, hslPercent).hex() : lighten(color, hslPercent).hex(); + }; + + nsColor.sassLighten = ( color, percent ) => sassLightenDarken( color, percent ); + nsColor.sassDarken = ( color, percent ) => sassLightenDarken( color, percent, true ); + + const mix = (color1, color2, percent) => { + let ratio = window.numeral(percent).value(); + if (ratio === null) + ratio = 1; + return window.chroma.mix(color1, color2, ratio); + }; + + nsColor.sassTintColor = (color, weight) => mix( color, 'white', weight ); + nsColor.sassShadeColor = (color, weight) => mix( color, 'black', weight ); + + //chromaBestContrast( color, contrastColors = ['#000000', '#ffffff'] + nsColor.chromaBestContrast = ( color, contrastColors = ['#000000', '#ffffff']) => { + contrastColors = $.isArray( contrastColors ) ? contrastColors : [contrastColors]; + let bestContrast = 0, result; + contrastColors.forEach( (textColor) => { + const contrast = window.chroma.contrast(color, textColor); + if (contrast > bestContrast){ + bestContrast = contrast; + result = textColor; + } + }); + return window.chroma(result); + }; + + /**************************************************************************** + setRootVar(id, value) + getRootVar(id) + setApplicationBaseColor(baseColor) + ****************************************************************************/ + const adjustId = (id) => id.slice(0, 2) == '--' ? id : '--'+id; + const root = document.querySelector(':root'); + + ns.setRootVar = (id, value) => { + root.style.setProperty(adjustId(id), value); + }; + + ns.getRootVar = (id) => { + return getComputedStyle(root).getPropertyValue( adjustId(id) ); + }; + + nsColor.setApplicationBaseColor = (baseColor) => { + baseColor = window.chroma(baseColor); + ns.setRootVar('--_fcoo-app-base-color', baseColor.hex() ); + ns.setRootVar('--_fcoo-app-base-text-color', nsColor.chromaBestContrast(baseColor).hex() ); + }; + + }(jQuery, this, document)); \ No newline at end of file diff --git a/gruntfile.js b/gruntfile.js index e2af3bd..b09afd1 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -14,7 +14,7 @@ module.exports = function(grunt) { "fcoo_grunt_plugin":{ default: { "haveJavaScript": true, //true if the packages have js-files - "haveStyleSheet": false, //true if the packages have css and/or scss-files + "haveStyleSheet": true, //true if the packages have css and/or scss-files "haveGhPages" : true, //true if there is a branch "gh-pages" used for demos "beforeProdCmd": "", //Cmd to be run at the start of prod-task. Multi cmd can be seperated by "&" diff --git a/package.json b/package.json index 8615981..a3b8db9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fcoo-colors", - "version": "1.2.0", + "version": "2.0.0", "homepage": "https://github.com/FCOO/fcoo-colors", "author": "Niels Holt nho@fcoo.dk", "description": "package.json is only use for building the package. see bower.json for more info", @@ -10,7 +10,7 @@ }, "dependencies": {}, "devDependencies": { - "grunt-fcoo-grunt-plugin": "^6.0.0" + "grunt-fcoo-grunt-plugin": "^6.7.0" }, "license": "MIT" } diff --git a/src/_fcoo-colors-include.scss b/src/_fcoo-colors-include.scss new file mode 100644 index 0000000..c9dbaf5 --- /dev/null +++ b/src/_fcoo-colors-include.scss @@ -0,0 +1,25 @@ +/********************************************************** + fcoo-colors-include.scss, + + https://github.com/FCOO/fcoo-colors + https://github.com/FCOO + + + Contain all include for a packages using + the scss-variables and scss-mixins of fcoo-colors + +**********************************************************/ + +//COLOR-HELPER +@import "../bower_components/sass-color-helpers/stylesheets/color-helpers"; + +//LEAFLET-BOOTSTRAP-MARKER-MIXIN - mixin to create colors for marker (bsMarker) +@import "../bower_components/leaflet-bootstrap-marker-mixin/dist/leaflet-bootstrap-marker-mixin"; + +//LEAFLET-POLYLINE-MIXIN - mixin to create colors for polyline and polygon +@import "../bower_components/leaflet-polyline-mixin/dist/leaflet-polyline-mixin"; + + +//FCOO-COLORS-VARIABLES and FCOO-COLORS-MIXIN +@import "../bower_components/fcoo-colors/src/fcoo-colors-variables"; +@import "../bower_components/fcoo-colors/src/fcoo-colors-mixin"; diff --git a/src/_fcoo-colors-mixin.scss b/src/_fcoo-colors-mixin.scss index ea6facd..0ba4c5c 100644 --- a/src/_fcoo-colors-mixin.scss +++ b/src/_fcoo-colors-mixin.scss @@ -1,52 +1,15 @@ -/*********************************************** - fcoo-colors-mixin.scss, - - (c) 2021, FCOO +/********************************************************** + fcoo-colors-mixin.scss https://github.com/FCOO/fcoo-colors https://github.com/FCOO - -************************************************/ - - -//All SCSS-variables are prefixed $fc- (fcoo-color) - -//Variables for the the nine colors -$fc-blue : 0; -$fc-purple : 1; -$fc-red : 2; -$fc-orange : 3; -$fc-cyan : 4; -$fc-yellow : 5; -$fc-pink : 6; -$fc-green : 7; -$fc-gray : 8; - - -$fc-color-list: ($fc-blue $fc-purple $fc-red $fc-orange $fc-cyan $fc-yellow $fc-pink $fc-green $fc-gray); - -//$fc-default-gradient = standard gradient to be used -$fc-default-gradient: 4 !default; - - - -//$fc-color-array: - -$fc-color-array: ( - //0:Blue 1:Purple 2:Red 3:Orange 4:Cyan 5:Yellow 6:Pink 7:Green 8:Gray - (#CFEDFB #EBE4FF #FFE0DA #FFE7BB #D2ECEB #FFF2B6 #FFDFF2 #E0F4BE #E6E9EC), - (#9BDAF3 #D8CCF4 #FAC2BB #F8CD94 #9EDDDD #FBE491 #FFC4E4 #C7E59A #D0D3D6), - (#68C7EC #BFABE6 #F59890 #F7B26A #69CDCF #F7D56B #F99ACA #AED677 #B6B9BC), - (#34B3E4 #A589D9 #F16D64 #F59640 #35BEC1 #F3C746 #F371AF #95C753 #A0A3A6), - (#00A0DC #8C68CB #EC4339 #F47B16 #00AEB3 #EFB920 #ED4795 #7CB82F #86898C), - (#008CC9 #7C5BBB #DD2E1F #EC640C #009EA5 #E6A700 #E2247F #60AA14 #737679), - (#0077B5 #6A4BA7 #C11F1D #CD5308 #008891 #CA9400 #C9186E #4E8F13 #595C5F), - (#005E93 #573B93 #A40F1C #AF4104 #00727D #AA7D00 #B10C5C #3B7511 #434649), - (#004471 #452B7F #88001A #903000 #005C69 #8B6700 #870044 #295A10 #303336) -); +**********************************************************/ +/********************************************************** +Functions to get colors in different (relative) gradients +**********************************************************/ @function fc-get-color-list($gradient: $fc-default-gradient) { @return nth( $fc-color-array, $gradient + 1); } @@ -58,4 +21,30 @@ $fc-color-array: ( @function fc-get-delta-color($color, $delta-gradient: 0) { @return fc-get-color( $color, $fc-default-gradient + $delta-gradient ); -} \ No newline at end of file +} + + +/********************************************************** +marker-and-polygon-color +create color-classes for bsMarker and bsPolyline +**********************************************************/ +@mixin marker-and-polygon-color( $name, $color, $border-color:$color){ + @include lbm-marker-and-icon-classes( $name, $color, $border-color ); + @include polyline-classes( $name, $color, $border-color ); +} + + + + +/********************************************************** +Application color +Defaults is = DALO color in "Forsvarsministeriets koncernfælles Designmanual 2018" +Can be changed by mixin application-base-color( new-color ) +**********************************************************/ +@mixin application-base-color($color){ + :root { + --_fcoo-app-base-color : #{$color}; + --_fcoo-app-base-text-color: #{ch-best-color-contrast($base: $color, $colors: (#ffffff, #000000), $tolerance: 0)}; + } +} + diff --git a/src/_fcoo-colors-variables.css b/src/_fcoo-colors-variables.css new file mode 100644 index 0000000..a6e3868 --- /dev/null +++ b/src/_fcoo-colors-variables.css @@ -0,0 +1,48 @@ +/********************************************************** + fcoo-colors-variables.scss, + + https://github.com/FCOO/fcoo-colors + https://github.com/FCOO +**********************************************************/ +/********************************************************** +The color scheme is from LinkedIn and shown in linkedin-palette-screen.pdf +**********************************************************/ +/********************************************************** +Color for time = tree colors for the past, now, and the future + + + +Skal bruge +@function _best_contrast( $color ){ + @return ch-best-color-contrast($base: $color, $colors: (#fff, #000), $tolerance: 0); +} +til at finde text-color for de tre tids-klasser +**********************************************************/ +:root { + --the-name: #FF1234; + --fc-time-past-color: #ff0000; +} + +/* +:root { + --jbn-time-past-color : #7ABAE1; + --jbn-time-past-bg-color : #7ABAE1; //TODO - Perhaps a lighter version + + --jbn-time-now-color : darkgreen; + --jbn-time-now-bg-color : lightgreen; + + --jbn-time-future-color : #4D72B8; + --jbn-time-future-bg-color: #4D72B8; //TODO - Perhaps a lighter version +} + +.time-past-color { color : $time-past-color } +.time-past-bg-color { background-color: $time-past-bg-color } + +.time-now-color { color : $time-now-color } +.time-now-bg-color { background-color: $time-now-bg-color } + +.time-future-color { color : $time-future-color } +.time-future-bg-color { background-color: $time-future-bg-color} +*/ + +/*# sourceMappingURL=_fcoo-colors-variables.css.map */ diff --git a/src/_fcoo-colors-variables.css.map b/src/_fcoo-colors-variables.css.map new file mode 100644 index 0000000..b92d4e4 --- /dev/null +++ b/src/_fcoo-colors-variables.css.map @@ -0,0 +1 @@ +{"version":3,"sourceRoot":"","sources":["_fcoo-colors-variables.scss"],"names":[],"mappings":"AAAA;AAAA;;AAAA;AAAA;AAAA;AAOA;AAAA;AAAA;AA0CA;AAAA;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA8BA;EAEI;EACA;;;AAGJ;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA;;AAAA;AAAA;AAAA","file":"_fcoo-colors-variables.css"} \ No newline at end of file diff --git a/src/_fcoo-colors-variables.scss b/src/_fcoo-colors-variables.scss new file mode 100644 index 0000000..4b52d34 --- /dev/null +++ b/src/_fcoo-colors-variables.scss @@ -0,0 +1,95 @@ +/********************************************************** + fcoo-colors-variables.scss, + + https://github.com/FCOO/fcoo-colors + https://github.com/FCOO +**********************************************************/ + +/********************************************************** +The color scheme is from LinkedIn and shown in linkedin-palette-screen.pdf +**********************************************************/ + +//All SCSS-variables are prefixed $fc- (fcoo-color) + +//Variables for the the nine colors +$fc-blue : 0; +$fc-purple : 1; +$fc-red : 2; +$fc-orange : 3; +$fc-cyan : 4; +$fc-yellow : 5; +$fc-pink : 6; +$fc-green : 7; +$fc-gray : 8; + + +$fc-color-list: ($fc-blue $fc-purple $fc-red $fc-orange $fc-cyan $fc-yellow $fc-pink $fc-green $fc-gray); + +//$fc-default-gradient = standard gradient to be used +$fc-default-gradient: 4 !default; + + +//$fc-color-array = [gradiant][color]. Eg. colorArray[3, 4] = gradiant 3 of orange +$fc-color-array: ( + //0:Blue 1:Purple 2:Red 3:Orange 4:Cyan 5:Yellow 6:Pink 7:Green 8:Gray + (#CFEDFB #EBE4FF #FFE0DA #FFE7BB #D2ECEB #FFF2B6 #FFDFF2 #E0F4BE #E6E9EC), + (#9BDAF3 #D8CCF4 #FAC2BB #F8CD94 #9EDDDD #FBE491 #FFC4E4 #C7E59A #D0D3D6), + (#68C7EC #BFABE6 #F59890 #F7B26A #69CDCF #F7D56B #F99ACA #AED677 #B6B9BC), + (#34B3E4 #A589D9 #F16D64 #F59640 #35BEC1 #F3C746 #F371AF #95C753 #A0A3A6), + (#00A0DC #8C68CB #EC4339 #F47B16 #00AEB3 #EFB920 #ED4795 #7CB82F #86898C), + (#008CC9 #7C5BBB #DD2E1F #EC640C #009EA5 #E6A700 #E2247F #60AA14 #737679), + (#0077B5 #6A4BA7 #C11F1D #CD5308 #008891 #CA9400 #C9186E #4E8F13 #595C5F), + (#005E93 #573B93 #A40F1C #AF4104 #00727D #AA7D00 #B10C5C #3B7511 #434649), + (#004471 #452B7F #88001A #903000 #005C69 #8B6700 #870044 #295A10 #303336) +); + + +/********************************************************** +Color for time = tree colors for the past, now, and the future +**********************************************************/ +$time-past-color-value : #EADCC1; +$time-past-text-color-value : ch-best-color-contrast($base: $time-past-color-value, $colors: (#fff, #000), $tolerance: 0); + +$time-now-color-value : #3B7511; +$time-now-text-color-value : ch-best-color-contrast($base: $time-now-color-value, $colors: (#fff, #000), $tolerance: 0); + +$time-future-color-value : #94B5C2; +$time-future-text-color-value: ch-best-color-contrast($base: $time-future-color-value, $colors: (#fff, #000), $tolerance: 0); + + +//Internal scss-var with the name of the css-var +$_time-past-color-var : --fc-time-past-color; +$_time-past-text-color-var : --fc-time-past-text-color; + +$_time-now-color-var : --fc-time-now-color; +$_time-now-text-color-var : --fc-time-now-text-color; + +$_time-future-color-var : --fc-time-future-color; +$_time-future-text-color-var: --fc-time-future-text-color; + + +//$-var for the different (bg-)color and text-color +$time-past-color : var(#{$_time-past-color-var}); +$time-past-text-color : var(#{$_time-past-text-color-var}); + +$time-now-color : var(#{$_time-now-color-var}); +$time-now-text-color : var(#{$_time-now-text-color-var}); + +$time-future-color : var(#{$_time-future-color-var}); +$time-future-text-color: var(#{$_time-future-text-color-var}); + + + +/********************************************************** +Application color +Defaults is = DALO color in "Forsvarsministeriets koncernfælles Designmanual 2018" +Can be changed by mixin application-base-color( new-color ) +in src/_fcoo-color-mixin.scss +**********************************************************/ +$fcoo-app-default-base-color : #3f5b58; //DALO color in "Forsvarsministeriets koncernfælles Designmanual 2018" +$fcoo-app-default-base-text-color: #ffffff; + + +$fcoo-app-base-color : var(--fcoo-app-base-color); +$fcoo-app-base-text-color: var(--fcoo-app-base-text-color); + diff --git a/src/fcoo-colors.css b/src/fcoo-colors.css new file mode 100644 index 0000000..d663ff1 --- /dev/null +++ b/src/fcoo-colors.css @@ -0,0 +1,135 @@ +@charset "UTF-8"; +/*********************************************** + fcoo-colors.scss, + + (c) 2023, FCOO + + https://github.com/fcoo/fcoo-colors + https://github.com/fcoo + + +************************************************/ +/*********************************************************************** + +leaflet-bootstrap-marker-mixin.scss + +*************************************************************************/ +/*********************************************************************** +marker-circle-color +Create style for bsMarkerCircle in different colors +*************************************************************************/ +/*********************************************************************** +lbm-circle-and-icon-classes +Create class for bsMarkerCircle named $name with color and color-border +*************************************************************************/ +/*********************************************************************** +lbm-marker-and-icon-classes +Create class for bsMarkerCircle named $name with color and color-border +*************************************************************************/ +/*********************************************************************** +fa-lbm-color +Create class for color and border-color used by L.bsMarkerAsIcon (and $.bsMarkerAsIcon) +to create fa-icon looking like the marker +*************************************************************************/ +/*********************************************** + _leaflet-polyline-mixin.scss + + (c) 2018, FCOO + + https://github.com/FCOO/leaflet-polyline + https://github.com/FCOO + +************************************************/ +/********************************************************** + fcoo-colors-variables.scss, + + https://github.com/FCOO/fcoo-colors + https://github.com/FCOO +**********************************************************/ +/********************************************************** +The color scheme is from LinkedIn and shown in linkedin-palette-screen.pdf +**********************************************************/ +/********************************************************** +Color for time = tree colors for the past, now, and the future +**********************************************************/ +/********************************************************** +Application color +Defaults is = DALO color in "Forsvarsministeriets koncernfælles Designmanual 2018" +Can be changed by mixin application-base-color( new-color ) +in src/_fcoo-color-mixin.scss +**********************************************************/ +/********************************************************** + fcoo-colors-mixin.scss + + https://github.com/FCOO/fcoo-colors + https://github.com/FCOO + +**********************************************************/ +/********************************************************** +Functions to get colors in different (relative) gradients +**********************************************************/ +/********************************************************** +marker-and-polygon-color +create color-classes for bsMarker and bsPolyline +**********************************************************/ +/********************************************************** +Application color +Defaults is = DALO color in "Forsvarsministeriets koncernfælles Designmanual 2018" +Can be changed by mixin application-base-color( new-color ) +**********************************************************/ +/********************************************************** +Color for time = tree colors for the past, now, and the future +**********************************************************/ +:root { + --fc-time-past-color: #EADCC1; + --fc-time-past-text-color: #000; + --fc-time-now-color: #3B7511; + --fc-time-now-text-color: #fff; + --fc-time-future-color: #94B5C2; + --fc-time-future-text-color: #000; +} + +.time-past-text-color { + color: var(--fc-time-past-text-color); +} + +.time-past-color { + background-color: var(--fc-time-past-color); +} + +.time-now-text-color { + color: var(--fc-time-now-text-color); +} + +.time-now-color { + background-color: var(--fc-time-now-color); +} + +.time-future-text-color { + color: var(--fc-time-future-text-color); +} + +.time-future-color { + background-color: var(--fc-time-future-color); +} + +/********************************************************** +Application color +Defaults is = DALO color in "Forsvarsministeriets koncernfælles Designmanual 2018" +Can be changed by mixin application-base-color( new-color ) +in src/_fcoo-color-mixin.scss +**********************************************************/ +:root { + --_fcoo-default-app-base-color: #3f5b58; + --fcoo-app-base-color: var(--_fcoo-app-base-color, var(--_fcoo-default-app-base-color)); + --_fcoo-default-app-base-text-color: #ffffff; + --fcoo-app-base-text-color: var(--_fcoo-app-base-text-color, var(--_fcoo-default-app-base-text-color)); +} + +.fcoo-app-base-text-color { + color: var(--fcoo-app-base-text-color); +} + +.fcoo-app-base-color { + background-color: var(--fcoo-app-base-color); +} \ No newline at end of file diff --git a/src/fcoo-colors.css.map b/src/fcoo-colors.css.map new file mode 100644 index 0000000..f61a8a6 --- /dev/null +++ b/src/fcoo-colors.css.map @@ -0,0 +1 @@ +{"version":3,"sourceRoot":"","sources":["fcoo-colors.scss","../bower_components/leaflet-bootstrap-marker-mixin/dist/_leaflet-bootstrap-marker-mixin.scss","../bower_components/leaflet-polyline-mixin/dist/_leaflet-polyline-mixin.scss","_fcoo-colors-variables.scss","_fcoo-colors-mixin.scss"],"names":[],"mappings":";AAAA;AAAA;;AAAA;;AAAA;AAAA;;;AAAA;ACAA;;AAAA;;AAAA;AAmCA;AAAA;AAAA;AAAA;AAwBA;AAAA;AAAA;AAAA;AAeA;AAAA;AAAA;AAAA;AAaA;AAAA;AAAA;AAAA;AAAA;ACvFA;AAAA;;AAAA;;AAAA;AAAA;;AAAA;ACAA;AAAA;;AAAA;AAAA;AAAA;AAOA;AAAA;AAAA;AAuCA;AAAA;AAAA;AAoCA;AAAA;AAAA;AAAA;AAAA;AAAA;AClFA;AAAA;;AAAA;AAAA;;AAAA;AASA;AAAA;AAAA;AAiBA;AAAA;AAAA;AAAA;AAYA;AAAA;AAAA;AAAA;AAAA;AJbA;AAAA;AAAA;AAGA;EACI;EACA;EAEA;EACA;EAEA;EACA;;;AAIJ;EAA0B,OGgCD;;;AH/BzB;EAA0B,kBG8BD;;;AH5BzB;EAA0B,OGgCD;;;AH/BzB;EAA0B,kBG8BD;;;AH5BzB;EAA0B,OGgCD;;;AH/BzB;EAA0B,kBG8BD;;;AH1BzB;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA;EACI;EACA;EAEA;EACA;;;AAGJ;EAA4B,OG4BD;;;AH3B3B;EAA4B,kBG0BD","file":"fcoo-colors.css"} \ No newline at end of file diff --git a/src/fcoo-colors.js b/src/fcoo-colors.js index 48d3f91..ce43b54 100644 --- a/src/fcoo-colors.js +++ b/src/fcoo-colors.js @@ -6,6 +6,8 @@ https://github.com/FCOO/fcoo-colors https://github.com/FCOO + Constants and methods to name, get and modify different colors used by FCOO Web Applications + ****************************************************************************/ (function ($, window/*, document, undefined*/) { @@ -15,7 +17,32 @@ var ns = window.fcoo = window.fcoo || {}, nsColor = ns.color = ns.color || {}; - + //nsColor.colorNames = {id}{da:STRING, en:STRING} + nsColor.colorNames = { + blue : {da: 'blå', en: 'blue' }, + purple : {da: 'lilla', en: 'purple' }, + red : {da: 'rød', en: 'red' }, + orange : {da: 'orange', en: 'orange' }, + cyan : {da: 'cyan', en: 'cyan' }, + yellow : {da: 'Gul', en: 'yellow' }, + pink : {da: 'pink', en: 'pink' }, + green : {da: 'grøn', en: 'green' }, + gray : {da: 'grå', en: 'gray' } + }; + + //nsColor.colorList = []{id, name: {da:STRING, en:STRING}} ordred by nsColor.defaultOrder + nsColor.colorList = []; + + $.each(nsColor.defaultOrder, function(index, colorId){ + nsColor.colorList.push({ + id : colorId, + name: nsColor.colorNames[colorId] + }); + }); + + + //The color scheme is from LinkedIn and shown in linkedin-palette-screen.pdf + //nsColor.colorArray = The colors defined in linkedin-palette-screen.pdf = [gradiant][color]. Eg. colorArray[3, 4] = gradiant 3 of orange nsColor.colorArray = [ //0:Blue 1:Purple 2:Red 3:Orange 4:Cyan 5:Yellow 6:Pink 7:Green 8:Gray ['#CFEDFB', '#EBE4FF', '#FFE0DA', '#FFE7BB', '#D2ECEB', '#FFF2B6', '#FFDFF2', '#E0F4BE', '#E6E9EC'], @@ -31,11 +58,11 @@ var colorName2Index = ['blue', 'purple', 'red', 'orange', 'cyan', 'yellow', 'pink', 'green', 'gray']; - nsColor.defaultGradient = 4; nsColor.defaultOrder = ["blue", "red", "green", "yellow", "gray", "purple", "pink", "cyan", "orange"]; + //Methods to get the value of different color-names and gradiants. nsColor.getColor = function(color, gradient, fromSortedList){ var colorIndex = typeof color == 'string' ? colorName2Index.indexOf(color) : color; return nsColor.getColorList(fromSortedList, gradient)[colorIndex]; @@ -78,4 +105,74 @@ return result; }; + + /**************************************************************************** + Using chroma.js (https://github.com/gka/chroma.js) + Create js-versions of sass functions darken, lighten, tint and shade + + chromaBestContrast( color, contrastColors = ['#000000', '#ffffff'] ) + returns the color from contrastColors with the best contrast + ****************************************************************************/ + + //HSL manipulators - from https://github.com/gka/chroma.js/issues/217 + const lighten = (color, hslPercent) => color.set("hsl.l", color.get("hsl.l") + hslPercent); + const darken = (color, hslPercent) => lighten(color, -hslPercent); + const sassLightenDarken = (color, percent, dark) => { + let hslPercent = window.numeral(percent).value(); + if (hslPercent === null) + hslPercent = 1; + color = window.chroma(color); + return dark ? darken(color, hslPercent).hex() : lighten(color, hslPercent).hex(); + }; + + nsColor.sassLighten = ( color, percent ) => sassLightenDarken( color, percent ); + nsColor.sassDarken = ( color, percent ) => sassLightenDarken( color, percent, true ); + + const mix = (color1, color2, percent) => { + let ratio = window.numeral(percent).value(); + if (ratio === null) + ratio = 1; + return window.chroma.mix(color1, color2, ratio); + }; + + nsColor.sassTintColor = (color, weight) => mix( color, 'white', weight ); + nsColor.sassShadeColor = (color, weight) => mix( color, 'black', weight ); + + //chromaBestContrast( color, contrastColors = ['#000000', '#ffffff'] + nsColor.chromaBestContrast = ( color, contrastColors = ['#000000', '#ffffff']) => { + contrastColors = $.isArray( contrastColors ) ? contrastColors : [contrastColors]; + let bestContrast = 0, result; + contrastColors.forEach( (textColor) => { + const contrast = window.chroma.contrast(color, textColor); + if (contrast > bestContrast){ + bestContrast = contrast; + result = textColor; + } + }); + return window.chroma(result); + }; + + /**************************************************************************** + setRootVar(id, value) + getRootVar(id) + setApplicationBaseColor(baseColor) + ****************************************************************************/ + const adjustId = (id) => id.slice(0, 2) == '--' ? id : '--'+id; + const root = document.querySelector(':root'); + + ns.setRootVar = (id, value) => { + root.style.setProperty(adjustId(id), value); + }; + + ns.getRootVar = (id) => { + return getComputedStyle(root).getPropertyValue( adjustId(id) ); + }; + + nsColor.setApplicationBaseColor = (baseColor) => { + baseColor = window.chroma(baseColor); + ns.setRootVar('--_fcoo-app-base-color', baseColor.hex() ); + ns.setRootVar('--_fcoo-app-base-text-color', nsColor.chromaBestContrast(baseColor).hex() ); + }; + + }(jQuery, this, document)); \ No newline at end of file diff --git a/src/fcoo-colors.scss b/src/fcoo-colors.scss new file mode 100644 index 0000000..561daeb --- /dev/null +++ b/src/fcoo-colors.scss @@ -0,0 +1,67 @@ +/*********************************************** + fcoo-colors.scss, + + (c) 2023, FCOO + + https://github.com/fcoo/fcoo-colors + https://github.com/fcoo + + +************************************************/ + +//COLOR-HELPER +@import "../bower_components/sass-color-helpers/stylesheets/color-helpers"; + +//LEAFLET-BOOTSTRAP-MARKER-MIXIN - mixin to create colors for marker (bsMarker) +@import "../bower_components/leaflet-bootstrap-marker-mixin/dist/leaflet-bootstrap-marker-mixin"; + +//LEAFLET-POLYLINE-MIXIN - mixin to create colors for polyline and polygon +@import "../bower_components/leaflet-polyline-mixin/dist/leaflet-polyline-mixin"; + + +//FCOO-COLORS-VARIABLES and FCOO-COLORS-MIXIN +@import "../src/fcoo-colors-variables"; +@import "../src/fcoo-colors-mixin"; + +/********************************************************** +Color for time = tree colors for the past, now, and the future +**********************************************************/ +:root { + #{$_time-past-color-var} : #{$time-past-color-value}; + #{$_time-past-text-color-var} : #{$time-past-text-color-value}; + + #{$_time-now-color-var} : #{$time-now-color-value}; + #{$_time-now-text-color-var} : #{$time-now-text-color-value}; + + #{$_time-future-color-var} : #{$time-future-color-value}; + #{$_time-future-text-color-var} : #{$time-future-text-color-value}; +} + + +.time-past-text-color { color : $time-past-text-color } +.time-past-color { background-color: $time-past-color } + +.time-now-text-color { color : $time-now-text-color } +.time-now-color { background-color: $time-now-color } + +.time-future-text-color { color : $time-future-text-color } +.time-future-color { background-color: $time-future-color } + + + +/********************************************************** +Application color +Defaults is = DALO color in "Forsvarsministeriets koncernfælles Designmanual 2018" +Can be changed by mixin application-base-color( new-color ) +in src/_fcoo-color-mixin.scss +**********************************************************/ +:root { + --_fcoo-default-app-base-color : #{$fcoo-app-default-base-color}; + --fcoo-app-base-color : var(--_fcoo-app-base-color, var(--_fcoo-default-app-base-color)); + + --_fcoo-default-app-base-text-color: #{$fcoo-app-default-base-text-color}; + --fcoo-app-base-text-color : var(--_fcoo-app-base-text-color, var(--_fcoo-default-app-base-text-color)); +} + +.fcoo-app-base-text-color { color : $fcoo-app-base-text-color } +.fcoo-app-base-color { background-color: $fcoo-app-base-color } diff --git a/yarn.lock b/yarn.lock index ebaa169..8c083f3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1090,11 +1090,6 @@ alphanum-sort@^1.0.0: resolved "https://registry.yarnpkg.com/alphanum-sort/-/alphanum-sort-1.0.2.tgz#97a1119649b211ad33691d9f9f486a8ec9fbe0a3" integrity sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM= -amdefine@>=0.0.4: - version "1.0.1" - resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" - integrity sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU= - ansi-align@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ansi-align/-/ansi-align-2.0.0.tgz#c36aeccba563b89ceb556f3690f0b1d9e3547f7f" @@ -1321,11 +1316,6 @@ astral-regex@^2.0.0: resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== -async-foreach@^0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/async-foreach/-/async-foreach-0.1.3.tgz#36121f845c0578172de419a97dbeb1d16ec34542" - integrity sha1-NhIfhFwFeBct5Bmpfb6x0W7DRUI= - async-hook-domain@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/async-hook-domain/-/async-hook-domain-2.0.4.tgz#5a24910982c04394ea33dd442860f80cce2d972c" @@ -1524,13 +1514,6 @@ bl@^1.0.0: readable-stream "^2.3.5" safe-buffer "^5.1.1" -block-stream@*: - version "0.0.9" - resolved "https://registry.yarnpkg.com/block-stream/-/block-stream-0.0.9.tgz#13ebfe778a03205cfe03751481ebb4b3300c126a" - integrity sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo= - dependencies: - inherits "~2.0.0" - bluebird@^3.5.1, bluebird@^3.5.3, bluebird@^3.5.5: version "3.7.2" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" @@ -1875,6 +1858,21 @@ cheerio@*: lodash.reject "^4.4.0" lodash.some "^4.4.0" +"chokidar@>=3.0.0 <4.0.0": + version "3.5.3" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd" + integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw== + dependencies: + anymatch "~3.1.2" + braces "~3.0.2" + glob-parent "~5.1.2" + is-binary-path "~2.1.0" + is-glob "~4.0.1" + normalize-path "~3.0.0" + readdirp "~3.6.0" + optionalDependencies: + fsevents "~2.3.2" + chokidar@^3.3.0: version "3.5.2" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.2.tgz#dba3976fcadb016f66fd365021d91600d01c1e75" @@ -2304,14 +2302,6 @@ create-error-class@^3.0.0: dependencies: capture-stack-trace "^1.0.0" -cross-spawn@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-3.0.1.tgz#1256037ecb9f0c5f79e3d6ef135e30770184b982" - integrity sha1-ElYDfsufDF9549bvE14wdwGEuYI= - dependencies: - lru-cache "^4.0.1" - which "^1.2.9" - cross-spawn@^5.0.1: version "5.1.0" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" @@ -3711,7 +3701,7 @@ fsevents@~2.3.2: resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== -fstream@^1.0.0, fstream@^1.0.12, fstream@^1.0.2, fstream@~1.0.12: +fstream@^1.0.2, fstream@~1.0.12: version "1.0.12" resolved "https://registry.yarnpkg.com/fstream/-/fstream-1.0.12.tgz#4e8ba8ee2d48be4f7d0de505455548eae5932045" integrity sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg== @@ -3750,13 +3740,6 @@ gauge@~2.7.3: strip-ansi "^3.0.1" wide-align "^1.1.0" -gaze@^1.0.0: - version "1.1.3" - resolved "https://registry.yarnpkg.com/gaze/-/gaze-1.1.3.tgz#c441733e13b927ac8c0ff0b4c3b033f28812924a" - integrity sha512-BRdNm8hbWzFzWHERTrejLqwHDfS4GibPoq5wjTPIoJHoBtKGPg3xAFfxmM+9ztbXelxcf2hwQcaz1PtmFeue8g== - dependencies: - globule "^1.0.0" - genfun@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/genfun/-/genfun-5.0.0.tgz#9dd9710a06900a5c4a5bf57aca5da4e52fe76537" @@ -3929,7 +3912,7 @@ glob@^5.0.3, glob@~5.0.0: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: +glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: version "7.2.0" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== @@ -3949,7 +3932,7 @@ glob@~3.2.6: inherits "2" minimatch "0.3" -glob@~7.1.1, glob@~7.1.6: +glob@~7.1.6: version "7.1.7" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90" integrity sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ== @@ -4010,15 +3993,6 @@ globby@^2.0.0: glob "^5.0.3" object-assign "^3.0.0" -globule@^1.0.0: - version "1.3.3" - resolved "https://registry.yarnpkg.com/globule/-/globule-1.3.3.tgz#811919eeac1ab7344e905f2e3be80a13447973c2" - integrity sha512-mb1aYtDbIjTu4ShMB85m3UzjX9BVKe9WCzsnfMSZk+K5GpIbBOexgg4PPCt5eHDEG5/ZQAUX2Kct02zfiPLsKg== - dependencies: - glob "~7.1.1" - lodash "~4.17.10" - minimatch "~3.0.2" - got@^6.7.1: version "6.7.1" resolved "https://registry.yarnpkg.com/got/-/got-6.7.1.tgz#240cd05785a9a18e561dc1b44b41c763ef1e8db0" @@ -4183,7 +4157,7 @@ grunt-css-url-embed@^1.6.1: optionalDependencies: mmmagic "~0.5.0" -grunt-curl@fcoo/grunt-curl#^2.6.0: +"grunt-curl@github:fcoo/grunt-curl#^2.6.0": version "2.6.0" resolved "https://codeload.github.com/fcoo/grunt-curl/tar.gz/30664557ed8c16c026832ebbb374f021d5a8f272" dependencies: @@ -4200,10 +4174,10 @@ grunt-eslint@^22.0.0: chalk "^2.1.0" eslint "^6.0.1" -grunt-fcoo-grunt-plugin@^6.0.0: - version "6.2.0" - resolved "https://registry.yarnpkg.com/grunt-fcoo-grunt-plugin/-/grunt-fcoo-grunt-plugin-6.2.0.tgz#9a2d24a746c8da4dff61b73866c3fab16556cce6" - integrity sha512-hT9+LqZGsN6U42m4l2s6UlDXRw5nSxbl9YvYTN8fR2lN/xyjpjy/0ou5abgH8jEFAK6rVUi+NJo2YfzEXb1e6A== +grunt-fcoo-grunt-plugin@^6.7.0: + version "6.7.0" + resolved "https://registry.yarnpkg.com/grunt-fcoo-grunt-plugin/-/grunt-fcoo-grunt-plugin-6.7.0.tgz#000b9c6847e419f7657a027daf7c95f6fd6bb503" + integrity sha512-Wm5NI79ERzPX9XIx7oz7m7680ncaVSo9M1bAFjfrOG2Xwi5BwfyE4/ZlE6SocZ9jwQotObRBXOVMLXzT2EF2AQ== dependencies: "@babel/core" "^7.11.6" "@babel/preset-env" "^7.11.5" @@ -4245,12 +4219,12 @@ grunt-fcoo-grunt-plugin@^6.0.0: load-grunt-tasks "^5.1.0" main-bower-files "^2.13.3" moment "^2.6.0" - node-sass "^4.12.0" nopt "^4.0.1" npm "^6.1.0" pixrem "^5.0.0" postcss "^7.0.0" rfg-api "^0.5.0" + sass "^1.6.6" scp2 "^0.1.4" semver "^6.3.0" shelljs "^0.8.1" @@ -4328,7 +4302,7 @@ grunt-legacy-util@~2.0.1: underscore.string "~3.3.5" which "~2.0.2" -grunt-postcss@fcoo/grunt-postcss#^1.0.0: +"grunt-postcss@github:fcoo/grunt-postcss#^1.0.0": version "0.9.0" resolved "https://codeload.github.com/fcoo/grunt-postcss/tar.gz/d9e44402f76ea098602188e22409fcc1d1f89e18" dependencies: @@ -4651,6 +4625,11 @@ ignore@^4.0.6: resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== +immutable@^4.0.0: + version "4.3.4" + resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.3.4.tgz#2e07b33837b4bb7662f288c244d1ced1ef65a78f" + integrity sha512-fsXeu4J4i6WNWSikpI88v/PcVflZz+6kMhUfIwc5SY+poQRPnaf5V7qds6SUyUN3cVxEzuCab7QIoLOQ+DQ1wA== + import-fresh@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-2.0.0.tgz#d81355c15612d386c61f9ddd3922d4304822a546" @@ -4697,11 +4676,6 @@ imurmurhash@^0.1.4: resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= -in-publish@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/in-publish/-/in-publish-2.0.1.tgz#948b1a535c8030561cea522f73f78f4be357e00c" - integrity sha512-oDM0kUSNFC31ShNxHKUyfZKy8ZeXZBWMjMdZHKLOk13uvT27VTL/QzRGfRUcevJhpkZAvlhPYuXkF7eNWrtyxQ== - indent-string@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-2.1.0.tgz#8e2d48348742121b4a8218b7a137e9a52049dc80" @@ -5323,11 +5297,6 @@ jpeg-recompress-bin@^4.0.0: bin-wrapper "^4.1.0" logalot "^2.0.0" -js-base64@^2.1.8: - version "2.6.4" - resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.6.4.tgz#f4e686c5de1ea1f867dbcad3d46d969428df98c4" - integrity sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ== - "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" @@ -5869,7 +5838,7 @@ lodash.without@~4.4.0: resolved "https://registry.yarnpkg.com/lodash.without/-/lodash.without-4.4.0.tgz#3cd4574a00b67bae373a94b748772640507b7aac" integrity sha1-PNRXSgC2e643OpS3SHcmQFB7eqw= -lodash@4.17.21, lodash@^4.0.0, lodash@^4.13.0, lodash@^4.17.0, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.6.1, lodash@~4.17.10, lodash@~4.17.19, lodash@~4.17.21: +lodash@4.17.21, lodash@^4.13.0, lodash@^4.17.0, lodash@^4.17.14, lodash@^4.17.19, lodash@^4.6.1, lodash@~4.17.19, lodash@~4.17.21: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -6062,7 +6031,7 @@ mem@^1.1.0: dependencies: mimic-fn "^1.0.0" -meow@^3.3.0, meow@^3.7.0: +meow@^3.3.0: version "3.7.0" resolved "https://registry.yarnpkg.com/meow/-/meow-3.7.0.tgz#72cb668b425228290abbfa856892587308a801fb" integrity sha1-cstmi0JSKCkKu/qFaJJYcwioAfs= @@ -6337,24 +6306,6 @@ node-fetch-npm@^2.0.2: json-parse-better-errors "^1.0.0" safe-buffer "^5.1.1" -node-gyp@^3.8.0: - version "3.8.0" - resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-3.8.0.tgz#540304261c330e80d0d5edce253a68cb3964218c" - integrity sha512-3g8lYefrRRzvGeSowdJKAKyks8oUpLEd/DyPV4eMhVlhJ0aNaZqIrNUIPuEWWTAoPqyFkfGrM67MC69baqn6vA== - dependencies: - fstream "^1.0.0" - glob "^7.0.3" - graceful-fs "^4.1.2" - mkdirp "^0.5.0" - nopt "2 || 3" - npmlog "0 || 1 || 2 || 3 || 4" - osenv "0" - request "^2.87.0" - rimraf "2" - semver "~5.3.0" - tar "^2.0.0" - which "1" - node-gyp@^5.0.2, node-gyp@^5.1.0: version "5.1.1" resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-5.1.1.tgz#eb915f7b631c937d282e33aed44cb7a025f62a3e" @@ -6384,29 +6335,6 @@ node-releases@^2.0.1: resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.1.tgz#3d1d395f204f1f2f29a54358b9fb678765ad2fc5" integrity sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA== -node-sass@^4.12.0: - version "4.14.1" - resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.14.1.tgz#99c87ec2efb7047ed638fb4c9db7f3a42e2217b5" - integrity sha512-sjCuOlvGyCJS40R8BscF5vhVlQjNN069NtQ1gSxyK1u9iqvn6tf7O1R4GNowVZfiZUCRt5MmMs1xd+4V/7Yr0g== - dependencies: - async-foreach "^0.1.3" - chalk "^1.1.1" - cross-spawn "^3.0.0" - gaze "^1.0.0" - get-stdin "^4.0.1" - glob "^7.0.3" - in-publish "^2.0.0" - lodash "^4.17.15" - meow "^3.7.0" - mkdirp "^0.5.1" - nan "^2.13.2" - node-gyp "^3.8.0" - npmlog "^4.0.0" - request "^2.88.0" - sass-graph "2.2.5" - stdout-stream "^1.4.0" - "true-case-path" "^1.0.2" - node-units@~0.1.0: version "0.1.7" resolved "https://registry.yarnpkg.com/node-units/-/node-units-0.1.7.tgz#9d3176a5c535bf8af06506c0adf6dc81afb3977b" @@ -6434,13 +6362,6 @@ nodeunit-x@^0.15.0: ejs "^3.1.6" tap "^15.0.10" -"nopt@2 || 3", nopt@~3.0.6: - version "3.0.6" - resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" - integrity sha1-xkZdvwirzU2zWTF/eaxopkayj/k= - dependencies: - abbrev "1" - nopt@^4.0.1, nopt@^4.0.3, nopt@~4.0.1: version "4.0.3" resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.3.tgz#a375cad9d02fd921278d954c2254d5aa57e15e48" @@ -6449,6 +6370,13 @@ nopt@^4.0.1, nopt@^4.0.3, nopt@~4.0.1: abbrev "1" osenv "^0.1.4" +nopt@~3.0.6: + version "3.0.6" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" + integrity sha1-xkZdvwirzU2zWTF/eaxopkayj/k= + dependencies: + abbrev "1" + normalize-package-data@^2.0.0, normalize-package-data@^2.3.2, normalize-package-data@^2.3.4, normalize-package-data@^2.4.0, normalize-package-data@^2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" @@ -6734,7 +6662,7 @@ npm@^6.1.0: worker-farm "^1.7.0" write-file-atomic "^2.4.3" -"npmlog@0 || 1 || 2 || 3 || 4", npmlog@^4.0.0, npmlog@^4.1.2, npmlog@~4.1.2: +npmlog@^4.1.2, npmlog@~4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== @@ -6962,7 +6890,7 @@ os-tmpdir@^1.0.0, os-tmpdir@~1.0.2: resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= -osenv@0, osenv@^0.1.3, osenv@^0.1.4, osenv@^0.1.5: +osenv@^0.1.3, osenv@^0.1.4, osenv@^0.1.5: version "0.1.5" resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" integrity sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g== @@ -8176,7 +8104,7 @@ replace-ext@^1.0.0: resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-1.0.1.tgz#2d6d996d04a15855d967443631dd5f77825b016a" integrity sha512-yD5BHCe7quCgBph4rMQ+0KkIRKwWCrHDOX1p1Gp6HwjPM5kVoCdKGNhN7ydqqsX6lJEnQDKZ/tFMiEdQ1dvPEw== -request@>=0.1.0, request@^2.87.0, request@^2.88.0, request@^2.88.2, request@~2.88.0: +request@>=0.1.0, request@^2.88.0, request@^2.88.2, request@~2.88.0: version "2.88.2" resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw== @@ -8424,15 +8352,14 @@ safefs@^4.1.0: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -sass-graph@2.2.5: - version "2.2.5" - resolved "https://registry.yarnpkg.com/sass-graph/-/sass-graph-2.2.5.tgz#a981c87446b8319d96dce0671e487879bd24c2e8" - integrity sha512-VFWDAHOe6mRuT4mZRd4eKE+d8Uedrk6Xnh7Sh9b4NGufQLQjOrvf/MQoOdx+0s92L89FeyUUNfU597j/3uNpag== +sass@^1.6.6: + version "1.69.5" + resolved "https://registry.yarnpkg.com/sass/-/sass-1.69.5.tgz#23e18d1c757a35f2e52cc81871060b9ad653dfde" + integrity sha512-qg2+UCJibLr2LCVOt3OlPhr/dqVHWOa9XtZf2OjbLs/T4VPSJ00udtgJxH3neXZm+QqX8B+3cU7RaLqp1iVfcQ== dependencies: - glob "^7.0.0" - lodash "^4.0.0" - scss-tokenizer "^0.2.3" - yargs "^13.3.2" + chokidar ">=3.0.0 <4.0.0" + immutable "^4.0.0" + source-map-js ">=0.6.2 <2.0.0" sax@~1.2.4: version "1.2.4" @@ -8457,14 +8384,6 @@ scp2@^0.1.4: lodash "~2.0.0" ssh2 "~0.2.12" -scss-tokenizer@^0.2.3: - version "0.2.3" - resolved "https://registry.yarnpkg.com/scss-tokenizer/-/scss-tokenizer-0.2.3.tgz#8eb06db9a9723333824d3f5530641149847ce5d1" - integrity sha1-jrBtualyMzOCTT9VMGQRSYR85dE= - dependencies: - js-base64 "^2.1.8" - source-map "^0.4.2" - seek-bzip@^1.0.5: version "1.0.6" resolved "https://registry.yarnpkg.com/seek-bzip/-/seek-bzip-1.0.6.tgz#35c4171f55a680916b52a07859ecf3b5857f21c4" @@ -8506,11 +8425,6 @@ semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.3.0: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== -semver@~5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" - integrity sha1-myzl094C0XxgEq0yaqa00M9U+U8= - set-blocking@^2.0.0, set-blocking@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" @@ -8687,6 +8601,11 @@ sorted-union-stream@~2.1.3: from2 "^1.3.0" stream-iterate "^1.1.0" +"source-map-js@>=0.6.2 <2.0.0": + version "1.0.2" + resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c" + integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw== + source-map-js@^0.6.2: version "0.6.2" resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-0.6.2.tgz#0bb5de631b41cfbda6cfba8bd05a80efdfd2385e" @@ -8700,13 +8619,6 @@ source-map-support@^0.5.16, source-map-support@~0.5.12: buffer-from "^1.0.0" source-map "^0.6.0" -source-map@^0.4.2: - version "0.4.4" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" - integrity sha1-66T12pwNyZneaAMti092FzZSA2s= - dependencies: - amdefine ">=0.0.4" - source-map@^0.5.0, source-map@^0.5.3: version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" @@ -8833,13 +8745,6 @@ stack-utils@^2.0.4: dependencies: escape-string-regexp "^2.0.0" -stdout-stream@^1.4.0: - version "1.4.1" - resolved "https://registry.yarnpkg.com/stdout-stream/-/stdout-stream-1.4.1.tgz#5ac174cdd5cd726104aa0c0b2bd83815d8d535de" - integrity sha512-j4emi03KXqJWcIeF8eIXkjMFN1Cmb8gUlDYGeBALLPo5qdyTfA9bOtl8m33lRoC+vFMkP3gl0WsDr6+gzxbbTA== - dependencies: - readable-stream "^2.0.1" - stream-each@^1.1.0: version "1.2.3" resolved "https://registry.yarnpkg.com/stream-each/-/stream-each-1.2.3.tgz#ebe27a0c389b04fbcc233642952e10731afa9bae" @@ -9188,15 +9093,6 @@ tar-stream@^1.5.2: to-buffer "^1.1.1" xtend "^4.0.0" -tar@^2.0.0: - version "2.2.2" - resolved "https://registry.yarnpkg.com/tar/-/tar-2.2.2.tgz#0ca8848562c7299b8b446ff6a4d60cdbb23edc40" - integrity sha512-FCEhQ/4rE1zYv9rYXJw/msRqsnmlje5jHP6huWeBZ704jUTy02c5AZyWujpMR1ax6mVw9NyJMfuK2CMDWVIfgA== - dependencies: - block-stream "*" - fstream "^1.0.12" - inherits "2" - tar@^4.4.10, tar@^4.4.12, tar@^4.4.19: version "4.4.19" resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.19.tgz#2e4d7263df26f2b914dee10c825ab132123742f3" @@ -9394,13 +9290,6 @@ trivial-deferred@^1.0.1: resolved "https://registry.yarnpkg.com/trivial-deferred/-/trivial-deferred-1.0.1.tgz#376d4d29d951d6368a6f7a0ae85c2f4d5e0658f3" integrity sha1-N21NKdlR1jaKb3oK6FwvTV4GWPM= -"true-case-path@^1.0.2": - version "1.0.3" - resolved "https://registry.yarnpkg.com/true-case-path/-/true-case-path-1.0.3.tgz#f813b5a8c86b40da59606722b144e3225799f47d" - integrity sha512-m6s2OdQe5wgpFMC+pAJ+q9djG82O2jcHPOI6RNg1yy9rCYR+WD6Nbpl32fDpfC56nirdRy+opFa/Vk7HYhqaew== - dependencies: - glob "^7.1.2" - tslib@^1.9.0: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" @@ -9793,7 +9682,7 @@ which-module@^2.0.0: resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= -which@1, which@^1.2.14, which@^1.2.9, which@^1.3.0, which@^1.3.1: +which@^1.2.14, which@^1.2.9, which@^1.3.0, which@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== @@ -9987,14 +9876,6 @@ yapool@^1.0.0: resolved "https://registry.yarnpkg.com/yapool/-/yapool-1.0.0.tgz#f693f29a315b50d9a9da2646a7a6645c96985b6a" integrity sha1-9pPymjFbUNmp2iZGp6ZkXJaYW2o= -yargs-parser@^13.1.2: - version "13.1.2" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.2.tgz#130f09702ebaeef2650d54ce6e3e5706f7a4fb38" - integrity sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg== - dependencies: - camelcase "^5.0.0" - decamelize "^1.2.0" - yargs-parser@^15.0.1: version "15.0.3" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-15.0.3.tgz#316e263d5febe8b38eef61ac092b33dfcc9b1115" @@ -10023,22 +9904,6 @@ yargs-parser@^7.0.0: dependencies: camelcase "^4.1.0" -yargs@^13.3.2: - version "13.3.2" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.2.tgz#ad7ffefec1aa59565ac915f82dccb38a9c31a2dd" - integrity sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw== - dependencies: - cliui "^5.0.0" - find-up "^3.0.0" - get-caller-file "^2.0.1" - require-directory "^2.1.1" - require-main-filename "^2.0.0" - set-blocking "^2.0.0" - string-width "^3.0.0" - which-module "^2.0.0" - y18n "^4.0.0" - yargs-parser "^13.1.2" - yargs@^14.2.3: version "14.2.3" resolved "https://registry.yarnpkg.com/yargs/-/yargs-14.2.3.tgz#1a1c3edced1afb2a2fea33604bc6d1d8d688a414"