postcss-lab-function 4.0.2 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/README.md +96 -17
- package/dist/convert-lab-to-display-p3.d.ts +3 -0
- package/dist/convert-lab-to-srgb.d.ts +3 -0
- package/dist/convert-lch-to-display-p3.d.ts +3 -0
- package/dist/convert-lch-to-srgb.d.ts +3 -0
- package/dist/css-color-4/conversions.d.ts +47 -0
- package/dist/css-color-4/deltaEOK.d.ts +11 -0
- package/dist/css-color-4/map-gamut.d.ts +5 -0
- package/dist/css-color-4/multiply-matrices.d.ts +13 -0
- package/dist/css-color-4/utilities.d.ts +25 -0
- package/dist/has-fallback-decl.d.ts +2 -0
- package/dist/index.cjs +30 -2
- package/dist/index.d.ts +8 -4
- package/dist/index.mjs +30 -2
- package/dist/modified-values.d.ts +5 -0
- package/dist/on-css-function.d.ts +3 -2
- package/package.json +18 -14
- package/INSTALL.md +0 -164
- package/dist/cli.d.ts +0 -1
- package/dist/cli.mjs +0 -3
- package/dist/color.d.ts +0 -3
- package/dist/index.cjs.map +0 -1
- package/dist/index.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# Changes to PostCSS Lab Function
|
|
2
2
|
|
|
3
|
+
### 4.1.1 (February 15, 2022)
|
|
4
|
+
|
|
5
|
+
- Fix plugin name
|
|
6
|
+
|
|
7
|
+
### 4.1.0 (February 12, 2022)
|
|
8
|
+
|
|
9
|
+
- Add gamut mapping for out of gamut colors.
|
|
10
|
+
- Add conversion to `display-p3` as a wider gamut fallback.
|
|
11
|
+
|
|
12
|
+
[Read more about out of gamut colors](https://github.com/csstools/postcss-plugins/blob/main/plugins/postcss-lab-function/README.md#out-of-gamut-colors)
|
|
13
|
+
|
|
14
|
+
[Read more about `color(display-p3 0 0 0)`](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/color())
|
|
15
|
+
|
|
16
|
+
```css
|
|
17
|
+
.color-lab {
|
|
18
|
+
color: lab(40% 56.6 39);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* with a display-p3 fallback : */
|
|
22
|
+
.color {
|
|
23
|
+
color: rgb(179, 35, 35);
|
|
24
|
+
color: color(display-p3 0.64331 0.19245 0.16771);
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### 4.0.4 (February 5, 2022)
|
|
29
|
+
|
|
30
|
+
- Improved `es module` and `commonjs` compatibility
|
|
31
|
+
|
|
32
|
+
### 4.0.3 (January 2, 2022)
|
|
33
|
+
|
|
34
|
+
- Removed Sourcemaps from package tarball.
|
|
35
|
+
- Moved CLI to CLI Package. See [announcement](https://github.com/csstools/postcss-plugins/discussions/121).
|
|
36
|
+
|
|
3
37
|
### 4.0.2 (December 13, 2021)
|
|
4
38
|
|
|
5
39
|
- Changed: now uses `postcss-value-parser` for parsing.
|
package/README.md
CHANGED
|
@@ -1,25 +1,33 @@
|
|
|
1
1
|
# PostCSS Lab Function [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS Logo" width="90" height="90" align="right">][postcss]
|
|
2
2
|
|
|
3
3
|
[<img alt="npm version" src="https://img.shields.io/npm/v/postcss-lab-function.svg" height="20">][npm-url]
|
|
4
|
-
[<img alt="CSS Standard Status" src="https://cssdb.org/
|
|
4
|
+
[<img alt="CSS Standard Status" src="https://cssdb.org/images/badges/lab-function.svg" height="20">][css-url]
|
|
5
5
|
[<img alt="Build Status" src="https://github.com/csstools/postcss-plugins/workflows/test/badge.svg" height="20">][cli-url]
|
|
6
|
-
[<img alt="
|
|
6
|
+
[<img alt="Discord" src="https://shields.io/badge/Discord-5865F2?logo=discord&logoColor=white">][discord]
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
[PostCSS Lab Function] lets you use `lab` and `lch` color functions in
|
|
10
|
+
CSS, following the [CSS Color] specification.
|
|
11
11
|
|
|
12
12
|
```pcss
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
.color-lab {
|
|
14
|
+
color: lab(40% 56.6 39);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.color-lch {
|
|
18
|
+
color: lch(40% 68.735435 34.568626);
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
/* becomes */
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
.color {
|
|
24
|
+
color: rgb(179, 35, 35);
|
|
25
|
+
color: color(display-p3 0.64331 0.19245 0.16771);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.color-lch {
|
|
29
|
+
color: rgb(179, 35, 35);
|
|
30
|
+
color: color(display-p3 0.64331 0.19245 0.16771);
|
|
23
31
|
}
|
|
24
32
|
```
|
|
25
33
|
|
|
@@ -59,25 +67,96 @@ is preserved. By default, it is not preserved.
|
|
|
59
67
|
postcssLabFunction({ preserve: true })
|
|
60
68
|
```
|
|
61
69
|
|
|
70
|
+
```pcss
|
|
71
|
+
.color {
|
|
72
|
+
color: lab(40% 56.6 39);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/* becomes */
|
|
76
|
+
|
|
77
|
+
.color {
|
|
78
|
+
color: rgb(179, 35, 35);
|
|
79
|
+
color: color(display-p3 0.64331 0.19245 0.16771);
|
|
80
|
+
color: lab(40% 56.6 39);
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### enableProgressiveCustomProperties
|
|
85
|
+
|
|
86
|
+
The `enableProgressiveCustomProperties` option determines whether the original notation
|
|
87
|
+
is wrapped with `@supports` when used in Custom Properties. By default, it is enabled.
|
|
88
|
+
|
|
89
|
+
⚠️ We only recommend disabling this when you set `preserve` to `false` or if you bring your own fix for Custom Properties. See what the plugin does in its [README](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties#readme).
|
|
90
|
+
|
|
91
|
+
```js
|
|
92
|
+
postcssLabFunction({ enableProgressiveCustomProperties: false })
|
|
93
|
+
```
|
|
94
|
+
|
|
62
95
|
```pcss
|
|
63
96
|
:root {
|
|
64
|
-
|
|
65
|
-
--firebrick-a50: lch(40% 68.8 34.5 / 50%);
|
|
97
|
+
--firebrick: lab(40% 56.6 39);
|
|
66
98
|
}
|
|
67
99
|
|
|
68
100
|
/* becomes */
|
|
69
101
|
|
|
70
102
|
:root {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
--firebrick-a50: lch(40% 68.8 34.5 / 50%);
|
|
103
|
+
--firebrick: rgb(178, 34, 34); /* will never be used, not even in older browser */
|
|
104
|
+
--firebrick: color(display-p3 0.64331 0.19245 0.16771); /* will never be used, not even in older browser */
|
|
105
|
+
--firebrick: lab(40% 56.6 39);
|
|
75
106
|
}
|
|
76
107
|
```
|
|
77
108
|
|
|
109
|
+
### subFeatures
|
|
110
|
+
|
|
111
|
+
#### displayP3
|
|
112
|
+
|
|
113
|
+
The `subFeatures.displayP3` option determines if `color(display-p3 ...)` is used as a fallback.<br>
|
|
114
|
+
By default, it is enabled.
|
|
115
|
+
|
|
116
|
+
`display-p3` can display wider gamut colors than `rgb` on some devices.
|
|
117
|
+
|
|
118
|
+
```js
|
|
119
|
+
postcssOKLabFunction({
|
|
120
|
+
subFeatures: {
|
|
121
|
+
displayP3: false
|
|
122
|
+
}
|
|
123
|
+
})
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
```pcss
|
|
127
|
+
.color {
|
|
128
|
+
color: lab(40% 56.6 39);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/* becomes */
|
|
132
|
+
|
|
133
|
+
.color {
|
|
134
|
+
color: rgb(179, 35, 35);
|
|
135
|
+
color: lab(40% 56.6 39);
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Out of gamut colors
|
|
140
|
+
|
|
141
|
+
Depending on the browser implementation out of gamut colors may be clipped, resulting in a different color.<br>
|
|
142
|
+
Fallback values generated by [PostCSS Lab Function] are always mapped to a close alternative in sRGB.
|
|
143
|
+
|
|
144
|
+
When setting `preserve` to `true` the original values will be used by some browsers and these may be clipped.<br>
|
|
145
|
+
Certain browsers will have an incorrect color if this occurs.
|
|
146
|
+
|
|
147
|
+
If the plugin detects out of gamut colors it will emit a warning :
|
|
148
|
+
|
|
149
|
+
> "lch(95% 210 285)" is out of gamut for "display-p3". When "preserve: true" is set this will lead to unexpected results in some browsers.
|
|
150
|
+
|
|
151
|
+
To resolve this warning you can use a color that is in gamut for `display-p3`.
|
|
152
|
+
|
|
153
|
+
## Copyright : color conversions
|
|
154
|
+
|
|
155
|
+
This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/tree/main/css-color-4. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
|
|
156
|
+
|
|
78
157
|
[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test
|
|
79
158
|
[css-url]: https://cssdb.org/#lab-function
|
|
80
|
-
[
|
|
159
|
+
[discord]: https://discord.gg/bUadyRwkJS
|
|
81
160
|
[npm-url]: https://www.npmjs.com/package/postcss-lab-function
|
|
82
161
|
|
|
83
162
|
[CSS Color]: https://drafts.csswg.org/css-color/#specifying-lab-lch
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license W3C
|
|
3
|
+
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
|
|
4
|
+
*
|
|
5
|
+
* @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
|
|
6
|
+
*
|
|
7
|
+
* @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js
|
|
8
|
+
*/
|
|
9
|
+
declare type color = [number, number, number];
|
|
10
|
+
export declare const D50: number[];
|
|
11
|
+
export declare const D65: number[];
|
|
12
|
+
export declare function lin_sRGB(RGB: color): color;
|
|
13
|
+
export declare function gam_sRGB(RGB: color): color;
|
|
14
|
+
export declare function lin_sRGB_to_XYZ(rgb: color): color;
|
|
15
|
+
export declare function XYZ_to_lin_sRGB(XYZ: color): color;
|
|
16
|
+
export declare function lin_P3(RGB: color): color;
|
|
17
|
+
export declare function gam_P3(RGB: color): color;
|
|
18
|
+
export declare function lin_P3_to_XYZ(rgb: color): color;
|
|
19
|
+
export declare function XYZ_to_lin_P3(XYZ: color): color;
|
|
20
|
+
export declare function lin_ProPhoto(RGB: color): color;
|
|
21
|
+
export declare function gam_ProPhoto(RGB: color): color;
|
|
22
|
+
export declare function lin_ProPhoto_to_XYZ(rgb: color): color;
|
|
23
|
+
export declare function XYZ_to_lin_ProPhoto(XYZ: color): color;
|
|
24
|
+
export declare function lin_a98rgb(RGB: color): color;
|
|
25
|
+
export declare function gam_a98rgb(RGB: color): color;
|
|
26
|
+
export declare function lin_a98rgb_to_XYZ(rgb: color): color;
|
|
27
|
+
export declare function XYZ_to_lin_a98rgb(XYZ: color): color;
|
|
28
|
+
export declare function lin_2020(RGB: color): color;
|
|
29
|
+
export declare function gam_2020(RGB: color): color;
|
|
30
|
+
export declare function lin_2020_to_XYZ(rgb: color): color;
|
|
31
|
+
export declare function XYZ_to_lin_2020(XYZ: color): color;
|
|
32
|
+
export declare function D65_to_D50(XYZ: color): color;
|
|
33
|
+
export declare function D50_to_D65(XYZ: color): color;
|
|
34
|
+
export declare function XYZ_to_Lab(XYZ: color): color;
|
|
35
|
+
export declare function Lab_to_XYZ(Lab: color): color;
|
|
36
|
+
export declare function Lab_to_LCH(Lab: color): color;
|
|
37
|
+
export declare function LCH_to_Lab(LCH: color): color;
|
|
38
|
+
export declare function XYZ_to_OKLab(XYZ: color): color;
|
|
39
|
+
export declare function OKLab_to_XYZ(OKLab: color): color;
|
|
40
|
+
export declare function OKLab_to_OKLCH(OKLab: color): color;
|
|
41
|
+
export declare function OKLCH_to_OKLab(OKLCH: color): color;
|
|
42
|
+
export declare function rectangular_premultiply(color: color, alpha: number): color;
|
|
43
|
+
export declare function rectangular_un_premultiply(color: color, alpha: number): color;
|
|
44
|
+
export declare function polar_premultiply(color: color, alpha: number, hueIndex: number): color;
|
|
45
|
+
export declare function polar_un_premultiply(color: color, alpha: number, hueIndex: number): color;
|
|
46
|
+
export declare function hsl_premultiply(color: color, alpha: number): color;
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license W3C
|
|
3
|
+
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
|
|
4
|
+
*
|
|
5
|
+
* @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/deltaEOK.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
|
|
6
|
+
*
|
|
7
|
+
* @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/deltaEOK.js
|
|
8
|
+
*/
|
|
9
|
+
declare type color = [number, number, number];
|
|
10
|
+
export declare function deltaEOK(reference: color, sample: color): number;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare type color = [number, number, number];
|
|
2
|
+
export declare function mapGamut(startOKLCH: color, toDestination: (x: color) => color, fromDestination: (x: color) => color): color;
|
|
3
|
+
export declare function clip(color: color): color;
|
|
4
|
+
export declare function inGamut(x: color): boolean;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple matrix (and vector) multiplication
|
|
3
|
+
* Warning: No error handling for incompatible dimensions!
|
|
4
|
+
* @author Lea Verou 2020 MIT License
|
|
5
|
+
*
|
|
6
|
+
* @license W3C
|
|
7
|
+
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
|
|
8
|
+
*
|
|
9
|
+
* @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/multiply-matrices.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
|
|
10
|
+
*
|
|
11
|
+
* @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/multiply-matrices.js
|
|
12
|
+
*/
|
|
13
|
+
export declare function multiplyMatrices(a: Array<Array<number>> | Array<number>, b: Array<Array<number>> | Array<number>): Array<Array<number>> | Array<number>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license W3C
|
|
3
|
+
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
|
|
4
|
+
*
|
|
5
|
+
* @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/utilities.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
|
|
6
|
+
*
|
|
7
|
+
* @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/utilities.js
|
|
8
|
+
*/
|
|
9
|
+
declare type color = [number, number, number];
|
|
10
|
+
export declare function sRGB_to_luminance(RGB: color): number;
|
|
11
|
+
export declare function contrast(RGB1: color, RGB2: color): number;
|
|
12
|
+
export declare function sRGB_to_LCH(RGB: color): color;
|
|
13
|
+
export declare function P3_to_LCH(RGB: color): color;
|
|
14
|
+
export declare function r2020_to_LCH(RGB: color): color;
|
|
15
|
+
export declare function LCH_to_sRGB(LCH: color): color;
|
|
16
|
+
export declare function LCH_to_P3(LCH: color): color;
|
|
17
|
+
export declare function LCH_to_r2020(LCH: color): color;
|
|
18
|
+
export declare function hslToRgb(hsl: color): color;
|
|
19
|
+
export declare function hueToRgb(t1: number, t2: number, hue: number): number;
|
|
20
|
+
export declare function naive_CMYK_to_sRGB(CMYK: [number, number, number, number]): color;
|
|
21
|
+
export declare function naive_sRGB_to_CMYK(RGB: color): [number, number, number, number];
|
|
22
|
+
export declare function XYZ_to_xy(XYZ: color): [number, number];
|
|
23
|
+
export declare function xy_to_uv(xy: [number, number]): [number, number];
|
|
24
|
+
export declare function XYZ_to_uv(XYZ: color): [number, number];
|
|
25
|
+
export {};
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,30 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
1
|
+
"use strict";var e=require("@csstools/postcss-progressive-custom-properties"),t=require("postcss-value-parser");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=n(e),u=n(t);
|
|
2
|
+
/**
|
|
3
|
+
* Simple matrix (and vector) multiplication
|
|
4
|
+
* Warning: No error handling for incompatible dimensions!
|
|
5
|
+
* @author Lea Verou 2020 MIT License
|
|
6
|
+
*
|
|
7
|
+
* @license W3C
|
|
8
|
+
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
|
|
9
|
+
*
|
|
10
|
+
* @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/multiply-matrices.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
|
|
11
|
+
*
|
|
12
|
+
* @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/multiply-matrices.js
|
|
13
|
+
*/
|
|
14
|
+
function a(e,t){const n=e.length;let r,u;r=Array.isArray(e[0])?e:[e],Array.isArray(t[0])||(u=t.map((e=>[e])));const a=u[0].length,o=u[0].map(((e,t)=>u.map((e=>e[t]))));let i=r.map((e=>o.map((t=>Array.isArray(e)?e.reduce(((e,n,r)=>e+n*(t[r]||0)),0):t.reduce(((t,n)=>t+n*e),0)))));return 1===n&&(i=i[0]),1===a?i.map((e=>e[0])):i}
|
|
15
|
+
/**
|
|
16
|
+
* @license W3C
|
|
17
|
+
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
|
|
18
|
+
*
|
|
19
|
+
* @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
|
|
20
|
+
*
|
|
21
|
+
* @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js
|
|
22
|
+
*/const o=[.3457/.3585,1,.2958/.3585];function i(e){return e.map((function(e){const t=e<0?-1:1,n=Math.abs(e);return n<.04045?e/12.92:t*Math.pow((n+.055)/1.055,2.4)}))}function s(e){return e.map((function(e){const t=e<0?-1:1,n=Math.abs(e);return n>.0031308?t*(1.055*Math.pow(n,1/2.4)-.055):12.92*e}))}function l(e){return a([[.41239079926595934,.357584339383878,.1804807884018343],[.21263900587151027,.715168678767756,.07219231536073371],[.01933081871559182,.11919477979462598,.9505321522496607]],e)}function c(e){return a([[3.2409699419045226,-1.537383177570094,-.4986107602930034],[-.9692436362808796,1.8759675015077202,.04155505740717559],[.05563007969699366,-.20397695888897652,1.0569715142428786]],e)}function f(e){return i(e)}function p(e){return s(e)}function d(e){return a([[.4865709486482162,.26566769316909306,.1982172852343625],[.2289745640697488,.6917385218365064,.079286914093745],[0,.04511338185890264,1.043944368900976]],e)}function h(e){return a([[2.493496911941425,-.9313836179191239,-.40271078445071684],[-.8294889695615747,1.7626640603183463,.023624685841943577],[.03584583024378447,-.07617238926804182,.9568845240076872]],e)}function v(e){return a([[.9554734527042182,-.023098536874261423,.0632593086610217],[-.028369706963208136,1.0099954580058226,.021041398966943008],[.012314001688319899,-.020507696433477912,1.3303659366080753]],e)}function m(e){const t=24389/27,n=216/24389,r=[];r[1]=(e[0]+16)/116,r[0]=e[1]/500+r[1],r[2]=r[1]-e[2]/200;return[Math.pow(r[0],3)>n?Math.pow(r[0],3):(116*r[0]-16)/t,e[0]>8?Math.pow((e[0]+16)/116,3):e[0]/t,Math.pow(r[2],3)>n?Math.pow(r[2],3):(116*r[2]-16)/t].map(((e,t)=>e*o[t]))}function b(e){return[e[0],e[1]*Math.cos(e[2]*Math.PI/180),e[1]*Math.sin(e[2]*Math.PI/180)]}function y(e){const t=a([[.8190224432164319,.3619062562801221,-.12887378261216414],[.0329836671980271,.9292868468965546,.03614466816999844],[.048177199566046255,.26423952494422764,.6335478258136937]],e);return a([[.2104542553,.793617785,-.0040720468],[1.9779984951,-2.428592205,.4505937099],[.0259040371,.7827717662,-.808675766]],t.map((e=>Math.cbrt(e))))}function M(e){const t=a([[.9999999984505198,.39633779217376786,.2158037580607588],[1.0000000088817609,-.10556134232365635,-.06385417477170591],[1.0000000546724108,-.08948418209496575,-1.2914855378640917]],e);return a([[1.2268798733741557,-.5578149965554813,.28139105017721583],[-.04057576262431372,1.1122868293970594,-.07171106666151701],[-.07637294974672142,-.4214933239627914,1.5869240244272418]],t.map((e=>e**3)))}function g(e){const t=180*Math.atan2(e[2],e[1])/Math.PI;return[e[0],Math.sqrt(e[1]**2+e[2]**2),t>=0?t:t+360]}function x(e){return[e[0],e[1]*Math.cos(e[2]*Math.PI/180),e[1]*Math.sin(e[2]*Math.PI/180)]}
|
|
23
|
+
/**
|
|
24
|
+
* @license W3C
|
|
25
|
+
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
|
|
26
|
+
*
|
|
27
|
+
* @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/deltaEOK.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
|
|
28
|
+
*
|
|
29
|
+
* @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/deltaEOK.js
|
|
30
|
+
*/function w(e,t){const[n,r,u]=e,[a,o,i]=t,s=n-a,l=r-o,c=u-i;return Math.sqrt(s**2+l**2+c**2)}function P(e,t,n){return function(e,t,n){let r=0,u=e[1];const a=e;for(;u-r>1e-4;){w(a,n(F(t(a))))-.02<1e-4?r=a[1]:u=a[1],a[1]=(u+r)/2}return F(t([...a]))}(e,t,n)}function F(e){return e.map((e=>e<0?0:e>1?1:e))}function I(e){const[t,n,r]=e;return t>=-1e-4&&t<=1.0001&&n>=-1e-4&&n<=1.0001&&r>=-1e-4&&r<=1.0001}function N(e){const[t,n,r]=e;let u=[Math.min(Math.max(t,0),100),Math.min(Math.max(n,-127),128),Math.min(Math.max(r,-127),128)].slice();u=m(u);let a=u.slice();return a=v(a),a=y(a),a=g(a),u=v(u),u=h(u),u=p(u),I(u)?[F(u),!0]:[P(a,(e=>p(e=h(e=M(e=x(e))))),(e=>g(e=y(e=d(e=f(e)))))),!1]}function S(e){const[t,n,r]=e;let u=[Math.min(Math.max(t,0),100),Math.min(Math.max(n,-127),128),Math.min(Math.max(r,-127),128)].slice();u=m(u);let a=u.slice();return a=v(a),a=y(a),a=g(a),u=v(u),u=c(u),u=s(u),I(u)?F(u).map((e=>Math.round(255*e))):P(a,(e=>s(e=c(e=M(e=x(e))))),(e=>g(e=y(e=l(e=i(e)))))).map((e=>Math.round(255*e)))}function O(e){let t=e.slice();t=b(t),t=m(t);let n=t.slice();return n=v(n),n=y(n),n=g(n),t=v(t),t=h(t),t=p(t),I(t)?[F(t),!0]:[P(n,(e=>p(e=h(e=M(e=x(e))))),(e=>g(e=y(e=d(e=f(e)))))),!1]}function A(e){let t=e.slice();t=b(t),t=m(t);let n=t.slice();return n=v(n),n=y(n),n=g(n),t=v(t),t=c(t),t=s(t),I(t)?F(t).map((e=>Math.round(255*e))):P(n,(e=>s(e=c(e=M(e=x(e))))),(e=>g(e=y(e=l(e=i(e)))))).map((e=>Math.round(255*e)))}function q(e){const t=e.value,n=e.nodes.slice().filter((e=>"comment"!==e.type&&"space"!==e.type));let r=null;if("lab"===t?r=G(n):"lch"===t&&(r=D(n)),!r)return;if(n.length>3&&(!r.slash||!r.alpha))return;e.value="rgb",function(e,t,n){if(!t||!n)return;if(e.value="rgba",t.value=",",t.before="",!function(e){if(!e||"word"!==e.type)return!1;if(!K(e))return!1;const t=u.default.unit(e.value);if(!t)return!1;return!!t.number}(n))return;const r=u.default.unit(n.value);if(!r)return;"%"===r.unit&&(r.number=String(parseFloat(r.number)/100),n.value=String(r.number))}(e,r.slash,r.alpha);const[a,o,i]=z(r),[s,l,c]=H(r),f=("lab"===t?S:A)([s.number,l.number,c.number].map((e=>parseFloat(e))));e.nodes.splice(e.nodes.indexOf(a)+1,0,{sourceIndex:0,sourceEndIndex:1,value:",",type:"div",before:"",after:""}),e.nodes.splice(e.nodes.indexOf(o)+1,0,{sourceIndex:0,sourceEndIndex:1,value:",",type:"div",before:"",after:""}),J(e.nodes,a,{...a,value:String(f[0])}),J(e.nodes,o,{...o,value:String(f[1])}),J(e.nodes,i,{...i,value:String(f[2])})}function B(e){if(!e||"word"!==e.type)return!1;if(!K(e))return!1;const t=u.default.unit(e.value);return!!t&&(!!t.number&&""===t.unit)}function E(e){if(!e||"word"!==e.type)return!1;if(!K(e))return!1;const t=u.default.unit(e.value);return!!t&&"%"===t.unit}function j(e){if(!e||"word"!==e.type)return!1;if(!K(e))return!1;const t=u.default.unit(e.value);return!!t&&("%"===t.unit||""===t.unit)}function k(e){return e&&"function"===e.type&&"calc"===e.value}function C(e){return e&&"function"===e.type&&"var"===e.value}function $(e){return e&&"div"===e.type&&"/"===e.value}function D(e){if(!E(e[0]))return null;if(!B(e[1]))return null;if(!function(e){if(!e||"word"!==e.type)return!1;if(!K(e))return!1;const t=u.default.unit(e.value);return!(!t||!t.number||"deg"!==t.unit&&"grad"!==t.unit&&"rad"!==t.unit&&"turn"!==t.unit&&""!==t.unit)}(e[2]))return null;const t={l:u.default.unit(e[0].value),lNode:e[0],c:u.default.unit(e[1].value),cNode:e[1],h:u.default.unit(e[2].value),hNode:e[2]};return function(e){switch(e.unit){case"deg":return void(e.unit="");case"rad":return e.unit="",void(e.number=(180*parseFloat(e.number)/Math.PI).toString());case"grad":return e.unit="",void(e.number=(.9*parseFloat(e.number)).toString());case"turn":e.unit="",e.number=(360*parseFloat(e.number)).toString()}}(t.h),""!==t.h.unit?null:($(e[3])&&(t.slash=e[3]),(j(e[4])||k(e[4])||C(e[4]))&&(t.alpha=e[4]),t)}function G(e){if(!E(e[0]))return null;if(!B(e[1]))return null;if(!B(e[2]))return null;const t={l:u.default.unit(e[0].value),lNode:e[0],a:u.default.unit(e[1].value),aNode:e[1],b:u.default.unit(e[2].value),bNode:e[2]};return $(e[3])&&(t.slash=e[3]),(j(e[4])||k(e[4])||C(e[4]))&&(t.alpha=e[4]),t}function L(e){return void 0!==e.a}function z(e){return L(e)?[e.lNode,e.aNode,e.bNode]:[e.lNode,e.cNode,e.hNode]}function H(e){return L(e)?[e.l,e.a,e.b]:[e.l,e.c,e.h]}function J(e,t,n){const r=e.indexOf(t);e[r]=n}function K(e){if(!e||!e.value)return!1;try{return!1!==u.default.unit(e.value)}catch(e){return!1}}function Q(e,t,n,r){let a;try{a=u.default(e)}catch(r){t.warn(n,`Failed to parse value '${e}' as a lab or lch function. Leaving the original value intact.`)}if(void 0===a)return;a.walk((e=>{e.type&&"function"===e.type&&("lab"!==e.value&&"lch"!==e.value||q(e))}));const o=String(a);if(o===e)return;const i=u.default(e);i.walk((e=>{e.type&&"function"===e.type&&("lab"!==e.value&&"lch"!==e.value||function(e,t,n,r){const a=u.default.stringify(e),o=e.value,i=e.nodes.slice().filter((e=>"comment"!==e.type&&"space"!==e.type));let s=null;if("lab"===o?s=G(i):"lch"===o&&(s=D(i)),!s)return;if(i.length>3&&(!s.slash||!s.alpha))return;e.value="color";const[l,c,f]=z(s),[p,d,h]=H(s),v="lab"===o?N:O,m=[p.number,d.number,h.number].map((e=>parseFloat(e))),[b,y]=v(m);!y&&r&&t.warn(n,`"${a}" is out of gamut for "display-p3". Given "preserve: true" is set, this will lead to unexpected results in some browsers.`),e.nodes.splice(0,0,{sourceIndex:0,sourceEndIndex:10,value:"display-p3",type:"word"}),e.nodes.splice(1,0,{sourceIndex:0,sourceEndIndex:1,value:" ",type:"space"}),J(e.nodes,l,{...l,value:b[0].toFixed(5)}),J(e.nodes,c,{...c,value:b[1].toFixed(5)}),J(e.nodes,f,{...f,value:b[2].toFixed(5)})}(e,t,n,r))}));return{rgb:o,displayP3:String(i)}}const R=e=>({postcssPlugin:"postcss-lab-function",Declaration:(t,{result:n})=>{if(function(e){const t=e.parent;if(!t)return!1;const n=t.index(e);for(let r=0;r<n;r++){const n=t.nodes[r];if("decl"===n.type&&n.prop===e.prop)return!0}return!1}(t))return;if(function(e){let t=e.parent;for(;t;)if("atrule"===t.type){if("supports"===t.name){if(-1!==t.params.indexOf("lab("))return!0;if(-1!==t.params.indexOf("lch("))return!0}t=t.parent}else t=t.parent;return!1}(t))return;const r=t.value;if(!/(^|[^\w-])(lab|lch)\(/i.test(r))return;const u=Q(r,t,n,e.preserve);void 0!==u&&(e.preserve?(t.cloneBefore({value:u.rgb}),e.subFeatures.displayP3&&t.cloneBefore({value:u.displayP3})):(t.cloneBefore({value:u.rgb}),e.subFeatures.displayP3&&t.cloneBefore({value:u.displayP3}),t.remove()))}});R.postcss=!0;const T=e=>{const t=Object.assign({enableProgressiveCustomProperties:!0,preserve:!1,subFeatures:{displayP3:!0}},e);return t.subFeatures=Object.assign({displayP3:!0},t.subFeatures),t.enableProgressiveCustomProperties&&(t.preserve||t.subFeatures.displayP3)?{postcssPlugin:"postcss-lab-function",plugins:[r.default(),R(t)]}:R(t)};T.postcss=!0,module.exports=T;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { PluginCreator } from 'postcss';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
preserve
|
|
5
|
-
|
|
2
|
+
declare type pluginOptions = {
|
|
3
|
+
enableProgressiveCustomProperties?: boolean;
|
|
4
|
+
preserve?: boolean;
|
|
5
|
+
subFeatures?: {
|
|
6
|
+
displayP3?: boolean;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
declare const postcssPlugin: PluginCreator<pluginOptions>;
|
|
6
10
|
export default postcssPlugin;
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,30 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import e from"@csstools/postcss-progressive-custom-properties";import n from"postcss-value-parser";
|
|
2
|
+
/**
|
|
3
|
+
* Simple matrix (and vector) multiplication
|
|
4
|
+
* Warning: No error handling for incompatible dimensions!
|
|
5
|
+
* @author Lea Verou 2020 MIT License
|
|
6
|
+
*
|
|
7
|
+
* @license W3C
|
|
8
|
+
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
|
|
9
|
+
*
|
|
10
|
+
* @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/multiply-matrices.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
|
|
11
|
+
*
|
|
12
|
+
* @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/multiply-matrices.js
|
|
13
|
+
*/
|
|
14
|
+
function t(e,n){const t=e.length;let r,u;r=Array.isArray(e[0])?e:[e],Array.isArray(n[0])||(u=n.map((e=>[e])));const a=u[0].length,o=u[0].map(((e,n)=>u.map((e=>e[n]))));let i=r.map((e=>o.map((n=>Array.isArray(e)?e.reduce(((e,t,r)=>e+t*(n[r]||0)),0):n.reduce(((n,t)=>n+t*e),0)))));return 1===t&&(i=i[0]),1===a?i.map((e=>e[0])):i}
|
|
15
|
+
/**
|
|
16
|
+
* @license W3C
|
|
17
|
+
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
|
|
18
|
+
*
|
|
19
|
+
* @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
|
|
20
|
+
*
|
|
21
|
+
* @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/conversions.js
|
|
22
|
+
*/const r=[.3457/.3585,1,.2958/.3585];function u(e){return e.map((function(e){const n=e<0?-1:1,t=Math.abs(e);return t<.04045?e/12.92:n*Math.pow((t+.055)/1.055,2.4)}))}function a(e){return e.map((function(e){const n=e<0?-1:1,t=Math.abs(e);return t>.0031308?n*(1.055*Math.pow(t,1/2.4)-.055):12.92*e}))}function o(e){return t([[.41239079926595934,.357584339383878,.1804807884018343],[.21263900587151027,.715168678767756,.07219231536073371],[.01933081871559182,.11919477979462598,.9505321522496607]],e)}function i(e){return t([[3.2409699419045226,-1.537383177570094,-.4986107602930034],[-.9692436362808796,1.8759675015077202,.04155505740717559],[.05563007969699366,-.20397695888897652,1.0569715142428786]],e)}function s(e){return u(e)}function l(e){return a(e)}function c(e){return t([[.4865709486482162,.26566769316909306,.1982172852343625],[.2289745640697488,.6917385218365064,.079286914093745],[0,.04511338185890264,1.043944368900976]],e)}function f(e){return t([[2.493496911941425,-.9313836179191239,-.40271078445071684],[-.8294889695615747,1.7626640603183463,.023624685841943577],[.03584583024378447,-.07617238926804182,.9568845240076872]],e)}function p(e){return t([[.9554734527042182,-.023098536874261423,.0632593086610217],[-.028369706963208136,1.0099954580058226,.021041398966943008],[.012314001688319899,-.020507696433477912,1.3303659366080753]],e)}function d(e){const n=24389/27,t=216/24389,u=[];u[1]=(e[0]+16)/116,u[0]=e[1]/500+u[1],u[2]=u[1]-e[2]/200;return[Math.pow(u[0],3)>t?Math.pow(u[0],3):(116*u[0]-16)/n,e[0]>8?Math.pow((e[0]+16)/116,3):e[0]/n,Math.pow(u[2],3)>t?Math.pow(u[2],3):(116*u[2]-16)/n].map(((e,n)=>e*r[n]))}function h(e){return[e[0],e[1]*Math.cos(e[2]*Math.PI/180),e[1]*Math.sin(e[2]*Math.PI/180)]}function v(e){const n=t([[.8190224432164319,.3619062562801221,-.12887378261216414],[.0329836671980271,.9292868468965546,.03614466816999844],[.048177199566046255,.26423952494422764,.6335478258136937]],e);return t([[.2104542553,.793617785,-.0040720468],[1.9779984951,-2.428592205,.4505937099],[.0259040371,.7827717662,-.808675766]],n.map((e=>Math.cbrt(e))))}function m(e){const n=t([[.9999999984505198,.39633779217376786,.2158037580607588],[1.0000000088817609,-.10556134232365635,-.06385417477170591],[1.0000000546724108,-.08948418209496575,-1.2914855378640917]],e);return t([[1.2268798733741557,-.5578149965554813,.28139105017721583],[-.04057576262431372,1.1122868293970594,-.07171106666151701],[-.07637294974672142,-.4214933239627914,1.5869240244272418]],n.map((e=>e**3)))}function b(e){const n=180*Math.atan2(e[2],e[1])/Math.PI;return[e[0],Math.sqrt(e[1]**2+e[2]**2),n>=0?n:n+360]}function y(e){return[e[0],e[1]*Math.cos(e[2]*Math.PI/180),e[1]*Math.sin(e[2]*Math.PI/180)]}
|
|
23
|
+
/**
|
|
24
|
+
* @license W3C
|
|
25
|
+
* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
|
|
26
|
+
*
|
|
27
|
+
* @copyright This software or document includes material copied from or derived from https://github.com/w3c/csswg-drafts/blob/main/css-color-4/deltaEOK.js. Copyright © 2022 W3C® (MIT, ERCIM, Keio, Beihang).
|
|
28
|
+
*
|
|
29
|
+
* @see https://github.com/w3c/csswg-drafts/blob/main/css-color-4/deltaEOK.js
|
|
30
|
+
*/function M(e,n){const[t,r,u]=e,[a,o,i]=n,s=t-a,l=r-o,c=u-i;return Math.sqrt(s**2+l**2+c**2)}function g(e,n,t){return function(e,n,t){let r=0,u=e[1];const a=e;for(;u-r>1e-4;){M(a,t(x(n(a))))-.02<1e-4?r=a[1]:u=a[1],a[1]=(u+r)/2}return x(n([...a]))}(e,n,t)}function x(e){return e.map((e=>e<0?0:e>1?1:e))}function w(e){const[n,t,r]=e;return n>=-1e-4&&n<=1.0001&&t>=-1e-4&&t<=1.0001&&r>=-1e-4&&r<=1.0001}function P(e){const[n,t,r]=e;let u=[Math.min(Math.max(n,0),100),Math.min(Math.max(t,-127),128),Math.min(Math.max(r,-127),128)].slice();u=d(u);let a=u.slice();return a=p(a),a=v(a),a=b(a),u=p(u),u=f(u),u=l(u),w(u)?[x(u),!0]:[g(a,(e=>l(e=f(e=m(e=y(e))))),(e=>b(e=v(e=c(e=s(e)))))),!1]}function F(e){const[n,t,r]=e;let s=[Math.min(Math.max(n,0),100),Math.min(Math.max(t,-127),128),Math.min(Math.max(r,-127),128)].slice();s=d(s);let l=s.slice();return l=p(l),l=v(l),l=b(l),s=p(s),s=i(s),s=a(s),w(s)?x(s).map((e=>Math.round(255*e))):g(l,(e=>a(e=i(e=m(e=y(e))))),(e=>b(e=v(e=o(e=u(e)))))).map((e=>Math.round(255*e)))}function I(e){let n=e.slice();n=h(n),n=d(n);let t=n.slice();return t=p(t),t=v(t),t=b(t),n=p(n),n=f(n),n=l(n),w(n)?[x(n),!0]:[g(t,(e=>l(e=f(e=m(e=y(e))))),(e=>b(e=v(e=c(e=s(e)))))),!1]}function N(e){let n=e.slice();n=h(n),n=d(n);let t=n.slice();return t=p(t),t=v(t),t=b(t),n=p(n),n=i(n),n=a(n),w(n)?x(n).map((e=>Math.round(255*e))):g(t,(e=>a(e=i(e=m(e=y(e))))),(e=>b(e=v(e=o(e=u(e)))))).map((e=>Math.round(255*e)))}function S(e){const t=e.value,r=e.nodes.slice().filter((e=>"comment"!==e.type&&"space"!==e.type));let u=null;if("lab"===t?u=C(r):"lch"===t&&(u=q(r)),!u)return;if(r.length>3&&(!u.slash||!u.alpha))return;e.value="rgb",function(e,t,r){if(!t||!r)return;if(e.value="rgba",t.value=",",t.before="",!function(e){if(!e||"word"!==e.type)return!1;if(!z(e))return!1;const t=n.unit(e.value);if(!t)return!1;return!!t.number}(r))return;const u=n.unit(r.value);if(!u)return;"%"===u.unit&&(u.number=String(parseFloat(u.number)/100),r.value=String(u.number))}(e,u.slash,u.alpha);const[a,o,i]=D(u),[s,l,c]=G(u),f=("lab"===t?F:N)([s.number,l.number,c.number].map((e=>parseFloat(e))));e.nodes.splice(e.nodes.indexOf(a)+1,0,{sourceIndex:0,sourceEndIndex:1,value:",",type:"div",before:"",after:""}),e.nodes.splice(e.nodes.indexOf(o)+1,0,{sourceIndex:0,sourceEndIndex:1,value:",",type:"div",before:"",after:""}),L(e.nodes,a,{...a,value:String(f[0])}),L(e.nodes,o,{...o,value:String(f[1])}),L(e.nodes,i,{...i,value:String(f[2])})}function O(e){if(!e||"word"!==e.type)return!1;if(!z(e))return!1;const t=n.unit(e.value);return!!t&&(!!t.number&&""===t.unit)}function A(e){if(!e||"word"!==e.type)return!1;if(!z(e))return!1;const t=n.unit(e.value);return!!t&&"%"===t.unit}function B(e){if(!e||"word"!==e.type)return!1;if(!z(e))return!1;const t=n.unit(e.value);return!!t&&("%"===t.unit||""===t.unit)}function E(e){return e&&"function"===e.type&&"calc"===e.value}function j(e){return e&&"function"===e.type&&"var"===e.value}function k(e){return e&&"div"===e.type&&"/"===e.value}function q(e){if(!A(e[0]))return null;if(!O(e[1]))return null;if(!function(e){if(!e||"word"!==e.type)return!1;if(!z(e))return!1;const t=n.unit(e.value);return!(!t||!t.number||"deg"!==t.unit&&"grad"!==t.unit&&"rad"!==t.unit&&"turn"!==t.unit&&""!==t.unit)}(e[2]))return null;const t={l:n.unit(e[0].value),lNode:e[0],c:n.unit(e[1].value),cNode:e[1],h:n.unit(e[2].value),hNode:e[2]};return function(e){switch(e.unit){case"deg":return void(e.unit="");case"rad":return e.unit="",void(e.number=(180*parseFloat(e.number)/Math.PI).toString());case"grad":return e.unit="",void(e.number=(.9*parseFloat(e.number)).toString());case"turn":e.unit="",e.number=(360*parseFloat(e.number)).toString()}}(t.h),""!==t.h.unit?null:(k(e[3])&&(t.slash=e[3]),(B(e[4])||E(e[4])||j(e[4]))&&(t.alpha=e[4]),t)}function C(e){if(!A(e[0]))return null;if(!O(e[1]))return null;if(!O(e[2]))return null;const t={l:n.unit(e[0].value),lNode:e[0],a:n.unit(e[1].value),aNode:e[1],b:n.unit(e[2].value),bNode:e[2]};return k(e[3])&&(t.slash=e[3]),(B(e[4])||E(e[4])||j(e[4]))&&(t.alpha=e[4]),t}function $(e){return void 0!==e.a}function D(e){return $(e)?[e.lNode,e.aNode,e.bNode]:[e.lNode,e.cNode,e.hNode]}function G(e){return $(e)?[e.l,e.a,e.b]:[e.l,e.c,e.h]}function L(e,n,t){const r=e.indexOf(n);e[r]=t}function z(e){if(!e||!e.value)return!1;try{return!1!==n.unit(e.value)}catch(e){return!1}}function H(e,t,r,u){let a;try{a=n(e)}catch(n){t.warn(r,`Failed to parse value '${e}' as a lab or lch function. Leaving the original value intact.`)}if(void 0===a)return;a.walk((e=>{e.type&&"function"===e.type&&("lab"!==e.value&&"lch"!==e.value||S(e))}));const o=String(a);if(o===e)return;const i=n(e);i.walk((e=>{e.type&&"function"===e.type&&("lab"!==e.value&&"lch"!==e.value||function(e,t,r,u){const a=n.stringify(e),o=e.value,i=e.nodes.slice().filter((e=>"comment"!==e.type&&"space"!==e.type));let s=null;if("lab"===o?s=C(i):"lch"===o&&(s=q(i)),!s)return;if(i.length>3&&(!s.slash||!s.alpha))return;e.value="color";const[l,c,f]=D(s),[p,d,h]=G(s),v="lab"===o?P:I,m=[p.number,d.number,h.number].map((e=>parseFloat(e))),[b,y]=v(m);!y&&u&&t.warn(r,`"${a}" is out of gamut for "display-p3". Given "preserve: true" is set, this will lead to unexpected results in some browsers.`),e.nodes.splice(0,0,{sourceIndex:0,sourceEndIndex:10,value:"display-p3",type:"word"}),e.nodes.splice(1,0,{sourceIndex:0,sourceEndIndex:1,value:" ",type:"space"}),L(e.nodes,l,{...l,value:b[0].toFixed(5)}),L(e.nodes,c,{...c,value:b[1].toFixed(5)}),L(e.nodes,f,{...f,value:b[2].toFixed(5)})}(e,t,r,u))}));return{rgb:o,displayP3:String(i)}}const J=e=>({postcssPlugin:"postcss-lab-function",Declaration:(n,{result:t})=>{if(function(e){const n=e.parent;if(!n)return!1;const t=n.index(e);for(let r=0;r<t;r++){const t=n.nodes[r];if("decl"===t.type&&t.prop===e.prop)return!0}return!1}(n))return;if(function(e){let n=e.parent;for(;n;)if("atrule"===n.type){if("supports"===n.name){if(-1!==n.params.indexOf("lab("))return!0;if(-1!==n.params.indexOf("lch("))return!0}n=n.parent}else n=n.parent;return!1}(n))return;const r=n.value;if(!/(^|[^\w-])(lab|lch)\(/i.test(r))return;const u=H(r,n,t,e.preserve);void 0!==u&&(e.preserve?(n.cloneBefore({value:u.rgb}),e.subFeatures.displayP3&&n.cloneBefore({value:u.displayP3})):(n.cloneBefore({value:u.rgb}),e.subFeatures.displayP3&&n.cloneBefore({value:u.displayP3}),n.remove()))}});J.postcss=!0;const K=n=>{const t=Object.assign({enableProgressiveCustomProperties:!0,preserve:!1,subFeatures:{displayP3:!0}},n);return t.subFeatures=Object.assign({displayP3:!0},t.subFeatures),t.enableProgressiveCustomProperties&&(t.preserve||t.subFeatures.displayP3)?{postcssPlugin:"postcss-lab-function",plugins:[e(),J(t)]}:J(t)};K.postcss=!0;export{K as default};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { FunctionNode } from 'postcss-value-parser';
|
|
2
|
-
|
|
3
|
-
export
|
|
2
|
+
import { Declaration, Result } from 'postcss';
|
|
3
|
+
export declare function onCSSFunctionSRgb(node: FunctionNode): void;
|
|
4
|
+
export declare function onCSSFunctionDisplayP3(node: FunctionNode, decl: Declaration, result: Result, preserve: boolean): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "postcss-lab-function",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.1",
|
|
4
4
|
"description": "Use lab() and lch() color functions in CSS",
|
|
5
5
|
"author": "Jonathan Neal <jonathantneal@hotmail.com>",
|
|
6
6
|
"license": "CC0-1.0",
|
|
@@ -9,36 +9,38 @@
|
|
|
9
9
|
"main": "dist/index.cjs",
|
|
10
10
|
"module": "dist/index.mjs",
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": "./dist/index.mjs",
|
|
15
|
+
"require": "./dist/index.cjs",
|
|
16
|
+
"default": "./dist/index.mjs"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
12
19
|
"files": [
|
|
13
20
|
"CHANGELOG.md",
|
|
14
|
-
"INSTALL.md",
|
|
15
21
|
"LICENSE.md",
|
|
16
22
|
"README.md",
|
|
17
23
|
"dist"
|
|
18
24
|
],
|
|
19
|
-
"bin": {
|
|
20
|
-
"postcss-lab-function": "dist/cli.mjs"
|
|
21
|
-
},
|
|
22
25
|
"scripts": {
|
|
23
26
|
"build": "rollup -c ../../rollup/default.js",
|
|
24
27
|
"clean": "node -e \"fs.rmSync('./dist', { recursive: true, force: true });\"",
|
|
25
28
|
"lint": "eslint ./src --ext .js --ext .ts --ext .mjs --no-error-on-unmatched-pattern",
|
|
26
29
|
"prepublishOnly": "npm run clean && npm run build && npm run test",
|
|
27
30
|
"stryker": "stryker run --logLevel error",
|
|
28
|
-
"test": "node
|
|
31
|
+
"test": "node .tape.mjs && npm run test:exports",
|
|
32
|
+
"test:rewrite-expects": "REWRITE_EXPECTS=true node .tape.mjs",
|
|
33
|
+
"test:exports": "node ./test/_import.mjs && node ./test/_require.cjs"
|
|
29
34
|
},
|
|
30
35
|
"engines": {
|
|
31
36
|
"node": "^12 || ^14 || >=16"
|
|
32
37
|
},
|
|
33
38
|
"dependencies": {
|
|
39
|
+
"@csstools/postcss-progressive-custom-properties": "^1.1.0",
|
|
34
40
|
"postcss-value-parser": "^4.2.0"
|
|
35
41
|
},
|
|
36
|
-
"devDependencies": {
|
|
37
|
-
"postcss": "^8.3.6",
|
|
38
|
-
"postcss-tape": "^6.0.1"
|
|
39
|
-
},
|
|
40
42
|
"peerDependencies": {
|
|
41
|
-
"postcss": "^8.
|
|
43
|
+
"postcss": "^8.4"
|
|
42
44
|
},
|
|
43
45
|
"keywords": [
|
|
44
46
|
"postcss",
|
|
@@ -48,9 +50,8 @@
|
|
|
48
50
|
"colors",
|
|
49
51
|
"rgb",
|
|
50
52
|
"rgba",
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"hwb",
|
|
53
|
+
"lab",
|
|
54
|
+
"lch",
|
|
54
55
|
"functional",
|
|
55
56
|
"notation",
|
|
56
57
|
"design",
|
|
@@ -62,5 +63,8 @@
|
|
|
62
63
|
"type": "git",
|
|
63
64
|
"url": "https://github.com/csstools/postcss-plugins.git",
|
|
64
65
|
"directory": "plugins/postcss-lab-function"
|
|
66
|
+
},
|
|
67
|
+
"volta": {
|
|
68
|
+
"extends": "../../package.json"
|
|
65
69
|
}
|
|
66
70
|
}
|
package/INSTALL.md
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
# Installing PostCSS Lab Function
|
|
2
|
-
|
|
3
|
-
[PostCSS Lab Function] runs in all Node environments, with special
|
|
4
|
-
instructions for:
|
|
5
|
-
|
|
6
|
-
| [Node](#node) | [PostCSS CLI](#postcss-cli) | [Webpack](#webpack) | [Create React App](#create-react-app) | [Gulp](#gulp) | [Grunt](#grunt) |
|
|
7
|
-
| --- | --- | --- | --- | --- | --- |
|
|
8
|
-
|
|
9
|
-
## Node
|
|
10
|
-
|
|
11
|
-
Add [PostCSS Lab Function] to your project:
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
npm install postcss postcss-lab-function --save-dev
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Use it as a [PostCSS] plugin:
|
|
18
|
-
|
|
19
|
-
```js
|
|
20
|
-
const postcss = require('postcss');
|
|
21
|
-
const postcssLabFunction = require('postcss-lab-function');
|
|
22
|
-
|
|
23
|
-
postcss([
|
|
24
|
-
postcssLabFunction(/* pluginOptions */)
|
|
25
|
-
]).process(YOUR_CSS /*, processOptions */);
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## PostCSS CLI
|
|
29
|
-
|
|
30
|
-
Add [PostCSS CLI] to your project:
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
npm install postcss-cli --save-dev
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
Use [PostCSS Lab Function] in your `postcss.config.js` configuration
|
|
37
|
-
file:
|
|
38
|
-
|
|
39
|
-
```js
|
|
40
|
-
const postcssLabFunction = require('postcss-lab-function');
|
|
41
|
-
|
|
42
|
-
module.exports = {
|
|
43
|
-
plugins: [
|
|
44
|
-
postcssLabFunction(/* pluginOptions */)
|
|
45
|
-
]
|
|
46
|
-
}
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
## Webpack
|
|
50
|
-
|
|
51
|
-
Add [PostCSS Loader] to your project:
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
npm install postcss-loader --save-dev
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
Use [PostCSS Lab Function] in your Webpack configuration:
|
|
58
|
-
|
|
59
|
-
```js
|
|
60
|
-
const postcssLabFunction = require('postcss-lab-function');
|
|
61
|
-
|
|
62
|
-
module.exports = {
|
|
63
|
-
module: {
|
|
64
|
-
rules: [
|
|
65
|
-
{
|
|
66
|
-
test: /\.css$/,
|
|
67
|
-
use: [
|
|
68
|
-
'style-loader',
|
|
69
|
-
{ loader: 'css-loader', options: { importLoaders: 1 } },
|
|
70
|
-
{ loader: 'postcss-loader', options: {
|
|
71
|
-
ident: 'postcss',
|
|
72
|
-
plugins: () => [
|
|
73
|
-
postcssLabFunction(/* pluginOptions */)
|
|
74
|
-
]
|
|
75
|
-
} }
|
|
76
|
-
]
|
|
77
|
-
}
|
|
78
|
-
]
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## Create React App
|
|
84
|
-
|
|
85
|
-
Add [React App Rewired] and [React App Rewire PostCSS] to your project:
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
npm install react-app-rewired react-app-rewire-postcss --save-dev
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
Use [React App Rewire PostCSS] and [PostCSS Lab Function] in your
|
|
92
|
-
`config-overrides.js` file:
|
|
93
|
-
|
|
94
|
-
```js
|
|
95
|
-
const reactAppRewirePostcss = require('react-app-rewire-postcss');
|
|
96
|
-
const postcssLabFunction = require('postcss-lab-function');
|
|
97
|
-
|
|
98
|
-
module.exports = config => reactAppRewirePostcss(config, {
|
|
99
|
-
plugins: () => [
|
|
100
|
-
postcssLabFunction(/* pluginOptions */)
|
|
101
|
-
]
|
|
102
|
-
});
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
## Gulp
|
|
106
|
-
|
|
107
|
-
Add [Gulp PostCSS] to your project:
|
|
108
|
-
|
|
109
|
-
```bash
|
|
110
|
-
npm install gulp-postcss --save-dev
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
Use [PostCSS Lab Function] in your Gulpfile:
|
|
114
|
-
|
|
115
|
-
```js
|
|
116
|
-
const postcss = require('gulp-postcss');
|
|
117
|
-
const postcssLabFunction = require('postcss-lab-function');
|
|
118
|
-
|
|
119
|
-
gulp.task('css', () => gulp.src('./src/*.css').pipe(
|
|
120
|
-
postcss([
|
|
121
|
-
postcssLabFunction(/* pluginOptions */)
|
|
122
|
-
])
|
|
123
|
-
).pipe(
|
|
124
|
-
gulp.dest('.')
|
|
125
|
-
));
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
## Grunt
|
|
129
|
-
|
|
130
|
-
Add [Grunt PostCSS] to your project:
|
|
131
|
-
|
|
132
|
-
```bash
|
|
133
|
-
npm install grunt-postcss --save-dev
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
Use [PostCSS Lab Function] in your Gruntfile:
|
|
137
|
-
|
|
138
|
-
```js
|
|
139
|
-
const postcssLabFunction = require('postcss-lab-function');
|
|
140
|
-
|
|
141
|
-
grunt.loadNpmTasks('grunt-postcss');
|
|
142
|
-
|
|
143
|
-
grunt.initConfig({
|
|
144
|
-
postcss: {
|
|
145
|
-
options: {
|
|
146
|
-
use: [
|
|
147
|
-
postcssLabFunction(/* pluginOptions */)
|
|
148
|
-
]
|
|
149
|
-
},
|
|
150
|
-
dist: {
|
|
151
|
-
src: '*.css'
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
[Gulp PostCSS]: https://github.com/postcss/gulp-postcss
|
|
158
|
-
[Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss
|
|
159
|
-
[PostCSS]: https://github.com/postcss/postcss
|
|
160
|
-
[PostCSS CLI]: https://github.com/postcss/postcss-cli
|
|
161
|
-
[PostCSS Loader]: https://github.com/postcss/postcss-loader
|
|
162
|
-
[PostCSS Lab Function]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-lab-function
|
|
163
|
-
[React App Rewire PostCSS]: https://github.com/csstools/react-app-rewire-postcss
|
|
164
|
-
[React App Rewired]: https://github.com/timarney/react-app-rewired
|
package/dist/cli.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/cli.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import e from"postcss-value-parser";import t from"tty";import r from"path";import n from"url";import s,{promises as i}from"fs";function o(e){return u(l(e,!0))}function a(e){return u(l(function(e){return[e[0],e[1]*Math.cos(e[2]*Math.PI/180),e[1]*Math.sin(e[2]*Math.PI/180)]}(e),!1))}function l(e,t){const[r,n,s]=e,i=Math.min(Math.max(r,0),100);let o=0,a=0;t?(o=Math.min(Math.max(n,-127),128),a=Math.min(Math.max(s,-127),128)):(o=n,a=s);const l=(i+16)/116,u=o/500+l,h=l-a/200,[w,y,v]=[Math.pow(u,3)>g?Math.pow(u,3):(116*u-16)/m,i>m*g?Math.pow((i+16)/116,3):i/m,Math.pow(h,3)>g?Math.pow(h,3):(116*h-16)/m],[b,S,C]=c([w*p,y*f,v*d],[[.9554734527042182,-.023098536874261423,.0632593086610217],[-.028369706963208136,1.0099954580058226,.021041398966943008],[.012314001688319899,-.020507696433477912,1.3303659366080753]]);return[b,S,C]}function u(e){const[t,r,n]=e,[s,i,o]=c([t,r,n],[[3.2409699419045226,-1.537383177570094,-.4986107602930034],[-.9692436362808796,1.8759675015077202,.04155505740717559],[.05563007969699366,-.20397695888897652,1.0569715142428786]]),[a,l,u]=[s,i,o].map((e=>e>.31308?1.055*Math.pow(e/100,1/2.4)*100-5.5:12.92*e));return[a,l,u]}function c(e,t){return t.map((t=>t.reduce(((t,r,n)=>t+e[n]*h*(r*h)/h/h),0)))}const h=1e8,[p,f,d]=[96.422,100,82.521],g=Math.pow(6,3)/Math.pow(29,3),m=Math.pow(29,3)/Math.pow(3,3);function w(t){const r=t.value,n=t.nodes.slice().filter((e=>"comment"!==e.type&&"space"!==e.type));let s=null;if("lab"===r?s=function(t){if(!v(t[0]))return null;if(!y(t[1]))return null;if(!y(t[2]))return null;const r={l:e.unit(t[0].value),lNode:t[0],a:e.unit(t[1].value),aNode:t[1],b:e.unit(t[2].value),bNode:t[2]};C(t[3])&&(r.slash=t[3]);(b(t[4])||S(t[4]))&&(r.alpha=t[4]);return r}(n):"lch"===r&&(s=function(t){if(!v(t[0]))return null;if(!y(t[1]))return null;if(!function(t){if(!t||"word"!==t.type)return!1;if(!O(t))return!1;const r=e.unit(t.value);if(!r)return!1;return!!r.number&&("deg"===r.unit||"grad"===r.unit||"rad"===r.unit||"turn"===r.unit||""===r.unit)}(t[2]))return null;const r={l:e.unit(t[0].value),lNode:t[0],c:e.unit(t[1].value),cNode:t[1],h:e.unit(t[2].value),hNode:t[2]};if(function(e){switch(e.unit){case"deg":return void(e.unit="");case"rad":return e.unit="",void(e.number=(180*parseFloat(e.number)/Math.PI).toString());case"grad":return e.unit="",void(e.number=(.9*parseFloat(e.number)).toString());case"turn":e.unit="",e.number=(360*parseFloat(e.number)).toString()}}(r.h),""!==r.h.unit)return null;C(t[3])&&(r.slash=t[3]);(b(t[4])||S(t[4])||function(e){return e&&"function"===e.type&&"var"===e.value}(t[4]))&&(r.alpha=t[4]);return r}(n)),!s)return;if(n.length>3&&(!s.slash||!s.alpha))return;t.value="rgb",function(t,r,n){if(!r||!n)return;if(t.value="rgba",r.value=",",r.before="",!function(t){if(!t||"word"!==t.type)return!1;if(!O(t))return!1;const r=e.unit(t.value);if(!r)return!1;return!!r.number}(n))return;const s=e.unit(n.value);if(!s)return;"%"===s.unit&&(s.number=String(parseFloat(s.number)/100),n.value=String(s.number))}(t,s.slash,s.alpha);const[i,l,u]=function(e){if(_(e))return[e.lNode,e.aNode,e.bNode];return[e.lNode,e.cNode,e.hNode]}(s),[c,h,p]=function(e){if(_(e))return[e.l,e.a,e.b];return[e.l,e.c,e.h]}(s),f=("lab"===r?o:a)([c.number,h.number,p.number].map((e=>parseFloat(e)))).map((e=>Math.max(Math.min(Math.round(2.55*e),255),0)));t.nodes.splice(t.nodes.indexOf(i)+1,0,{sourceIndex:0,sourceEndIndex:1,value:",",type:"div",before:"",after:""}),t.nodes.splice(t.nodes.indexOf(l)+1,0,{sourceIndex:0,sourceEndIndex:1,value:",",type:"div",before:"",after:""}),x(t.nodes,i,{...i,value:String(f[0])}),x(t.nodes,l,{...l,value:String(f[1])}),x(t.nodes,u,{...u,value:String(f[2])})}function y(t){if(!t||"word"!==t.type)return!1;if(!O(t))return!1;const r=e.unit(t.value);return!!r&&(!!r.number&&""===r.unit)}function v(t){if(!t||"word"!==t.type)return!1;if(!O(t))return!1;const r=e.unit(t.value);return!!r&&"%"===r.unit}function b(t){if(!t||"word"!==t.type)return!1;if(!O(t))return!1;const r=e.unit(t.value);return!!r&&("%"===r.unit||""===r.unit)}function S(e){return e&&"function"===e.type&&"calc"===e.value}function C(e){return e&&"div"===e.type&&"/"===e.value}function _(e){return void 0!==e.a}function x(e,t,r){const n=e.indexOf(t);e[n]=r}function O(t){if(!t||!t.value)return!1;try{return!1!==e.unit(t.value)}catch(e){return!1}}const A=t=>{const r="preserve"in Object(t)&&Boolean(t.preserve);return{postcssPlugin:"postcss-lab-function",Declaration:(t,{result:n,postcss:s})=>{if(r&&function(e){let t=e.parent;for(;t;)if("atrule"===t.type){if("supports"===t.name&&-1!==t.params.indexOf("(color: lab(0% 0 0)) and (color: lch(0% 0 0))"))return!0;t=t.parent}else t=t.parent;return!1}(t))return;const i=t.value;if(!/(^|[^\w-])(lab|lch)\(/i.test(i))return;let o;try{o=e(i)}catch(e){t.warn(n,`Failed to parse value '${i}' as a lab or hcl function. Leaving the original value intact.`)}if(void 0===o)return;o.walk((e=>{e.type&&"function"===e.type&&("lab"!==e.value&&"lch"!==e.value||w(e))}));const a=String(o);if(a!==i)if(r&&t.variable){const e=t.parent,r="(color: lab(0% 0 0)) and (color: lch(0% 0 0))",n=s.atRule({name:"supports",params:r,source:t.source}),i=e.clone();i.removeAll(),i.append(t.clone()),n.append(i);let o=e,l=e.next();for(;o&&l&&"atrule"===l.type&&"supports"===l.name&&l.params===r;)o=l,l=l.next();o.after(n),t.value=a}else r?t.cloneBefore({value:a}):t.value=a}}};var M;A.postcss=!0,A._labToSRgb=o,A._lchToSRgb=a,function(e){e.InvalidArguments="INVALID_ARGUMENTS"}(M||(M={}));var k={exports:{}};let E=t,L=!("NO_COLOR"in process.env||process.argv.includes("--no-color"))&&("FORCE_COLOR"in process.env||process.argv.includes("--color")||"win32"===process.platform||E.isatty(1)&&"dumb"!==process.env.TERM||"CI"in process.env),R=(e,t,r=e)=>n=>{let s=""+n,i=s.indexOf(t,e.length);return~i?e+P(s,t,r,i)+t:e+s+t},P=(e,t,r,n)=>{let s=e.substring(0,n)+r,i=e.substring(n+t.length),o=i.indexOf(t);return~o?s+P(i,t,r,o):s+i},I=(e=L)=>({isColorSupported:e,reset:e?e=>`[0m${e}[0m`:String,bold:e?R("[1m","[22m","[22m[1m"):String,dim:e?R("[2m","[22m","[22m[2m"):String,italic:e?R("[3m","[23m"):String,underline:e?R("[4m","[24m"):String,inverse:e?R("[7m","[27m"):String,hidden:e?R("[8m","[28m"):String,strikethrough:e?R("[9m","[29m"):String,black:e?R("[30m","[39m"):String,red:e?R("[31m","[39m"):String,green:e?R("[32m","[39m"):String,yellow:e?R("[33m","[39m"):String,blue:e?R("[34m","[39m"):String,magenta:e?R("[35m","[39m"):String,cyan:e?R("[36m","[39m"):String,white:e?R("[37m","[39m"):String,gray:e?R("[90m","[39m"):String,bgBlack:e?R("[40m","[49m"):String,bgRed:e?R("[41m","[49m"):String,bgGreen:e?R("[42m","[49m"):String,bgYellow:e?R("[43m","[49m"):String,bgBlue:e?R("[44m","[49m"):String,bgMagenta:e?R("[45m","[49m"):String,bgCyan:e?R("[46m","[49m"):String,bgWhite:e?R("[47m","[49m"):String});k.exports=I(),k.exports.createColors=I;const N="'".charCodeAt(0),F='"'.charCodeAt(0),j="\\".charCodeAt(0),U="/".charCodeAt(0),D="\n".charCodeAt(0),B=" ".charCodeAt(0),T="\f".charCodeAt(0),$="\t".charCodeAt(0),G="\r".charCodeAt(0),z="[".charCodeAt(0),W="]".charCodeAt(0),V="(".charCodeAt(0),J=")".charCodeAt(0),q="{".charCodeAt(0),Y="}".charCodeAt(0),Q=";".charCodeAt(0),Z="*".charCodeAt(0),H=":".charCodeAt(0),K="@".charCodeAt(0),X=/[\t\n\f\r "#'()/;[\\\]{}]/g,ee=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,te=/.[\n"'(/\\]/,re=/[\da-f]/i;var ne=function(e,t={}){let r,n,s,i,o,a,l,u,c,h,p=e.css.valueOf(),f=t.ignoreErrors,d=p.length,g=0,m=[],w=[];function y(t){throw e.error("Unclosed "+t,g)}return{back:function(e){w.push(e)},nextToken:function(e){if(w.length)return w.pop();if(g>=d)return;let t=!!e&&e.ignoreUnclosed;switch(r=p.charCodeAt(g),r){case D:case B:case $:case G:case T:n=g;do{n+=1,r=p.charCodeAt(n)}while(r===B||r===D||r===$||r===G||r===T);h=["space",p.slice(g,n)],g=n-1;break;case z:case W:case q:case Y:case H:case Q:case J:{let e=String.fromCharCode(r);h=[e,e,g];break}case V:if(u=m.length?m.pop()[1]:"",c=p.charCodeAt(g+1),"url"===u&&c!==N&&c!==F&&c!==B&&c!==D&&c!==$&&c!==T&&c!==G){n=g;do{if(a=!1,n=p.indexOf(")",n+1),-1===n){if(f||t){n=g;break}y("bracket")}for(l=n;p.charCodeAt(l-1)===j;)l-=1,a=!a}while(a);h=["brackets",p.slice(g,n+1),g,n],g=n}else n=p.indexOf(")",g+1),i=p.slice(g,n+1),-1===n||te.test(i)?h=["(","(",g]:(h=["brackets",i,g,n],g=n);break;case N:case F:s=r===N?"'":'"',n=g;do{if(a=!1,n=p.indexOf(s,n+1),-1===n){if(f||t){n=g+1;break}y("string")}for(l=n;p.charCodeAt(l-1)===j;)l-=1,a=!a}while(a);h=["string",p.slice(g,n+1),g,n],g=n;break;case K:X.lastIndex=g+1,X.test(p),n=0===X.lastIndex?p.length-1:X.lastIndex-2,h=["at-word",p.slice(g,n+1),g,n],g=n;break;case j:for(n=g,o=!0;p.charCodeAt(n+1)===j;)n+=1,o=!o;if(r=p.charCodeAt(n+1),o&&r!==U&&r!==B&&r!==D&&r!==$&&r!==G&&r!==T&&(n+=1,re.test(p.charAt(n)))){for(;re.test(p.charAt(n+1));)n+=1;p.charCodeAt(n+1)===B&&(n+=1)}h=["word",p.slice(g,n+1),g,n],g=n;break;default:r===U&&p.charCodeAt(g+1)===Z?(n=p.indexOf("*/",g+2)+1,0===n&&(f||t?n=p.length:y("comment")),h=["comment",p.slice(g,n+1),g,n],g=n):(ee.lastIndex=g+1,ee.test(p),n=0===ee.lastIndex?p.length-1:ee.lastIndex-2,h=["word",p.slice(g,n+1),g,n],m.push(h),g=n)}return g++,h},endOfFile:function(){return 0===w.length&&g>=d},position:function(){return g}}};let se,ie=k.exports,oe=ne;const ae={brackets:ie.cyan,"at-word":ie.cyan,comment:ie.gray,string:ie.green,class:ie.yellow,hash:ie.magenta,call:ie.cyan,"(":ie.cyan,")":ie.cyan,"{":ie.yellow,"}":ie.yellow,"[":ie.yellow,"]":ie.yellow,":":ie.yellow,";":ie.yellow};function le([e,t],r){if("word"===e){if("."===t[0])return"class";if("#"===t[0])return"hash"}if(!r.endOfFile()){let e=r.nextToken();if(r.back(e),"brackets"===e[0]||"("===e[0])return"call"}return e}function ue(e){let t=oe(new se(e),{ignoreErrors:!0}),r="";for(;!t.endOfFile();){let e=t.nextToken(),n=ae[le(e,t)];r+=n?e[1].split(/\r?\n/).map((e=>n(e))).join("\n"):e[1]}return r}ue.registerInput=function(e){se=e};var ce=ue;let he=k.exports,pe=ce;class fe extends Error{constructor(e,t,r,n,s,i){super(e),this.name="CssSyntaxError",this.reason=e,s&&(this.file=s),n&&(this.source=n),i&&(this.plugin=i),void 0!==t&&void 0!==r&&("number"==typeof t?(this.line=t,this.column=r):(this.line=t.line,this.column=t.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,fe)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",void 0!==this.line&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(e){if(!this.source)return"";let t=this.source;null==e&&(e=he.isColorSupported),pe&&e&&(t=pe(t));let r,n,s=t.split(/\r?\n/),i=Math.max(this.line-3,0),o=Math.min(this.line+2,s.length),a=String(o).length;if(e){let{bold:e,red:t,gray:s}=he.createColors(!0);r=r=>e(t(r)),n=e=>s(e)}else r=n=e=>e;return s.slice(i,o).map(((e,t)=>{let s=i+1+t,o=" "+(" "+s).slice(-a)+" | ";if(s===this.line){let t=n(o.replace(/\d/g," "))+e.slice(0,this.column-1).replace(/[^\t]/g," ");return r(">")+n(o)+e+"\n "+t+r("^")}return" "+n(o)+e})).join("\n")}toString(){let e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e}}var de=fe;fe.default=fe;var ge={};ge.isClean=Symbol("isClean"),ge.my=Symbol("my");const me={colon:": ",indent:" ",beforeDecl:"\n",beforeRule:"\n",beforeOpen:" ",beforeClose:"\n",beforeComment:"\n",after:"\n",emptyBody:"",commentLeft:" ",commentRight:" ",semicolon:!1};class we{constructor(e){this.builder=e}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}document(e){this.body(e)}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}comment(e){let t=this.raw(e,"left","commentLeft"),r=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+r+"*/",e)}decl(e,t){let r=this.raw(e,"between","colon"),n=e.prop+r+this.rawValue(e,"value");e.important&&(n+=e.raws.important||" !important"),t&&(n+=";"),this.builder(n,e)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}atrule(e,t){let r="@"+e.name,n=e.params?this.rawValue(e,"params"):"";if(void 0!==e.raws.afterName?r+=e.raws.afterName:n&&(r+=" "),e.nodes)this.block(e,r+n);else{let s=(e.raws.between||"")+(t?";":"");this.builder(r+n+s,e)}}body(e){let t=e.nodes.length-1;for(;t>0&&"comment"===e.nodes[t].type;)t-=1;let r=this.raw(e,"semicolon");for(let n=0;n<e.nodes.length;n++){let s=e.nodes[n],i=this.raw(s,"before");i&&this.builder(i),this.stringify(s,t!==n||r)}}block(e,t){let r,n=this.raw(e,"between","beforeOpen");this.builder(t+n+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),r=this.raw(e,"after")):r=this.raw(e,"after","emptyBody"),r&&this.builder(r),this.builder("}",e,"end")}raw(e,t,r){let n;if(r||(r=t),t&&(n=e.raws[t],void 0!==n))return n;let s=e.parent;if("before"===r){if(!s||"root"===s.type&&s.first===e)return"";if(s&&"document"===s.type)return""}if(!s)return me[r];let i=e.root();if(i.rawCache||(i.rawCache={}),void 0!==i.rawCache[r])return i.rawCache[r];if("before"===r||"after"===r)return this.beforeAfter(e,r);{let s="raw"+((o=r)[0].toUpperCase()+o.slice(1));this[s]?n=this[s](i,e):i.walk((e=>{if(n=e.raws[t],void 0!==n)return!1}))}var o;return void 0===n&&(n=me[r]),i.rawCache[r]=n,n}rawSemicolon(e){let t;return e.walk((e=>{if(e.nodes&&e.nodes.length&&"decl"===e.last.type&&(t=e.raws.semicolon,void 0!==t))return!1})),t}rawEmptyBody(e){let t;return e.walk((e=>{if(e.nodes&&0===e.nodes.length&&(t=e.raws.after,void 0!==t))return!1})),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk((r=>{let n=r.parent;if(n&&n!==e&&n.parent&&n.parent===e&&void 0!==r.raws.before){let e=r.raws.before.split("\n");return t=e[e.length-1],t=t.replace(/\S/g,""),!1}})),t}rawBeforeComment(e,t){let r;return e.walkComments((e=>{if(void 0!==e.raws.before)return r=e.raws.before,r.includes("\n")&&(r=r.replace(/[^\n]+$/,"")),!1})),void 0===r?r=this.raw(t,null,"beforeDecl"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeDecl(e,t){let r;return e.walkDecls((e=>{if(void 0!==e.raws.before)return r=e.raws.before,r.includes("\n")&&(r=r.replace(/[^\n]+$/,"")),!1})),void 0===r?r=this.raw(t,null,"beforeRule"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeRule(e){let t;return e.walk((r=>{if(r.nodes&&(r.parent!==e||e.first!==r)&&void 0!==r.raws.before)return t=r.raws.before,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1})),t&&(t=t.replace(/\S/g,"")),t}rawBeforeClose(e){let t;return e.walk((e=>{if(e.nodes&&e.nodes.length>0&&void 0!==e.raws.after)return t=e.raws.after,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1})),t&&(t=t.replace(/\S/g,"")),t}rawBeforeOpen(e){let t;return e.walk((e=>{if("decl"!==e.type&&(t=e.raws.between,void 0!==t))return!1})),t}rawColon(e){let t;return e.walkDecls((e=>{if(void 0!==e.raws.between)return t=e.raws.between.replace(/[^\s:]/g,""),!1})),t}beforeAfter(e,t){let r;r="decl"===e.type?this.raw(e,null,"beforeDecl"):"comment"===e.type?this.raw(e,null,"beforeComment"):"before"===t?this.raw(e,null,"beforeRule"):this.raw(e,null,"beforeClose");let n=e.parent,s=0;for(;n&&"root"!==n.type;)s+=1,n=n.parent;if(r.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<s;e++)r+=t}return r}rawValue(e,t){let r=e[t],n=e.raws[t];return n&&n.value===r?n.raw:r}}var ye=we;we.default=we;let ve=ye;function be(e,t){new ve(t).stringify(e)}var Se=be;be.default=be;let{isClean:Ce,my:_e}=ge,xe=de,Oe=ye,Ae=Se;function Me(e,t){let r=new e.constructor;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if("proxyCache"===n)continue;let s=e[n],i=typeof s;"parent"===n&&"object"===i?t&&(r[n]=t):"source"===n?r[n]=s:Array.isArray(s)?r[n]=s.map((e=>Me(e,r))):("object"===i&&null!==s&&(s=Me(s)),r[n]=s)}return r}class ke{constructor(e={}){this.raws={},this[Ce]=!1,this[_e]=!0;for(let t in e)if("nodes"===t){this.nodes=[];for(let r of e[t])"function"==typeof r.clone?this.append(r.clone()):this.append(r)}else this[t]=e[t]}error(e,t={}){if(this.source){let{start:r,end:n}=this.rangeBy(t);return this.source.input.error(e,{line:r.line,column:r.column},{line:n.line,column:n.column},t)}return new xe(e)}warn(e,t,r){let n={node:this};for(let e in r)n[e]=r[e];return e.warn(t,n)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}toString(e=Ae){e.stringify&&(e=e.stringify);let t="";return e(this,(e=>{t+=e})),t}assign(e={}){for(let t in e)this[t]=e[t];return this}clone(e={}){let t=Me(this);for(let r in e)t[r]=e[r];return t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}replaceWith(...e){if(this.parent){let t=this,r=!1;for(let n of e)n===this?r=!0:r?(this.parent.insertAfter(t,n),t=n):this.parent.insertBefore(t,n);r||this.remove()}return this}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}before(e){return this.parent.insertBefore(this,e),this}after(e){return this.parent.insertAfter(this,e),this}root(){let e=this;for(;e.parent&&"document"!==e.parent.type;)e=e.parent;return e}raw(e,t){return(new Oe).raw(this,e,t)}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}toJSON(e,t){let r={},n=null==t;t=t||new Map;let s=0;for(let e in this){if(!Object.prototype.hasOwnProperty.call(this,e))continue;if("parent"===e||"proxyCache"===e)continue;let n=this[e];if(Array.isArray(n))r[e]=n.map((e=>"object"==typeof e&&e.toJSON?e.toJSON(null,t):e));else if("object"==typeof n&&n.toJSON)r[e]=n.toJSON(null,t);else if("source"===e){let i=t.get(n.input);null==i&&(i=s,t.set(n.input,s),s++),r[e]={inputId:i,start:n.start,end:n.end}}else r[e]=n}return n&&(r.inputs=[...t.keys()].map((e=>e.toJSON()))),r}positionInside(e){let t=this.toString(),r=this.source.start.column,n=this.source.start.line;for(let s=0;s<e;s++)"\n"===t[s]?(r=1,n+=1):r+=1;return{line:n,column:r}}positionBy(e){let t=this.source.start;if(e.index)t=this.positionInside(e.index);else if(e.word){let r=this.toString().indexOf(e.word);-1!==r&&(t=this.positionInside(r))}return t}rangeBy(e){let t={line:this.source.start.line,column:this.source.start.column},r=this.source.end?{line:this.source.end.line,column:this.source.end.column+1}:{line:t.line,column:t.column+1};if(e.word){let n=this.toString().indexOf(e.word);-1!==n&&(t=this.positionInside(n),r=this.positionInside(n+e.word.length))}else e.start?t={line:e.start.line,column:e.start.column}:e.index&&(t=this.positionInside(e.index)),e.end?r={line:e.end.line,column:e.end.column}:e.endIndex?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<t.line||r.line===t.line&&r.column<=t.column)&&(r={line:t.line,column:t.column+1}),{start:t,end:r}}getProxyProcessor(){return{set:(e,t,r)=>(e[t]===r||(e[t]=r,"prop"!==t&&"value"!==t&&"name"!==t&&"params"!==t&&"important"!==t&&"text"!==t||e.markDirty()),!0),get:(e,t)=>"proxyOf"===t?e:"root"===t?()=>e.root().toProxy():e[t]}}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}markDirty(){if(this[Ce]){this[Ce]=!1;let e=this;for(;e=e.parent;)e[Ce]=!1}}get proxyOf(){return this}}var Ee=ke;ke.default=ke;let Le=Ee;class Re extends Le{constructor(e){e&&void 0!==e.value&&"string"!=typeof e.value&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||"$"===this.prop[0]}}var Pe=Re;Re.default=Re;var Ie={},Ne={},Fe={},je={},Ue="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");je.encode=function(e){if(0<=e&&e<Ue.length)return Ue[e];throw new TypeError("Must be between 0 and 63: "+e)},je.decode=function(e){return 65<=e&&e<=90?e-65:97<=e&&e<=122?e-97+26:48<=e&&e<=57?e-48+52:43==e?62:47==e?63:-1};var De=je;Fe.encode=function(e){var t,r="",n=function(e){return e<0?1+(-e<<1):0+(e<<1)}(e);do{t=31&n,(n>>>=5)>0&&(t|=32),r+=De.encode(t)}while(n>0);return r},Fe.decode=function(e,t,r){var n,s,i,o,a=e.length,l=0,u=0;do{if(t>=a)throw new Error("Expected more digits in base 64 VLQ value.");if(-1===(s=De.decode(e.charCodeAt(t++))))throw new Error("Invalid base64 digit: "+e.charAt(t-1));n=!!(32&s),l+=(s&=31)<<u,u+=5}while(n);r.value=(o=(i=l)>>1,1==(1&i)?-o:o),r.rest=t};var Be={};!function(e){e.getArg=function(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')};var t=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,r=/^data:.+\,.+$/;function n(e){var r=e.match(t);return r?{scheme:r[1],auth:r[2],host:r[3],port:r[4],path:r[5]}:null}function s(e){var t="";return e.scheme&&(t+=e.scheme+":"),t+="//",e.auth&&(t+=e.auth+"@"),e.host&&(t+=e.host),e.port&&(t+=":"+e.port),e.path&&(t+=e.path),t}e.urlParse=n,e.urlGenerate=s;var i,o,a=(i=function(t){var r=t,i=n(t);if(i){if(!i.path)return t;r=i.path}for(var o=e.isAbsolute(r),a=[],l=0,u=0;;){if(l=u,-1===(u=r.indexOf("/",l))){a.push(r.slice(l));break}for(a.push(r.slice(l,u));u<r.length&&"/"===r[u];)u++}var c,h=0;for(u=a.length-1;u>=0;u--)"."===(c=a[u])?a.splice(u,1):".."===c?h++:h>0&&(""===c?(a.splice(u+1,h),h=0):(a.splice(u,2),h--));return""===(r=a.join("/"))&&(r=o?"/":"."),i?(i.path=r,s(i)):r},o=[],function(e){for(var t=0;t<o.length;t++)if(o[t].input===e){var r=o[0];return o[0]=o[t],o[t]=r,o[0].result}var n=i(e);return o.unshift({input:e,result:n}),o.length>32&&o.pop(),n});function l(e,t){""===e&&(e="."),""===t&&(t=".");var i=n(t),o=n(e);if(o&&(e=o.path||"/"),i&&!i.scheme)return o&&(i.scheme=o.scheme),s(i);if(i||t.match(r))return t;if(o&&!o.host&&!o.path)return o.host=t,s(o);var l="/"===t.charAt(0)?t:a(e.replace(/\/+$/,"")+"/"+t);return o?(o.path=l,s(o)):l}e.normalize=a,e.join=l,e.isAbsolute=function(e){return"/"===e.charAt(0)||t.test(e)},e.relative=function(e,t){""===e&&(e="."),e=e.replace(/\/$/,"");for(var r=0;0!==t.indexOf(e+"/");){var n=e.lastIndexOf("/");if(n<0)return t;if((e=e.slice(0,n)).match(/^([^\/]+:\/)?\/*$/))return t;++r}return Array(r+1).join("../")+t.substr(e.length+1)};var u=!("__proto__"in Object.create(null));function c(e){return e}function h(e){if(!e)return!1;var t=e.length;if(t<9)return!1;if(95!==e.charCodeAt(t-1)||95!==e.charCodeAt(t-2)||111!==e.charCodeAt(t-3)||116!==e.charCodeAt(t-4)||111!==e.charCodeAt(t-5)||114!==e.charCodeAt(t-6)||112!==e.charCodeAt(t-7)||95!==e.charCodeAt(t-8)||95!==e.charCodeAt(t-9))return!1;for(var r=t-10;r>=0;r--)if(36!==e.charCodeAt(r))return!1;return!0}function p(e,t){return e===t?0:null===e?1:null===t?-1:e>t?1:-1}e.toSetString=u?c:function(e){return h(e)?"$"+e:e},e.fromSetString=u?c:function(e){return h(e)?e.slice(1):e},e.compareByOriginalPositions=function(e,t,r){var n=p(e.source,t.source);return 0!==n||0!==(n=e.originalLine-t.originalLine)||0!==(n=e.originalColumn-t.originalColumn)||r||0!==(n=e.generatedColumn-t.generatedColumn)||0!==(n=e.generatedLine-t.generatedLine)?n:p(e.name,t.name)},e.compareByOriginalPositionsNoSource=function(e,t,r){var n;return 0!==(n=e.originalLine-t.originalLine)||0!==(n=e.originalColumn-t.originalColumn)||r||0!==(n=e.generatedColumn-t.generatedColumn)||0!==(n=e.generatedLine-t.generatedLine)?n:p(e.name,t.name)},e.compareByGeneratedPositionsDeflated=function(e,t,r){var n=e.generatedLine-t.generatedLine;return 0!==n||0!==(n=e.generatedColumn-t.generatedColumn)||r||0!==(n=p(e.source,t.source))||0!==(n=e.originalLine-t.originalLine)||0!==(n=e.originalColumn-t.originalColumn)?n:p(e.name,t.name)},e.compareByGeneratedPositionsDeflatedNoLine=function(e,t,r){var n=e.generatedColumn-t.generatedColumn;return 0!==n||r||0!==(n=p(e.source,t.source))||0!==(n=e.originalLine-t.originalLine)||0!==(n=e.originalColumn-t.originalColumn)?n:p(e.name,t.name)},e.compareByGeneratedPositionsInflated=function(e,t){var r=e.generatedLine-t.generatedLine;return 0!==r||0!==(r=e.generatedColumn-t.generatedColumn)||0!==(r=p(e.source,t.source))||0!==(r=e.originalLine-t.originalLine)||0!==(r=e.originalColumn-t.originalColumn)?r:p(e.name,t.name)},e.parseSourceMapInput=function(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))},e.computeSourceURL=function(e,t,r){if(t=t||"",e&&("/"!==e[e.length-1]&&"/"!==t[0]&&(e+="/"),t=e+t),r){var i=n(r);if(!i)throw new Error("sourceMapURL could not be parsed");if(i.path){var o=i.path.lastIndexOf("/");o>=0&&(i.path=i.path.substring(0,o+1))}t=l(s(i),t)}return a(t)}}(Be);var Te={},$e=Be,Ge=Object.prototype.hasOwnProperty,ze="undefined"!=typeof Map;function We(){this._array=[],this._set=ze?new Map:Object.create(null)}We.fromArray=function(e,t){for(var r=new We,n=0,s=e.length;n<s;n++)r.add(e[n],t);return r},We.prototype.size=function(){return ze?this._set.size:Object.getOwnPropertyNames(this._set).length},We.prototype.add=function(e,t){var r=ze?e:$e.toSetString(e),n=ze?this.has(e):Ge.call(this._set,r),s=this._array.length;n&&!t||this._array.push(e),n||(ze?this._set.set(e,s):this._set[r]=s)},We.prototype.has=function(e){if(ze)return this._set.has(e);var t=$e.toSetString(e);return Ge.call(this._set,t)},We.prototype.indexOf=function(e){if(ze){var t=this._set.get(e);if(t>=0)return t}else{var r=$e.toSetString(e);if(Ge.call(this._set,r))return this._set[r]}throw new Error('"'+e+'" is not in the set.')},We.prototype.at=function(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)},We.prototype.toArray=function(){return this._array.slice()},Te.ArraySet=We;var Ve={},Je=Be;function qe(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}qe.prototype.unsortedForEach=function(e,t){this._array.forEach(e,t)},qe.prototype.add=function(e){var t,r,n,s,i,o;t=this._last,r=e,n=t.generatedLine,s=r.generatedLine,i=t.generatedColumn,o=r.generatedColumn,s>n||s==n&&o>=i||Je.compareByGeneratedPositionsInflated(t,r)<=0?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))},qe.prototype.toArray=function(){return this._sorted||(this._array.sort(Je.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},Ve.MappingList=qe;var Ye=Fe,Qe=Be,Ze=Te.ArraySet,He=Ve.MappingList;function Ke(e){e||(e={}),this._file=Qe.getArg(e,"file",null),this._sourceRoot=Qe.getArg(e,"sourceRoot",null),this._skipValidation=Qe.getArg(e,"skipValidation",!1),this._sources=new Ze,this._names=new Ze,this._mappings=new He,this._sourcesContents=null}Ke.prototype._version=3,Ke.fromSourceMap=function(e){var t=e.sourceRoot,r=new Ke({file:e.file,sourceRoot:t});return e.eachMapping((function(e){var n={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(n.source=e.source,null!=t&&(n.source=Qe.relative(t,n.source)),n.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(n.name=e.name)),r.addMapping(n)})),e.sources.forEach((function(n){var s=n;null!==t&&(s=Qe.relative(t,n)),r._sources.has(s)||r._sources.add(s);var i=e.sourceContentFor(n);null!=i&&r.setSourceContent(n,i)})),r},Ke.prototype.addMapping=function(e){var t=Qe.getArg(e,"generated"),r=Qe.getArg(e,"original",null),n=Qe.getArg(e,"source",null),s=Qe.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,n,s),null!=n&&(n=String(n),this._sources.has(n)||this._sources.add(n)),null!=s&&(s=String(s),this._names.has(s)||this._names.add(s)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:null!=r&&r.line,originalColumn:null!=r&&r.column,source:n,name:s})},Ke.prototype.setSourceContent=function(e,t){var r=e;null!=this._sourceRoot&&(r=Qe.relative(this._sourceRoot,r)),null!=t?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[Qe.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[Qe.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},Ke.prototype.applySourceMap=function(e,t,r){var n=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');n=e.file}var s=this._sourceRoot;null!=s&&(n=Qe.relative(s,n));var i=new Ze,o=new Ze;this._mappings.unsortedForEach((function(t){if(t.source===n&&null!=t.originalLine){var a=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=a.source&&(t.source=a.source,null!=r&&(t.source=Qe.join(r,t.source)),null!=s&&(t.source=Qe.relative(s,t.source)),t.originalLine=a.line,t.originalColumn=a.column,null!=a.name&&(t.name=a.name))}var l=t.source;null==l||i.has(l)||i.add(l);var u=t.name;null==u||o.has(u)||o.add(u)}),this),this._sources=i,this._names=o,e.sources.forEach((function(t){var n=e.sourceContentFor(t);null!=n&&(null!=r&&(t=Qe.join(r,t)),null!=s&&(t=Qe.relative(s,t)),this.setSourceContent(t,n))}),this)},Ke.prototype._validateMapping=function(e,t,r,n){if(t&&"number"!=typeof t.line&&"number"!=typeof t.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if((!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0)||t||r||n)&&!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:n}))},Ke.prototype._serializeMappings=function(){for(var e,t,r,n,s=0,i=1,o=0,a=0,l=0,u=0,c="",h=this._mappings.toArray(),p=0,f=h.length;p<f;p++){if(e="",(t=h[p]).generatedLine!==i)for(s=0;t.generatedLine!==i;)e+=";",i++;else if(p>0){if(!Qe.compareByGeneratedPositionsInflated(t,h[p-1]))continue;e+=","}e+=Ye.encode(t.generatedColumn-s),s=t.generatedColumn,null!=t.source&&(n=this._sources.indexOf(t.source),e+=Ye.encode(n-u),u=n,e+=Ye.encode(t.originalLine-1-a),a=t.originalLine-1,e+=Ye.encode(t.originalColumn-o),o=t.originalColumn,null!=t.name&&(r=this._names.indexOf(t.name),e+=Ye.encode(r-l),l=r)),c+=e}return c},Ke.prototype._generateSourcesContent=function(e,t){return e.map((function(e){if(!this._sourcesContents)return null;null!=t&&(e=Qe.relative(t,e));var r=Qe.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null}),this)},Ke.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e},Ke.prototype.toString=function(){return JSON.stringify(this.toJSON())},Ne.SourceMapGenerator=Ke;var Xe={},et={};!function(e){function t(r,n,s,i,o,a){var l=Math.floor((n-r)/2)+r,u=o(s,i[l],!0);return 0===u?l:u>0?n-l>1?t(l,n,s,i,o,a):a==e.LEAST_UPPER_BOUND?n<i.length?n:-1:l:l-r>1?t(r,l,s,i,o,a):a==e.LEAST_UPPER_BOUND?l:r<0?-1:r}e.GREATEST_LOWER_BOUND=1,e.LEAST_UPPER_BOUND=2,e.search=function(r,n,s,i){if(0===n.length)return-1;var o=t(-1,n.length,r,n,s,i||e.GREATEST_LOWER_BOUND);if(o<0)return-1;for(;o-1>=0&&0===s(n[o],n[o-1],!0);)--o;return o}}(et);var tt={};function rt(e){function t(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}return function e(r,n,s,i){if(s<i){var o=s-1;t(r,(c=s,h=i,Math.round(c+Math.random()*(h-c))),i);for(var a=r[i],l=s;l<i;l++)n(r[l],a,!1)<=0&&t(r,o+=1,l);t(r,o+1,l);var u=o+1;e(r,n,s,u-1),e(r,n,u+1,i)}var c,h}}let nt=new WeakMap;tt.quickSort=function(e,t,r=0){let n=nt.get(t);void 0===n&&(n=function(e){let t=rt.toString();return new Function(`return ${t}`)()(e)}(t),nt.set(t,n)),n(e,t,r,e.length-1)};var st=Be,it=et,ot=Te.ArraySet,at=Fe,lt=tt.quickSort;function ut(e,t){var r=e;return"string"==typeof e&&(r=st.parseSourceMapInput(e)),null!=r.sections?new dt(r,t):new ct(r,t)}function ct(e,t){var r=e;"string"==typeof e&&(r=st.parseSourceMapInput(e));var n=st.getArg(r,"version"),s=st.getArg(r,"sources"),i=st.getArg(r,"names",[]),o=st.getArg(r,"sourceRoot",null),a=st.getArg(r,"sourcesContent",null),l=st.getArg(r,"mappings"),u=st.getArg(r,"file",null);if(n!=this._version)throw new Error("Unsupported version: "+n);o&&(o=st.normalize(o)),s=s.map(String).map(st.normalize).map((function(e){return o&&st.isAbsolute(o)&&st.isAbsolute(e)?st.relative(o,e):e})),this._names=ot.fromArray(i.map(String),!0),this._sources=ot.fromArray(s,!0),this._absoluteSources=this._sources.toArray().map((function(e){return st.computeSourceURL(o,e,t)})),this.sourceRoot=o,this.sourcesContent=a,this._mappings=l,this._sourceMapURL=t,this.file=u}function ht(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}ut.fromSourceMap=function(e,t){return ct.fromSourceMap(e,t)},ut.prototype._version=3,ut.prototype.__generatedMappings=null,Object.defineProperty(ut.prototype,"_generatedMappings",{configurable:!0,enumerable:!0,get:function(){return this.__generatedMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappings}}),ut.prototype.__originalMappings=null,Object.defineProperty(ut.prototype,"_originalMappings",{configurable:!0,enumerable:!0,get:function(){return this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappings}}),ut.prototype._charIsMappingSeparator=function(e,t){var r=e.charAt(t);return";"===r||","===r},ut.prototype._parseMappings=function(e,t){throw new Error("Subclasses must implement _parseMappings")},ut.GENERATED_ORDER=1,ut.ORIGINAL_ORDER=2,ut.GREATEST_LOWER_BOUND=1,ut.LEAST_UPPER_BOUND=2,ut.prototype.eachMapping=function(e,t,r){var n,s=t||null;switch(r||ut.GENERATED_ORDER){case ut.GENERATED_ORDER:n=this._generatedMappings;break;case ut.ORIGINAL_ORDER:n=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}for(var i=this.sourceRoot,o=e.bind(s),a=this._names,l=this._sources,u=this._sourceMapURL,c=0,h=n.length;c<h;c++){var p=n[c],f=null===p.source?null:l.at(p.source);o({source:f=st.computeSourceURL(i,f,u),generatedLine:p.generatedLine,generatedColumn:p.generatedColumn,originalLine:p.originalLine,originalColumn:p.originalColumn,name:null===p.name?null:a.at(p.name)})}},ut.prototype.allGeneratedPositionsFor=function(e){var t=st.getArg(e,"line"),r={source:st.getArg(e,"source"),originalLine:t,originalColumn:st.getArg(e,"column",0)};if(r.source=this._findSourceIndex(r.source),r.source<0)return[];var n=[],s=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",st.compareByOriginalPositions,it.LEAST_UPPER_BOUND);if(s>=0){var i=this._originalMappings[s];if(void 0===e.column)for(var o=i.originalLine;i&&i.originalLine===o;)n.push({line:st.getArg(i,"generatedLine",null),column:st.getArg(i,"generatedColumn",null),lastColumn:st.getArg(i,"lastGeneratedColumn",null)}),i=this._originalMappings[++s];else for(var a=i.originalColumn;i&&i.originalLine===t&&i.originalColumn==a;)n.push({line:st.getArg(i,"generatedLine",null),column:st.getArg(i,"generatedColumn",null),lastColumn:st.getArg(i,"lastGeneratedColumn",null)}),i=this._originalMappings[++s]}return n},Xe.SourceMapConsumer=ut,ct.prototype=Object.create(ut.prototype),ct.prototype.consumer=ut,ct.prototype._findSourceIndex=function(e){var t,r=e;if(null!=this.sourceRoot&&(r=st.relative(this.sourceRoot,r)),this._sources.has(r))return this._sources.indexOf(r);for(t=0;t<this._absoluteSources.length;++t)if(this._absoluteSources[t]==e)return t;return-1},ct.fromSourceMap=function(e,t){var r=Object.create(ct.prototype),n=r._names=ot.fromArray(e._names.toArray(),!0),s=r._sources=ot.fromArray(e._sources.toArray(),!0);r.sourceRoot=e._sourceRoot,r.sourcesContent=e._generateSourcesContent(r._sources.toArray(),r.sourceRoot),r.file=e._file,r._sourceMapURL=t,r._absoluteSources=r._sources.toArray().map((function(e){return st.computeSourceURL(r.sourceRoot,e,t)}));for(var i=e._mappings.toArray().slice(),o=r.__generatedMappings=[],a=r.__originalMappings=[],l=0,u=i.length;l<u;l++){var c=i[l],h=new ht;h.generatedLine=c.generatedLine,h.generatedColumn=c.generatedColumn,c.source&&(h.source=s.indexOf(c.source),h.originalLine=c.originalLine,h.originalColumn=c.originalColumn,c.name&&(h.name=n.indexOf(c.name)),a.push(h)),o.push(h)}return lt(r.__originalMappings,st.compareByOriginalPositions),r},ct.prototype._version=3,Object.defineProperty(ct.prototype,"sources",{get:function(){return this._absoluteSources.slice()}});const pt=st.compareByGeneratedPositionsDeflatedNoLine;function ft(e,t){let r=e.length,n=e.length-t;if(!(n<=1))if(2==n){let r=e[t],n=e[t+1];pt(r,n)>0&&(e[t]=n,e[t+1]=r)}else if(n<20)for(let n=t;n<r;n++)for(let r=n;r>t;r--){let t=e[r-1],n=e[r];if(pt(t,n)<=0)break;e[r-1]=n,e[r]=t}else lt(e,pt,t)}function dt(e,t){var r=e;"string"==typeof e&&(r=st.parseSourceMapInput(e));var n=st.getArg(r,"version"),s=st.getArg(r,"sections");if(n!=this._version)throw new Error("Unsupported version: "+n);this._sources=new ot,this._names=new ot;var i={line:-1,column:0};this._sections=s.map((function(e){if(e.url)throw new Error("Support for url field in sections not implemented.");var r=st.getArg(e,"offset"),n=st.getArg(r,"line"),s=st.getArg(r,"column");if(n<i.line||n===i.line&&s<i.column)throw new Error("Section offsets must be ordered and non-overlapping.");return i=r,{generatedOffset:{generatedLine:n+1,generatedColumn:s+1},consumer:new ut(st.getArg(e,"map"),t)}}))}ct.prototype._parseMappings=function(e,t){var r,n,s,i,o=1,a=0,l=0,u=0,c=0,h=0,p=e.length,f=0,d={},g=[],m=[];let w=0;for(;f<p;)if(";"===e.charAt(f))o++,f++,a=0,ft(m,w),w=m.length;else if(","===e.charAt(f))f++;else{for((r=new ht).generatedLine=o,s=f;s<p&&!this._charIsMappingSeparator(e,s);s++);for(e.slice(f,s),n=[];f<s;)at.decode(e,f,d),i=d.value,f=d.rest,n.push(i);if(2===n.length)throw new Error("Found a source, but no line and column");if(3===n.length)throw new Error("Found a source and line, but no column");if(r.generatedColumn=a+n[0],a=r.generatedColumn,n.length>1&&(r.source=c+n[1],c+=n[1],r.originalLine=l+n[2],l=r.originalLine,r.originalLine+=1,r.originalColumn=u+n[3],u=r.originalColumn,n.length>4&&(r.name=h+n[4],h+=n[4])),m.push(r),"number"==typeof r.originalLine){let e=r.source;for(;g.length<=e;)g.push(null);null===g[e]&&(g[e]=[]),g[e].push(r)}}ft(m,w),this.__generatedMappings=m;for(var y=0;y<g.length;y++)null!=g[y]&<(g[y],st.compareByOriginalPositionsNoSource);this.__originalMappings=[].concat(...g)},ct.prototype._findMapping=function(e,t,r,n,s,i){if(e[r]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[r]);if(e[n]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[n]);return it.search(e,t,s,i)},ct.prototype.computeColumnSpans=function(){for(var e=0;e<this._generatedMappings.length;++e){var t=this._generatedMappings[e];if(e+1<this._generatedMappings.length){var r=this._generatedMappings[e+1];if(t.generatedLine===r.generatedLine){t.lastGeneratedColumn=r.generatedColumn-1;continue}}t.lastGeneratedColumn=1/0}},ct.prototype.originalPositionFor=function(e){var t={generatedLine:st.getArg(e,"line"),generatedColumn:st.getArg(e,"column")},r=this._findMapping(t,this._generatedMappings,"generatedLine","generatedColumn",st.compareByGeneratedPositionsDeflated,st.getArg(e,"bias",ut.GREATEST_LOWER_BOUND));if(r>=0){var n=this._generatedMappings[r];if(n.generatedLine===t.generatedLine){var s=st.getArg(n,"source",null);null!==s&&(s=this._sources.at(s),s=st.computeSourceURL(this.sourceRoot,s,this._sourceMapURL));var i=st.getArg(n,"name",null);return null!==i&&(i=this._names.at(i)),{source:s,line:st.getArg(n,"originalLine",null),column:st.getArg(n,"originalColumn",null),name:i}}}return{source:null,line:null,column:null,name:null}},ct.prototype.hasContentsOfAllSources=function(){return!!this.sourcesContent&&(this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some((function(e){return null==e})))},ct.prototype.sourceContentFor=function(e,t){if(!this.sourcesContent)return null;var r=this._findSourceIndex(e);if(r>=0)return this.sourcesContent[r];var n,s=e;if(null!=this.sourceRoot&&(s=st.relative(this.sourceRoot,s)),null!=this.sourceRoot&&(n=st.urlParse(this.sourceRoot))){var i=s.replace(/^file:\/\//,"");if("file"==n.scheme&&this._sources.has(i))return this.sourcesContent[this._sources.indexOf(i)];if((!n.path||"/"==n.path)&&this._sources.has("/"+s))return this.sourcesContent[this._sources.indexOf("/"+s)]}if(t)return null;throw new Error('"'+s+'" is not in the SourceMap.')},ct.prototype.generatedPositionFor=function(e){var t=st.getArg(e,"source");if((t=this._findSourceIndex(t))<0)return{line:null,column:null,lastColumn:null};var r={source:t,originalLine:st.getArg(e,"line"),originalColumn:st.getArg(e,"column")},n=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",st.compareByOriginalPositions,st.getArg(e,"bias",ut.GREATEST_LOWER_BOUND));if(n>=0){var s=this._originalMappings[n];if(s.source===r.source)return{line:st.getArg(s,"generatedLine",null),column:st.getArg(s,"generatedColumn",null),lastColumn:st.getArg(s,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},Xe.BasicSourceMapConsumer=ct,dt.prototype=Object.create(ut.prototype),dt.prototype.constructor=ut,dt.prototype._version=3,Object.defineProperty(dt.prototype,"sources",{get:function(){for(var e=[],t=0;t<this._sections.length;t++)for(var r=0;r<this._sections[t].consumer.sources.length;r++)e.push(this._sections[t].consumer.sources[r]);return e}}),dt.prototype.originalPositionFor=function(e){var t={generatedLine:st.getArg(e,"line"),generatedColumn:st.getArg(e,"column")},r=it.search(t,this._sections,(function(e,t){var r=e.generatedLine-t.generatedOffset.generatedLine;return r||e.generatedColumn-t.generatedOffset.generatedColumn})),n=this._sections[r];return n?n.consumer.originalPositionFor({line:t.generatedLine-(n.generatedOffset.generatedLine-1),column:t.generatedColumn-(n.generatedOffset.generatedLine===t.generatedLine?n.generatedOffset.generatedColumn-1:0),bias:e.bias}):{source:null,line:null,column:null,name:null}},dt.prototype.hasContentsOfAllSources=function(){return this._sections.every((function(e){return e.consumer.hasContentsOfAllSources()}))},dt.prototype.sourceContentFor=function(e,t){for(var r=0;r<this._sections.length;r++){var n=this._sections[r].consumer.sourceContentFor(e,!0);if(n)return n}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')},dt.prototype.generatedPositionFor=function(e){for(var t=0;t<this._sections.length;t++){var r=this._sections[t];if(-1!==r.consumer._findSourceIndex(st.getArg(e,"source"))){var n=r.consumer.generatedPositionFor(e);if(n)return{line:n.line+(r.generatedOffset.generatedLine-1),column:n.column+(r.generatedOffset.generatedLine===n.line?r.generatedOffset.generatedColumn-1:0)}}}return{line:null,column:null}},dt.prototype._parseMappings=function(e,t){this.__generatedMappings=[],this.__originalMappings=[];for(var r=0;r<this._sections.length;r++)for(var n=this._sections[r],s=n.consumer._generatedMappings,i=0;i<s.length;i++){var o=s[i],a=n.consumer._sources.at(o.source);a=st.computeSourceURL(n.consumer.sourceRoot,a,this._sourceMapURL),this._sources.add(a),a=this._sources.indexOf(a);var l=null;o.name&&(l=n.consumer._names.at(o.name),this._names.add(l),l=this._names.indexOf(l));var u={source:a,generatedLine:o.generatedLine+(n.generatedOffset.generatedLine-1),generatedColumn:o.generatedColumn+(n.generatedOffset.generatedLine===o.generatedLine?n.generatedOffset.generatedColumn-1:0),originalLine:o.originalLine,originalColumn:o.originalColumn,name:l};this.__generatedMappings.push(u),"number"==typeof u.originalLine&&this.__originalMappings.push(u)}lt(this.__generatedMappings,st.compareByGeneratedPositionsDeflated),lt(this.__originalMappings,st.compareByOriginalPositions)},Xe.IndexedSourceMapConsumer=dt;var gt={},mt=Ne.SourceMapGenerator,wt=Be,yt=/(\r?\n)/,vt="$$$isSourceNode$$$";function bt(e,t,r,n,s){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==r?null:r,this.name=null==s?null:s,this[vt]=!0,null!=n&&this.add(n)}bt.fromStringWithSourceMap=function(e,t,r){var n=new bt,s=e.split(yt),i=0,o=function(){return e()+(e()||"");function e(){return i<s.length?s[i++]:void 0}},a=1,l=0,u=null;return t.eachMapping((function(e){if(null!==u){if(!(a<e.generatedLine)){var t=(r=s[i]||"").substr(0,e.generatedColumn-l);return s[i]=r.substr(e.generatedColumn-l),l=e.generatedColumn,c(u,t),void(u=e)}c(u,o()),a++,l=0}for(;a<e.generatedLine;)n.add(o()),a++;if(l<e.generatedColumn){var r=s[i]||"";n.add(r.substr(0,e.generatedColumn)),s[i]=r.substr(e.generatedColumn),l=e.generatedColumn}u=e}),this),i<s.length&&(u&&c(u,o()),n.add(s.splice(i).join(""))),t.sources.forEach((function(e){var s=t.sourceContentFor(e);null!=s&&(null!=r&&(e=wt.join(r,e)),n.setSourceContent(e,s))})),n;function c(e,t){if(null===e||void 0===e.source)n.add(t);else{var s=r?wt.join(r,e.source):e.source;n.add(new bt(e.originalLine,e.originalColumn,s,t,e.name))}}},bt.prototype.add=function(e){if(Array.isArray(e))e.forEach((function(e){this.add(e)}),this);else{if(!e[vt]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);e&&this.children.push(e)}return this},bt.prototype.prepend=function(e){if(Array.isArray(e))for(var t=e.length-1;t>=0;t--)this.prepend(e[t]);else{if(!e[vt]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this},bt.prototype.walk=function(e){for(var t,r=0,n=this.children.length;r<n;r++)(t=this.children[r])[vt]?t.walk(e):""!==t&&e(t,{source:this.source,line:this.line,column:this.column,name:this.name})},bt.prototype.join=function(e){var t,r,n=this.children.length;if(n>0){for(t=[],r=0;r<n-1;r++)t.push(this.children[r]),t.push(e);t.push(this.children[r]),this.children=t}return this},bt.prototype.replaceRight=function(e,t){var r=this.children[this.children.length-1];return r[vt]?r.replaceRight(e,t):"string"==typeof r?this.children[this.children.length-1]=r.replace(e,t):this.children.push("".replace(e,t)),this},bt.prototype.setSourceContent=function(e,t){this.sourceContents[wt.toSetString(e)]=t},bt.prototype.walkSourceContents=function(e){for(var t=0,r=this.children.length;t<r;t++)this.children[t][vt]&&this.children[t].walkSourceContents(e);var n=Object.keys(this.sourceContents);for(t=0,r=n.length;t<r;t++)e(wt.fromSetString(n[t]),this.sourceContents[n[t]])},bt.prototype.toString=function(){var e="";return this.walk((function(t){e+=t})),e},bt.prototype.toStringWithSourceMap=function(e){var t={code:"",line:1,column:0},r=new mt(e),n=!1,s=null,i=null,o=null,a=null;return this.walk((function(e,l){t.code+=e,null!==l.source&&null!==l.line&&null!==l.column?(s===l.source&&i===l.line&&o===l.column&&a===l.name||r.addMapping({source:l.source,original:{line:l.line,column:l.column},generated:{line:t.line,column:t.column},name:l.name}),s=l.source,i=l.line,o=l.column,a=l.name,n=!0):n&&(r.addMapping({generated:{line:t.line,column:t.column}}),s=null,n=!1);for(var u=0,c=e.length;u<c;u++)10===e.charCodeAt(u)?(t.line++,t.column=0,u+1===c?(s=null,n=!1):n&&r.addMapping({source:l.source,original:{line:l.line,column:l.column},generated:{line:t.line,column:t.column},name:l.name})):t.column++})),this.walkSourceContents((function(e,t){r.setSourceContent(e,t)})),{code:t.code,map:r}},gt.SourceNode=bt,Ie.SourceMapGenerator=Ne.SourceMapGenerator,Ie.SourceMapConsumer=Xe.SourceMapConsumer,Ie.SourceNode=gt.SourceNode;var St={nanoid:(e=21)=>{let t="",r=e;for(;r--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},customAlphabet:(e,t)=>()=>{let r="",n=t;for(;n--;)r+=e[Math.random()*e.length|0];return r}};let{SourceMapConsumer:Ct,SourceMapGenerator:_t}=Ie,{existsSync:xt,readFileSync:Ot}=s,{dirname:At,join:Mt}=r;class kt{constructor(e,t){if(!1===t.map)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let r=t.map?t.map.prev:void 0,n=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=At(this.mapFile)),n&&(this.text=n)}consumer(){return this.consumerCache||(this.consumerCache=new Ct(this.text)),this.consumerCache}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}startWith(e,t){return!!e&&e.substr(0,t.length)===t}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let r=e.lastIndexOf(t.pop()),n=e.indexOf("*/",r);r>-1&&n>-1&&(this.annotation=this.getAnnotationURL(e.substring(r,n)))}decodeInline(e){if(/^data:application\/json;charset=utf-?8,/.test(e)||/^data:application\/json,/.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(/^data:application\/json;charset=utf-?8;base64,/.test(e)||/^data:application\/json;base64,/.test(e))return t=e.substr(RegExp.lastMatch.length),Buffer?Buffer.from(t,"base64").toString():window.atob(t);var t;let r=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+r)}loadFile(e){if(this.root=At(e),xt(e))return this.mapFile=e,Ot(e,"utf-8").toString().trim()}loadMap(e,t){if(!1===t)return!1;if(t){if("string"==typeof t)return t;if("function"!=typeof t){if(t instanceof Ct)return _t.fromSourceMap(t).toString();if(t instanceof _t)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}{let r=t(e);if(r){let e=this.loadFile(r);if(!e)throw new Error("Unable to load previous source map: "+r.toString());return e}}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let t=this.annotation;return e&&(t=Mt(At(e),t)),this.loadFile(t)}}}isMap(e){return"object"==typeof e&&("string"==typeof e.mappings||"string"==typeof e._mappings||Array.isArray(e.sections))}}var Et=kt;kt.default=kt;let{SourceMapConsumer:Lt,SourceMapGenerator:Rt}=Ie,{fileURLToPath:Pt,pathToFileURL:It}=n,{resolve:Nt,isAbsolute:Ft}=r,{nanoid:jt}=St,Ut=ce,Dt=de,Bt=Et,Tt=Symbol("fromOffsetCache"),$t=Boolean(Lt&&Rt),Gt=Boolean(Nt&&Ft);class zt{constructor(e,t={}){if(null==e||"object"==typeof e&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),"\ufeff"===this.css[0]||""===this.css[0]?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!Gt||/^\w+:\/\//.test(t.from)||Ft(t.from)?this.file=t.from:this.file=Nt(t.from)),Gt&&$t){let e=new Bt(this.css,t);if(e.text){this.map=e;let t=e.consumer().file;!this.file&&t&&(this.file=this.mapResolve(t))}}this.file||(this.id="<input css "+jt(6)+">"),this.map&&(this.map.file=this.from)}fromOffset(e){let t,r;if(this[Tt])r=this[Tt];else{let e=this.css.split("\n");r=new Array(e.length);let t=0;for(let n=0,s=e.length;n<s;n++)r[n]=t,t+=e[n].length+1;this[Tt]=r}t=r[r.length-1];let n=0;if(e>=t)n=r.length-1;else{let t,s=r.length-2;for(;n<s;)if(t=n+(s-n>>1),e<r[t])s=t-1;else{if(!(e>=r[t+1])){n=t;break}n=t+1}}return{line:n+1,col:e-r[n]+1}}error(e,t,r,n={}){let s,i,o;if(t&&"object"==typeof t){let e=t,n=r;if("number"==typeof t.offset){let n=this.fromOffset(e.offset);t=n.line,r=n.col}else t=e.line,r=e.column;if("number"==typeof n.offset){let e=this.fromOffset(n.offset);i=e.line,o=e.col}else i=n.line,o=n.column}else if(!r){let e=this.fromOffset(t);t=e.line,r=e.col}let a=this.origin(t,r,i,o);return s=a?new Dt(e,void 0===a.endLine?a.line:{line:a.line,column:a.column},void 0===a.endLine?a.column:{line:a.endLine,column:a.endColumn},a.source,a.file,n.plugin):new Dt(e,void 0===i?t:{line:t,column:r},void 0===i?r:{line:i,column:o},this.css,this.file,n.plugin),s.input={line:t,column:r,endLine:i,endColumn:o,source:this.css},this.file&&(It&&(s.input.url=It(this.file).toString()),s.input.file=this.file),s}origin(e,t,r,n){if(!this.map)return!1;let s,i,o=this.map.consumer(),a=o.originalPositionFor({line:e,column:t});if(!a.source)return!1;"number"==typeof r&&(s=o.originalPositionFor({line:r,column:n})),i=Ft(a.source)?It(a.source):new URL(a.source,this.map.consumer().sourceRoot||It(this.map.mapFile));let l={url:i.toString(),line:a.line,column:a.column,endLine:s&&s.line,endColumn:s&&s.column};if("file:"===i.protocol){if(!Pt)throw new Error("file: protocol is not available in this PostCSS build");l.file=Pt(i)}let u=o.sourceContentFor(a.source);return u&&(l.source=u),l}mapResolve(e){return/^\w+:\/\//.test(e)?e:Nt(this.map.consumer().sourceRoot||this.map.root||".",e)}get from(){return this.file||this.id}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])null!=this[t]&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}}var Wt=zt;zt.default=zt,Ut&&Ut.registerInput&&Ut.registerInput(zt);let{SourceMapConsumer:Vt,SourceMapGenerator:Jt}=Ie,{dirname:qt,resolve:Yt,relative:Qt,sep:Zt}=r,{pathToFileURL:Ht}=n,Kt=Wt,Xt=Boolean(Vt&&Jt),er=Boolean(qt&&Yt&&Qt&&Zt);var tr=class{constructor(e,t,r,n){this.stringify=e,this.mapOpts=r.map||{},this.root=t,this.opts=r,this.css=n}isMap(){return void 0!==this.opts.map?!!this.opts.map:this.previous().length>0}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk((e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}}));else{let e=new Kt(this.css,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}isInline(){if(void 0!==this.mapOpts.inline)return this.mapOpts.inline;let e=this.mapOpts.annotation;return(void 0===e||!0===e)&&(!this.previous().length||this.previous().some((e=>e.inline)))}isSourcesContent(){return void 0!==this.mapOpts.sourcesContent?this.mapOpts.sourcesContent:!this.previous().length||this.previous().some((e=>e.withContent()))}clearAnnotation(){if(!1!==this.mapOpts.annotation)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],"comment"===e.type&&0===e.text.indexOf("# sourceMappingURL=")&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/(\n)?\/\*#[\S\s]*?\*\/$/gm,""))}setSourcesContent(){let e={};if(this.root)this.root.walk((t=>{if(t.source){let r=t.source.input.from;r&&!e[r]&&(e[r]=!0,this.map.setSourceContent(this.toUrl(this.path(r)),t.source.input.css))}}));else if(this.css){let e=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(e,this.css)}}applyPrevMaps(){for(let e of this.previous()){let t,r=this.toUrl(this.path(e.file)),n=e.root||qt(e.file);!1===this.mapOpts.sourcesContent?(t=new Vt(e.text),t.sourcesContent&&(t.sourcesContent=t.sourcesContent.map((()=>null)))):t=e.consumer(),this.map.applySourceMap(t,r,this.toUrl(this.path(n)))}}isAnnotation(){return!!this.isInline()||(void 0!==this.mapOpts.annotation?this.mapOpts.annotation:!this.previous().length||this.previous().some((e=>e.annotation)))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}addAnnotation(){let e;e=this.isInline()?"data:application/json;base64,"+this.toBase64(this.map.toString()):"string"==typeof this.mapOpts.annotation?this.mapOpts.annotation:"function"==typeof this.mapOpts.annotation?this.mapOpts.annotation(this.opts.to,this.root):this.outputFile()+".map";let t="\n";this.css.includes("\r\n")&&(t="\r\n"),this.css+=t+"/*# sourceMappingURL="+e+" */"}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}generateMap(){if(this.root)this.generateString();else if(1===this.previous().length){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=Jt.fromSourceMap(e)}else this.map=new Jt({file:this.outputFile()}),this.map.addMapping({source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>",generated:{line:1,column:0},original:{line:1,column:0}});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}path(e){if(0===e.indexOf("<"))return e;if(/^\w+:\/\//.test(e))return e;if(this.mapOpts.absolute)return e;let t=this.opts.to?qt(this.opts.to):".";return"string"==typeof this.mapOpts.annotation&&(t=qt(Yt(t,this.mapOpts.annotation))),e=Qt(t,e)}toUrl(e){return"\\"===Zt&&(e=e.replace(/\\/g,"/")),encodeURI(e).replace(/[#?]/g,encodeURIComponent)}sourcePath(e){if(this.mapOpts.from)return this.toUrl(this.mapOpts.from);if(this.mapOpts.absolute){if(Ht)return Ht(e.source.input.from).toString();throw new Error("`map.absolute` option is not available in this PostCSS build")}return this.toUrl(this.path(e.source.input.from))}generateString(){this.css="",this.map=new Jt({file:this.outputFile()});let e,t,r=1,n=1,s="<no source>",i={source:"",generated:{line:0,column:0},original:{line:0,column:0}};this.stringify(this.root,((o,a,l)=>{if(this.css+=o,a&&"end"!==l&&(i.generated.line=r,i.generated.column=n-1,a.source&&a.source.start?(i.source=this.sourcePath(a),i.original.line=a.source.start.line,i.original.column=a.source.start.column-1,this.map.addMapping(i)):(i.source=s,i.original.line=1,i.original.column=0,this.map.addMapping(i))),e=o.match(/\n/g),e?(r+=e.length,t=o.lastIndexOf("\n"),n=o.length-t):n+=o.length,a&&"start"!==l){let e=a.parent||{raws:{}};("decl"!==a.type||a!==e.last||e.raws.semicolon)&&(a.source&&a.source.end?(i.source=this.sourcePath(a),i.original.line=a.source.end.line,i.original.column=a.source.end.column-1,i.generated.line=r,i.generated.column=n-2,this.map.addMapping(i)):(i.source=s,i.original.line=1,i.original.column=0,i.generated.line=r,i.generated.column=n-1,this.map.addMapping(i)))}}))}generate(){if(this.clearAnnotation(),er&&Xt&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,(t=>{e+=t})),[e]}}};let rr=Ee;class nr extends rr{constructor(e){super(e),this.type="comment"}}var sr=nr;nr.default=nr;let ir,or,ar,{isClean:lr,my:ur}=ge,cr=Pe,hr=sr,pr=Ee;function fr(e){return e.map((e=>(e.nodes&&(e.nodes=fr(e.nodes)),delete e.source,e)))}function dr(e){if(e[lr]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)dr(t)}class gr extends pr{push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}each(e){if(!this.proxyOf.nodes)return;let t,r,n=this.getIterator();for(;this.indexes[n]<this.proxyOf.nodes.length&&(t=this.indexes[n],r=e(this.proxyOf.nodes[t],t),!1!==r);)this.indexes[n]+=1;return delete this.indexes[n],r}walk(e){return this.each(((t,r)=>{let n;try{n=e(t,r)}catch(e){throw t.addToError(e)}return!1!==n&&t.walk&&(n=t.walk(e)),n}))}walkDecls(e,t){return t?e instanceof RegExp?this.walk(((r,n)=>{if("decl"===r.type&&e.test(r.prop))return t(r,n)})):this.walk(((r,n)=>{if("decl"===r.type&&r.prop===e)return t(r,n)})):(t=e,this.walk(((e,r)=>{if("decl"===e.type)return t(e,r)})))}walkRules(e,t){return t?e instanceof RegExp?this.walk(((r,n)=>{if("rule"===r.type&&e.test(r.selector))return t(r,n)})):this.walk(((r,n)=>{if("rule"===r.type&&r.selector===e)return t(r,n)})):(t=e,this.walk(((e,r)=>{if("rule"===e.type)return t(e,r)})))}walkAtRules(e,t){return t?e instanceof RegExp?this.walk(((r,n)=>{if("atrule"===r.type&&e.test(r.name))return t(r,n)})):this.walk(((r,n)=>{if("atrule"===r.type&&r.name===e)return t(r,n)})):(t=e,this.walk(((e,r)=>{if("atrule"===e.type)return t(e,r)})))}walkComments(e){return this.walk(((t,r)=>{if("comment"===t.type)return e(t,r)}))}append(...e){for(let t of e){let e=this.normalize(t,this.last);for(let t of e)this.proxyOf.nodes.push(t)}return this.markDirty(),this}prepend(...e){e=e.reverse();for(let t of e){let e=this.normalize(t,this.first,"prepend").reverse();for(let t of e)this.proxyOf.nodes.unshift(t);for(let t in this.indexes)this.indexes[t]=this.indexes[t]+e.length}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}insertBefore(e,t){let r,n=0===(e=this.index(e))&&"prepend",s=this.normalize(t,this.proxyOf.nodes[e],n).reverse();for(let t of s)this.proxyOf.nodes.splice(e,0,t);for(let t in this.indexes)r=this.indexes[t],e<=r&&(this.indexes[t]=r+s.length);return this.markDirty(),this}insertAfter(e,t){e=this.index(e);let r,n=this.normalize(t,this.proxyOf.nodes[e]).reverse();for(let t of n)this.proxyOf.nodes.splice(e+1,0,t);for(let t in this.indexes)r=this.indexes[t],e<r&&(this.indexes[t]=r+n.length);return this.markDirty(),this}removeChild(e){let t;e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);for(let r in this.indexes)t=this.indexes[r],t>=e&&(this.indexes[r]=t-1);return this.markDirty(),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}replaceValues(e,t,r){return r||(r=t,t={}),this.walkDecls((n=>{t.props&&!t.props.includes(n.prop)||t.fast&&!n.value.includes(t.fast)||(n.value=n.value.replace(e,r))})),this.markDirty(),this}every(e){return this.nodes.every(e)}some(e){return this.nodes.some(e)}index(e){return"number"==typeof e?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}normalize(e,t){if("string"==typeof e)e=fr(ir(e).nodes);else if(Array.isArray(e)){e=e.slice(0);for(let t of e)t.parent&&t.parent.removeChild(t,"ignore")}else if("root"===e.type&&"document"!==this.type){e=e.nodes.slice(0);for(let t of e)t.parent&&t.parent.removeChild(t,"ignore")}else if(e.type)e=[e];else if(e.prop){if(void 0===e.value)throw new Error("Value field is missed in node creation");"string"!=typeof e.value&&(e.value=String(e.value)),e=[new cr(e)]}else if(e.selector)e=[new or(e)];else if(e.name)e=[new ar(e)];else{if(!e.text)throw new Error("Unknown node type in node creation");e=[new hr(e)]}return e.map((e=>(e[ur]||gr.rebuild(e),(e=e.proxyOf).parent&&e.parent.removeChild(e),e[lr]&&dr(e),void 0===e.raws.before&&t&&void 0!==t.raws.before&&(e.raws.before=t.raws.before.replace(/\S/g,"")),e.parent=this,e)))}getProxyProcessor(){return{set:(e,t,r)=>(e[t]===r||(e[t]=r,"name"!==t&&"params"!==t&&"selector"!==t||e.markDirty()),!0),get:(e,t)=>"proxyOf"===t?e:e[t]?"each"===t||"string"==typeof t&&t.startsWith("walk")?(...r)=>e[t](...r.map((e=>"function"==typeof e?(t,r)=>e(t.toProxy(),r):e))):"every"===t||"some"===t?r=>e[t](((e,...t)=>r(e.toProxy(),...t))):"root"===t?()=>e.root().toProxy():"nodes"===t?e.nodes.map((e=>e.toProxy())):"first"===t||"last"===t?e[t].toProxy():e[t]:e[t]}}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}}gr.registerParse=e=>{ir=e},gr.registerRule=e=>{or=e},gr.registerAtRule=e=>{ar=e};var mr=gr;gr.default=gr,gr.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,ar.prototype):"rule"===e.type?Object.setPrototypeOf(e,or.prototype):"decl"===e.type?Object.setPrototypeOf(e,cr.prototype):"comment"===e.type&&Object.setPrototypeOf(e,hr.prototype),e[ur]=!0,e.nodes&&e.nodes.forEach((e=>{gr.rebuild(e)}))};let wr,yr,vr=mr;class br extends vr{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new wr(new yr,this,e).stringify()}}br.registerLazyResult=e=>{wr=e},br.registerProcessor=e=>{yr=e};var Sr=br;br.default=br;let Cr={};var _r=function(e){Cr[e]||(Cr[e]=!0,"undefined"!=typeof console&&console.warn&&console.warn(e))};class xr{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let e=t.node.rangeBy(t);this.line=e.start.line,this.column=e.start.column,this.endLine=e.end.line,this.endColumn=e.end.column}for(let e in t)this[e]=t[e]}toString(){return this.node?this.node.error(this.text,{plugin:this.plugin,index:this.index,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}}var Or=xr;xr.default=xr;let Ar=Or;class Mr{constructor(e,t,r){this.processor=e,this.messages=[],this.root=t,this.opts=r,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let r=new Ar(e,t);return this.messages.push(r),r}warnings(){return this.messages.filter((e=>"warning"===e.type))}get content(){return this.css}}var kr=Mr;Mr.default=Mr;let Er=mr;class Lr extends Er{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}}var Rr=Lr;Lr.default=Lr,Er.registerAtRule(Lr);let Pr,Ir,Nr=mr;class Fr extends Nr{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}removeChild(e,t){let r=this.index(e);return!t&&0===r&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(e)}normalize(e,t,r){let n=super.normalize(e);if(t)if("prepend"===r)this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let e of n)e.raws.before=t.raws.before;return n}toResult(e={}){return new Pr(new Ir,this,e).stringify()}}Fr.registerLazyResult=e=>{Pr=e},Fr.registerProcessor=e=>{Ir=e};var jr=Fr;Fr.default=Fr;let Ur={split(e,t,r){let n=[],s="",i=!1,o=0,a=!1,l=!1;for(let r of e)l?l=!1:"\\"===r?l=!0:a?r===a&&(a=!1):'"'===r||"'"===r?a=r:"("===r?o+=1:")"===r?o>0&&(o-=1):0===o&&t.includes(r)&&(i=!0),i?(""!==s&&n.push(s.trim()),s="",i=!1):s+=r;return(r||""!==s)&&n.push(s.trim()),n},space:e=>Ur.split(e,[" ","\n","\t"]),comma:e=>Ur.split(e,[","],!0)};var Dr=Ur;Ur.default=Ur;let Br=mr,Tr=Dr;class $r extends Br{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return Tr.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,r=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(r)}}var Gr=$r;$r.default=$r,Br.registerRule($r);let zr=Pe,Wr=ne,Vr=sr,Jr=Rr,qr=jr,Yr=Gr;var Qr=class{constructor(e){this.input=e,this.root=new qr,this.current=this.root,this.spaces="",this.semicolon=!1,this.customProperty=!1,this.createTokenizer(),this.root.source={input:e,start:{offset:0,line:1,column:1}}}createTokenizer(){this.tokenizer=Wr(this.input)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e)}this.endFile()}comment(e){let t=new Vr;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]);let r=e[1].slice(2,-2);if(/^\s*$/.test(r))t.text="",t.raws.left=r,t.raws.right="";else{let e=r.match(/^(\s*)([^]*\S)(\s*)$/);t.text=e[2],t.raws.left=e[1],t.raws.right=e[3]}}emptyRule(e){let t=new Yr;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}other(e){let t=!1,r=null,n=!1,s=null,i=[],o=e[1].startsWith("--"),a=[],l=e;for(;l;){if(r=l[0],a.push(l),"("===r||"["===r)s||(s=l),i.push("("===r?")":"]");else if(o&&n&&"{"===r)s||(s=l),i.push("}");else if(0===i.length){if(";"===r){if(n)return void this.decl(a,o);break}if("{"===r)return void this.rule(a);if("}"===r){this.tokenizer.back(a.pop()),t=!0;break}":"===r&&(n=!0)}else r===i[i.length-1]&&(i.pop(),0===i.length&&(s=null));l=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),i.length>0&&this.unclosedBracket(s),t&&n){for(;a.length&&(l=a[a.length-1][0],"space"===l||"comment"===l);)this.tokenizer.back(a.pop());this.decl(a,o)}else this.unknownWord(a)}rule(e){e.pop();let t=new Yr;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}decl(e,t){let r=new zr;this.init(r,e[0][2]);let n,s=e[e.length-1];for(";"===s[0]&&(this.semicolon=!0,e.pop()),r.source.end=this.getPosition(s[3]||s[2]);"word"!==e[0][0];)1===e.length&&this.unknownWord(e),r.raws.before+=e.shift()[1];for(r.source.start=this.getPosition(e[0][2]),r.prop="";e.length;){let t=e[0][0];if(":"===t||"space"===t||"comment"===t)break;r.prop+=e.shift()[1]}for(r.raws.between="";e.length;){if(n=e.shift(),":"===n[0]){r.raws.between+=n[1];break}"word"===n[0]&&/\w/.test(n[1])&&this.unknownWord([n]),r.raws.between+=n[1]}"_"!==r.prop[0]&&"*"!==r.prop[0]||(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));let i=this.spacesAndCommentsFromStart(e);this.precheckMissedSemicolon(e);for(let t=e.length-1;t>=0;t--){if(n=e[t],"!important"===n[1].toLowerCase()){r.important=!0;let n=this.stringFrom(e,t);n=this.spacesFromEnd(e)+n," !important"!==n&&(r.raws.important=n);break}if("important"===n[1].toLowerCase()){let n=e.slice(0),s="";for(let e=t;e>0;e--){let t=n[e][0];if(0===s.trim().indexOf("!")&&"space"!==t)break;s=n.pop()[1]+s}0===s.trim().indexOf("!")&&(r.important=!0,r.raws.important=s,e=n)}if("space"!==n[0]&&"comment"!==n[0])break}let o=e.some((e=>"space"!==e[0]&&"comment"!==e[0]));this.raw(r,"value",e),o?r.raws.between+=i:r.value=i+r.value,r.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}atrule(e){let t,r,n,s=new Jr;s.name=e[1].slice(1),""===s.name&&this.unnamedAtrule(s,e),this.init(s,e[2]);let i=!1,o=!1,a=[],l=[];for(;!this.tokenizer.endOfFile();){if(t=(e=this.tokenizer.nextToken())[0],"("===t||"["===t?l.push("("===t?")":"]"):"{"===t&&l.length>0?l.push("}"):t===l[l.length-1]&&l.pop(),0===l.length){if(";"===t){s.source.end=this.getPosition(e[2]),this.semicolon=!0;break}if("{"===t){o=!0;break}if("}"===t){if(a.length>0){for(n=a.length-1,r=a[n];r&&"space"===r[0];)r=a[--n];r&&(s.source.end=this.getPosition(r[3]||r[2]))}this.end(e);break}a.push(e)}else a.push(e);if(this.tokenizer.endOfFile()){i=!0;break}}s.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(s.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(s,"params",a),i&&(e=a[a.length-1],s.source.end=this.getPosition(e[3]||e[2]),this.spaces=s.raws.between,s.raws.between="")):(s.raws.afterName="",s.params=""),o&&(s.nodes=[],this.current=s)}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let e=this.current.nodes[this.current.nodes.length-1];e&&"rule"===e.type&&!e.raws.ownSemicolon&&(e.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{offset:e,line:t.line,column:t.col}}init(e,t){this.current.push(e),e.source={start:this.getPosition(t),input:this.input},e.raws.before=this.spaces,this.spaces="","comment"!==e.type&&(this.semicolon=!1)}raw(e,t,r){let n,s,i,o,a=r.length,l="",u=!0,c=/^([#.|])?(\w)+/i;for(let t=0;t<a;t+=1)n=r[t],s=n[0],"comment"!==s||"rule"!==e.type?"comment"===s||"space"===s&&t===a-1?u=!1:l+=n[1]:(o=r[t-1],i=r[t+1],"space"!==o[0]&&"space"!==i[0]&&c.test(o[1])&&c.test(i[1])?l+=n[1]:u=!1);if(!u){let n=r.reduce(((e,t)=>e+t[1]),"");e.raws[t]={value:l,raw:n}}e[t]=l}spacesAndCommentsFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],"space"===t||"comment"===t);)r=e.pop()[1]+r;return r}spacesAndCommentsFromStart(e){let t,r="";for(;e.length&&(t=e[0][0],"space"===t||"comment"===t);)r+=e.shift()[1];return r}spacesFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],"space"===t);)r=e.pop()[1]+r;return r}stringFrom(e,t){let r="";for(let n=t;n<e.length;n++)r+=e[n][1];return e.splice(t,e.length-t),r}colon(e){let t,r,n,s=0;for(let[i,o]of e.entries()){if(t=o,r=t[0],"("===r&&(s+=1),")"===r&&(s-=1),0===s&&":"===r){if(n){if("word"===n[0]&&"progid"===n[1])continue;return i}this.doubleColon(t)}n=t}return!1}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}precheckMissedSemicolon(){}checkMissedSemicolon(e){let t=this.colon(e);if(!1===t)return;let r,n=0;for(let s=t-1;s>=0&&(r=e[s],"space"===r[0]||(n+=1,2!==n));s--);throw this.input.error("Missed semicolon","word"===r[0]?r[3]+1:r[2])}};let Zr=mr,Hr=Qr,Kr=Wt;function Xr(e,t){let r=new Kr(e,t),n=new Hr(r);try{n.parse()}catch(e){throw"production"!==process.env.NODE_ENV&&"CssSyntaxError"===e.name&&t&&t.from&&(/\.scss$/i.test(t.from)?e.message+="\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser":/\.sass/i.test(t.from)?e.message+="\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser":/\.less$/i.test(t.from)&&(e.message+="\nYou tried to parse Less with the standard CSS parser; try again with the postcss-less parser")),e}return n.root}var en=Xr;Xr.default=Xr,Zr.registerParse(Xr);let{isClean:tn,my:rn}=ge,nn=tr,sn=Se,on=mr,an=Sr,ln=_r,un=kr,cn=en,hn=jr;const pn={document:"Document",root:"Root",atrule:"AtRule",rule:"Rule",decl:"Declaration",comment:"Comment"},fn={postcssPlugin:!0,prepare:!0,Once:!0,Document:!0,Root:!0,Declaration:!0,Rule:!0,AtRule:!0,Comment:!0,DeclarationExit:!0,RuleExit:!0,AtRuleExit:!0,CommentExit:!0,RootExit:!0,DocumentExit:!0,OnceExit:!0},dn={postcssPlugin:!0,prepare:!0,Once:!0};function gn(e){return"object"==typeof e&&"function"==typeof e.then}function mn(e){let t=!1,r=pn[e.type];return"decl"===e.type?t=e.prop.toLowerCase():"atrule"===e.type&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,0,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,0,r+"Exit"]:[r,r+"Exit"]}function wn(e){let t;return t="document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:mn(e),{node:e,events:t,eventIndex:0,visitors:[],visitorIndex:0,iterator:0}}function yn(e){return e[tn]=!1,e.nodes&&e.nodes.forEach((e=>yn(e))),e}let vn={};class bn{constructor(e,t,r){let n;if(this.stringified=!1,this.processed=!1,"object"!=typeof t||null===t||"root"!==t.type&&"document"!==t.type)if(t instanceof bn||t instanceof un)n=yn(t.root),t.map&&(void 0===r.map&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=t.map);else{let e=cn;r.syntax&&(e=r.syntax.parse),r.parser&&(e=r.parser),e.parse&&(e=e.parse);try{n=e(t,r)}catch(e){this.processed=!0,this.error=e}n&&!n[rn]&&on.rebuild(n)}else n=yn(t);this.result=new un(e,n,r),this.helpers={...vn,result:this.result,postcss:vn},this.plugins=this.processor.plugins.map((e=>"object"==typeof e&&e.prepare?{...e,...e.prepare(this.result)}:e))}get[Symbol.toStringTag](){return"LazyResult"}get processor(){return this.result.processor}get opts(){return this.result.opts}get css(){return this.stringify().css}get content(){return this.stringify().content}get map(){return this.stringify().map}get root(){return this.sync().root}get messages(){return this.sync().messages}warnings(){return this.sync().warnings()}toString(){return this.css}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this.opts||ln("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins){if(gn(this.runOnRoot(e)))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[tn];)e[tn]=!0,this.walkSync(e);if(this.listeners.OnceExit)if("document"===e.type)for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=sn;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let r=new nn(t,this.result.root,this.result.opts).generate();return this.result.css=r[0],this.result.map=r[1],this.result}walkSync(e){e[tn]=!0;let t=mn(e);for(let r of t)if(0===r)e.nodes&&e.each((e=>{e[tn]||this.walkSync(e)}));else{let t=this.listeners[r];if(t&&this.visitSync(t,e.toProxy()))return}}visitSync(e,t){for(let[r,n]of e){let e;this.result.lastPlugin=r;try{e=n(t,this.helpers)}catch(e){throw this.handleError(e,t.proxyOf)}if("root"!==t.type&&"document"!==t.type&&!t.parent)return!0;if(gn(e))throw this.getAsyncError()}}runOnRoot(e){this.result.lastPlugin=e;try{if("object"==typeof e&&e.Once){if("document"===this.result.root.type){let t=this.result.root.nodes.map((t=>e.Once(t,this.helpers)));return gn(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}if("function"==typeof e)return e(this.result.root,this.result)}catch(e){throw this.handleError(e)}}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let r=this.result.lastPlugin;try{if(t&&t.addToError(e),this.error=e,"CssSyntaxError"!==e.name||e.plugin){if(r.postcssVersion&&"production"!==process.env.NODE_ENV){let e=r.postcssPlugin,t=r.postcssVersion,n=this.result.processor.version,s=t.split("."),i=n.split(".");(s[0]!==i[0]||parseInt(s[1])>parseInt(i[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+n+", but "+e+" uses "+t+". Perhaps this is the source of the error below.")}}else e.plugin=r.postcssPlugin,e.setMessage()}catch(e){console&&console.error&&console.error(e)}return e}async runAsync(){this.plugin=0;for(let e=0;e<this.plugins.length;e++){let t=this.plugins[e],r=this.runOnRoot(t);if(gn(r))try{await r}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[tn];){e[tn]=!0;let t=[wn(e)];for(;t.length>0;){let e=this.visitTick(t);if(gn(e))try{await e}catch(e){let r=t[t.length-1].node;throw this.handleError(e,r)}}}if(this.listeners.OnceExit)for(let[t,r]of this.listeners.OnceExit){this.result.lastPlugin=t;try{if("document"===e.type){let t=e.nodes.map((e=>r(e,this.helpers)));await Promise.all(t)}else await r(e,this.helpers)}catch(e){throw this.handleError(e)}}}return this.processed=!0,this.stringify()}prepareVisitors(){this.listeners={};let e=(e,t,r)=>{this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push([e,r])};for(let t of this.plugins)if("object"==typeof t)for(let r in t){if(!fn[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!dn[r])if("object"==typeof t[r])for(let n in t[r])e(t,"*"===n?r:r+"-"+n.toLowerCase(),t[r][n]);else"function"==typeof t[r]&&e(t,r,t[r])}this.hasListener=Object.keys(this.listeners).length>0}visitTick(e){let t=e[e.length-1],{node:r,visitors:n}=t;if("root"!==r.type&&"document"!==r.type&&!r.parent)return void e.pop();if(n.length>0&&t.visitorIndex<n.length){let[e,s]=n[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===n.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=e;try{return s(r.toProxy(),this.helpers)}catch(e){throw this.handleError(e,r)}}if(0!==t.iterator){let n,s=t.iterator;for(;n=r.nodes[r.indexes[s]];)if(r.indexes[s]+=1,!n[tn])return n[tn]=!0,void e.push(wn(n));t.iterator=0,delete r.indexes[s]}let s=t.events;for(;t.eventIndex<s.length;){let e=s[t.eventIndex];if(t.eventIndex+=1,0===e)return void(r.nodes&&r.nodes.length&&(r[tn]=!0,t.iterator=r.getIterator()));if(this.listeners[e])return void(t.visitors=this.listeners[e])}e.pop()}}bn.registerPostcss=e=>{vn=e};var Sn=bn;bn.default=bn,hn.registerLazyResult(bn),an.registerLazyResult(bn);let Cn=tr,_n=Se,xn=_r,On=en;const An=kr;class Mn{constructor(e,t,r){let n;t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=r,this._map=void 0;let s=_n;this.result=new An(this._processor,n,this._opts),this.result.css=t;let i=this;Object.defineProperty(this.result,"root",{get:()=>i.root});let o=new Cn(s,n,this._opts,t);if(o.isMap()){let[e,t]=o.generate();e&&(this.result.css=e),t&&(this.result.map=t)}}get[Symbol.toStringTag](){return"NoWorkResult"}get processor(){return this.result.processor}get opts(){return this.result.opts}get css(){return this.result.css}get content(){return this.result.css}get map(){return this.result.map}get root(){if(this._root)return this._root;let e,t=On;try{e=t(this._css,this._opts)}catch(e){this.error=e}return this._root=e,e}get messages(){return[]}warnings(){return[]}toString(){return this._css}then(e,t){return"production"!==process.env.NODE_ENV&&("from"in this._opts||xn("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(e,t)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}sync(){if(this.error)throw this.error;return this.result}}var kn=Mn;Mn.default=Mn;let En=kn,Ln=Sn,Rn=Sr,Pn=jr;class In{constructor(e=[]){this.version="8.4.5",this.plugins=this.normalize(e)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}process(e,t={}){return 0===this.plugins.length&&void 0===t.parser&&void 0===t.stringifier&&void 0===t.syntax?new En(this,e,t):new Ln(this,e,t)}normalize(e){let t=[];for(let r of e)if(!0===r.postcss?r=r():r.postcss&&(r=r.postcss),"object"==typeof r&&Array.isArray(r.plugins))t=t.concat(r.plugins);else if("object"==typeof r&&r.postcssPlugin)t.push(r);else if("function"==typeof r)t.push(r);else{if("object"!=typeof r||!r.parse&&!r.stringify)throw new Error(r+" is not a PostCSS plugin");if("production"!==process.env.NODE_ENV)throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.")}return t}}var Nn=In;In.default=In,Pn.registerProcessor(In),Rn.registerProcessor(In);let Fn=Pe,jn=Et,Un=sr,Dn=Rr,Bn=Wt,Tn=jr,$n=Gr;function Gn(e,t){if(Array.isArray(e))return e.map((e=>Gn(e)));let{inputs:r,...n}=e;if(r){t=[];for(let e of r){let r={...e,__proto__:Bn.prototype};r.map&&(r.map={...r.map,__proto__:jn.prototype}),t.push(r)}}if(n.nodes&&(n.nodes=e.nodes.map((e=>Gn(e,t)))),n.source){let{inputId:e,...r}=n.source;n.source=r,null!=e&&(n.source.input=t[e])}if("root"===n.type)return new Tn(n);if("decl"===n.type)return new Fn(n);if("rule"===n.type)return new $n(n);if("comment"===n.type)return new Un(n);if("atrule"===n.type)return new Dn(n);throw new Error("Unknown node type: "+e.type)}var zn=Gn;Gn.default=Gn;let Wn=de,Vn=Pe,Jn=Sn,qn=mr,Yn=Nn,Qn=Se,Zn=zn,Hn=Sr,Kn=Or,Xn=sr,es=Rr,ts=kr,rs=Wt,ns=en,ss=Dr,is=Gr,os=jr,as=Ee;function ls(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new Yn(e)}ls.plugin=function(e,t){function r(...r){let n=t(...r);return n.postcssPlugin=e,n.postcssVersion=(new Yn).version,n}let n;return console&&console.warn&&(console.warn(e+": postcss.plugin was deprecated. Migration guide:\nhttps://evilmartians.com/chronicles/postcss-8-plugin-migration"),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(e+": 里面 postcss.plugin 被弃用. 迁移指南:\nhttps://www.w3ctech.com/topic/2226")),Object.defineProperty(r,"postcss",{get:()=>(n||(n=r()),n)}),r.process=function(e,t,n){return ls([r(n)]).process(e,t)},r},ls.stringify=Qn,ls.parse=ns,ls.fromJSON=Zn,ls.list=ss,ls.comment=e=>new Xn(e),ls.atRule=e=>new es(e),ls.decl=e=>new Vn(e),ls.rule=e=>new is(e),ls.root=e=>new os(e),ls.document=e=>new Hn(e),ls.CssSyntaxError=Wn,ls.Declaration=Vn,ls.Container=qn,ls.Processor=Yn,ls.Document=Hn,ls.Comment=Xn,ls.Warning=Kn,ls.AtRule=es,ls.Result=ts,ls.Input=rs,ls.Rule=is,ls.Root=os,ls.Node=as,Jn.registerPostcss(ls);var us=ls;async function cs(){return new Promise((e=>{let t="",r=!1;if(setTimeout((()=>{r=!0,e("")}),1e4),process.stdin.isTTY){if(r)return;e(t)}else process.stdin.setEncoding("utf8"),process.stdin.on("readable",(()=>{let e;for(;e=process.stdin.read();)t+=e})),process.stdin.on("end",(()=>{r||e(t)}))}))}ls.default=ls,async function(e,t,n){const s=function(e,t,r){const n=e.map((e=>e.trim())).filter((e=>!!e)),s={stdin:!1,stdout:!1,output:null,outputDir:null,inputs:[],inlineMap:!0,externalMap:!1,replace:!1,pluginOptions:{},debug:!1};let i=null,o=!1;for(let e=0;e<n.length;e++){const t=n[e];switch(t){case"-o":case"--output":s.output=n[e+1],e++,o=!0;break;case"-m":case"--map":s.externalMap=!0,s.inlineMap=!1,o=!0;break;case"--no-map":s.externalMap=!1,s.inlineMap=!1,o=!0;break;case"-r":case"--replace":s.replace=!0,o=!0;break;case"--debug":s.debug=!0,o=!0;break;case"-d":case"--dir":s.outputDir=n[e+1],e++,o=!0;break;case"-p":case"--plugin-options":i=n[e+1],e++,o=!0;break;default:if(0===t.indexOf("-"))return console.warn(`[error] unknown argument : ${t}\n`),r(),M.InvalidArguments;if(!o){s.inputs.push(t);break}return r(),M.InvalidArguments}}if(s.replace&&(s.output=null,s.outputDir=null),s.outputDir&&(s.output=null),s.inputs.length>1&&s.output)return console.warn('[error] omit "--output" when processing multiple inputs\n'),r(),M.InvalidArguments;0===s.inputs.length&&(s.stdin=!0),s.output||s.outputDir||s.replace||(s.stdout=!0),s.stdout&&(s.externalMap=!1);let a={};if(i)try{a=JSON.parse(i)}catch(e){return console.warn("[error] plugin options must be valid JSON\n"),r(),M.InvalidArguments}for(const e in a){const n=a[e];if(!t.includes(e))return console.warn(`[error] unknown plugin option: ${e}\n`),r(),M.InvalidArguments;s.pluginOptions[e]=n}return s}(process.argv.slice(2),t,n);s===M.InvalidArguments&&process.exit(1);const o=e(s.pluginOptions);s.stdin&&s.stdout?await async function(e,t,r){let n="";try{const s=await cs();s||(r(),process.exit(1)),n=(await us([e]).process(s,{from:"stdin",to:"stdout",map:!!t.inlineMap&&{inline:!0}})).css}catch(e){console.error(t.debug?e:e.message),process.exit(1)}process.stdout.write(n+(t.inlineMap?"\n":"")),process.exit(0)}(o,s,n):s.stdin?await async function(e,t,n){let s=t.output;!s&&t.outputDir&&(s=r.join(t.outputDir,"output.css"));try{const r=await cs();r||(n(),process.exit(1));const o=await us([e]).process(r,{from:"stdin",to:s,map:!(!t.inlineMap&&!t.externalMap)&&{inline:t.inlineMap}});t.externalMap&&o.map?await Promise.all([await i.writeFile(s,o.css+(t.inlineMap?"\n":"")),await i.writeFile(`${s}.map`,o.map.toString())]):await i.writeFile(s,o.css+(t.inlineMap?"\n":""))}catch(e){console.error(t.debug?e:e.message),process.exit(1)}console.log(`CSS was written to "${r.normalize(s)}"`),process.exit(0)}(o,s,n):s.stdout?await async function(e,t){let r=[];try{r=await Promise.all(t.inputs.map((async t=>{const r=await i.readFile(t);return(await us([e]).process(r,{from:t,to:"stdout",map:!1})).css})))}catch(e){console.error(t.debug?e:e.message),process.exit(1)}for(const e of r)process.stdout.write(e);process.exit(0)}(o,s):await async function(e,t){try{await Promise.all(t.inputs.map((async n=>{let s=t.output;t.outputDir&&(s=r.join(t.outputDir,r.basename(n))),t.replace&&(s=n);const o=await i.readFile(n),a=await us([e]).process(o,{from:n,to:s,map:!(!t.inlineMap&&!t.externalMap)&&{inline:t.inlineMap}});t.externalMap&&a.map?await Promise.all([await i.writeFile(s,a.css+(t.inlineMap?"\n":"")),await i.writeFile(`${s}.map`,a.map.toString())]):await i.writeFile(s,a.css+(t.inlineMap?"\n":"")),console.log(`CSS was written to "${r.normalize(s)}"`)})))}catch(e){console.error(t.debug?e:e.message),process.exit(1)}process.exit(0)}(o,s)}(A,["preserve"],function(e,t,r,n=null){let s=[];if(n){const e=Math.max(...Object.keys(n).map((e=>e.length))),t=new Array(e).fill(" ").join("");t.length&&(s=["\nPlugin Options:",...Object.keys(n).map((e=>` ${(e+t).slice(0,t.length)} ${typeof n[e]}`))],s.push(`\n ${JSON.stringify(n,null,2).split("\n").join("\n ")}`))}const i=[`${t}\n`,` ${r}\n`,"Usage:",` ${e} [input.css] [OPTIONS] [-o|--output output.css]`,` ${e} <input.css>... [OPTIONS] --dir <output-directory>`,` ${e} <input.css>... [OPTIONS] --replace`,"\nOptions:"," -o, --output Output file"," -d, --dir Output directory"," -r, --replace Replace (overwrite) the input file"," -m, --map Create an external sourcemap"," --no-map Disable the default inline sourcemaps"," -p, --plugin-options Stringified JSON object with plugin options"];return s.length>0&&i.push(...s),()=>{console.warn(i.join("\n"))}}("postcss-lab-function-cli","PostCSS Lab function","Convert lab() to rgb()",{preserve:!0}));
|
package/dist/color.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare function labToSRgb(lab: [number, number, number]): [number, number, number];
|
|
2
|
-
export declare function lchToSRgb(lch: [number, number, number]): [number, number, number];
|
|
3
|
-
export declare function xyz2rgb(xyz: [number, number, number]): [number, number, number];
|
package/dist/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/color.ts","../src/on-css-function.ts","../src/index.ts","../src/has-supports-at-rule-ancestor.ts"],"sourcesContent":["// Taken from @csstools/convert-colors\n// That package is in need of maintenance but this is out of scope for preset-env\n// We only need lab() -> rgb() and lch() -> rgb()\n\nexport function labToSRgb(lab: [number, number, number]): [number, number, number] {\n\treturn xyz2rgb(lab2xyz(lab, true));\n}\n\nexport function lchToSRgb(lch: [number, number, number]): [number, number, number] {\n\treturn xyz2rgb(\n\t\tlab2xyz(lch2lab(lch),\n\t\tfalse, /* do not clamp \"a\" and \"b\" when processing lch */\n\t));\n}\n\nfunction lch2lab(lch: [number, number, number]): [number, number, number] {\n\t// Convert from polar form\n\treturn [\n\t\tlch[0], // L is still L\n\t\tlch[1] * Math.cos(lch[2] * Math.PI / 180), // a\n\t\tlch[1] * Math.sin(lch[2] * Math.PI / 180), // b\n\t];\n}\n\nfunction lab2xyz(lab: [number, number, number], clamp : boolean): [number, number, number] {\n\tconst [labLRaw, labARaw, labBRaw] = lab;\n\n\tconst labL = Math.min(\n\t\tMath.max(\n\t\t\tlabLRaw,\n\t\t\t0,\n\t\t),\n\t\t100,\n\t);\n\n\tlet labA = 0;\n\tlet labB = 0;\n\n\tif (clamp) {\n\t\tlabA = Math.min(\n\t\t\tMath.max(\n\t\t\t\tlabARaw,\n\t\t\t\t-127,\n\t\t\t),\n\t\t\t128,\n\t\t);\n\n\t\tlabB = Math.min(\n\t\t\tMath.max(\n\t\t\t\tlabBRaw,\n\t\t\t\t-127,\n\t\t\t),\n\t\t\t128,\n\t\t);\n\t} else {\n\t\tlabA = labARaw;\n\t\tlabB = labBRaw;\n\t}\n\n\t// compute f, starting with the luminance-related term\n\tconst f2 = (labL + 16) / 116;\n\tconst f1 = labA / 500 + f2;\n\tconst f3 = f2 - labB / 200;\n\n\t// compute pre-scaled XYZ\n\tconst [ initX, initY, initZ ] = [\n\t\tMath.pow(f1, 3) > epsilon ? Math.pow(f1, 3) : (116 * f1 - 16) / kappa,\n\t\tlabL > kappa * epsilon ? Math.pow((labL + 16) / 116, 3) : labL / kappa,\n\t\tMath.pow(f3, 3) > epsilon ? Math.pow(f3, 3) : (116 * f3 - 16) / kappa,\n\t];\n\n\tconst [ xyzX, xyzY, xyzZ ] = matrix(\n\t\t// compute XYZ by scaling pre-scaled XYZ by reference white\n\t\t[ initX * wd50X, initY * wd50Y, initZ * wd50Z ],\n\t\t// calculate D65 XYZ from D50 XYZ\n\t\t[\n\t\t\t[ 0.9554734527042182, -0.023098536874261423, 0.0632593086610217 ],\n\t\t\t[ -0.028369706963208136, 1.0099954580058226, 0.021041398966943008 ],\n\t\t\t[ 0.012314001688319899, -0.020507696433477912, 1.3303659366080753 ],\n\t\t],\n\t);\n\n\treturn [ xyzX, xyzY, xyzZ ];\n}\n\nexport function xyz2rgb(xyz: [number, number, number]): [number, number, number] {\n\tconst [xyzX, xyzY, xyzZ] = xyz;\n\tconst [ lrgbR, lrgbB, lrgbG ] = matrix([ xyzX, xyzY, xyzZ ], [\n\t\t[ 3.2409699419045226, -1.537383177570094, -0.4986107602930034 ],\n\t\t[ -0.9692436362808796, 1.8759675015077202, 0.04155505740717559 ],\n\t\t[ 0.05563007969699366, -0.20397695888897652, 1.0569715142428786 ],\n\t]);\n\n\tconst [ rgbR, rgbG, rgbB ] = [ lrgbR, lrgbB, lrgbG ].map(\n\t\tv => v > 0.31308 ? 1.055 * Math.pow(v / 100, 1 / 2.4) * 100 - 5.5 : 12.92 * v,\n\t);\n\n\treturn [ rgbR, rgbG, rgbB ];\n}\n\nfunction matrix(params: [number, number, number], mats: [[number, number, number], [number, number, number], [number, number, number]]): [number, number, number] {\n\treturn mats.map(\n\t\tmat => mat.reduce(\n\t\t\t// (acc, value, index) => acc + params[index] * value,\n\t\t\t(acc, value, index) => acc + params[index] * precision * (value * precision) / precision / precision,\n\t\t\t0,\n\t\t),\n\t) as [number, number, number];\n}\n\n/* Precision\n/* ========================================================================== */\n\nconst precision = 100000000;\n\n/* D50 reference white\n/* ========================================================================== */\n\nconst [ wd50X, wd50Y, wd50Z ] = [ 96.422, 100.000, 82.521 ];\n\n/* Math Constants\n/* ========================================================================== */\n\nconst epsilon = Math.pow(6, 3) / Math.pow(29, 3);\nconst kappa = Math.pow(29, 3) / Math.pow(3, 3);\n","import valueParser from 'postcss-value-parser';\nimport type { FunctionNode, Dimension, Node, DivNode, WordNode } from 'postcss-value-parser';\nimport { labToSRgb, lchToSRgb } from './color';\n\nfunction onCSSFunction(node: FunctionNode) {\n\tconst value = node.value;\n\tconst rawNodes = node.nodes;\n\tconst relevantNodes = rawNodes.slice().filter((x) => {\n\t\treturn x.type !== 'comment' && x.type !== 'space';\n\t});\n\n\tlet nodes: Lch | Lab | null = null;\n\tif (value === 'lab') {\n\t\tnodes = labFunctionContents(relevantNodes);\n\t} else if (value === 'lch') {\n\t\tnodes = lchFunctionContents(relevantNodes);\n\t}\n\n\tif (!nodes) {\n\t\treturn;\n\t}\n\n\tif (relevantNodes.length > 3 && (!nodes.slash || !nodes.alpha)) {\n\t\treturn;\n\t}\n\n\t// rename the Color function to `rgb`\n\tnode.value = 'rgb';\n\n\ttransformAlpha(node, nodes.slash, nodes.alpha);\n\n\t/** Extracted Color channels. */\n\tconst [channelNode1, channelNode2, channelNode3] = channelNodes(nodes);\n\tconst [channelDimension1, channelDimension2, channelDimension3] = channelDimensions(nodes);\n\n\t/** Corresponding Color transformer. */\n\tconst toRGB = value === 'lab' ? labToSRgb : lchToSRgb;\n\n\t/** RGB channels from the source color. */\n\tconst channelNumbers: [number, number, number] = [\n\t\tchannelDimension1.number,\n\t\tchannelDimension2.number,\n\t\tchannelDimension3.number,\n\t].map(\n\t\tchannelNumber => parseFloat(channelNumber),\n\t) as [number, number, number];\n\n\tconst rgbValues = toRGB(\n\t\tchannelNumbers,\n\t).map(\n\t\tchannelValue => Math.max(Math.min(Math.round(channelValue * 2.55), 255), 0),\n\t);\n\n\tnode.nodes.splice(node.nodes.indexOf(channelNode1) + 1, 0, commaNode());\n\tnode.nodes.splice(node.nodes.indexOf(channelNode2) + 1, 0, commaNode());\n\n\treplaceWith(node.nodes, channelNode1, {\n\t\t...channelNode1,\n\t\tvalue: String(rgbValues[0]),\n\t});\n\n\treplaceWith(node.nodes, channelNode2, {\n\t\t...channelNode2,\n\t\tvalue: String(rgbValues[1]),\n\t});\n\n\treplaceWith(node.nodes, channelNode3, {\n\t\t...channelNode3,\n\t\tvalue: String(rgbValues[2]),\n\t});\n\n}\n\nexport default onCSSFunction;\n\nfunction commaNode(): DivNode {\n\treturn {\n\t\tsourceIndex: 0,\n\t\tsourceEndIndex: 1,\n\t\tvalue: ',',\n\t\ttype: 'div',\n\t\tbefore: '',\n\t\tafter: '',\n\t};\n}\n\nfunction isNumericNode(node: Node): node is WordNode {\n\tif (!node || node.type !== 'word') {\n\t\treturn false;\n\t}\n\n\tif (!canParseAsUnit(node)) {\n\t\treturn false;\n\t}\n\n\tconst unitAndValue = valueParser.unit(node.value);\n\tif (!unitAndValue) {\n\t\treturn false;\n\t}\n\n\treturn !!unitAndValue.number;\n}\n\nfunction isNumericNodeNumber(node): node is WordNode {\n\tif (!node || node.type !== 'word') {\n\t\treturn false;\n\t}\n\n\tif (!canParseAsUnit(node)) {\n\t\treturn false;\n\t}\n\n\tconst unitAndValue = valueParser.unit(node.value);\n\tif (!unitAndValue) {\n\t\treturn false;\n\t}\n\n\treturn !!unitAndValue.number && unitAndValue.unit === '';\n}\n\nfunction isNumericNodeHueLike(node: Node): node is WordNode {\n\tif (!node || node.type !== 'word') {\n\t\treturn false;\n\t}\n\n\tif (!canParseAsUnit(node)) {\n\t\treturn false;\n\t}\n\n\tconst unitAndValue = valueParser.unit(node.value);\n\tif (!unitAndValue) {\n\t\treturn false;\n\t}\n\n\treturn !!unitAndValue.number && (\n\t\tunitAndValue.unit === 'deg' ||\n\t\tunitAndValue.unit === 'grad' ||\n\t\tunitAndValue.unit === 'rad' ||\n\t\tunitAndValue.unit === 'turn' ||\n\t\tunitAndValue.unit === ''\n\t);\n}\n\nfunction isNumericNodePercentage(node: Node): node is WordNode {\n\tif (!node || node.type !== 'word') {\n\t\treturn false;\n\t}\n\n\tif (!canParseAsUnit(node)) {\n\t\treturn false;\n\t}\n\n\tconst unitAndValue = valueParser.unit(node.value);\n\tif (!unitAndValue) {\n\t\treturn false;\n\t}\n\n\treturn unitAndValue.unit === '%';\n}\n\nfunction isNumericNodePercentageOrNumber(node: Node): node is WordNode {\n\tif (!node || node.type !== 'word') {\n\t\treturn false;\n\t}\n\n\tif (!canParseAsUnit(node)) {\n\t\treturn false;\n\t}\n\n\tconst unitAndValue = valueParser.unit(node.value);\n\tif (!unitAndValue) {\n\t\treturn false;\n\t}\n\n\treturn unitAndValue.unit === '%' || unitAndValue.unit === '';\n}\n\nfunction isCalcNode(node: Node): node is FunctionNode {\n\treturn node && node.type === 'function' && node.value === 'calc';\n}\n\nfunction isVarNode(node: Node): node is FunctionNode {\n\treturn node && node.type === 'function' && node.value === 'var';\n}\n\nfunction isSlashNode(node: Node): node is DivNode {\n\treturn node && node.type === 'div' && node.value === '/';\n}\n\ntype Lch = {\n\tl: Dimension,\n\tlNode: Node,\n\tc: Dimension,\n\tcNode: Node,\n\th: Dimension,\n\thNode: Node,\n\tslash?: DivNode,\n\talpha?: WordNode|FunctionNode,\n}\n\nfunction lchFunctionContents(nodes): Lch|null {\n\tif (!isNumericNodePercentage(nodes[0])) {\n\t\treturn null;\n\t}\n\n\tif (!isNumericNodeNumber(nodes[1])) {\n\t\treturn null;\n\t}\n\n\tif (!isNumericNodeHueLike(nodes[2])) {\n\t\treturn null;\n\t}\n\n\tconst out: Lch = {\n\t\tl: valueParser.unit(nodes[0].value) as Dimension,\n\t\tlNode: nodes[0],\n\t\tc: valueParser.unit(nodes[1].value) as Dimension,\n\t\tcNode: nodes[1],\n\t\th: valueParser.unit(nodes[2].value) as Dimension,\n\t\thNode: nodes[2],\n\t};\n\n\tnormalizeHueNode(out.h);\n\tif (out.h.unit !== '') {\n\t\treturn null;\n\t}\n\n\tif (isSlashNode(nodes[3])) {\n\t\tout.slash = nodes[3];\n\t}\n\n\tif ((isNumericNodePercentageOrNumber(nodes[4]) || isCalcNode(nodes[4]) || isVarNode(nodes[4]))) {\n\t\tout.alpha = nodes[4];\n\t}\n\n\treturn out;\n}\n\ntype Lab = {\n\tl: Dimension,\n\tlNode: Node,\n\ta: Dimension,\n\taNode: Node,\n\tb: Dimension,\n\tbNode: Node,\n\tslash?: DivNode,\n\talpha?: WordNode | FunctionNode,\n}\n\nfunction labFunctionContents(nodes): Lab|null {\n\tif (!isNumericNodePercentage(nodes[0])) {\n\t\treturn null;\n\t}\n\n\tif (!isNumericNodeNumber(nodes[1])) {\n\t\treturn null;\n\t}\n\n\tif (!isNumericNodeNumber(nodes[2])) {\n\t\treturn null;\n\t}\n\n\tconst out: Lab = {\n\t\tl: valueParser.unit(nodes[0].value) as Dimension,\n\t\tlNode: nodes[0],\n\t\ta: valueParser.unit(nodes[1].value) as Dimension,\n\t\taNode: nodes[1],\n\t\tb: valueParser.unit(nodes[2].value) as Dimension,\n\t\tbNode: nodes[2],\n\t};\n\n\tif (isSlashNode(nodes[3])) {\n\t\tout.slash = nodes[3];\n\t}\n\n\tif ((isNumericNodePercentageOrNumber(nodes[4]) || isCalcNode(nodes[4]))) {\n\t\tout.alpha = nodes[4];\n\t}\n\n\treturn out;\n}\n\nfunction isLab(x: Lch | Lab): x is Lab {\n\tif (typeof (x as Lab).a !== 'undefined') {\n\t\treturn true;\n\t}\n\n\treturn false;\n}\n\nfunction channelNodes(x: Lch | Lab): [Node, Node, Node] {\n\tif (isLab(x)) {\n\t\treturn [x.lNode, x.aNode, x.bNode];\n\t}\n\n\treturn [x.lNode, x.cNode, x.hNode];\n}\n\nfunction channelDimensions(x: Lch | Lab): [Dimension, Dimension, Dimension] {\n\tif (isLab(x)) {\n\t\treturn [x.l, x.a, x.b];\n\t}\n\n\treturn [x.l, x.c, x.h];\n}\n\nfunction transformAlpha(node: FunctionNode, slashNode: DivNode | undefined, alphaNode: WordNode | FunctionNode | undefined) {\n\tif (!slashNode || !alphaNode) {\n\t\treturn;\n\t}\n\n\tnode.value = 'rgba';\n\tslashNode.value = ',';\n\tslashNode.before = '';\n\n\tif (!isNumericNode(alphaNode)) {\n\t\treturn;\n\t}\n\n\tconst unitAndValue = valueParser.unit(alphaNode.value);\n\tif (!unitAndValue) {\n\t\treturn;\n\t}\n\n\tif (unitAndValue.unit === '%') {\n\t\t// transform the Alpha channel from a Percentage to (0-1) Number\n\t\tunitAndValue.number = String(parseFloat(unitAndValue.number) / 100);\n\t\talphaNode.value = String(unitAndValue.number);\n\t}\n}\n\nfunction replaceWith(nodes: Array<Node>, oldNode: Node, newNode: Node) {\n\tconst index = nodes.indexOf(oldNode);\n\tnodes[index] = newNode;\n}\n\nfunction normalizeHueNode(dimension: Dimension) {\n\tswitch (dimension.unit) {\n\t\tcase 'deg':\n\t\t\tdimension.unit = '';\n\t\t\treturn;\n\t\tcase 'rad':\n\t\t\t// radians -> degrees\n\t\t\tdimension.unit = '';\n\t\t\tdimension.number = (parseFloat(dimension.number) * 180 / Math.PI).toString();\n\t\t\treturn;\n\n\t\tcase 'grad':\n\t\t\t// grades -> degrees\n\t\t\tdimension.unit = '';\n\t\t\tdimension.number = (parseFloat(dimension.number) * 0.9).toString();\n\t\t\treturn;\n\n\t\tcase 'turn':\n\t\t\t// turns -> degrees\n\t\t\tdimension.unit = '';\n\t\t\tdimension.number = (parseFloat(dimension.number) * 360).toString();\n\t\t\treturn;\n\t}\n}\n\nfunction canParseAsUnit(node : Node): boolean {\n\tif (!node || !node.value) {\n\t\treturn false;\n\t}\n\n\ttry {\n\t\treturn valueParser.unit(node.value) !== false;\n\t} catch (e) {\n\t\treturn false;\n\t}\n}\n","import { hasSupportsAtRuleAncestor } from './has-supports-at-rule-ancestor';\nimport valueParser from 'postcss-value-parser';\nimport type { ParsedValue, FunctionNode } from 'postcss-value-parser';\nimport type { Declaration, Postcss, Result } from 'postcss';\nimport onCSSFunction from './on-css-function';\n\nimport type { PluginCreator } from 'postcss';\n\n// NOTE : Used in unit tests.\nimport { labToSRgb, lchToSRgb } from './color';\n\n/** Transform lab() and lch() functions in CSS. */\nconst postcssPlugin: PluginCreator<{ preserve: boolean }> = (opts?: { preserve: boolean }) => {\n\tconst preserve = 'preserve' in Object(opts) ? Boolean(opts.preserve) : false;\n\n\treturn {\n\t\tpostcssPlugin: 'postcss-lab-function',\n\t\tDeclaration: (decl: Declaration, { result, postcss }: { result: Result, postcss: Postcss }) => {\n\t\t\tif (preserve && hasSupportsAtRuleAncestor(decl)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst originalValue = decl.value;\n\t\t\tif (!(/(^|[^\\w-])(lab|lch)\\(/i.test(originalValue))) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet valueAST: ParsedValue|undefined;\n\n\t\t\ttry {\n\t\t\t\tvalueAST = valueParser(originalValue);\n\t\t\t} catch (error) {\n\t\t\t\tdecl.warn(\n\t\t\t\t\tresult,\n\t\t\t\t\t`Failed to parse value '${originalValue}' as a lab or hcl function. Leaving the original value intact.`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (typeof valueAST === 'undefined') {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvalueAST.walk((node) => {\n\t\t\t\tif (!node.type || node.type !== 'function') {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (node.value !== 'lab' && node.value !== 'lch') {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tonCSSFunction(node as FunctionNode);\n\t\t\t});\n\t\t\tconst modifiedValue = String(valueAST);\n\n\t\t\tif (modifiedValue === originalValue) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (preserve && decl.variable) {\n\t\t\t\tconst parent = decl.parent;\n\t\t\t\tconst atSupportsParams = '(color: lab(0% 0 0)) and (color: lch(0% 0 0))';\n\t\t\t\tconst atSupports = postcss.atRule({ name: 'supports', params: atSupportsParams, source: decl.source });\n\n\t\t\t\tconst parentClone = parent.clone();\n\t\t\t\tparentClone.removeAll();\n\n\t\t\t\tparentClone.append(decl.clone());\n\t\t\t\tatSupports.append(parentClone);\n\n\t\t\t\t// Ensure correct order of @supports rules\n\t\t\t\t// Find the last one created by us or the current parent and insert after.\n\t\t\t\tlet insertAfter = parent;\n\t\t\t\tlet nextInsertAfter = parent.next();\n\t\t\t\twhile (\n\t\t\t\t\tinsertAfter &&\n\t\t\t\t\tnextInsertAfter &&\n\t\t\t\t\tnextInsertAfter.type === 'atrule' &&\n\t\t\t\t\tnextInsertAfter.name === 'supports' &&\n\t\t\t\t\tnextInsertAfter.params === atSupportsParams\n\t\t\t\t) {\n\t\t\t\t\tinsertAfter = nextInsertAfter;\n\t\t\t\t\tnextInsertAfter = nextInsertAfter.next();\n\t\t\t\t}\n\n\t\t\t\tinsertAfter.after(atSupports);\n\n\t\t\t\tdecl.value = modifiedValue;\n\t\t\t} else if (preserve) {\n\t\t\t\tdecl.cloneBefore({ value: modifiedValue });\n\t\t\t} else {\n\t\t\t\tdecl.value = modifiedValue;\n\t\t\t}\n\t\t},\n\t};\n};\n\npostcssPlugin.postcss = true;\n\n// Used by unit tests.\n// Mixing named and default export causes issues with CJS.\n// Attaching these to the default export is the best solution.\npostcssPlugin['_labToSRgb'] = labToSRgb;\npostcssPlugin['_lchToSRgb'] = lchToSRgb;\n\nexport default postcssPlugin;\n","import type { Node, AtRule } from 'postcss';\n\nexport function hasSupportsAtRuleAncestor(node: Node): boolean {\n\tlet parent = node.parent;\n\twhile (parent) {\n\t\tif (parent.type !== 'atrule') {\n\t\t\tparent = parent.parent;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif ((parent as AtRule).name === 'supports' && (parent as AtRule).params.indexOf('(color: lab(0% 0 0)) and (color: lch(0% 0 0))') !== -1) {\n\t\t\treturn true;\n\t\t}\n\n\t\tparent = parent.parent;\n\t}\n\n\treturn false;\n}\n"],"names":["labToSRgb","lab","xyz2rgb","lab2xyz","lchToSRgb","lch","Math","cos","PI","sin","lch2lab","clamp","labLRaw","labARaw","labBRaw","labL","min","max","labA","labB","f2","f1","f3","initX","initY","initZ","pow","epsilon","kappa","xyzX","xyzY","xyzZ","matrix","wd50X","wd50Y","wd50Z","xyz","lrgbR","lrgbB","lrgbG","rgbR","rgbG","rgbB","map","v","params","mats","mat","reduce","acc","value","index","precision","onCSSFunction","node","relevantNodes","nodes","slice","filter","x","type","isNumericNodePercentage","isNumericNodeNumber","out","l","valueParser","unit","lNode","a","aNode","b","bNode","isSlashNode","slash","isNumericNodePercentageOrNumber","isCalcNode","alpha","labFunctionContents","canParseAsUnit","unitAndValue","number","isNumericNodeHueLike","c","cNode","h","hNode","dimension","parseFloat","toString","normalizeHueNode","isVarNode","lchFunctionContents","length","slashNode","alphaNode","before","isNumericNode","String","transformAlpha","channelNode1","channelNode2","channelNode3","isLab","channelNodes","channelDimension1","channelDimension2","channelDimension3","channelDimensions","rgbValues","channelNumber","channelValue","round","splice","indexOf","sourceIndex","sourceEndIndex","after","replaceWith","oldNode","newNode","e","postcssPlugin","opts","preserve","Object","Boolean","Declaration","decl","result","postcss","parent","name","hasSupportsAtRuleAncestor","originalValue","test","valueAST","error","warn","walk","modifiedValue","variable","atSupportsParams","atSupports","atRule","source","parentClone","clone","removeAll","append","insertAfter","nextInsertAfter","next","cloneBefore"],"mappings":"uIAIgBA,EAAUC,GACzB,O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T,EAAKU,KACJT,EACA,0BAA0BK,mEAI5B,QAAwB,IAAbE,EACV,OAGDA,EAASG,MAAMpF,IACTA,EAAKM,MAAsB,aAAdN,EAAKM,OAIJ,QAAfN,EAAKJ,OAAkC,QAAfI,EAAKJ,OAIjCG,EAAcC,OAEf,MAAMqF,EAAgB1C,OAAOsC,GAE7B,GAAII,IAAkBN,EAItB,GAAIV,GAAYI,EAAKa,SAAU,CAC9B,MAAMV,EAASH,EAAKG,OACdW,EAAmB,gDACnBC,EAAab,EAAQc,OAAO,CAAEZ,KAAM,WAAYtF,OAAQgG,EAAkBG,OAAQjB,EAAKiB,SAEvFC,EAAcf,EAAOgB,QAC3BD,EAAYE,YAEZF,EAAYG,OAAOrB,EAAKmB,SACxBJ,EAAWM,OAAOH,GAIlB,IAAII,EAAcnB,EACdoB,EAAkBpB,EAAOqB,OAC7B,KACCF,GACAC,GACyB,WAAzBA,EAAgB1F,MACS,aAAzB0F,EAAgBnB,MAChBmB,EAAgBzG,SAAWgG,GAE3BQ,EAAcC,EACdA,EAAkBA,EAAgBC,OAGnCF,EAAYjC,MAAM0B,GAElBf,EAAK7E,MAAQyF,OACHhB,EACVI,EAAKyB,YAAY,CAAEtG,MAAOyF,IAE1BZ,EAAK7E,MAAQyF,KAMjBlB,EAAcQ,SAAU,EAKxBR,EAA0B,WAAIzH,EAC9ByH,EAA0B,WAAIrH"}
|
package/dist/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/color.ts","../src/on-css-function.ts","../src/index.ts","../src/has-supports-at-rule-ancestor.ts"],"sourcesContent":["// Taken from @csstools/convert-colors\n// That package is in need of maintenance but this is out of scope for preset-env\n// We only need lab() -> rgb() and lch() -> rgb()\n\nexport function labToSRgb(lab: [number, number, number]): [number, number, number] {\n\treturn xyz2rgb(lab2xyz(lab, true));\n}\n\nexport function lchToSRgb(lch: [number, number, number]): [number, number, number] {\n\treturn xyz2rgb(\n\t\tlab2xyz(lch2lab(lch),\n\t\tfalse, /* do not clamp \"a\" and \"b\" when processing lch */\n\t));\n}\n\nfunction lch2lab(lch: [number, number, number]): [number, number, number] {\n\t// Convert from polar form\n\treturn [\n\t\tlch[0], // L is still L\n\t\tlch[1] * Math.cos(lch[2] * Math.PI / 180), // a\n\t\tlch[1] * Math.sin(lch[2] * Math.PI / 180), // b\n\t];\n}\n\nfunction lab2xyz(lab: [number, number, number], clamp : boolean): [number, number, number] {\n\tconst [labLRaw, labARaw, labBRaw] = lab;\n\n\tconst labL = Math.min(\n\t\tMath.max(\n\t\t\tlabLRaw,\n\t\t\t0,\n\t\t),\n\t\t100,\n\t);\n\n\tlet labA = 0;\n\tlet labB = 0;\n\n\tif (clamp) {\n\t\tlabA = Math.min(\n\t\t\tMath.max(\n\t\t\t\tlabARaw,\n\t\t\t\t-127,\n\t\t\t),\n\t\t\t128,\n\t\t);\n\n\t\tlabB = Math.min(\n\t\t\tMath.max(\n\t\t\t\tlabBRaw,\n\t\t\t\t-127,\n\t\t\t),\n\t\t\t128,\n\t\t);\n\t} else {\n\t\tlabA = labARaw;\n\t\tlabB = labBRaw;\n\t}\n\n\t// compute f, starting with the luminance-related term\n\tconst f2 = (labL + 16) / 116;\n\tconst f1 = labA / 500 + f2;\n\tconst f3 = f2 - labB / 200;\n\n\t// compute pre-scaled XYZ\n\tconst [ initX, initY, initZ ] = [\n\t\tMath.pow(f1, 3) > epsilon ? Math.pow(f1, 3) : (116 * f1 - 16) / kappa,\n\t\tlabL > kappa * epsilon ? Math.pow((labL + 16) / 116, 3) : labL / kappa,\n\t\tMath.pow(f3, 3) > epsilon ? Math.pow(f3, 3) : (116 * f3 - 16) / kappa,\n\t];\n\n\tconst [ xyzX, xyzY, xyzZ ] = matrix(\n\t\t// compute XYZ by scaling pre-scaled XYZ by reference white\n\t\t[ initX * wd50X, initY * wd50Y, initZ * wd50Z ],\n\t\t// calculate D65 XYZ from D50 XYZ\n\t\t[\n\t\t\t[ 0.9554734527042182, -0.023098536874261423, 0.0632593086610217 ],\n\t\t\t[ -0.028369706963208136, 1.0099954580058226, 0.021041398966943008 ],\n\t\t\t[ 0.012314001688319899, -0.020507696433477912, 1.3303659366080753 ],\n\t\t],\n\t);\n\n\treturn [ xyzX, xyzY, xyzZ ];\n}\n\nexport function xyz2rgb(xyz: [number, number, number]): [number, number, number] {\n\tconst [xyzX, xyzY, xyzZ] = xyz;\n\tconst [ lrgbR, lrgbB, lrgbG ] = matrix([ xyzX, xyzY, xyzZ ], [\n\t\t[ 3.2409699419045226, -1.537383177570094, -0.4986107602930034 ],\n\t\t[ -0.9692436362808796, 1.8759675015077202, 0.04155505740717559 ],\n\t\t[ 0.05563007969699366, -0.20397695888897652, 1.0569715142428786 ],\n\t]);\n\n\tconst [ rgbR, rgbG, rgbB ] = [ lrgbR, lrgbB, lrgbG ].map(\n\t\tv => v > 0.31308 ? 1.055 * Math.pow(v / 100, 1 / 2.4) * 100 - 5.5 : 12.92 * v,\n\t);\n\n\treturn [ rgbR, rgbG, rgbB ];\n}\n\nfunction matrix(params: [number, number, number], mats: [[number, number, number], [number, number, number], [number, number, number]]): [number, number, number] {\n\treturn mats.map(\n\t\tmat => mat.reduce(\n\t\t\t// (acc, value, index) => acc + params[index] * value,\n\t\t\t(acc, value, index) => acc + params[index] * precision * (value * precision) / precision / precision,\n\t\t\t0,\n\t\t),\n\t) as [number, number, number];\n}\n\n/* Precision\n/* ========================================================================== */\n\nconst precision = 100000000;\n\n/* D50 reference white\n/* ========================================================================== */\n\nconst [ wd50X, wd50Y, wd50Z ] = [ 96.422, 100.000, 82.521 ];\n\n/* Math Constants\n/* ========================================================================== */\n\nconst epsilon = Math.pow(6, 3) / Math.pow(29, 3);\nconst kappa = Math.pow(29, 3) / Math.pow(3, 3);\n","import valueParser from 'postcss-value-parser';\nimport type { FunctionNode, Dimension, Node, DivNode, WordNode } from 'postcss-value-parser';\nimport { labToSRgb, lchToSRgb } from './color';\n\nfunction onCSSFunction(node: FunctionNode) {\n\tconst value = node.value;\n\tconst rawNodes = node.nodes;\n\tconst relevantNodes = rawNodes.slice().filter((x) => {\n\t\treturn x.type !== 'comment' && x.type !== 'space';\n\t});\n\n\tlet nodes: Lch | Lab | null = null;\n\tif (value === 'lab') {\n\t\tnodes = labFunctionContents(relevantNodes);\n\t} else if (value === 'lch') {\n\t\tnodes = lchFunctionContents(relevantNodes);\n\t}\n\n\tif (!nodes) {\n\t\treturn;\n\t}\n\n\tif (relevantNodes.length > 3 && (!nodes.slash || !nodes.alpha)) {\n\t\treturn;\n\t}\n\n\t// rename the Color function to `rgb`\n\tnode.value = 'rgb';\n\n\ttransformAlpha(node, nodes.slash, nodes.alpha);\n\n\t/** Extracted Color channels. */\n\tconst [channelNode1, channelNode2, channelNode3] = channelNodes(nodes);\n\tconst [channelDimension1, channelDimension2, channelDimension3] = channelDimensions(nodes);\n\n\t/** Corresponding Color transformer. */\n\tconst toRGB = value === 'lab' ? labToSRgb : lchToSRgb;\n\n\t/** RGB channels from the source color. */\n\tconst channelNumbers: [number, number, number] = [\n\t\tchannelDimension1.number,\n\t\tchannelDimension2.number,\n\t\tchannelDimension3.number,\n\t].map(\n\t\tchannelNumber => parseFloat(channelNumber),\n\t) as [number, number, number];\n\n\tconst rgbValues = toRGB(\n\t\tchannelNumbers,\n\t).map(\n\t\tchannelValue => Math.max(Math.min(Math.round(channelValue * 2.55), 255), 0),\n\t);\n\n\tnode.nodes.splice(node.nodes.indexOf(channelNode1) + 1, 0, commaNode());\n\tnode.nodes.splice(node.nodes.indexOf(channelNode2) + 1, 0, commaNode());\n\n\treplaceWith(node.nodes, channelNode1, {\n\t\t...channelNode1,\n\t\tvalue: String(rgbValues[0]),\n\t});\n\n\treplaceWith(node.nodes, channelNode2, {\n\t\t...channelNode2,\n\t\tvalue: String(rgbValues[1]),\n\t});\n\n\treplaceWith(node.nodes, channelNode3, {\n\t\t...channelNode3,\n\t\tvalue: String(rgbValues[2]),\n\t});\n\n}\n\nexport default onCSSFunction;\n\nfunction commaNode(): DivNode {\n\treturn {\n\t\tsourceIndex: 0,\n\t\tsourceEndIndex: 1,\n\t\tvalue: ',',\n\t\ttype: 'div',\n\t\tbefore: '',\n\t\tafter: '',\n\t};\n}\n\nfunction isNumericNode(node: Node): node is WordNode {\n\tif (!node || node.type !== 'word') {\n\t\treturn false;\n\t}\n\n\tif (!canParseAsUnit(node)) {\n\t\treturn false;\n\t}\n\n\tconst unitAndValue = valueParser.unit(node.value);\n\tif (!unitAndValue) {\n\t\treturn false;\n\t}\n\n\treturn !!unitAndValue.number;\n}\n\nfunction isNumericNodeNumber(node): node is WordNode {\n\tif (!node || node.type !== 'word') {\n\t\treturn false;\n\t}\n\n\tif (!canParseAsUnit(node)) {\n\t\treturn false;\n\t}\n\n\tconst unitAndValue = valueParser.unit(node.value);\n\tif (!unitAndValue) {\n\t\treturn false;\n\t}\n\n\treturn !!unitAndValue.number && unitAndValue.unit === '';\n}\n\nfunction isNumericNodeHueLike(node: Node): node is WordNode {\n\tif (!node || node.type !== 'word') {\n\t\treturn false;\n\t}\n\n\tif (!canParseAsUnit(node)) {\n\t\treturn false;\n\t}\n\n\tconst unitAndValue = valueParser.unit(node.value);\n\tif (!unitAndValue) {\n\t\treturn false;\n\t}\n\n\treturn !!unitAndValue.number && (\n\t\tunitAndValue.unit === 'deg' ||\n\t\tunitAndValue.unit === 'grad' ||\n\t\tunitAndValue.unit === 'rad' ||\n\t\tunitAndValue.unit === 'turn' ||\n\t\tunitAndValue.unit === ''\n\t);\n}\n\nfunction isNumericNodePercentage(node: Node): node is WordNode {\n\tif (!node || node.type !== 'word') {\n\t\treturn false;\n\t}\n\n\tif (!canParseAsUnit(node)) {\n\t\treturn false;\n\t}\n\n\tconst unitAndValue = valueParser.unit(node.value);\n\tif (!unitAndValue) {\n\t\treturn false;\n\t}\n\n\treturn unitAndValue.unit === '%';\n}\n\nfunction isNumericNodePercentageOrNumber(node: Node): node is WordNode {\n\tif (!node || node.type !== 'word') {\n\t\treturn false;\n\t}\n\n\tif (!canParseAsUnit(node)) {\n\t\treturn false;\n\t}\n\n\tconst unitAndValue = valueParser.unit(node.value);\n\tif (!unitAndValue) {\n\t\treturn false;\n\t}\n\n\treturn unitAndValue.unit === '%' || unitAndValue.unit === '';\n}\n\nfunction isCalcNode(node: Node): node is FunctionNode {\n\treturn node && node.type === 'function' && node.value === 'calc';\n}\n\nfunction isVarNode(node: Node): node is FunctionNode {\n\treturn node && node.type === 'function' && node.value === 'var';\n}\n\nfunction isSlashNode(node: Node): node is DivNode {\n\treturn node && node.type === 'div' && node.value === '/';\n}\n\ntype Lch = {\n\tl: Dimension,\n\tlNode: Node,\n\tc: Dimension,\n\tcNode: Node,\n\th: Dimension,\n\thNode: Node,\n\tslash?: DivNode,\n\talpha?: WordNode|FunctionNode,\n}\n\nfunction lchFunctionContents(nodes): Lch|null {\n\tif (!isNumericNodePercentage(nodes[0])) {\n\t\treturn null;\n\t}\n\n\tif (!isNumericNodeNumber(nodes[1])) {\n\t\treturn null;\n\t}\n\n\tif (!isNumericNodeHueLike(nodes[2])) {\n\t\treturn null;\n\t}\n\n\tconst out: Lch = {\n\t\tl: valueParser.unit(nodes[0].value) as Dimension,\n\t\tlNode: nodes[0],\n\t\tc: valueParser.unit(nodes[1].value) as Dimension,\n\t\tcNode: nodes[1],\n\t\th: valueParser.unit(nodes[2].value) as Dimension,\n\t\thNode: nodes[2],\n\t};\n\n\tnormalizeHueNode(out.h);\n\tif (out.h.unit !== '') {\n\t\treturn null;\n\t}\n\n\tif (isSlashNode(nodes[3])) {\n\t\tout.slash = nodes[3];\n\t}\n\n\tif ((isNumericNodePercentageOrNumber(nodes[4]) || isCalcNode(nodes[4]) || isVarNode(nodes[4]))) {\n\t\tout.alpha = nodes[4];\n\t}\n\n\treturn out;\n}\n\ntype Lab = {\n\tl: Dimension,\n\tlNode: Node,\n\ta: Dimension,\n\taNode: Node,\n\tb: Dimension,\n\tbNode: Node,\n\tslash?: DivNode,\n\talpha?: WordNode | FunctionNode,\n}\n\nfunction labFunctionContents(nodes): Lab|null {\n\tif (!isNumericNodePercentage(nodes[0])) {\n\t\treturn null;\n\t}\n\n\tif (!isNumericNodeNumber(nodes[1])) {\n\t\treturn null;\n\t}\n\n\tif (!isNumericNodeNumber(nodes[2])) {\n\t\treturn null;\n\t}\n\n\tconst out: Lab = {\n\t\tl: valueParser.unit(nodes[0].value) as Dimension,\n\t\tlNode: nodes[0],\n\t\ta: valueParser.unit(nodes[1].value) as Dimension,\n\t\taNode: nodes[1],\n\t\tb: valueParser.unit(nodes[2].value) as Dimension,\n\t\tbNode: nodes[2],\n\t};\n\n\tif (isSlashNode(nodes[3])) {\n\t\tout.slash = nodes[3];\n\t}\n\n\tif ((isNumericNodePercentageOrNumber(nodes[4]) || isCalcNode(nodes[4]))) {\n\t\tout.alpha = nodes[4];\n\t}\n\n\treturn out;\n}\n\nfunction isLab(x: Lch | Lab): x is Lab {\n\tif (typeof (x as Lab).a !== 'undefined') {\n\t\treturn true;\n\t}\n\n\treturn false;\n}\n\nfunction channelNodes(x: Lch | Lab): [Node, Node, Node] {\n\tif (isLab(x)) {\n\t\treturn [x.lNode, x.aNode, x.bNode];\n\t}\n\n\treturn [x.lNode, x.cNode, x.hNode];\n}\n\nfunction channelDimensions(x: Lch | Lab): [Dimension, Dimension, Dimension] {\n\tif (isLab(x)) {\n\t\treturn [x.l, x.a, x.b];\n\t}\n\n\treturn [x.l, x.c, x.h];\n}\n\nfunction transformAlpha(node: FunctionNode, slashNode: DivNode | undefined, alphaNode: WordNode | FunctionNode | undefined) {\n\tif (!slashNode || !alphaNode) {\n\t\treturn;\n\t}\n\n\tnode.value = 'rgba';\n\tslashNode.value = ',';\n\tslashNode.before = '';\n\n\tif (!isNumericNode(alphaNode)) {\n\t\treturn;\n\t}\n\n\tconst unitAndValue = valueParser.unit(alphaNode.value);\n\tif (!unitAndValue) {\n\t\treturn;\n\t}\n\n\tif (unitAndValue.unit === '%') {\n\t\t// transform the Alpha channel from a Percentage to (0-1) Number\n\t\tunitAndValue.number = String(parseFloat(unitAndValue.number) / 100);\n\t\talphaNode.value = String(unitAndValue.number);\n\t}\n}\n\nfunction replaceWith(nodes: Array<Node>, oldNode: Node, newNode: Node) {\n\tconst index = nodes.indexOf(oldNode);\n\tnodes[index] = newNode;\n}\n\nfunction normalizeHueNode(dimension: Dimension) {\n\tswitch (dimension.unit) {\n\t\tcase 'deg':\n\t\t\tdimension.unit = '';\n\t\t\treturn;\n\t\tcase 'rad':\n\t\t\t// radians -> degrees\n\t\t\tdimension.unit = '';\n\t\t\tdimension.number = (parseFloat(dimension.number) * 180 / Math.PI).toString();\n\t\t\treturn;\n\n\t\tcase 'grad':\n\t\t\t// grades -> degrees\n\t\t\tdimension.unit = '';\n\t\t\tdimension.number = (parseFloat(dimension.number) * 0.9).toString();\n\t\t\treturn;\n\n\t\tcase 'turn':\n\t\t\t// turns -> degrees\n\t\t\tdimension.unit = '';\n\t\t\tdimension.number = (parseFloat(dimension.number) * 360).toString();\n\t\t\treturn;\n\t}\n}\n\nfunction canParseAsUnit(node : Node): boolean {\n\tif (!node || !node.value) {\n\t\treturn false;\n\t}\n\n\ttry {\n\t\treturn valueParser.unit(node.value) !== false;\n\t} catch (e) {\n\t\treturn false;\n\t}\n}\n","import { hasSupportsAtRuleAncestor } from './has-supports-at-rule-ancestor';\nimport valueParser from 'postcss-value-parser';\nimport type { ParsedValue, FunctionNode } from 'postcss-value-parser';\nimport type { Declaration, Postcss, Result } from 'postcss';\nimport onCSSFunction from './on-css-function';\n\nimport type { PluginCreator } from 'postcss';\n\n// NOTE : Used in unit tests.\nimport { labToSRgb, lchToSRgb } from './color';\n\n/** Transform lab() and lch() functions in CSS. */\nconst postcssPlugin: PluginCreator<{ preserve: boolean }> = (opts?: { preserve: boolean }) => {\n\tconst preserve = 'preserve' in Object(opts) ? Boolean(opts.preserve) : false;\n\n\treturn {\n\t\tpostcssPlugin: 'postcss-lab-function',\n\t\tDeclaration: (decl: Declaration, { result, postcss }: { result: Result, postcss: Postcss }) => {\n\t\t\tif (preserve && hasSupportsAtRuleAncestor(decl)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst originalValue = decl.value;\n\t\t\tif (!(/(^|[^\\w-])(lab|lch)\\(/i.test(originalValue))) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet valueAST: ParsedValue|undefined;\n\n\t\t\ttry {\n\t\t\t\tvalueAST = valueParser(originalValue);\n\t\t\t} catch (error) {\n\t\t\t\tdecl.warn(\n\t\t\t\t\tresult,\n\t\t\t\t\t`Failed to parse value '${originalValue}' as a lab or hcl function. Leaving the original value intact.`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (typeof valueAST === 'undefined') {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvalueAST.walk((node) => {\n\t\t\t\tif (!node.type || node.type !== 'function') {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (node.value !== 'lab' && node.value !== 'lch') {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tonCSSFunction(node as FunctionNode);\n\t\t\t});\n\t\t\tconst modifiedValue = String(valueAST);\n\n\t\t\tif (modifiedValue === originalValue) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (preserve && decl.variable) {\n\t\t\t\tconst parent = decl.parent;\n\t\t\t\tconst atSupportsParams = '(color: lab(0% 0 0)) and (color: lch(0% 0 0))';\n\t\t\t\tconst atSupports = postcss.atRule({ name: 'supports', params: atSupportsParams, source: decl.source });\n\n\t\t\t\tconst parentClone = parent.clone();\n\t\t\t\tparentClone.removeAll();\n\n\t\t\t\tparentClone.append(decl.clone());\n\t\t\t\tatSupports.append(parentClone);\n\n\t\t\t\t// Ensure correct order of @supports rules\n\t\t\t\t// Find the last one created by us or the current parent and insert after.\n\t\t\t\tlet insertAfter = parent;\n\t\t\t\tlet nextInsertAfter = parent.next();\n\t\t\t\twhile (\n\t\t\t\t\tinsertAfter &&\n\t\t\t\t\tnextInsertAfter &&\n\t\t\t\t\tnextInsertAfter.type === 'atrule' &&\n\t\t\t\t\tnextInsertAfter.name === 'supports' &&\n\t\t\t\t\tnextInsertAfter.params === atSupportsParams\n\t\t\t\t) {\n\t\t\t\t\tinsertAfter = nextInsertAfter;\n\t\t\t\t\tnextInsertAfter = nextInsertAfter.next();\n\t\t\t\t}\n\n\t\t\t\tinsertAfter.after(atSupports);\n\n\t\t\t\tdecl.value = modifiedValue;\n\t\t\t} else if (preserve) {\n\t\t\t\tdecl.cloneBefore({ value: modifiedValue });\n\t\t\t} else {\n\t\t\t\tdecl.value = modifiedValue;\n\t\t\t}\n\t\t},\n\t};\n};\n\npostcssPlugin.postcss = true;\n\n// Used by unit tests.\n// Mixing named and default export causes issues with CJS.\n// Attaching these to the default export is the best solution.\npostcssPlugin['_labToSRgb'] = labToSRgb;\npostcssPlugin['_lchToSRgb'] = lchToSRgb;\n\nexport default postcssPlugin;\n","import type { Node, AtRule } from 'postcss';\n\nexport function hasSupportsAtRuleAncestor(node: Node): boolean {\n\tlet parent = node.parent;\n\twhile (parent) {\n\t\tif (parent.type !== 'atrule') {\n\t\t\tparent = parent.parent;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif ((parent as AtRule).name === 'supports' && (parent as AtRule).params.indexOf('(color: lab(0% 0 0)) and (color: lch(0% 0 0))') !== -1) {\n\t\t\treturn true;\n\t\t}\n\n\t\tparent = parent.parent;\n\t}\n\n\treturn false;\n}\n"],"names":["labToSRgb","lab","xyz2rgb","lab2xyz","lchToSRgb","lch","Math","cos","PI","sin","lch2lab","clamp","labLRaw","labARaw","labBRaw","labL","min","max","labA","labB","f2","f1","f3","initX","initY","initZ","pow","epsilon","kappa","xyzX","xyzY","xyzZ","matrix","wd50X","wd50Y","wd50Z","xyz","lrgbR","lrgbB","lrgbG","rgbR","rgbG","rgbB","map","v","params","mats","mat","reduce","acc","value","index","precision","onCSSFunction","node","relevantNodes","nodes","slice","filter","x","type","isNumericNodePercentage","isNumericNodeNumber","out","l","valueParser","unit","lNode","a","aNode","b","bNode","isSlashNode","slash","isNumericNodePercentageOrNumber","isCalcNode","alpha","labFunctionContents","canParseAsUnit","unitAndValue","number","isNumericNodeHueLike","c","cNode","h","hNode","dimension","parseFloat","toString","normalizeHueNode","isVarNode","lchFunctionContents","length","slashNode","alphaNode","before","isNumericNode","String","transformAlpha","channelNode1","channelNode2","channelNode3","isLab","channelNodes","channelDimension1","channelDimension2","channelDimension3","channelDimensions","rgbValues","channelNumber","channelValue","round","splice","indexOf","sourceIndex","sourceEndIndex","after","replaceWith","oldNode","newNode","e","postcssPlugin","opts","preserve","Object","Boolean","Declaration","decl","result","postcss","parent","name","hasSupportsAtRuleAncestor","originalValue","test","valueAST","error","warn","walk","modifiedValue","variable","atSupportsParams","atSupports","atRule","source","parentClone","clone","removeAll","append","insertAfter","nextInsertAfter","next","cloneBefore"],"mappings":"6CAIgBA,EAAUC,GACzB,OAAOC,EAAQC,EAAQF,GAAK,aAGbG,EAAUC,GACzB,OAAOH,EACNC,EAKF,SAAiBE,GAEhB,MAAO,CACNA,EAAI,GACJA,EAAI,GAAKC,KAAKC,IAAIF,EAAI,GAAKC,KAAKE,GAAK,KACrCH,EAAI,GAAKC,KAAKG,IAAIJ,EAAI,GAAKC,KAAKE,GAAK,MAV7BE,CAAQL,IAChB,IAaF,SAASF,EAAQF,EAA+BU,GAC/C,MAAOC,EAASC,EAASC,GAAWb,EAE9Bc,EAAOT,KAAKU,IACjBV,KAAKW,IACJL,EACA,GAED,KAGD,IAAIM,EAAO,EACPC,EAAO,EAEPR,GACHO,EAAOZ,KAAKU,IACXV,KAAKW,IACJJ,GACC,KAEF,KAGDM,EAAOb,KAAKU,IACXV,KAAKW,IACJH,GACC,KAEF,OAGDI,EAAOL,EACPM,EAAOL,GAIR,MAAMM,GAAML,EAAO,IAAM,IACnBM,EAAKH,EAAO,IAAME,EAClBE,EAAKF,EAAKD,EAAO,KAGfI,EAAOC,EAAOC,GAAU,CAC/BnB,KAAK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