@ha-bits/cortex 1.1.0 → 1.1.7
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/README.md +64 -27
- package/pack/index.cjs +2275 -2151
- package/package.json +1 -1
- package/ui/package.json +1 -1
package/pack/index.cjs
CHANGED
|
@@ -581,1376 +581,6 @@ module.exports = ({onlyFirst = false} = {}) => {
|
|
|
581
581
|
};
|
|
582
582
|
|
|
583
583
|
|
|
584
|
-
/***/ }),
|
|
585
|
-
|
|
586
|
-
/***/ 54412:
|
|
587
|
-
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
588
|
-
|
|
589
|
-
"use strict";
|
|
590
|
-
/* module decorator */ module = __nccwpck_require__.nmd(module);
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
const wrapAnsi16 = (fn, offset) => (...args) => {
|
|
594
|
-
const code = fn(...args);
|
|
595
|
-
return `\u001B[${code + offset}m`;
|
|
596
|
-
};
|
|
597
|
-
|
|
598
|
-
const wrapAnsi256 = (fn, offset) => (...args) => {
|
|
599
|
-
const code = fn(...args);
|
|
600
|
-
return `\u001B[${38 + offset};5;${code}m`;
|
|
601
|
-
};
|
|
602
|
-
|
|
603
|
-
const wrapAnsi16m = (fn, offset) => (...args) => {
|
|
604
|
-
const rgb = fn(...args);
|
|
605
|
-
return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
|
606
|
-
};
|
|
607
|
-
|
|
608
|
-
const ansi2ansi = n => n;
|
|
609
|
-
const rgb2rgb = (r, g, b) => [r, g, b];
|
|
610
|
-
|
|
611
|
-
const setLazyProperty = (object, property, get) => {
|
|
612
|
-
Object.defineProperty(object, property, {
|
|
613
|
-
get: () => {
|
|
614
|
-
const value = get();
|
|
615
|
-
|
|
616
|
-
Object.defineProperty(object, property, {
|
|
617
|
-
value,
|
|
618
|
-
enumerable: true,
|
|
619
|
-
configurable: true
|
|
620
|
-
});
|
|
621
|
-
|
|
622
|
-
return value;
|
|
623
|
-
},
|
|
624
|
-
enumerable: true,
|
|
625
|
-
configurable: true
|
|
626
|
-
});
|
|
627
|
-
};
|
|
628
|
-
|
|
629
|
-
/** @type {typeof import('color-convert')} */
|
|
630
|
-
let colorConvert;
|
|
631
|
-
const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
|
|
632
|
-
if (colorConvert === undefined) {
|
|
633
|
-
colorConvert = __nccwpck_require__(88597);
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
const offset = isBackground ? 10 : 0;
|
|
637
|
-
const styles = {};
|
|
638
|
-
|
|
639
|
-
for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
|
|
640
|
-
const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
|
|
641
|
-
if (sourceSpace === targetSpace) {
|
|
642
|
-
styles[name] = wrap(identity, offset);
|
|
643
|
-
} else if (typeof suite === 'object') {
|
|
644
|
-
styles[name] = wrap(suite[targetSpace], offset);
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
return styles;
|
|
649
|
-
};
|
|
650
|
-
|
|
651
|
-
function assembleStyles() {
|
|
652
|
-
const codes = new Map();
|
|
653
|
-
const styles = {
|
|
654
|
-
modifier: {
|
|
655
|
-
reset: [0, 0],
|
|
656
|
-
// 21 isn't widely supported and 22 does the same thing
|
|
657
|
-
bold: [1, 22],
|
|
658
|
-
dim: [2, 22],
|
|
659
|
-
italic: [3, 23],
|
|
660
|
-
underline: [4, 24],
|
|
661
|
-
inverse: [7, 27],
|
|
662
|
-
hidden: [8, 28],
|
|
663
|
-
strikethrough: [9, 29]
|
|
664
|
-
},
|
|
665
|
-
color: {
|
|
666
|
-
black: [30, 39],
|
|
667
|
-
red: [31, 39],
|
|
668
|
-
green: [32, 39],
|
|
669
|
-
yellow: [33, 39],
|
|
670
|
-
blue: [34, 39],
|
|
671
|
-
magenta: [35, 39],
|
|
672
|
-
cyan: [36, 39],
|
|
673
|
-
white: [37, 39],
|
|
674
|
-
|
|
675
|
-
// Bright color
|
|
676
|
-
blackBright: [90, 39],
|
|
677
|
-
redBright: [91, 39],
|
|
678
|
-
greenBright: [92, 39],
|
|
679
|
-
yellowBright: [93, 39],
|
|
680
|
-
blueBright: [94, 39],
|
|
681
|
-
magentaBright: [95, 39],
|
|
682
|
-
cyanBright: [96, 39],
|
|
683
|
-
whiteBright: [97, 39]
|
|
684
|
-
},
|
|
685
|
-
bgColor: {
|
|
686
|
-
bgBlack: [40, 49],
|
|
687
|
-
bgRed: [41, 49],
|
|
688
|
-
bgGreen: [42, 49],
|
|
689
|
-
bgYellow: [43, 49],
|
|
690
|
-
bgBlue: [44, 49],
|
|
691
|
-
bgMagenta: [45, 49],
|
|
692
|
-
bgCyan: [46, 49],
|
|
693
|
-
bgWhite: [47, 49],
|
|
694
|
-
|
|
695
|
-
// Bright color
|
|
696
|
-
bgBlackBright: [100, 49],
|
|
697
|
-
bgRedBright: [101, 49],
|
|
698
|
-
bgGreenBright: [102, 49],
|
|
699
|
-
bgYellowBright: [103, 49],
|
|
700
|
-
bgBlueBright: [104, 49],
|
|
701
|
-
bgMagentaBright: [105, 49],
|
|
702
|
-
bgCyanBright: [106, 49],
|
|
703
|
-
bgWhiteBright: [107, 49]
|
|
704
|
-
}
|
|
705
|
-
};
|
|
706
|
-
|
|
707
|
-
// Alias bright black as gray (and grey)
|
|
708
|
-
styles.color.gray = styles.color.blackBright;
|
|
709
|
-
styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
|
|
710
|
-
styles.color.grey = styles.color.blackBright;
|
|
711
|
-
styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
|
|
712
|
-
|
|
713
|
-
for (const [groupName, group] of Object.entries(styles)) {
|
|
714
|
-
for (const [styleName, style] of Object.entries(group)) {
|
|
715
|
-
styles[styleName] = {
|
|
716
|
-
open: `\u001B[${style[0]}m`,
|
|
717
|
-
close: `\u001B[${style[1]}m`
|
|
718
|
-
};
|
|
719
|
-
|
|
720
|
-
group[styleName] = styles[styleName];
|
|
721
|
-
|
|
722
|
-
codes.set(style[0], style[1]);
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
Object.defineProperty(styles, groupName, {
|
|
726
|
-
value: group,
|
|
727
|
-
enumerable: false
|
|
728
|
-
});
|
|
729
|
-
}
|
|
730
|
-
|
|
731
|
-
Object.defineProperty(styles, 'codes', {
|
|
732
|
-
value: codes,
|
|
733
|
-
enumerable: false
|
|
734
|
-
});
|
|
735
|
-
|
|
736
|
-
styles.color.close = '\u001B[39m';
|
|
737
|
-
styles.bgColor.close = '\u001B[49m';
|
|
738
|
-
|
|
739
|
-
setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
|
|
740
|
-
setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
|
|
741
|
-
setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
|
|
742
|
-
setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
|
|
743
|
-
setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
|
|
744
|
-
setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
|
|
745
|
-
|
|
746
|
-
return styles;
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
// Make the export immutable
|
|
750
|
-
Object.defineProperty(module, 'exports', {
|
|
751
|
-
enumerable: true,
|
|
752
|
-
get: assembleStyles
|
|
753
|
-
});
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
/***/ }),
|
|
757
|
-
|
|
758
|
-
/***/ 45532:
|
|
759
|
-
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
760
|
-
|
|
761
|
-
/* MIT license */
|
|
762
|
-
/* eslint-disable no-mixed-operators */
|
|
763
|
-
const cssKeywords = __nccwpck_require__(75085);
|
|
764
|
-
|
|
765
|
-
// NOTE: conversions should only return primitive values (i.e. arrays, or
|
|
766
|
-
// values that give correct `typeof` results).
|
|
767
|
-
// do not use box values types (i.e. Number(), String(), etc.)
|
|
768
|
-
|
|
769
|
-
const reverseKeywords = {};
|
|
770
|
-
for (const key of Object.keys(cssKeywords)) {
|
|
771
|
-
reverseKeywords[cssKeywords[key]] = key;
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
const convert = {
|
|
775
|
-
rgb: {channels: 3, labels: 'rgb'},
|
|
776
|
-
hsl: {channels: 3, labels: 'hsl'},
|
|
777
|
-
hsv: {channels: 3, labels: 'hsv'},
|
|
778
|
-
hwb: {channels: 3, labels: 'hwb'},
|
|
779
|
-
cmyk: {channels: 4, labels: 'cmyk'},
|
|
780
|
-
xyz: {channels: 3, labels: 'xyz'},
|
|
781
|
-
lab: {channels: 3, labels: 'lab'},
|
|
782
|
-
lch: {channels: 3, labels: 'lch'},
|
|
783
|
-
hex: {channels: 1, labels: ['hex']},
|
|
784
|
-
keyword: {channels: 1, labels: ['keyword']},
|
|
785
|
-
ansi16: {channels: 1, labels: ['ansi16']},
|
|
786
|
-
ansi256: {channels: 1, labels: ['ansi256']},
|
|
787
|
-
hcg: {channels: 3, labels: ['h', 'c', 'g']},
|
|
788
|
-
apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
|
|
789
|
-
gray: {channels: 1, labels: ['gray']}
|
|
790
|
-
};
|
|
791
|
-
|
|
792
|
-
module.exports = convert;
|
|
793
|
-
|
|
794
|
-
// Hide .channels and .labels properties
|
|
795
|
-
for (const model of Object.keys(convert)) {
|
|
796
|
-
if (!('channels' in convert[model])) {
|
|
797
|
-
throw new Error('missing channels property: ' + model);
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
if (!('labels' in convert[model])) {
|
|
801
|
-
throw new Error('missing channel labels property: ' + model);
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
if (convert[model].labels.length !== convert[model].channels) {
|
|
805
|
-
throw new Error('channel and label counts mismatch: ' + model);
|
|
806
|
-
}
|
|
807
|
-
|
|
808
|
-
const {channels, labels} = convert[model];
|
|
809
|
-
delete convert[model].channels;
|
|
810
|
-
delete convert[model].labels;
|
|
811
|
-
Object.defineProperty(convert[model], 'channels', {value: channels});
|
|
812
|
-
Object.defineProperty(convert[model], 'labels', {value: labels});
|
|
813
|
-
}
|
|
814
|
-
|
|
815
|
-
convert.rgb.hsl = function (rgb) {
|
|
816
|
-
const r = rgb[0] / 255;
|
|
817
|
-
const g = rgb[1] / 255;
|
|
818
|
-
const b = rgb[2] / 255;
|
|
819
|
-
const min = Math.min(r, g, b);
|
|
820
|
-
const max = Math.max(r, g, b);
|
|
821
|
-
const delta = max - min;
|
|
822
|
-
let h;
|
|
823
|
-
let s;
|
|
824
|
-
|
|
825
|
-
if (max === min) {
|
|
826
|
-
h = 0;
|
|
827
|
-
} else if (r === max) {
|
|
828
|
-
h = (g - b) / delta;
|
|
829
|
-
} else if (g === max) {
|
|
830
|
-
h = 2 + (b - r) / delta;
|
|
831
|
-
} else if (b === max) {
|
|
832
|
-
h = 4 + (r - g) / delta;
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
h = Math.min(h * 60, 360);
|
|
836
|
-
|
|
837
|
-
if (h < 0) {
|
|
838
|
-
h += 360;
|
|
839
|
-
}
|
|
840
|
-
|
|
841
|
-
const l = (min + max) / 2;
|
|
842
|
-
|
|
843
|
-
if (max === min) {
|
|
844
|
-
s = 0;
|
|
845
|
-
} else if (l <= 0.5) {
|
|
846
|
-
s = delta / (max + min);
|
|
847
|
-
} else {
|
|
848
|
-
s = delta / (2 - max - min);
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
return [h, s * 100, l * 100];
|
|
852
|
-
};
|
|
853
|
-
|
|
854
|
-
convert.rgb.hsv = function (rgb) {
|
|
855
|
-
let rdif;
|
|
856
|
-
let gdif;
|
|
857
|
-
let bdif;
|
|
858
|
-
let h;
|
|
859
|
-
let s;
|
|
860
|
-
|
|
861
|
-
const r = rgb[0] / 255;
|
|
862
|
-
const g = rgb[1] / 255;
|
|
863
|
-
const b = rgb[2] / 255;
|
|
864
|
-
const v = Math.max(r, g, b);
|
|
865
|
-
const diff = v - Math.min(r, g, b);
|
|
866
|
-
const diffc = function (c) {
|
|
867
|
-
return (v - c) / 6 / diff + 1 / 2;
|
|
868
|
-
};
|
|
869
|
-
|
|
870
|
-
if (diff === 0) {
|
|
871
|
-
h = 0;
|
|
872
|
-
s = 0;
|
|
873
|
-
} else {
|
|
874
|
-
s = diff / v;
|
|
875
|
-
rdif = diffc(r);
|
|
876
|
-
gdif = diffc(g);
|
|
877
|
-
bdif = diffc(b);
|
|
878
|
-
|
|
879
|
-
if (r === v) {
|
|
880
|
-
h = bdif - gdif;
|
|
881
|
-
} else if (g === v) {
|
|
882
|
-
h = (1 / 3) + rdif - bdif;
|
|
883
|
-
} else if (b === v) {
|
|
884
|
-
h = (2 / 3) + gdif - rdif;
|
|
885
|
-
}
|
|
886
|
-
|
|
887
|
-
if (h < 0) {
|
|
888
|
-
h += 1;
|
|
889
|
-
} else if (h > 1) {
|
|
890
|
-
h -= 1;
|
|
891
|
-
}
|
|
892
|
-
}
|
|
893
|
-
|
|
894
|
-
return [
|
|
895
|
-
h * 360,
|
|
896
|
-
s * 100,
|
|
897
|
-
v * 100
|
|
898
|
-
];
|
|
899
|
-
};
|
|
900
|
-
|
|
901
|
-
convert.rgb.hwb = function (rgb) {
|
|
902
|
-
const r = rgb[0];
|
|
903
|
-
const g = rgb[1];
|
|
904
|
-
let b = rgb[2];
|
|
905
|
-
const h = convert.rgb.hsl(rgb)[0];
|
|
906
|
-
const w = 1 / 255 * Math.min(r, Math.min(g, b));
|
|
907
|
-
|
|
908
|
-
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
|
|
909
|
-
|
|
910
|
-
return [h, w * 100, b * 100];
|
|
911
|
-
};
|
|
912
|
-
|
|
913
|
-
convert.rgb.cmyk = function (rgb) {
|
|
914
|
-
const r = rgb[0] / 255;
|
|
915
|
-
const g = rgb[1] / 255;
|
|
916
|
-
const b = rgb[2] / 255;
|
|
917
|
-
|
|
918
|
-
const k = Math.min(1 - r, 1 - g, 1 - b);
|
|
919
|
-
const c = (1 - r - k) / (1 - k) || 0;
|
|
920
|
-
const m = (1 - g - k) / (1 - k) || 0;
|
|
921
|
-
const y = (1 - b - k) / (1 - k) || 0;
|
|
922
|
-
|
|
923
|
-
return [c * 100, m * 100, y * 100, k * 100];
|
|
924
|
-
};
|
|
925
|
-
|
|
926
|
-
function comparativeDistance(x, y) {
|
|
927
|
-
/*
|
|
928
|
-
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
|
929
|
-
*/
|
|
930
|
-
return (
|
|
931
|
-
((x[0] - y[0]) ** 2) +
|
|
932
|
-
((x[1] - y[1]) ** 2) +
|
|
933
|
-
((x[2] - y[2]) ** 2)
|
|
934
|
-
);
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
convert.rgb.keyword = function (rgb) {
|
|
938
|
-
const reversed = reverseKeywords[rgb];
|
|
939
|
-
if (reversed) {
|
|
940
|
-
return reversed;
|
|
941
|
-
}
|
|
942
|
-
|
|
943
|
-
let currentClosestDistance = Infinity;
|
|
944
|
-
let currentClosestKeyword;
|
|
945
|
-
|
|
946
|
-
for (const keyword of Object.keys(cssKeywords)) {
|
|
947
|
-
const value = cssKeywords[keyword];
|
|
948
|
-
|
|
949
|
-
// Compute comparative distance
|
|
950
|
-
const distance = comparativeDistance(rgb, value);
|
|
951
|
-
|
|
952
|
-
// Check if its less, if so set as closest
|
|
953
|
-
if (distance < currentClosestDistance) {
|
|
954
|
-
currentClosestDistance = distance;
|
|
955
|
-
currentClosestKeyword = keyword;
|
|
956
|
-
}
|
|
957
|
-
}
|
|
958
|
-
|
|
959
|
-
return currentClosestKeyword;
|
|
960
|
-
};
|
|
961
|
-
|
|
962
|
-
convert.keyword.rgb = function (keyword) {
|
|
963
|
-
return cssKeywords[keyword];
|
|
964
|
-
};
|
|
965
|
-
|
|
966
|
-
convert.rgb.xyz = function (rgb) {
|
|
967
|
-
let r = rgb[0] / 255;
|
|
968
|
-
let g = rgb[1] / 255;
|
|
969
|
-
let b = rgb[2] / 255;
|
|
970
|
-
|
|
971
|
-
// Assume sRGB
|
|
972
|
-
r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);
|
|
973
|
-
g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);
|
|
974
|
-
b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);
|
|
975
|
-
|
|
976
|
-
const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
|
|
977
|
-
const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
|
|
978
|
-
const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
|
|
979
|
-
|
|
980
|
-
return [x * 100, y * 100, z * 100];
|
|
981
|
-
};
|
|
982
|
-
|
|
983
|
-
convert.rgb.lab = function (rgb) {
|
|
984
|
-
const xyz = convert.rgb.xyz(rgb);
|
|
985
|
-
let x = xyz[0];
|
|
986
|
-
let y = xyz[1];
|
|
987
|
-
let z = xyz[2];
|
|
988
|
-
|
|
989
|
-
x /= 95.047;
|
|
990
|
-
y /= 100;
|
|
991
|
-
z /= 108.883;
|
|
992
|
-
|
|
993
|
-
x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
|
|
994
|
-
y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
|
|
995
|
-
z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
|
|
996
|
-
|
|
997
|
-
const l = (116 * y) - 16;
|
|
998
|
-
const a = 500 * (x - y);
|
|
999
|
-
const b = 200 * (y - z);
|
|
1000
|
-
|
|
1001
|
-
return [l, a, b];
|
|
1002
|
-
};
|
|
1003
|
-
|
|
1004
|
-
convert.hsl.rgb = function (hsl) {
|
|
1005
|
-
const h = hsl[0] / 360;
|
|
1006
|
-
const s = hsl[1] / 100;
|
|
1007
|
-
const l = hsl[2] / 100;
|
|
1008
|
-
let t2;
|
|
1009
|
-
let t3;
|
|
1010
|
-
let val;
|
|
1011
|
-
|
|
1012
|
-
if (s === 0) {
|
|
1013
|
-
val = l * 255;
|
|
1014
|
-
return [val, val, val];
|
|
1015
|
-
}
|
|
1016
|
-
|
|
1017
|
-
if (l < 0.5) {
|
|
1018
|
-
t2 = l * (1 + s);
|
|
1019
|
-
} else {
|
|
1020
|
-
t2 = l + s - l * s;
|
|
1021
|
-
}
|
|
1022
|
-
|
|
1023
|
-
const t1 = 2 * l - t2;
|
|
1024
|
-
|
|
1025
|
-
const rgb = [0, 0, 0];
|
|
1026
|
-
for (let i = 0; i < 3; i++) {
|
|
1027
|
-
t3 = h + 1 / 3 * -(i - 1);
|
|
1028
|
-
if (t3 < 0) {
|
|
1029
|
-
t3++;
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
|
-
if (t3 > 1) {
|
|
1033
|
-
t3--;
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
|
-
if (6 * t3 < 1) {
|
|
1037
|
-
val = t1 + (t2 - t1) * 6 * t3;
|
|
1038
|
-
} else if (2 * t3 < 1) {
|
|
1039
|
-
val = t2;
|
|
1040
|
-
} else if (3 * t3 < 2) {
|
|
1041
|
-
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
|
|
1042
|
-
} else {
|
|
1043
|
-
val = t1;
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
|
-
rgb[i] = val * 255;
|
|
1047
|
-
}
|
|
1048
|
-
|
|
1049
|
-
return rgb;
|
|
1050
|
-
};
|
|
1051
|
-
|
|
1052
|
-
convert.hsl.hsv = function (hsl) {
|
|
1053
|
-
const h = hsl[0];
|
|
1054
|
-
let s = hsl[1] / 100;
|
|
1055
|
-
let l = hsl[2] / 100;
|
|
1056
|
-
let smin = s;
|
|
1057
|
-
const lmin = Math.max(l, 0.01);
|
|
1058
|
-
|
|
1059
|
-
l *= 2;
|
|
1060
|
-
s *= (l <= 1) ? l : 2 - l;
|
|
1061
|
-
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
|
1062
|
-
const v = (l + s) / 2;
|
|
1063
|
-
const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
|
|
1064
|
-
|
|
1065
|
-
return [h, sv * 100, v * 100];
|
|
1066
|
-
};
|
|
1067
|
-
|
|
1068
|
-
convert.hsv.rgb = function (hsv) {
|
|
1069
|
-
const h = hsv[0] / 60;
|
|
1070
|
-
const s = hsv[1] / 100;
|
|
1071
|
-
let v = hsv[2] / 100;
|
|
1072
|
-
const hi = Math.floor(h) % 6;
|
|
1073
|
-
|
|
1074
|
-
const f = h - Math.floor(h);
|
|
1075
|
-
const p = 255 * v * (1 - s);
|
|
1076
|
-
const q = 255 * v * (1 - (s * f));
|
|
1077
|
-
const t = 255 * v * (1 - (s * (1 - f)));
|
|
1078
|
-
v *= 255;
|
|
1079
|
-
|
|
1080
|
-
switch (hi) {
|
|
1081
|
-
case 0:
|
|
1082
|
-
return [v, t, p];
|
|
1083
|
-
case 1:
|
|
1084
|
-
return [q, v, p];
|
|
1085
|
-
case 2:
|
|
1086
|
-
return [p, v, t];
|
|
1087
|
-
case 3:
|
|
1088
|
-
return [p, q, v];
|
|
1089
|
-
case 4:
|
|
1090
|
-
return [t, p, v];
|
|
1091
|
-
case 5:
|
|
1092
|
-
return [v, p, q];
|
|
1093
|
-
}
|
|
1094
|
-
};
|
|
1095
|
-
|
|
1096
|
-
convert.hsv.hsl = function (hsv) {
|
|
1097
|
-
const h = hsv[0];
|
|
1098
|
-
const s = hsv[1] / 100;
|
|
1099
|
-
const v = hsv[2] / 100;
|
|
1100
|
-
const vmin = Math.max(v, 0.01);
|
|
1101
|
-
let sl;
|
|
1102
|
-
let l;
|
|
1103
|
-
|
|
1104
|
-
l = (2 - s) * v;
|
|
1105
|
-
const lmin = (2 - s) * vmin;
|
|
1106
|
-
sl = s * vmin;
|
|
1107
|
-
sl /= (lmin <= 1) ? lmin : 2 - lmin;
|
|
1108
|
-
sl = sl || 0;
|
|
1109
|
-
l /= 2;
|
|
1110
|
-
|
|
1111
|
-
return [h, sl * 100, l * 100];
|
|
1112
|
-
};
|
|
1113
|
-
|
|
1114
|
-
// http://dev.w3.org/csswg/css-color/#hwb-to-rgb
|
|
1115
|
-
convert.hwb.rgb = function (hwb) {
|
|
1116
|
-
const h = hwb[0] / 360;
|
|
1117
|
-
let wh = hwb[1] / 100;
|
|
1118
|
-
let bl = hwb[2] / 100;
|
|
1119
|
-
const ratio = wh + bl;
|
|
1120
|
-
let f;
|
|
1121
|
-
|
|
1122
|
-
// Wh + bl cant be > 1
|
|
1123
|
-
if (ratio > 1) {
|
|
1124
|
-
wh /= ratio;
|
|
1125
|
-
bl /= ratio;
|
|
1126
|
-
}
|
|
1127
|
-
|
|
1128
|
-
const i = Math.floor(6 * h);
|
|
1129
|
-
const v = 1 - bl;
|
|
1130
|
-
f = 6 * h - i;
|
|
1131
|
-
|
|
1132
|
-
if ((i & 0x01) !== 0) {
|
|
1133
|
-
f = 1 - f;
|
|
1134
|
-
}
|
|
1135
|
-
|
|
1136
|
-
const n = wh + f * (v - wh); // Linear interpolation
|
|
1137
|
-
|
|
1138
|
-
let r;
|
|
1139
|
-
let g;
|
|
1140
|
-
let b;
|
|
1141
|
-
/* eslint-disable max-statements-per-line,no-multi-spaces */
|
|
1142
|
-
switch (i) {
|
|
1143
|
-
default:
|
|
1144
|
-
case 6:
|
|
1145
|
-
case 0: r = v; g = n; b = wh; break;
|
|
1146
|
-
case 1: r = n; g = v; b = wh; break;
|
|
1147
|
-
case 2: r = wh; g = v; b = n; break;
|
|
1148
|
-
case 3: r = wh; g = n; b = v; break;
|
|
1149
|
-
case 4: r = n; g = wh; b = v; break;
|
|
1150
|
-
case 5: r = v; g = wh; b = n; break;
|
|
1151
|
-
}
|
|
1152
|
-
/* eslint-enable max-statements-per-line,no-multi-spaces */
|
|
1153
|
-
|
|
1154
|
-
return [r * 255, g * 255, b * 255];
|
|
1155
|
-
};
|
|
1156
|
-
|
|
1157
|
-
convert.cmyk.rgb = function (cmyk) {
|
|
1158
|
-
const c = cmyk[0] / 100;
|
|
1159
|
-
const m = cmyk[1] / 100;
|
|
1160
|
-
const y = cmyk[2] / 100;
|
|
1161
|
-
const k = cmyk[3] / 100;
|
|
1162
|
-
|
|
1163
|
-
const r = 1 - Math.min(1, c * (1 - k) + k);
|
|
1164
|
-
const g = 1 - Math.min(1, m * (1 - k) + k);
|
|
1165
|
-
const b = 1 - Math.min(1, y * (1 - k) + k);
|
|
1166
|
-
|
|
1167
|
-
return [r * 255, g * 255, b * 255];
|
|
1168
|
-
};
|
|
1169
|
-
|
|
1170
|
-
convert.xyz.rgb = function (xyz) {
|
|
1171
|
-
const x = xyz[0] / 100;
|
|
1172
|
-
const y = xyz[1] / 100;
|
|
1173
|
-
const z = xyz[2] / 100;
|
|
1174
|
-
let r;
|
|
1175
|
-
let g;
|
|
1176
|
-
let b;
|
|
1177
|
-
|
|
1178
|
-
r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
|
|
1179
|
-
g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
|
|
1180
|
-
b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
|
|
1181
|
-
|
|
1182
|
-
// Assume sRGB
|
|
1183
|
-
r = r > 0.0031308
|
|
1184
|
-
? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)
|
|
1185
|
-
: r * 12.92;
|
|
1186
|
-
|
|
1187
|
-
g = g > 0.0031308
|
|
1188
|
-
? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)
|
|
1189
|
-
: g * 12.92;
|
|
1190
|
-
|
|
1191
|
-
b = b > 0.0031308
|
|
1192
|
-
? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)
|
|
1193
|
-
: b * 12.92;
|
|
1194
|
-
|
|
1195
|
-
r = Math.min(Math.max(0, r), 1);
|
|
1196
|
-
g = Math.min(Math.max(0, g), 1);
|
|
1197
|
-
b = Math.min(Math.max(0, b), 1);
|
|
1198
|
-
|
|
1199
|
-
return [r * 255, g * 255, b * 255];
|
|
1200
|
-
};
|
|
1201
|
-
|
|
1202
|
-
convert.xyz.lab = function (xyz) {
|
|
1203
|
-
let x = xyz[0];
|
|
1204
|
-
let y = xyz[1];
|
|
1205
|
-
let z = xyz[2];
|
|
1206
|
-
|
|
1207
|
-
x /= 95.047;
|
|
1208
|
-
y /= 100;
|
|
1209
|
-
z /= 108.883;
|
|
1210
|
-
|
|
1211
|
-
x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
|
|
1212
|
-
y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
|
|
1213
|
-
z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
|
|
1214
|
-
|
|
1215
|
-
const l = (116 * y) - 16;
|
|
1216
|
-
const a = 500 * (x - y);
|
|
1217
|
-
const b = 200 * (y - z);
|
|
1218
|
-
|
|
1219
|
-
return [l, a, b];
|
|
1220
|
-
};
|
|
1221
|
-
|
|
1222
|
-
convert.lab.xyz = function (lab) {
|
|
1223
|
-
const l = lab[0];
|
|
1224
|
-
const a = lab[1];
|
|
1225
|
-
const b = lab[2];
|
|
1226
|
-
let x;
|
|
1227
|
-
let y;
|
|
1228
|
-
let z;
|
|
1229
|
-
|
|
1230
|
-
y = (l + 16) / 116;
|
|
1231
|
-
x = a / 500 + y;
|
|
1232
|
-
z = y - b / 200;
|
|
1233
|
-
|
|
1234
|
-
const y2 = y ** 3;
|
|
1235
|
-
const x2 = x ** 3;
|
|
1236
|
-
const z2 = z ** 3;
|
|
1237
|
-
y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
|
|
1238
|
-
x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
|
|
1239
|
-
z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
|
|
1240
|
-
|
|
1241
|
-
x *= 95.047;
|
|
1242
|
-
y *= 100;
|
|
1243
|
-
z *= 108.883;
|
|
1244
|
-
|
|
1245
|
-
return [x, y, z];
|
|
1246
|
-
};
|
|
1247
|
-
|
|
1248
|
-
convert.lab.lch = function (lab) {
|
|
1249
|
-
const l = lab[0];
|
|
1250
|
-
const a = lab[1];
|
|
1251
|
-
const b = lab[2];
|
|
1252
|
-
let h;
|
|
1253
|
-
|
|
1254
|
-
const hr = Math.atan2(b, a);
|
|
1255
|
-
h = hr * 360 / 2 / Math.PI;
|
|
1256
|
-
|
|
1257
|
-
if (h < 0) {
|
|
1258
|
-
h += 360;
|
|
1259
|
-
}
|
|
1260
|
-
|
|
1261
|
-
const c = Math.sqrt(a * a + b * b);
|
|
1262
|
-
|
|
1263
|
-
return [l, c, h];
|
|
1264
|
-
};
|
|
1265
|
-
|
|
1266
|
-
convert.lch.lab = function (lch) {
|
|
1267
|
-
const l = lch[0];
|
|
1268
|
-
const c = lch[1];
|
|
1269
|
-
const h = lch[2];
|
|
1270
|
-
|
|
1271
|
-
const hr = h / 360 * 2 * Math.PI;
|
|
1272
|
-
const a = c * Math.cos(hr);
|
|
1273
|
-
const b = c * Math.sin(hr);
|
|
1274
|
-
|
|
1275
|
-
return [l, a, b];
|
|
1276
|
-
};
|
|
1277
|
-
|
|
1278
|
-
convert.rgb.ansi16 = function (args, saturation = null) {
|
|
1279
|
-
const [r, g, b] = args;
|
|
1280
|
-
let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
|
|
1281
|
-
|
|
1282
|
-
value = Math.round(value / 50);
|
|
1283
|
-
|
|
1284
|
-
if (value === 0) {
|
|
1285
|
-
return 30;
|
|
1286
|
-
}
|
|
1287
|
-
|
|
1288
|
-
let ansi = 30
|
|
1289
|
-
+ ((Math.round(b / 255) << 2)
|
|
1290
|
-
| (Math.round(g / 255) << 1)
|
|
1291
|
-
| Math.round(r / 255));
|
|
1292
|
-
|
|
1293
|
-
if (value === 2) {
|
|
1294
|
-
ansi += 60;
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
|
-
return ansi;
|
|
1298
|
-
};
|
|
1299
|
-
|
|
1300
|
-
convert.hsv.ansi16 = function (args) {
|
|
1301
|
-
// Optimization here; we already know the value and don't need to get
|
|
1302
|
-
// it converted for us.
|
|
1303
|
-
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
|
|
1304
|
-
};
|
|
1305
|
-
|
|
1306
|
-
convert.rgb.ansi256 = function (args) {
|
|
1307
|
-
const r = args[0];
|
|
1308
|
-
const g = args[1];
|
|
1309
|
-
const b = args[2];
|
|
1310
|
-
|
|
1311
|
-
// We use the extended greyscale palette here, with the exception of
|
|
1312
|
-
// black and white. normal palette only has 4 greyscale shades.
|
|
1313
|
-
if (r === g && g === b) {
|
|
1314
|
-
if (r < 8) {
|
|
1315
|
-
return 16;
|
|
1316
|
-
}
|
|
1317
|
-
|
|
1318
|
-
if (r > 248) {
|
|
1319
|
-
return 231;
|
|
1320
|
-
}
|
|
1321
|
-
|
|
1322
|
-
return Math.round(((r - 8) / 247) * 24) + 232;
|
|
1323
|
-
}
|
|
1324
|
-
|
|
1325
|
-
const ansi = 16
|
|
1326
|
-
+ (36 * Math.round(r / 255 * 5))
|
|
1327
|
-
+ (6 * Math.round(g / 255 * 5))
|
|
1328
|
-
+ Math.round(b / 255 * 5);
|
|
1329
|
-
|
|
1330
|
-
return ansi;
|
|
1331
|
-
};
|
|
1332
|
-
|
|
1333
|
-
convert.ansi16.rgb = function (args) {
|
|
1334
|
-
let color = args % 10;
|
|
1335
|
-
|
|
1336
|
-
// Handle greyscale
|
|
1337
|
-
if (color === 0 || color === 7) {
|
|
1338
|
-
if (args > 50) {
|
|
1339
|
-
color += 3.5;
|
|
1340
|
-
}
|
|
1341
|
-
|
|
1342
|
-
color = color / 10.5 * 255;
|
|
1343
|
-
|
|
1344
|
-
return [color, color, color];
|
|
1345
|
-
}
|
|
1346
|
-
|
|
1347
|
-
const mult = (~~(args > 50) + 1) * 0.5;
|
|
1348
|
-
const r = ((color & 1) * mult) * 255;
|
|
1349
|
-
const g = (((color >> 1) & 1) * mult) * 255;
|
|
1350
|
-
const b = (((color >> 2) & 1) * mult) * 255;
|
|
1351
|
-
|
|
1352
|
-
return [r, g, b];
|
|
1353
|
-
};
|
|
1354
|
-
|
|
1355
|
-
convert.ansi256.rgb = function (args) {
|
|
1356
|
-
// Handle greyscale
|
|
1357
|
-
if (args >= 232) {
|
|
1358
|
-
const c = (args - 232) * 10 + 8;
|
|
1359
|
-
return [c, c, c];
|
|
1360
|
-
}
|
|
1361
|
-
|
|
1362
|
-
args -= 16;
|
|
1363
|
-
|
|
1364
|
-
let rem;
|
|
1365
|
-
const r = Math.floor(args / 36) / 5 * 255;
|
|
1366
|
-
const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
|
1367
|
-
const b = (rem % 6) / 5 * 255;
|
|
1368
|
-
|
|
1369
|
-
return [r, g, b];
|
|
1370
|
-
};
|
|
1371
|
-
|
|
1372
|
-
convert.rgb.hex = function (args) {
|
|
1373
|
-
const integer = ((Math.round(args[0]) & 0xFF) << 16)
|
|
1374
|
-
+ ((Math.round(args[1]) & 0xFF) << 8)
|
|
1375
|
-
+ (Math.round(args[2]) & 0xFF);
|
|
1376
|
-
|
|
1377
|
-
const string = integer.toString(16).toUpperCase();
|
|
1378
|
-
return '000000'.substring(string.length) + string;
|
|
1379
|
-
};
|
|
1380
|
-
|
|
1381
|
-
convert.hex.rgb = function (args) {
|
|
1382
|
-
const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
|
|
1383
|
-
if (!match) {
|
|
1384
|
-
return [0, 0, 0];
|
|
1385
|
-
}
|
|
1386
|
-
|
|
1387
|
-
let colorString = match[0];
|
|
1388
|
-
|
|
1389
|
-
if (match[0].length === 3) {
|
|
1390
|
-
colorString = colorString.split('').map(char => {
|
|
1391
|
-
return char + char;
|
|
1392
|
-
}).join('');
|
|
1393
|
-
}
|
|
1394
|
-
|
|
1395
|
-
const integer = parseInt(colorString, 16);
|
|
1396
|
-
const r = (integer >> 16) & 0xFF;
|
|
1397
|
-
const g = (integer >> 8) & 0xFF;
|
|
1398
|
-
const b = integer & 0xFF;
|
|
1399
|
-
|
|
1400
|
-
return [r, g, b];
|
|
1401
|
-
};
|
|
1402
|
-
|
|
1403
|
-
convert.rgb.hcg = function (rgb) {
|
|
1404
|
-
const r = rgb[0] / 255;
|
|
1405
|
-
const g = rgb[1] / 255;
|
|
1406
|
-
const b = rgb[2] / 255;
|
|
1407
|
-
const max = Math.max(Math.max(r, g), b);
|
|
1408
|
-
const min = Math.min(Math.min(r, g), b);
|
|
1409
|
-
const chroma = (max - min);
|
|
1410
|
-
let grayscale;
|
|
1411
|
-
let hue;
|
|
1412
|
-
|
|
1413
|
-
if (chroma < 1) {
|
|
1414
|
-
grayscale = min / (1 - chroma);
|
|
1415
|
-
} else {
|
|
1416
|
-
grayscale = 0;
|
|
1417
|
-
}
|
|
1418
|
-
|
|
1419
|
-
if (chroma <= 0) {
|
|
1420
|
-
hue = 0;
|
|
1421
|
-
} else
|
|
1422
|
-
if (max === r) {
|
|
1423
|
-
hue = ((g - b) / chroma) % 6;
|
|
1424
|
-
} else
|
|
1425
|
-
if (max === g) {
|
|
1426
|
-
hue = 2 + (b - r) / chroma;
|
|
1427
|
-
} else {
|
|
1428
|
-
hue = 4 + (r - g) / chroma;
|
|
1429
|
-
}
|
|
1430
|
-
|
|
1431
|
-
hue /= 6;
|
|
1432
|
-
hue %= 1;
|
|
1433
|
-
|
|
1434
|
-
return [hue * 360, chroma * 100, grayscale * 100];
|
|
1435
|
-
};
|
|
1436
|
-
|
|
1437
|
-
convert.hsl.hcg = function (hsl) {
|
|
1438
|
-
const s = hsl[1] / 100;
|
|
1439
|
-
const l = hsl[2] / 100;
|
|
1440
|
-
|
|
1441
|
-
const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));
|
|
1442
|
-
|
|
1443
|
-
let f = 0;
|
|
1444
|
-
if (c < 1.0) {
|
|
1445
|
-
f = (l - 0.5 * c) / (1.0 - c);
|
|
1446
|
-
}
|
|
1447
|
-
|
|
1448
|
-
return [hsl[0], c * 100, f * 100];
|
|
1449
|
-
};
|
|
1450
|
-
|
|
1451
|
-
convert.hsv.hcg = function (hsv) {
|
|
1452
|
-
const s = hsv[1] / 100;
|
|
1453
|
-
const v = hsv[2] / 100;
|
|
1454
|
-
|
|
1455
|
-
const c = s * v;
|
|
1456
|
-
let f = 0;
|
|
1457
|
-
|
|
1458
|
-
if (c < 1.0) {
|
|
1459
|
-
f = (v - c) / (1 - c);
|
|
1460
|
-
}
|
|
1461
|
-
|
|
1462
|
-
return [hsv[0], c * 100, f * 100];
|
|
1463
|
-
};
|
|
1464
|
-
|
|
1465
|
-
convert.hcg.rgb = function (hcg) {
|
|
1466
|
-
const h = hcg[0] / 360;
|
|
1467
|
-
const c = hcg[1] / 100;
|
|
1468
|
-
const g = hcg[2] / 100;
|
|
1469
|
-
|
|
1470
|
-
if (c === 0.0) {
|
|
1471
|
-
return [g * 255, g * 255, g * 255];
|
|
1472
|
-
}
|
|
1473
|
-
|
|
1474
|
-
const pure = [0, 0, 0];
|
|
1475
|
-
const hi = (h % 1) * 6;
|
|
1476
|
-
const v = hi % 1;
|
|
1477
|
-
const w = 1 - v;
|
|
1478
|
-
let mg = 0;
|
|
1479
|
-
|
|
1480
|
-
/* eslint-disable max-statements-per-line */
|
|
1481
|
-
switch (Math.floor(hi)) {
|
|
1482
|
-
case 0:
|
|
1483
|
-
pure[0] = 1; pure[1] = v; pure[2] = 0; break;
|
|
1484
|
-
case 1:
|
|
1485
|
-
pure[0] = w; pure[1] = 1; pure[2] = 0; break;
|
|
1486
|
-
case 2:
|
|
1487
|
-
pure[0] = 0; pure[1] = 1; pure[2] = v; break;
|
|
1488
|
-
case 3:
|
|
1489
|
-
pure[0] = 0; pure[1] = w; pure[2] = 1; break;
|
|
1490
|
-
case 4:
|
|
1491
|
-
pure[0] = v; pure[1] = 0; pure[2] = 1; break;
|
|
1492
|
-
default:
|
|
1493
|
-
pure[0] = 1; pure[1] = 0; pure[2] = w;
|
|
1494
|
-
}
|
|
1495
|
-
/* eslint-enable max-statements-per-line */
|
|
1496
|
-
|
|
1497
|
-
mg = (1.0 - c) * g;
|
|
1498
|
-
|
|
1499
|
-
return [
|
|
1500
|
-
(c * pure[0] + mg) * 255,
|
|
1501
|
-
(c * pure[1] + mg) * 255,
|
|
1502
|
-
(c * pure[2] + mg) * 255
|
|
1503
|
-
];
|
|
1504
|
-
};
|
|
1505
|
-
|
|
1506
|
-
convert.hcg.hsv = function (hcg) {
|
|
1507
|
-
const c = hcg[1] / 100;
|
|
1508
|
-
const g = hcg[2] / 100;
|
|
1509
|
-
|
|
1510
|
-
const v = c + g * (1.0 - c);
|
|
1511
|
-
let f = 0;
|
|
1512
|
-
|
|
1513
|
-
if (v > 0.0) {
|
|
1514
|
-
f = c / v;
|
|
1515
|
-
}
|
|
1516
|
-
|
|
1517
|
-
return [hcg[0], f * 100, v * 100];
|
|
1518
|
-
};
|
|
1519
|
-
|
|
1520
|
-
convert.hcg.hsl = function (hcg) {
|
|
1521
|
-
const c = hcg[1] / 100;
|
|
1522
|
-
const g = hcg[2] / 100;
|
|
1523
|
-
|
|
1524
|
-
const l = g * (1.0 - c) + 0.5 * c;
|
|
1525
|
-
let s = 0;
|
|
1526
|
-
|
|
1527
|
-
if (l > 0.0 && l < 0.5) {
|
|
1528
|
-
s = c / (2 * l);
|
|
1529
|
-
} else
|
|
1530
|
-
if (l >= 0.5 && l < 1.0) {
|
|
1531
|
-
s = c / (2 * (1 - l));
|
|
1532
|
-
}
|
|
1533
|
-
|
|
1534
|
-
return [hcg[0], s * 100, l * 100];
|
|
1535
|
-
};
|
|
1536
|
-
|
|
1537
|
-
convert.hcg.hwb = function (hcg) {
|
|
1538
|
-
const c = hcg[1] / 100;
|
|
1539
|
-
const g = hcg[2] / 100;
|
|
1540
|
-
const v = c + g * (1.0 - c);
|
|
1541
|
-
return [hcg[0], (v - c) * 100, (1 - v) * 100];
|
|
1542
|
-
};
|
|
1543
|
-
|
|
1544
|
-
convert.hwb.hcg = function (hwb) {
|
|
1545
|
-
const w = hwb[1] / 100;
|
|
1546
|
-
const b = hwb[2] / 100;
|
|
1547
|
-
const v = 1 - b;
|
|
1548
|
-
const c = v - w;
|
|
1549
|
-
let g = 0;
|
|
1550
|
-
|
|
1551
|
-
if (c < 1) {
|
|
1552
|
-
g = (v - c) / (1 - c);
|
|
1553
|
-
}
|
|
1554
|
-
|
|
1555
|
-
return [hwb[0], c * 100, g * 100];
|
|
1556
|
-
};
|
|
1557
|
-
|
|
1558
|
-
convert.apple.rgb = function (apple) {
|
|
1559
|
-
return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
|
|
1560
|
-
};
|
|
1561
|
-
|
|
1562
|
-
convert.rgb.apple = function (rgb) {
|
|
1563
|
-
return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
|
|
1564
|
-
};
|
|
1565
|
-
|
|
1566
|
-
convert.gray.rgb = function (args) {
|
|
1567
|
-
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
|
1568
|
-
};
|
|
1569
|
-
|
|
1570
|
-
convert.gray.hsl = function (args) {
|
|
1571
|
-
return [0, 0, args[0]];
|
|
1572
|
-
};
|
|
1573
|
-
|
|
1574
|
-
convert.gray.hsv = convert.gray.hsl;
|
|
1575
|
-
|
|
1576
|
-
convert.gray.hwb = function (gray) {
|
|
1577
|
-
return [0, 100, gray[0]];
|
|
1578
|
-
};
|
|
1579
|
-
|
|
1580
|
-
convert.gray.cmyk = function (gray) {
|
|
1581
|
-
return [0, 0, 0, gray[0]];
|
|
1582
|
-
};
|
|
1583
|
-
|
|
1584
|
-
convert.gray.lab = function (gray) {
|
|
1585
|
-
return [gray[0], 0, 0];
|
|
1586
|
-
};
|
|
1587
|
-
|
|
1588
|
-
convert.gray.hex = function (gray) {
|
|
1589
|
-
const val = Math.round(gray[0] / 100 * 255) & 0xFF;
|
|
1590
|
-
const integer = (val << 16) + (val << 8) + val;
|
|
1591
|
-
|
|
1592
|
-
const string = integer.toString(16).toUpperCase();
|
|
1593
|
-
return '000000'.substring(string.length) + string;
|
|
1594
|
-
};
|
|
1595
|
-
|
|
1596
|
-
convert.rgb.gray = function (rgb) {
|
|
1597
|
-
const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
|
1598
|
-
return [val / 255 * 100];
|
|
1599
|
-
};
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
/***/ }),
|
|
1603
|
-
|
|
1604
|
-
/***/ 88597:
|
|
1605
|
-
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
1606
|
-
|
|
1607
|
-
const conversions = __nccwpck_require__(45532);
|
|
1608
|
-
const route = __nccwpck_require__(58028);
|
|
1609
|
-
|
|
1610
|
-
const convert = {};
|
|
1611
|
-
|
|
1612
|
-
const models = Object.keys(conversions);
|
|
1613
|
-
|
|
1614
|
-
function wrapRaw(fn) {
|
|
1615
|
-
const wrappedFn = function (...args) {
|
|
1616
|
-
const arg0 = args[0];
|
|
1617
|
-
if (arg0 === undefined || arg0 === null) {
|
|
1618
|
-
return arg0;
|
|
1619
|
-
}
|
|
1620
|
-
|
|
1621
|
-
if (arg0.length > 1) {
|
|
1622
|
-
args = arg0;
|
|
1623
|
-
}
|
|
1624
|
-
|
|
1625
|
-
return fn(args);
|
|
1626
|
-
};
|
|
1627
|
-
|
|
1628
|
-
// Preserve .conversion property if there is one
|
|
1629
|
-
if ('conversion' in fn) {
|
|
1630
|
-
wrappedFn.conversion = fn.conversion;
|
|
1631
|
-
}
|
|
1632
|
-
|
|
1633
|
-
return wrappedFn;
|
|
1634
|
-
}
|
|
1635
|
-
|
|
1636
|
-
function wrapRounded(fn) {
|
|
1637
|
-
const wrappedFn = function (...args) {
|
|
1638
|
-
const arg0 = args[0];
|
|
1639
|
-
|
|
1640
|
-
if (arg0 === undefined || arg0 === null) {
|
|
1641
|
-
return arg0;
|
|
1642
|
-
}
|
|
1643
|
-
|
|
1644
|
-
if (arg0.length > 1) {
|
|
1645
|
-
args = arg0;
|
|
1646
|
-
}
|
|
1647
|
-
|
|
1648
|
-
const result = fn(args);
|
|
1649
|
-
|
|
1650
|
-
// We're assuming the result is an array here.
|
|
1651
|
-
// see notice in conversions.js; don't use box types
|
|
1652
|
-
// in conversion functions.
|
|
1653
|
-
if (typeof result === 'object') {
|
|
1654
|
-
for (let len = result.length, i = 0; i < len; i++) {
|
|
1655
|
-
result[i] = Math.round(result[i]);
|
|
1656
|
-
}
|
|
1657
|
-
}
|
|
1658
|
-
|
|
1659
|
-
return result;
|
|
1660
|
-
};
|
|
1661
|
-
|
|
1662
|
-
// Preserve .conversion property if there is one
|
|
1663
|
-
if ('conversion' in fn) {
|
|
1664
|
-
wrappedFn.conversion = fn.conversion;
|
|
1665
|
-
}
|
|
1666
|
-
|
|
1667
|
-
return wrappedFn;
|
|
1668
|
-
}
|
|
1669
|
-
|
|
1670
|
-
models.forEach(fromModel => {
|
|
1671
|
-
convert[fromModel] = {};
|
|
1672
|
-
|
|
1673
|
-
Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
|
|
1674
|
-
Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
|
|
1675
|
-
|
|
1676
|
-
const routes = route(fromModel);
|
|
1677
|
-
const routeModels = Object.keys(routes);
|
|
1678
|
-
|
|
1679
|
-
routeModels.forEach(toModel => {
|
|
1680
|
-
const fn = routes[toModel];
|
|
1681
|
-
|
|
1682
|
-
convert[fromModel][toModel] = wrapRounded(fn);
|
|
1683
|
-
convert[fromModel][toModel].raw = wrapRaw(fn);
|
|
1684
|
-
});
|
|
1685
|
-
});
|
|
1686
|
-
|
|
1687
|
-
module.exports = convert;
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
/***/ }),
|
|
1691
|
-
|
|
1692
|
-
/***/ 58028:
|
|
1693
|
-
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
1694
|
-
|
|
1695
|
-
const conversions = __nccwpck_require__(45532);
|
|
1696
|
-
|
|
1697
|
-
/*
|
|
1698
|
-
This function routes a model to all other models.
|
|
1699
|
-
|
|
1700
|
-
all functions that are routed have a property `.conversion` attached
|
|
1701
|
-
to the returned synthetic function. This property is an array
|
|
1702
|
-
of strings, each with the steps in between the 'from' and 'to'
|
|
1703
|
-
color models (inclusive).
|
|
1704
|
-
|
|
1705
|
-
conversions that are not possible simply are not included.
|
|
1706
|
-
*/
|
|
1707
|
-
|
|
1708
|
-
function buildGraph() {
|
|
1709
|
-
const graph = {};
|
|
1710
|
-
// https://jsperf.com/object-keys-vs-for-in-with-closure/3
|
|
1711
|
-
const models = Object.keys(conversions);
|
|
1712
|
-
|
|
1713
|
-
for (let len = models.length, i = 0; i < len; i++) {
|
|
1714
|
-
graph[models[i]] = {
|
|
1715
|
-
// http://jsperf.com/1-vs-infinity
|
|
1716
|
-
// micro-opt, but this is simple.
|
|
1717
|
-
distance: -1,
|
|
1718
|
-
parent: null
|
|
1719
|
-
};
|
|
1720
|
-
}
|
|
1721
|
-
|
|
1722
|
-
return graph;
|
|
1723
|
-
}
|
|
1724
|
-
|
|
1725
|
-
// https://en.wikipedia.org/wiki/Breadth-first_search
|
|
1726
|
-
function deriveBFS(fromModel) {
|
|
1727
|
-
const graph = buildGraph();
|
|
1728
|
-
const queue = [fromModel]; // Unshift -> queue -> pop
|
|
1729
|
-
|
|
1730
|
-
graph[fromModel].distance = 0;
|
|
1731
|
-
|
|
1732
|
-
while (queue.length) {
|
|
1733
|
-
const current = queue.pop();
|
|
1734
|
-
const adjacents = Object.keys(conversions[current]);
|
|
1735
|
-
|
|
1736
|
-
for (let len = adjacents.length, i = 0; i < len; i++) {
|
|
1737
|
-
const adjacent = adjacents[i];
|
|
1738
|
-
const node = graph[adjacent];
|
|
1739
|
-
|
|
1740
|
-
if (node.distance === -1) {
|
|
1741
|
-
node.distance = graph[current].distance + 1;
|
|
1742
|
-
node.parent = current;
|
|
1743
|
-
queue.unshift(adjacent);
|
|
1744
|
-
}
|
|
1745
|
-
}
|
|
1746
|
-
}
|
|
1747
|
-
|
|
1748
|
-
return graph;
|
|
1749
|
-
}
|
|
1750
|
-
|
|
1751
|
-
function link(from, to) {
|
|
1752
|
-
return function (args) {
|
|
1753
|
-
return to(from(args));
|
|
1754
|
-
};
|
|
1755
|
-
}
|
|
1756
|
-
|
|
1757
|
-
function wrapConversion(toModel, graph) {
|
|
1758
|
-
const path = [graph[toModel].parent, toModel];
|
|
1759
|
-
let fn = conversions[graph[toModel].parent][toModel];
|
|
1760
|
-
|
|
1761
|
-
let cur = graph[toModel].parent;
|
|
1762
|
-
while (graph[cur].parent) {
|
|
1763
|
-
path.unshift(graph[cur].parent);
|
|
1764
|
-
fn = link(conversions[graph[cur].parent][cur], fn);
|
|
1765
|
-
cur = graph[cur].parent;
|
|
1766
|
-
}
|
|
1767
|
-
|
|
1768
|
-
fn.conversion = path;
|
|
1769
|
-
return fn;
|
|
1770
|
-
}
|
|
1771
|
-
|
|
1772
|
-
module.exports = function (fromModel) {
|
|
1773
|
-
const graph = deriveBFS(fromModel);
|
|
1774
|
-
const conversion = {};
|
|
1775
|
-
|
|
1776
|
-
const models = Object.keys(graph);
|
|
1777
|
-
for (let len = models.length, i = 0; i < len; i++) {
|
|
1778
|
-
const toModel = models[i];
|
|
1779
|
-
const node = graph[toModel];
|
|
1780
|
-
|
|
1781
|
-
if (node.parent === null) {
|
|
1782
|
-
// No possible conversion, or this node is the source model.
|
|
1783
|
-
continue;
|
|
1784
|
-
}
|
|
1785
|
-
|
|
1786
|
-
conversion[toModel] = wrapConversion(toModel, graph);
|
|
1787
|
-
}
|
|
1788
|
-
|
|
1789
|
-
return conversion;
|
|
1790
|
-
};
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
/***/ }),
|
|
1795
|
-
|
|
1796
|
-
/***/ 75085:
|
|
1797
|
-
/***/ ((module) => {
|
|
1798
|
-
|
|
1799
|
-
"use strict";
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
module.exports = {
|
|
1803
|
-
"aliceblue": [240, 248, 255],
|
|
1804
|
-
"antiquewhite": [250, 235, 215],
|
|
1805
|
-
"aqua": [0, 255, 255],
|
|
1806
|
-
"aquamarine": [127, 255, 212],
|
|
1807
|
-
"azure": [240, 255, 255],
|
|
1808
|
-
"beige": [245, 245, 220],
|
|
1809
|
-
"bisque": [255, 228, 196],
|
|
1810
|
-
"black": [0, 0, 0],
|
|
1811
|
-
"blanchedalmond": [255, 235, 205],
|
|
1812
|
-
"blue": [0, 0, 255],
|
|
1813
|
-
"blueviolet": [138, 43, 226],
|
|
1814
|
-
"brown": [165, 42, 42],
|
|
1815
|
-
"burlywood": [222, 184, 135],
|
|
1816
|
-
"cadetblue": [95, 158, 160],
|
|
1817
|
-
"chartreuse": [127, 255, 0],
|
|
1818
|
-
"chocolate": [210, 105, 30],
|
|
1819
|
-
"coral": [255, 127, 80],
|
|
1820
|
-
"cornflowerblue": [100, 149, 237],
|
|
1821
|
-
"cornsilk": [255, 248, 220],
|
|
1822
|
-
"crimson": [220, 20, 60],
|
|
1823
|
-
"cyan": [0, 255, 255],
|
|
1824
|
-
"darkblue": [0, 0, 139],
|
|
1825
|
-
"darkcyan": [0, 139, 139],
|
|
1826
|
-
"darkgoldenrod": [184, 134, 11],
|
|
1827
|
-
"darkgray": [169, 169, 169],
|
|
1828
|
-
"darkgreen": [0, 100, 0],
|
|
1829
|
-
"darkgrey": [169, 169, 169],
|
|
1830
|
-
"darkkhaki": [189, 183, 107],
|
|
1831
|
-
"darkmagenta": [139, 0, 139],
|
|
1832
|
-
"darkolivegreen": [85, 107, 47],
|
|
1833
|
-
"darkorange": [255, 140, 0],
|
|
1834
|
-
"darkorchid": [153, 50, 204],
|
|
1835
|
-
"darkred": [139, 0, 0],
|
|
1836
|
-
"darksalmon": [233, 150, 122],
|
|
1837
|
-
"darkseagreen": [143, 188, 143],
|
|
1838
|
-
"darkslateblue": [72, 61, 139],
|
|
1839
|
-
"darkslategray": [47, 79, 79],
|
|
1840
|
-
"darkslategrey": [47, 79, 79],
|
|
1841
|
-
"darkturquoise": [0, 206, 209],
|
|
1842
|
-
"darkviolet": [148, 0, 211],
|
|
1843
|
-
"deeppink": [255, 20, 147],
|
|
1844
|
-
"deepskyblue": [0, 191, 255],
|
|
1845
|
-
"dimgray": [105, 105, 105],
|
|
1846
|
-
"dimgrey": [105, 105, 105],
|
|
1847
|
-
"dodgerblue": [30, 144, 255],
|
|
1848
|
-
"firebrick": [178, 34, 34],
|
|
1849
|
-
"floralwhite": [255, 250, 240],
|
|
1850
|
-
"forestgreen": [34, 139, 34],
|
|
1851
|
-
"fuchsia": [255, 0, 255],
|
|
1852
|
-
"gainsboro": [220, 220, 220],
|
|
1853
|
-
"ghostwhite": [248, 248, 255],
|
|
1854
|
-
"gold": [255, 215, 0],
|
|
1855
|
-
"goldenrod": [218, 165, 32],
|
|
1856
|
-
"gray": [128, 128, 128],
|
|
1857
|
-
"green": [0, 128, 0],
|
|
1858
|
-
"greenyellow": [173, 255, 47],
|
|
1859
|
-
"grey": [128, 128, 128],
|
|
1860
|
-
"honeydew": [240, 255, 240],
|
|
1861
|
-
"hotpink": [255, 105, 180],
|
|
1862
|
-
"indianred": [205, 92, 92],
|
|
1863
|
-
"indigo": [75, 0, 130],
|
|
1864
|
-
"ivory": [255, 255, 240],
|
|
1865
|
-
"khaki": [240, 230, 140],
|
|
1866
|
-
"lavender": [230, 230, 250],
|
|
1867
|
-
"lavenderblush": [255, 240, 245],
|
|
1868
|
-
"lawngreen": [124, 252, 0],
|
|
1869
|
-
"lemonchiffon": [255, 250, 205],
|
|
1870
|
-
"lightblue": [173, 216, 230],
|
|
1871
|
-
"lightcoral": [240, 128, 128],
|
|
1872
|
-
"lightcyan": [224, 255, 255],
|
|
1873
|
-
"lightgoldenrodyellow": [250, 250, 210],
|
|
1874
|
-
"lightgray": [211, 211, 211],
|
|
1875
|
-
"lightgreen": [144, 238, 144],
|
|
1876
|
-
"lightgrey": [211, 211, 211],
|
|
1877
|
-
"lightpink": [255, 182, 193],
|
|
1878
|
-
"lightsalmon": [255, 160, 122],
|
|
1879
|
-
"lightseagreen": [32, 178, 170],
|
|
1880
|
-
"lightskyblue": [135, 206, 250],
|
|
1881
|
-
"lightslategray": [119, 136, 153],
|
|
1882
|
-
"lightslategrey": [119, 136, 153],
|
|
1883
|
-
"lightsteelblue": [176, 196, 222],
|
|
1884
|
-
"lightyellow": [255, 255, 224],
|
|
1885
|
-
"lime": [0, 255, 0],
|
|
1886
|
-
"limegreen": [50, 205, 50],
|
|
1887
|
-
"linen": [250, 240, 230],
|
|
1888
|
-
"magenta": [255, 0, 255],
|
|
1889
|
-
"maroon": [128, 0, 0],
|
|
1890
|
-
"mediumaquamarine": [102, 205, 170],
|
|
1891
|
-
"mediumblue": [0, 0, 205],
|
|
1892
|
-
"mediumorchid": [186, 85, 211],
|
|
1893
|
-
"mediumpurple": [147, 112, 219],
|
|
1894
|
-
"mediumseagreen": [60, 179, 113],
|
|
1895
|
-
"mediumslateblue": [123, 104, 238],
|
|
1896
|
-
"mediumspringgreen": [0, 250, 154],
|
|
1897
|
-
"mediumturquoise": [72, 209, 204],
|
|
1898
|
-
"mediumvioletred": [199, 21, 133],
|
|
1899
|
-
"midnightblue": [25, 25, 112],
|
|
1900
|
-
"mintcream": [245, 255, 250],
|
|
1901
|
-
"mistyrose": [255, 228, 225],
|
|
1902
|
-
"moccasin": [255, 228, 181],
|
|
1903
|
-
"navajowhite": [255, 222, 173],
|
|
1904
|
-
"navy": [0, 0, 128],
|
|
1905
|
-
"oldlace": [253, 245, 230],
|
|
1906
|
-
"olive": [128, 128, 0],
|
|
1907
|
-
"olivedrab": [107, 142, 35],
|
|
1908
|
-
"orange": [255, 165, 0],
|
|
1909
|
-
"orangered": [255, 69, 0],
|
|
1910
|
-
"orchid": [218, 112, 214],
|
|
1911
|
-
"palegoldenrod": [238, 232, 170],
|
|
1912
|
-
"palegreen": [152, 251, 152],
|
|
1913
|
-
"paleturquoise": [175, 238, 238],
|
|
1914
|
-
"palevioletred": [219, 112, 147],
|
|
1915
|
-
"papayawhip": [255, 239, 213],
|
|
1916
|
-
"peachpuff": [255, 218, 185],
|
|
1917
|
-
"peru": [205, 133, 63],
|
|
1918
|
-
"pink": [255, 192, 203],
|
|
1919
|
-
"plum": [221, 160, 221],
|
|
1920
|
-
"powderblue": [176, 224, 230],
|
|
1921
|
-
"purple": [128, 0, 128],
|
|
1922
|
-
"rebeccapurple": [102, 51, 153],
|
|
1923
|
-
"red": [255, 0, 0],
|
|
1924
|
-
"rosybrown": [188, 143, 143],
|
|
1925
|
-
"royalblue": [65, 105, 225],
|
|
1926
|
-
"saddlebrown": [139, 69, 19],
|
|
1927
|
-
"salmon": [250, 128, 114],
|
|
1928
|
-
"sandybrown": [244, 164, 96],
|
|
1929
|
-
"seagreen": [46, 139, 87],
|
|
1930
|
-
"seashell": [255, 245, 238],
|
|
1931
|
-
"sienna": [160, 82, 45],
|
|
1932
|
-
"silver": [192, 192, 192],
|
|
1933
|
-
"skyblue": [135, 206, 235],
|
|
1934
|
-
"slateblue": [106, 90, 205],
|
|
1935
|
-
"slategray": [112, 128, 144],
|
|
1936
|
-
"slategrey": [112, 128, 144],
|
|
1937
|
-
"snow": [255, 250, 250],
|
|
1938
|
-
"springgreen": [0, 255, 127],
|
|
1939
|
-
"steelblue": [70, 130, 180],
|
|
1940
|
-
"tan": [210, 180, 140],
|
|
1941
|
-
"teal": [0, 128, 128],
|
|
1942
|
-
"thistle": [216, 191, 216],
|
|
1943
|
-
"tomato": [255, 99, 71],
|
|
1944
|
-
"turquoise": [64, 224, 208],
|
|
1945
|
-
"violet": [238, 130, 238],
|
|
1946
|
-
"wheat": [245, 222, 179],
|
|
1947
|
-
"white": [255, 255, 255],
|
|
1948
|
-
"whitesmoke": [245, 245, 245],
|
|
1949
|
-
"yellow": [255, 255, 0],
|
|
1950
|
-
"yellowgreen": [154, 205, 50]
|
|
1951
|
-
};
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
584
|
/***/ }),
|
|
1955
585
|
|
|
1956
586
|
/***/ 31324:
|
|
@@ -17015,64 +15645,6 @@ if (typeof Object.create === 'function') {
|
|
|
17015
15645
|
}).call(this);
|
|
17016
15646
|
|
|
17017
15647
|
|
|
17018
|
-
/***/ }),
|
|
17019
|
-
|
|
17020
|
-
/***/ 4519:
|
|
17021
|
-
/***/ ((module) => {
|
|
17022
|
-
|
|
17023
|
-
"use strict";
|
|
17024
|
-
/* eslint-disable yoda */
|
|
17025
|
-
|
|
17026
|
-
|
|
17027
|
-
const isFullwidthCodePoint = codePoint => {
|
|
17028
|
-
if (Number.isNaN(codePoint)) {
|
|
17029
|
-
return false;
|
|
17030
|
-
}
|
|
17031
|
-
|
|
17032
|
-
// Code points are derived from:
|
|
17033
|
-
// http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
|
|
17034
|
-
if (
|
|
17035
|
-
codePoint >= 0x1100 && (
|
|
17036
|
-
codePoint <= 0x115F || // Hangul Jamo
|
|
17037
|
-
codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET
|
|
17038
|
-
codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET
|
|
17039
|
-
// CJK Radicals Supplement .. Enclosed CJK Letters and Months
|
|
17040
|
-
(0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F) ||
|
|
17041
|
-
// Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
|
|
17042
|
-
(0x3250 <= codePoint && codePoint <= 0x4DBF) ||
|
|
17043
|
-
// CJK Unified Ideographs .. Yi Radicals
|
|
17044
|
-
(0x4E00 <= codePoint && codePoint <= 0xA4C6) ||
|
|
17045
|
-
// Hangul Jamo Extended-A
|
|
17046
|
-
(0xA960 <= codePoint && codePoint <= 0xA97C) ||
|
|
17047
|
-
// Hangul Syllables
|
|
17048
|
-
(0xAC00 <= codePoint && codePoint <= 0xD7A3) ||
|
|
17049
|
-
// CJK Compatibility Ideographs
|
|
17050
|
-
(0xF900 <= codePoint && codePoint <= 0xFAFF) ||
|
|
17051
|
-
// Vertical Forms
|
|
17052
|
-
(0xFE10 <= codePoint && codePoint <= 0xFE19) ||
|
|
17053
|
-
// CJK Compatibility Forms .. Small Form Variants
|
|
17054
|
-
(0xFE30 <= codePoint && codePoint <= 0xFE6B) ||
|
|
17055
|
-
// Halfwidth and Fullwidth Forms
|
|
17056
|
-
(0xFF01 <= codePoint && codePoint <= 0xFF60) ||
|
|
17057
|
-
(0xFFE0 <= codePoint && codePoint <= 0xFFE6) ||
|
|
17058
|
-
// Kana Supplement
|
|
17059
|
-
(0x1B000 <= codePoint && codePoint <= 0x1B001) ||
|
|
17060
|
-
// Enclosed Ideographic Supplement
|
|
17061
|
-
(0x1F200 <= codePoint && codePoint <= 0x1F251) ||
|
|
17062
|
-
// CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
|
|
17063
|
-
(0x20000 <= codePoint && codePoint <= 0x3FFFD)
|
|
17064
|
-
)
|
|
17065
|
-
) {
|
|
17066
|
-
return true;
|
|
17067
|
-
}
|
|
17068
|
-
|
|
17069
|
-
return false;
|
|
17070
|
-
};
|
|
17071
|
-
|
|
17072
|
-
module.exports = isFullwidthCodePoint;
|
|
17073
|
-
module.exports["default"] = isFullwidthCodePoint;
|
|
17074
|
-
|
|
17075
|
-
|
|
17076
15648
|
/***/ }),
|
|
17077
15649
|
|
|
17078
15650
|
/***/ 76904:
|
|
@@ -29529,7 +28101,7 @@ function status (code) {
|
|
|
29529
28101
|
"use strict";
|
|
29530
28102
|
|
|
29531
28103
|
const stripAnsi = __nccwpck_require__(13958);
|
|
29532
|
-
const isFullwidthCodePoint = __nccwpck_require__(
|
|
28104
|
+
const isFullwidthCodePoint = __nccwpck_require__(46299);
|
|
29533
28105
|
const emojiRegex = __nccwpck_require__(50872);
|
|
29534
28106
|
|
|
29535
28107
|
const stringWidth = string => {
|
|
@@ -29576,6 +28148,64 @@ module.exports = stringWidth;
|
|
|
29576
28148
|
module.exports["default"] = stringWidth;
|
|
29577
28149
|
|
|
29578
28150
|
|
|
28151
|
+
/***/ }),
|
|
28152
|
+
|
|
28153
|
+
/***/ 46299:
|
|
28154
|
+
/***/ ((module) => {
|
|
28155
|
+
|
|
28156
|
+
"use strict";
|
|
28157
|
+
/* eslint-disable yoda */
|
|
28158
|
+
|
|
28159
|
+
|
|
28160
|
+
const isFullwidthCodePoint = codePoint => {
|
|
28161
|
+
if (Number.isNaN(codePoint)) {
|
|
28162
|
+
return false;
|
|
28163
|
+
}
|
|
28164
|
+
|
|
28165
|
+
// Code points are derived from:
|
|
28166
|
+
// http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
|
|
28167
|
+
if (
|
|
28168
|
+
codePoint >= 0x1100 && (
|
|
28169
|
+
codePoint <= 0x115F || // Hangul Jamo
|
|
28170
|
+
codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET
|
|
28171
|
+
codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET
|
|
28172
|
+
// CJK Radicals Supplement .. Enclosed CJK Letters and Months
|
|
28173
|
+
(0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F) ||
|
|
28174
|
+
// Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
|
|
28175
|
+
(0x3250 <= codePoint && codePoint <= 0x4DBF) ||
|
|
28176
|
+
// CJK Unified Ideographs .. Yi Radicals
|
|
28177
|
+
(0x4E00 <= codePoint && codePoint <= 0xA4C6) ||
|
|
28178
|
+
// Hangul Jamo Extended-A
|
|
28179
|
+
(0xA960 <= codePoint && codePoint <= 0xA97C) ||
|
|
28180
|
+
// Hangul Syllables
|
|
28181
|
+
(0xAC00 <= codePoint && codePoint <= 0xD7A3) ||
|
|
28182
|
+
// CJK Compatibility Ideographs
|
|
28183
|
+
(0xF900 <= codePoint && codePoint <= 0xFAFF) ||
|
|
28184
|
+
// Vertical Forms
|
|
28185
|
+
(0xFE10 <= codePoint && codePoint <= 0xFE19) ||
|
|
28186
|
+
// CJK Compatibility Forms .. Small Form Variants
|
|
28187
|
+
(0xFE30 <= codePoint && codePoint <= 0xFE6B) ||
|
|
28188
|
+
// Halfwidth and Fullwidth Forms
|
|
28189
|
+
(0xFF01 <= codePoint && codePoint <= 0xFF60) ||
|
|
28190
|
+
(0xFFE0 <= codePoint && codePoint <= 0xFFE6) ||
|
|
28191
|
+
// Kana Supplement
|
|
28192
|
+
(0x1B000 <= codePoint && codePoint <= 0x1B001) ||
|
|
28193
|
+
// Enclosed Ideographic Supplement
|
|
28194
|
+
(0x1F200 <= codePoint && codePoint <= 0x1F251) ||
|
|
28195
|
+
// CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
|
|
28196
|
+
(0x20000 <= codePoint && codePoint <= 0x3FFFD)
|
|
28197
|
+
)
|
|
28198
|
+
) {
|
|
28199
|
+
return true;
|
|
28200
|
+
}
|
|
28201
|
+
|
|
28202
|
+
return false;
|
|
28203
|
+
};
|
|
28204
|
+
|
|
28205
|
+
module.exports = isFullwidthCodePoint;
|
|
28206
|
+
module.exports["default"] = isFullwidthCodePoint;
|
|
28207
|
+
|
|
28208
|
+
|
|
29579
28209
|
/***/ }),
|
|
29580
28210
|
|
|
29581
28211
|
/***/ 13958:
|
|
@@ -228516,1008 +227146,2378 @@ Object.defineProperty(exports, "validate", ({
|
|
|
228516
227146
|
get: function () {
|
|
228517
227147
|
return _validate.default;
|
|
228518
227148
|
}
|
|
228519
|
-
}));
|
|
228520
|
-
Object.defineProperty(exports, "version", ({
|
|
228521
|
-
enumerable: true,
|
|
228522
|
-
get: function () {
|
|
228523
|
-
return _version.default;
|
|
227149
|
+
}));
|
|
227150
|
+
Object.defineProperty(exports, "version", ({
|
|
227151
|
+
enumerable: true,
|
|
227152
|
+
get: function () {
|
|
227153
|
+
return _version.default;
|
|
227154
|
+
}
|
|
227155
|
+
}));
|
|
227156
|
+
|
|
227157
|
+
var _v = _interopRequireDefault(__nccwpck_require__(6415));
|
|
227158
|
+
|
|
227159
|
+
var _v2 = _interopRequireDefault(__nccwpck_require__(51697));
|
|
227160
|
+
|
|
227161
|
+
var _v3 = _interopRequireDefault(__nccwpck_require__(4676));
|
|
227162
|
+
|
|
227163
|
+
var _v4 = _interopRequireDefault(__nccwpck_require__(69771));
|
|
227164
|
+
|
|
227165
|
+
var _nil = _interopRequireDefault(__nccwpck_require__(37723));
|
|
227166
|
+
|
|
227167
|
+
var _version = _interopRequireDefault(__nccwpck_require__(15868));
|
|
227168
|
+
|
|
227169
|
+
var _validate = _interopRequireDefault(__nccwpck_require__(36200));
|
|
227170
|
+
|
|
227171
|
+
var _stringify = _interopRequireDefault(__nccwpck_require__(37597));
|
|
227172
|
+
|
|
227173
|
+
var _parse = _interopRequireDefault(__nccwpck_require__(17267));
|
|
227174
|
+
|
|
227175
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
227176
|
+
|
|
227177
|
+
/***/ }),
|
|
227178
|
+
|
|
227179
|
+
/***/ 10216:
|
|
227180
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
227181
|
+
|
|
227182
|
+
"use strict";
|
|
227183
|
+
|
|
227184
|
+
|
|
227185
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
227186
|
+
value: true
|
|
227187
|
+
}));
|
|
227188
|
+
exports["default"] = void 0;
|
|
227189
|
+
|
|
227190
|
+
var _crypto = _interopRequireDefault(__nccwpck_require__(76982));
|
|
227191
|
+
|
|
227192
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
227193
|
+
|
|
227194
|
+
function md5(bytes) {
|
|
227195
|
+
if (Array.isArray(bytes)) {
|
|
227196
|
+
bytes = Buffer.from(bytes);
|
|
227197
|
+
} else if (typeof bytes === 'string') {
|
|
227198
|
+
bytes = Buffer.from(bytes, 'utf8');
|
|
227199
|
+
}
|
|
227200
|
+
|
|
227201
|
+
return _crypto.default.createHash('md5').update(bytes).digest();
|
|
227202
|
+
}
|
|
227203
|
+
|
|
227204
|
+
var _default = md5;
|
|
227205
|
+
exports["default"] = _default;
|
|
227206
|
+
|
|
227207
|
+
/***/ }),
|
|
227208
|
+
|
|
227209
|
+
/***/ 54221:
|
|
227210
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
227211
|
+
|
|
227212
|
+
"use strict";
|
|
227213
|
+
|
|
227214
|
+
|
|
227215
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
227216
|
+
value: true
|
|
227217
|
+
}));
|
|
227218
|
+
exports["default"] = void 0;
|
|
227219
|
+
|
|
227220
|
+
var _crypto = _interopRequireDefault(__nccwpck_require__(76982));
|
|
227221
|
+
|
|
227222
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
227223
|
+
|
|
227224
|
+
var _default = {
|
|
227225
|
+
randomUUID: _crypto.default.randomUUID
|
|
227226
|
+
};
|
|
227227
|
+
exports["default"] = _default;
|
|
227228
|
+
|
|
227229
|
+
/***/ }),
|
|
227230
|
+
|
|
227231
|
+
/***/ 37723:
|
|
227232
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
227233
|
+
|
|
227234
|
+
"use strict";
|
|
227235
|
+
|
|
227236
|
+
|
|
227237
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
227238
|
+
value: true
|
|
227239
|
+
}));
|
|
227240
|
+
exports["default"] = void 0;
|
|
227241
|
+
var _default = '00000000-0000-0000-0000-000000000000';
|
|
227242
|
+
exports["default"] = _default;
|
|
227243
|
+
|
|
227244
|
+
/***/ }),
|
|
227245
|
+
|
|
227246
|
+
/***/ 17267:
|
|
227247
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
227248
|
+
|
|
227249
|
+
"use strict";
|
|
227250
|
+
|
|
227251
|
+
|
|
227252
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
227253
|
+
value: true
|
|
227254
|
+
}));
|
|
227255
|
+
exports["default"] = void 0;
|
|
227256
|
+
|
|
227257
|
+
var _validate = _interopRequireDefault(__nccwpck_require__(36200));
|
|
227258
|
+
|
|
227259
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
227260
|
+
|
|
227261
|
+
function parse(uuid) {
|
|
227262
|
+
if (!(0, _validate.default)(uuid)) {
|
|
227263
|
+
throw TypeError('Invalid UUID');
|
|
227264
|
+
}
|
|
227265
|
+
|
|
227266
|
+
let v;
|
|
227267
|
+
const arr = new Uint8Array(16); // Parse ########-....-....-....-............
|
|
227268
|
+
|
|
227269
|
+
arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
|
|
227270
|
+
arr[1] = v >>> 16 & 0xff;
|
|
227271
|
+
arr[2] = v >>> 8 & 0xff;
|
|
227272
|
+
arr[3] = v & 0xff; // Parse ........-####-....-....-............
|
|
227273
|
+
|
|
227274
|
+
arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;
|
|
227275
|
+
arr[5] = v & 0xff; // Parse ........-....-####-....-............
|
|
227276
|
+
|
|
227277
|
+
arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;
|
|
227278
|
+
arr[7] = v & 0xff; // Parse ........-....-....-####-............
|
|
227279
|
+
|
|
227280
|
+
arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;
|
|
227281
|
+
arr[9] = v & 0xff; // Parse ........-....-....-....-############
|
|
227282
|
+
// (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes)
|
|
227283
|
+
|
|
227284
|
+
arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;
|
|
227285
|
+
arr[11] = v / 0x100000000 & 0xff;
|
|
227286
|
+
arr[12] = v >>> 24 & 0xff;
|
|
227287
|
+
arr[13] = v >>> 16 & 0xff;
|
|
227288
|
+
arr[14] = v >>> 8 & 0xff;
|
|
227289
|
+
arr[15] = v & 0xff;
|
|
227290
|
+
return arr;
|
|
227291
|
+
}
|
|
227292
|
+
|
|
227293
|
+
var _default = parse;
|
|
227294
|
+
exports["default"] = _default;
|
|
227295
|
+
|
|
227296
|
+
/***/ }),
|
|
227297
|
+
|
|
227298
|
+
/***/ 67879:
|
|
227299
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
227300
|
+
|
|
227301
|
+
"use strict";
|
|
227302
|
+
|
|
227303
|
+
|
|
227304
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
227305
|
+
value: true
|
|
227306
|
+
}));
|
|
227307
|
+
exports["default"] = void 0;
|
|
227308
|
+
var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
227309
|
+
exports["default"] = _default;
|
|
227310
|
+
|
|
227311
|
+
/***/ }),
|
|
227312
|
+
|
|
227313
|
+
/***/ 12973:
|
|
227314
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
227315
|
+
|
|
227316
|
+
"use strict";
|
|
227317
|
+
|
|
227318
|
+
|
|
227319
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
227320
|
+
value: true
|
|
227321
|
+
}));
|
|
227322
|
+
exports["default"] = rng;
|
|
227323
|
+
|
|
227324
|
+
var _crypto = _interopRequireDefault(__nccwpck_require__(76982));
|
|
227325
|
+
|
|
227326
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
227327
|
+
|
|
227328
|
+
const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate
|
|
227329
|
+
|
|
227330
|
+
let poolPtr = rnds8Pool.length;
|
|
227331
|
+
|
|
227332
|
+
function rng() {
|
|
227333
|
+
if (poolPtr > rnds8Pool.length - 16) {
|
|
227334
|
+
_crypto.default.randomFillSync(rnds8Pool);
|
|
227335
|
+
|
|
227336
|
+
poolPtr = 0;
|
|
227337
|
+
}
|
|
227338
|
+
|
|
227339
|
+
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
227340
|
+
}
|
|
227341
|
+
|
|
227342
|
+
/***/ }),
|
|
227343
|
+
|
|
227344
|
+
/***/ 507:
|
|
227345
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
227346
|
+
|
|
227347
|
+
"use strict";
|
|
227348
|
+
|
|
227349
|
+
|
|
227350
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
227351
|
+
value: true
|
|
227352
|
+
}));
|
|
227353
|
+
exports["default"] = void 0;
|
|
227354
|
+
|
|
227355
|
+
var _crypto = _interopRequireDefault(__nccwpck_require__(76982));
|
|
227356
|
+
|
|
227357
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
227358
|
+
|
|
227359
|
+
function sha1(bytes) {
|
|
227360
|
+
if (Array.isArray(bytes)) {
|
|
227361
|
+
bytes = Buffer.from(bytes);
|
|
227362
|
+
} else if (typeof bytes === 'string') {
|
|
227363
|
+
bytes = Buffer.from(bytes, 'utf8');
|
|
227364
|
+
}
|
|
227365
|
+
|
|
227366
|
+
return _crypto.default.createHash('sha1').update(bytes).digest();
|
|
227367
|
+
}
|
|
227368
|
+
|
|
227369
|
+
var _default = sha1;
|
|
227370
|
+
exports["default"] = _default;
|
|
227371
|
+
|
|
227372
|
+
/***/ }),
|
|
227373
|
+
|
|
227374
|
+
/***/ 37597:
|
|
227375
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
227376
|
+
|
|
227377
|
+
"use strict";
|
|
227378
|
+
|
|
227379
|
+
|
|
227380
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
227381
|
+
value: true
|
|
227382
|
+
}));
|
|
227383
|
+
exports["default"] = void 0;
|
|
227384
|
+
exports.unsafeStringify = unsafeStringify;
|
|
227385
|
+
|
|
227386
|
+
var _validate = _interopRequireDefault(__nccwpck_require__(36200));
|
|
227387
|
+
|
|
227388
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
227389
|
+
|
|
227390
|
+
/**
|
|
227391
|
+
* Convert array of 16 byte values to UUID string format of the form:
|
|
227392
|
+
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
227393
|
+
*/
|
|
227394
|
+
const byteToHex = [];
|
|
227395
|
+
|
|
227396
|
+
for (let i = 0; i < 256; ++i) {
|
|
227397
|
+
byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
227398
|
+
}
|
|
227399
|
+
|
|
227400
|
+
function unsafeStringify(arr, offset = 0) {
|
|
227401
|
+
// Note: Be careful editing this code! It's been tuned for performance
|
|
227402
|
+
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
|
227403
|
+
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
|
227404
|
+
}
|
|
227405
|
+
|
|
227406
|
+
function stringify(arr, offset = 0) {
|
|
227407
|
+
const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one
|
|
227408
|
+
// of the following:
|
|
227409
|
+
// - One or more input array values don't map to a hex octet (leading to
|
|
227410
|
+
// "undefined" in the uuid)
|
|
227411
|
+
// - Invalid input values for the RFC `version` or `variant` fields
|
|
227412
|
+
|
|
227413
|
+
if (!(0, _validate.default)(uuid)) {
|
|
227414
|
+
throw TypeError('Stringified UUID is invalid');
|
|
227415
|
+
}
|
|
227416
|
+
|
|
227417
|
+
return uuid;
|
|
227418
|
+
}
|
|
227419
|
+
|
|
227420
|
+
var _default = stringify;
|
|
227421
|
+
exports["default"] = _default;
|
|
227422
|
+
|
|
227423
|
+
/***/ }),
|
|
227424
|
+
|
|
227425
|
+
/***/ 6415:
|
|
227426
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
227427
|
+
|
|
227428
|
+
"use strict";
|
|
227429
|
+
|
|
227430
|
+
|
|
227431
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
227432
|
+
value: true
|
|
227433
|
+
}));
|
|
227434
|
+
exports["default"] = void 0;
|
|
227435
|
+
|
|
227436
|
+
var _rng = _interopRequireDefault(__nccwpck_require__(12973));
|
|
227437
|
+
|
|
227438
|
+
var _stringify = __nccwpck_require__(37597);
|
|
227439
|
+
|
|
227440
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
227441
|
+
|
|
227442
|
+
// **`v1()` - Generate time-based UUID**
|
|
227443
|
+
//
|
|
227444
|
+
// Inspired by https://github.com/LiosK/UUID.js
|
|
227445
|
+
// and http://docs.python.org/library/uuid.html
|
|
227446
|
+
let _nodeId;
|
|
227447
|
+
|
|
227448
|
+
let _clockseq; // Previous uuid creation time
|
|
227449
|
+
|
|
227450
|
+
|
|
227451
|
+
let _lastMSecs = 0;
|
|
227452
|
+
let _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details
|
|
227453
|
+
|
|
227454
|
+
function v1(options, buf, offset) {
|
|
227455
|
+
let i = buf && offset || 0;
|
|
227456
|
+
const b = buf || new Array(16);
|
|
227457
|
+
options = options || {};
|
|
227458
|
+
let node = options.node || _nodeId;
|
|
227459
|
+
let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not
|
|
227460
|
+
// specified. We do this lazily to minimize issues related to insufficient
|
|
227461
|
+
// system entropy. See #189
|
|
227462
|
+
|
|
227463
|
+
if (node == null || clockseq == null) {
|
|
227464
|
+
const seedBytes = options.random || (options.rng || _rng.default)();
|
|
227465
|
+
|
|
227466
|
+
if (node == null) {
|
|
227467
|
+
// Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
|
|
227468
|
+
node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];
|
|
227469
|
+
}
|
|
227470
|
+
|
|
227471
|
+
if (clockseq == null) {
|
|
227472
|
+
// Per 4.2.2, randomize (14 bit) clockseq
|
|
227473
|
+
clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;
|
|
227474
|
+
}
|
|
227475
|
+
} // UUID timestamps are 100 nano-second units since the Gregorian epoch,
|
|
227476
|
+
// (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
|
|
227477
|
+
// time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
|
|
227478
|
+
// (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
|
|
227479
|
+
|
|
227480
|
+
|
|
227481
|
+
let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock
|
|
227482
|
+
// cycle to simulate higher resolution clock
|
|
227483
|
+
|
|
227484
|
+
let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs)
|
|
227485
|
+
|
|
227486
|
+
const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression
|
|
227487
|
+
|
|
227488
|
+
if (dt < 0 && options.clockseq === undefined) {
|
|
227489
|
+
clockseq = clockseq + 1 & 0x3fff;
|
|
227490
|
+
} // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
|
|
227491
|
+
// time interval
|
|
227492
|
+
|
|
227493
|
+
|
|
227494
|
+
if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
|
|
227495
|
+
nsecs = 0;
|
|
227496
|
+
} // Per 4.2.1.2 Throw error if too many uuids are requested
|
|
227497
|
+
|
|
227498
|
+
|
|
227499
|
+
if (nsecs >= 10000) {
|
|
227500
|
+
throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
|
|
227501
|
+
}
|
|
227502
|
+
|
|
227503
|
+
_lastMSecs = msecs;
|
|
227504
|
+
_lastNSecs = nsecs;
|
|
227505
|
+
_clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch
|
|
227506
|
+
|
|
227507
|
+
msecs += 12219292800000; // `time_low`
|
|
227508
|
+
|
|
227509
|
+
const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
|
|
227510
|
+
b[i++] = tl >>> 24 & 0xff;
|
|
227511
|
+
b[i++] = tl >>> 16 & 0xff;
|
|
227512
|
+
b[i++] = tl >>> 8 & 0xff;
|
|
227513
|
+
b[i++] = tl & 0xff; // `time_mid`
|
|
227514
|
+
|
|
227515
|
+
const tmh = msecs / 0x100000000 * 10000 & 0xfffffff;
|
|
227516
|
+
b[i++] = tmh >>> 8 & 0xff;
|
|
227517
|
+
b[i++] = tmh & 0xff; // `time_high_and_version`
|
|
227518
|
+
|
|
227519
|
+
b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
|
|
227520
|
+
|
|
227521
|
+
b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
|
|
227522
|
+
|
|
227523
|
+
b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low`
|
|
227524
|
+
|
|
227525
|
+
b[i++] = clockseq & 0xff; // `node`
|
|
227526
|
+
|
|
227527
|
+
for (let n = 0; n < 6; ++n) {
|
|
227528
|
+
b[i + n] = node[n];
|
|
227529
|
+
}
|
|
227530
|
+
|
|
227531
|
+
return buf || (0, _stringify.unsafeStringify)(b);
|
|
227532
|
+
}
|
|
227533
|
+
|
|
227534
|
+
var _default = v1;
|
|
227535
|
+
exports["default"] = _default;
|
|
227536
|
+
|
|
227537
|
+
/***/ }),
|
|
227538
|
+
|
|
227539
|
+
/***/ 51697:
|
|
227540
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
227541
|
+
|
|
227542
|
+
"use strict";
|
|
227543
|
+
|
|
227544
|
+
|
|
227545
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
227546
|
+
value: true
|
|
227547
|
+
}));
|
|
227548
|
+
exports["default"] = void 0;
|
|
227549
|
+
|
|
227550
|
+
var _v = _interopRequireDefault(__nccwpck_require__(92930));
|
|
227551
|
+
|
|
227552
|
+
var _md = _interopRequireDefault(__nccwpck_require__(10216));
|
|
227553
|
+
|
|
227554
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
227555
|
+
|
|
227556
|
+
const v3 = (0, _v.default)('v3', 0x30, _md.default);
|
|
227557
|
+
var _default = v3;
|
|
227558
|
+
exports["default"] = _default;
|
|
227559
|
+
|
|
227560
|
+
/***/ }),
|
|
227561
|
+
|
|
227562
|
+
/***/ 92930:
|
|
227563
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
227564
|
+
|
|
227565
|
+
"use strict";
|
|
227566
|
+
|
|
227567
|
+
|
|
227568
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
227569
|
+
value: true
|
|
227570
|
+
}));
|
|
227571
|
+
exports.URL = exports.DNS = void 0;
|
|
227572
|
+
exports["default"] = v35;
|
|
227573
|
+
|
|
227574
|
+
var _stringify = __nccwpck_require__(37597);
|
|
227575
|
+
|
|
227576
|
+
var _parse = _interopRequireDefault(__nccwpck_require__(17267));
|
|
227577
|
+
|
|
227578
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
227579
|
+
|
|
227580
|
+
function stringToBytes(str) {
|
|
227581
|
+
str = unescape(encodeURIComponent(str)); // UTF8 escape
|
|
227582
|
+
|
|
227583
|
+
const bytes = [];
|
|
227584
|
+
|
|
227585
|
+
for (let i = 0; i < str.length; ++i) {
|
|
227586
|
+
bytes.push(str.charCodeAt(i));
|
|
227587
|
+
}
|
|
227588
|
+
|
|
227589
|
+
return bytes;
|
|
227590
|
+
}
|
|
227591
|
+
|
|
227592
|
+
const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
|
|
227593
|
+
exports.DNS = DNS;
|
|
227594
|
+
const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
|
|
227595
|
+
exports.URL = URL;
|
|
227596
|
+
|
|
227597
|
+
function v35(name, version, hashfunc) {
|
|
227598
|
+
function generateUUID(value, namespace, buf, offset) {
|
|
227599
|
+
var _namespace;
|
|
227600
|
+
|
|
227601
|
+
if (typeof value === 'string') {
|
|
227602
|
+
value = stringToBytes(value);
|
|
227603
|
+
}
|
|
227604
|
+
|
|
227605
|
+
if (typeof namespace === 'string') {
|
|
227606
|
+
namespace = (0, _parse.default)(namespace);
|
|
227607
|
+
}
|
|
227608
|
+
|
|
227609
|
+
if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) {
|
|
227610
|
+
throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');
|
|
227611
|
+
} // Compute hash of namespace and value, Per 4.3
|
|
227612
|
+
// Future: Use spread syntax when supported on all platforms, e.g. `bytes =
|
|
227613
|
+
// hashfunc([...namespace, ... value])`
|
|
227614
|
+
|
|
227615
|
+
|
|
227616
|
+
let bytes = new Uint8Array(16 + value.length);
|
|
227617
|
+
bytes.set(namespace);
|
|
227618
|
+
bytes.set(value, namespace.length);
|
|
227619
|
+
bytes = hashfunc(bytes);
|
|
227620
|
+
bytes[6] = bytes[6] & 0x0f | version;
|
|
227621
|
+
bytes[8] = bytes[8] & 0x3f | 0x80;
|
|
227622
|
+
|
|
227623
|
+
if (buf) {
|
|
227624
|
+
offset = offset || 0;
|
|
227625
|
+
|
|
227626
|
+
for (let i = 0; i < 16; ++i) {
|
|
227627
|
+
buf[offset + i] = bytes[i];
|
|
227628
|
+
}
|
|
227629
|
+
|
|
227630
|
+
return buf;
|
|
227631
|
+
}
|
|
227632
|
+
|
|
227633
|
+
return (0, _stringify.unsafeStringify)(bytes);
|
|
227634
|
+
} // Function#name is not settable on some platforms (#270)
|
|
227635
|
+
|
|
227636
|
+
|
|
227637
|
+
try {
|
|
227638
|
+
generateUUID.name = name; // eslint-disable-next-line no-empty
|
|
227639
|
+
} catch (err) {} // For CommonJS default export support
|
|
227640
|
+
|
|
227641
|
+
|
|
227642
|
+
generateUUID.DNS = DNS;
|
|
227643
|
+
generateUUID.URL = URL;
|
|
227644
|
+
return generateUUID;
|
|
227645
|
+
}
|
|
227646
|
+
|
|
227647
|
+
/***/ }),
|
|
227648
|
+
|
|
227649
|
+
/***/ 4676:
|
|
227650
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
227651
|
+
|
|
227652
|
+
"use strict";
|
|
227653
|
+
|
|
227654
|
+
|
|
227655
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
227656
|
+
value: true
|
|
227657
|
+
}));
|
|
227658
|
+
exports["default"] = void 0;
|
|
227659
|
+
|
|
227660
|
+
var _native = _interopRequireDefault(__nccwpck_require__(54221));
|
|
227661
|
+
|
|
227662
|
+
var _rng = _interopRequireDefault(__nccwpck_require__(12973));
|
|
227663
|
+
|
|
227664
|
+
var _stringify = __nccwpck_require__(37597);
|
|
227665
|
+
|
|
227666
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
227667
|
+
|
|
227668
|
+
function v4(options, buf, offset) {
|
|
227669
|
+
if (_native.default.randomUUID && !buf && !options) {
|
|
227670
|
+
return _native.default.randomUUID();
|
|
227671
|
+
}
|
|
227672
|
+
|
|
227673
|
+
options = options || {};
|
|
227674
|
+
|
|
227675
|
+
const rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
227676
|
+
|
|
227677
|
+
|
|
227678
|
+
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
227679
|
+
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
|
|
227680
|
+
|
|
227681
|
+
if (buf) {
|
|
227682
|
+
offset = offset || 0;
|
|
227683
|
+
|
|
227684
|
+
for (let i = 0; i < 16; ++i) {
|
|
227685
|
+
buf[offset + i] = rnds[i];
|
|
227686
|
+
}
|
|
227687
|
+
|
|
227688
|
+
return buf;
|
|
227689
|
+
}
|
|
227690
|
+
|
|
227691
|
+
return (0, _stringify.unsafeStringify)(rnds);
|
|
227692
|
+
}
|
|
227693
|
+
|
|
227694
|
+
var _default = v4;
|
|
227695
|
+
exports["default"] = _default;
|
|
227696
|
+
|
|
227697
|
+
/***/ }),
|
|
227698
|
+
|
|
227699
|
+
/***/ 69771:
|
|
227700
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
227701
|
+
|
|
227702
|
+
"use strict";
|
|
227703
|
+
|
|
227704
|
+
|
|
227705
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
227706
|
+
value: true
|
|
227707
|
+
}));
|
|
227708
|
+
exports["default"] = void 0;
|
|
227709
|
+
|
|
227710
|
+
var _v = _interopRequireDefault(__nccwpck_require__(92930));
|
|
227711
|
+
|
|
227712
|
+
var _sha = _interopRequireDefault(__nccwpck_require__(507));
|
|
227713
|
+
|
|
227714
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
227715
|
+
|
|
227716
|
+
const v5 = (0, _v.default)('v5', 0x50, _sha.default);
|
|
227717
|
+
var _default = v5;
|
|
227718
|
+
exports["default"] = _default;
|
|
227719
|
+
|
|
227720
|
+
/***/ }),
|
|
227721
|
+
|
|
227722
|
+
/***/ 36200:
|
|
227723
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
227724
|
+
|
|
227725
|
+
"use strict";
|
|
227726
|
+
|
|
227727
|
+
|
|
227728
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
227729
|
+
value: true
|
|
227730
|
+
}));
|
|
227731
|
+
exports["default"] = void 0;
|
|
227732
|
+
|
|
227733
|
+
var _regex = _interopRequireDefault(__nccwpck_require__(67879));
|
|
227734
|
+
|
|
227735
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
227736
|
+
|
|
227737
|
+
function validate(uuid) {
|
|
227738
|
+
return typeof uuid === 'string' && _regex.default.test(uuid);
|
|
227739
|
+
}
|
|
227740
|
+
|
|
227741
|
+
var _default = validate;
|
|
227742
|
+
exports["default"] = _default;
|
|
227743
|
+
|
|
227744
|
+
/***/ }),
|
|
227745
|
+
|
|
227746
|
+
/***/ 15868:
|
|
227747
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
227748
|
+
|
|
227749
|
+
"use strict";
|
|
227750
|
+
|
|
227751
|
+
|
|
227752
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
227753
|
+
value: true
|
|
227754
|
+
}));
|
|
227755
|
+
exports["default"] = void 0;
|
|
227756
|
+
|
|
227757
|
+
var _validate = _interopRequireDefault(__nccwpck_require__(36200));
|
|
227758
|
+
|
|
227759
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
227760
|
+
|
|
227761
|
+
function version(uuid) {
|
|
227762
|
+
if (!(0, _validate.default)(uuid)) {
|
|
227763
|
+
throw TypeError('Invalid UUID');
|
|
227764
|
+
}
|
|
227765
|
+
|
|
227766
|
+
return parseInt(uuid.slice(14, 15), 16);
|
|
227767
|
+
}
|
|
227768
|
+
|
|
227769
|
+
var _default = version;
|
|
227770
|
+
exports["default"] = _default;
|
|
227771
|
+
|
|
227772
|
+
/***/ }),
|
|
227773
|
+
|
|
227774
|
+
/***/ 45116:
|
|
227775
|
+
/***/ ((module) => {
|
|
227776
|
+
|
|
227777
|
+
"use strict";
|
|
227778
|
+
/*!
|
|
227779
|
+
* vary
|
|
227780
|
+
* Copyright(c) 2014-2017 Douglas Christopher Wilson
|
|
227781
|
+
* MIT Licensed
|
|
227782
|
+
*/
|
|
227783
|
+
|
|
227784
|
+
|
|
227785
|
+
|
|
227786
|
+
/**
|
|
227787
|
+
* Module exports.
|
|
227788
|
+
*/
|
|
227789
|
+
|
|
227790
|
+
module.exports = vary
|
|
227791
|
+
module.exports.append = append
|
|
227792
|
+
|
|
227793
|
+
/**
|
|
227794
|
+
* RegExp to match field-name in RFC 7230 sec 3.2
|
|
227795
|
+
*
|
|
227796
|
+
* field-name = token
|
|
227797
|
+
* token = 1*tchar
|
|
227798
|
+
* tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*"
|
|
227799
|
+
* / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
|
|
227800
|
+
* / DIGIT / ALPHA
|
|
227801
|
+
* ; any VCHAR, except delimiters
|
|
227802
|
+
*/
|
|
227803
|
+
|
|
227804
|
+
var FIELD_NAME_REGEXP = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/
|
|
227805
|
+
|
|
227806
|
+
/**
|
|
227807
|
+
* Append a field to a vary header.
|
|
227808
|
+
*
|
|
227809
|
+
* @param {String} header
|
|
227810
|
+
* @param {String|Array} field
|
|
227811
|
+
* @return {String}
|
|
227812
|
+
* @public
|
|
227813
|
+
*/
|
|
227814
|
+
|
|
227815
|
+
function append (header, field) {
|
|
227816
|
+
if (typeof header !== 'string') {
|
|
227817
|
+
throw new TypeError('header argument is required')
|
|
227818
|
+
}
|
|
227819
|
+
|
|
227820
|
+
if (!field) {
|
|
227821
|
+
throw new TypeError('field argument is required')
|
|
227822
|
+
}
|
|
227823
|
+
|
|
227824
|
+
// get fields array
|
|
227825
|
+
var fields = !Array.isArray(field)
|
|
227826
|
+
? parse(String(field))
|
|
227827
|
+
: field
|
|
227828
|
+
|
|
227829
|
+
// assert on invalid field names
|
|
227830
|
+
for (var j = 0; j < fields.length; j++) {
|
|
227831
|
+
if (!FIELD_NAME_REGEXP.test(fields[j])) {
|
|
227832
|
+
throw new TypeError('field argument contains an invalid header name')
|
|
227833
|
+
}
|
|
227834
|
+
}
|
|
227835
|
+
|
|
227836
|
+
// existing, unspecified vary
|
|
227837
|
+
if (header === '*') {
|
|
227838
|
+
return header
|
|
227839
|
+
}
|
|
227840
|
+
|
|
227841
|
+
// enumerate current values
|
|
227842
|
+
var val = header
|
|
227843
|
+
var vals = parse(header.toLowerCase())
|
|
227844
|
+
|
|
227845
|
+
// unspecified vary
|
|
227846
|
+
if (fields.indexOf('*') !== -1 || vals.indexOf('*') !== -1) {
|
|
227847
|
+
return '*'
|
|
227848
|
+
}
|
|
227849
|
+
|
|
227850
|
+
for (var i = 0; i < fields.length; i++) {
|
|
227851
|
+
var fld = fields[i].toLowerCase()
|
|
227852
|
+
|
|
227853
|
+
// append value (case-preserving)
|
|
227854
|
+
if (vals.indexOf(fld) === -1) {
|
|
227855
|
+
vals.push(fld)
|
|
227856
|
+
val = val
|
|
227857
|
+
? val + ', ' + fields[i]
|
|
227858
|
+
: fields[i]
|
|
227859
|
+
}
|
|
227860
|
+
}
|
|
227861
|
+
|
|
227862
|
+
return val
|
|
227863
|
+
}
|
|
227864
|
+
|
|
227865
|
+
/**
|
|
227866
|
+
* Parse a vary header into an array.
|
|
227867
|
+
*
|
|
227868
|
+
* @param {String} header
|
|
227869
|
+
* @return {Array}
|
|
227870
|
+
* @private
|
|
227871
|
+
*/
|
|
227872
|
+
|
|
227873
|
+
function parse (header) {
|
|
227874
|
+
var end = 0
|
|
227875
|
+
var list = []
|
|
227876
|
+
var start = 0
|
|
227877
|
+
|
|
227878
|
+
// gather tokens
|
|
227879
|
+
for (var i = 0, len = header.length; i < len; i++) {
|
|
227880
|
+
switch (header.charCodeAt(i)) {
|
|
227881
|
+
case 0x20: /* */
|
|
227882
|
+
if (start === end) {
|
|
227883
|
+
start = end = i + 1
|
|
227884
|
+
}
|
|
227885
|
+
break
|
|
227886
|
+
case 0x2c: /* , */
|
|
227887
|
+
list.push(header.substring(start, end))
|
|
227888
|
+
start = end = i + 1
|
|
227889
|
+
break
|
|
227890
|
+
default:
|
|
227891
|
+
end = i + 1
|
|
227892
|
+
break
|
|
227893
|
+
}
|
|
227894
|
+
}
|
|
227895
|
+
|
|
227896
|
+
// final token
|
|
227897
|
+
list.push(header.substring(start, end))
|
|
227898
|
+
|
|
227899
|
+
return list
|
|
227900
|
+
}
|
|
227901
|
+
|
|
227902
|
+
/**
|
|
227903
|
+
* Mark that a request is varied on a header field.
|
|
227904
|
+
*
|
|
227905
|
+
* @param {Object} res
|
|
227906
|
+
* @param {String|Array} field
|
|
227907
|
+
* @public
|
|
227908
|
+
*/
|
|
227909
|
+
|
|
227910
|
+
function vary (res, field) {
|
|
227911
|
+
if (!res || !res.getHeader || !res.setHeader) {
|
|
227912
|
+
// quack quack
|
|
227913
|
+
throw new TypeError('res argument is required')
|
|
227914
|
+
}
|
|
227915
|
+
|
|
227916
|
+
// get existing header
|
|
227917
|
+
var val = res.getHeader('Vary') || ''
|
|
227918
|
+
var header = Array.isArray(val)
|
|
227919
|
+
? val.join(', ')
|
|
227920
|
+
: String(val)
|
|
227921
|
+
|
|
227922
|
+
// set new header
|
|
227923
|
+
if ((val = append(header, field))) {
|
|
227924
|
+
res.setHeader('Vary', val)
|
|
228524
227925
|
}
|
|
228525
|
-
}
|
|
227926
|
+
}
|
|
228526
227927
|
|
|
228527
|
-
var _v = _interopRequireDefault(__nccwpck_require__(6415));
|
|
228528
227928
|
|
|
228529
|
-
|
|
227929
|
+
/***/ }),
|
|
228530
227930
|
|
|
228531
|
-
|
|
227931
|
+
/***/ 43236:
|
|
227932
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
228532
227933
|
|
|
228533
|
-
|
|
227934
|
+
"use strict";
|
|
228534
227935
|
|
|
228535
|
-
|
|
227936
|
+
const stringWidth = __nccwpck_require__(60060);
|
|
227937
|
+
const stripAnsi = __nccwpck_require__(13958);
|
|
227938
|
+
const ansiStyles = __nccwpck_require__(40256);
|
|
228536
227939
|
|
|
228537
|
-
|
|
227940
|
+
const ESCAPES = new Set([
|
|
227941
|
+
'\u001B',
|
|
227942
|
+
'\u009B'
|
|
227943
|
+
]);
|
|
228538
227944
|
|
|
228539
|
-
|
|
227945
|
+
const END_CODE = 39;
|
|
228540
227946
|
|
|
228541
|
-
|
|
227947
|
+
const ANSI_ESCAPE_BELL = '\u0007';
|
|
227948
|
+
const ANSI_CSI = '[';
|
|
227949
|
+
const ANSI_OSC = ']';
|
|
227950
|
+
const ANSI_SGR_TERMINATOR = 'm';
|
|
227951
|
+
const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
228542
227952
|
|
|
228543
|
-
|
|
227953
|
+
const wrapAnsi = code => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
227954
|
+
const wrapAnsiHyperlink = uri => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${uri}${ANSI_ESCAPE_BELL}`;
|
|
228544
227955
|
|
|
228545
|
-
|
|
227956
|
+
// Calculate the length of words split on ' ', ignoring
|
|
227957
|
+
// the extra characters added by ansi escape codes
|
|
227958
|
+
const wordLengths = string => string.split(' ').map(character => stringWidth(character));
|
|
228546
227959
|
|
|
228547
|
-
|
|
227960
|
+
// Wrap a long word across multiple rows
|
|
227961
|
+
// Ansi escape codes do not count towards length
|
|
227962
|
+
const wrapWord = (rows, word, columns) => {
|
|
227963
|
+
const characters = [...word];
|
|
228548
227964
|
|
|
228549
|
-
|
|
228550
|
-
|
|
227965
|
+
let isInsideEscape = false;
|
|
227966
|
+
let isInsideLinkEscape = false;
|
|
227967
|
+
let visible = stringWidth(stripAnsi(rows[rows.length - 1]));
|
|
228551
227968
|
|
|
228552
|
-
|
|
227969
|
+
for (const [index, character] of characters.entries()) {
|
|
227970
|
+
const characterLength = stringWidth(character);
|
|
228553
227971
|
|
|
227972
|
+
if (visible + characterLength <= columns) {
|
|
227973
|
+
rows[rows.length - 1] += character;
|
|
227974
|
+
} else {
|
|
227975
|
+
rows.push(character);
|
|
227976
|
+
visible = 0;
|
|
227977
|
+
}
|
|
228554
227978
|
|
|
228555
|
-
|
|
228556
|
-
|
|
228557
|
-
|
|
228558
|
-
|
|
227979
|
+
if (ESCAPES.has(character)) {
|
|
227980
|
+
isInsideEscape = true;
|
|
227981
|
+
isInsideLinkEscape = characters.slice(index + 1).join('').startsWith(ANSI_ESCAPE_LINK);
|
|
227982
|
+
}
|
|
228559
227983
|
|
|
228560
|
-
|
|
227984
|
+
if (isInsideEscape) {
|
|
227985
|
+
if (isInsideLinkEscape) {
|
|
227986
|
+
if (character === ANSI_ESCAPE_BELL) {
|
|
227987
|
+
isInsideEscape = false;
|
|
227988
|
+
isInsideLinkEscape = false;
|
|
227989
|
+
}
|
|
227990
|
+
} else if (character === ANSI_SGR_TERMINATOR) {
|
|
227991
|
+
isInsideEscape = false;
|
|
227992
|
+
}
|
|
228561
227993
|
|
|
228562
|
-
|
|
227994
|
+
continue;
|
|
227995
|
+
}
|
|
228563
227996
|
|
|
228564
|
-
|
|
228565
|
-
if (Array.isArray(bytes)) {
|
|
228566
|
-
bytes = Buffer.from(bytes);
|
|
228567
|
-
} else if (typeof bytes === 'string') {
|
|
228568
|
-
bytes = Buffer.from(bytes, 'utf8');
|
|
228569
|
-
}
|
|
227997
|
+
visible += characterLength;
|
|
228570
227998
|
|
|
228571
|
-
|
|
228572
|
-
|
|
227999
|
+
if (visible === columns && index < characters.length - 1) {
|
|
228000
|
+
rows.push('');
|
|
228001
|
+
visible = 0;
|
|
228002
|
+
}
|
|
228003
|
+
}
|
|
228573
228004
|
|
|
228574
|
-
|
|
228575
|
-
|
|
228005
|
+
// It's possible that the last row we copy over is only
|
|
228006
|
+
// ansi escape characters, handle this edge-case
|
|
228007
|
+
if (!visible && rows[rows.length - 1].length > 0 && rows.length > 1) {
|
|
228008
|
+
rows[rows.length - 2] += rows.pop();
|
|
228009
|
+
}
|
|
228010
|
+
};
|
|
228576
228011
|
|
|
228577
|
-
|
|
228012
|
+
// Trims spaces from a string ignoring invisible sequences
|
|
228013
|
+
const stringVisibleTrimSpacesRight = string => {
|
|
228014
|
+
const words = string.split(' ');
|
|
228015
|
+
let last = words.length;
|
|
228578
228016
|
|
|
228579
|
-
|
|
228580
|
-
|
|
228017
|
+
while (last > 0) {
|
|
228018
|
+
if (stringWidth(words[last - 1]) > 0) {
|
|
228019
|
+
break;
|
|
228020
|
+
}
|
|
228581
228021
|
|
|
228582
|
-
|
|
228022
|
+
last--;
|
|
228023
|
+
}
|
|
228583
228024
|
|
|
228025
|
+
if (last === words.length) {
|
|
228026
|
+
return string;
|
|
228027
|
+
}
|
|
228584
228028
|
|
|
228585
|
-
|
|
228586
|
-
|
|
228587
|
-
}));
|
|
228588
|
-
exports["default"] = void 0;
|
|
228029
|
+
return words.slice(0, last).join(' ') + words.slice(last).join('');
|
|
228030
|
+
};
|
|
228589
228031
|
|
|
228590
|
-
|
|
228032
|
+
// The wrap-ansi module can be invoked in either 'hard' or 'soft' wrap mode
|
|
228033
|
+
//
|
|
228034
|
+
// 'hard' will never allow a string to take up more than columns characters
|
|
228035
|
+
//
|
|
228036
|
+
// 'soft' allows long words to expand past the column length
|
|
228037
|
+
const exec = (string, columns, options = {}) => {
|
|
228038
|
+
if (options.trim !== false && string.trim() === '') {
|
|
228039
|
+
return '';
|
|
228040
|
+
}
|
|
228591
228041
|
|
|
228592
|
-
|
|
228042
|
+
let returnValue = '';
|
|
228043
|
+
let escapeCode;
|
|
228044
|
+
let escapeUrl;
|
|
228593
228045
|
|
|
228594
|
-
|
|
228595
|
-
|
|
228596
|
-
};
|
|
228597
|
-
exports["default"] = _default;
|
|
228046
|
+
const lengths = wordLengths(string);
|
|
228047
|
+
let rows = [''];
|
|
228598
228048
|
|
|
228599
|
-
|
|
228049
|
+
for (const [index, word] of string.split(' ').entries()) {
|
|
228050
|
+
if (options.trim !== false) {
|
|
228051
|
+
rows[rows.length - 1] = rows[rows.length - 1].trimStart();
|
|
228052
|
+
}
|
|
228600
228053
|
|
|
228601
|
-
|
|
228602
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
228054
|
+
let rowLength = stringWidth(rows[rows.length - 1]);
|
|
228603
228055
|
|
|
228604
|
-
|
|
228056
|
+
if (index !== 0) {
|
|
228057
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
228058
|
+
// If we start with a new word but the current row length equals the length of the columns, add a new row
|
|
228059
|
+
rows.push('');
|
|
228060
|
+
rowLength = 0;
|
|
228061
|
+
}
|
|
228605
228062
|
|
|
228063
|
+
if (rowLength > 0 || options.trim === false) {
|
|
228064
|
+
rows[rows.length - 1] += ' ';
|
|
228065
|
+
rowLength++;
|
|
228066
|
+
}
|
|
228067
|
+
}
|
|
228606
228068
|
|
|
228607
|
-
|
|
228608
|
-
|
|
228609
|
-
|
|
228610
|
-
|
|
228611
|
-
|
|
228612
|
-
|
|
228069
|
+
// In 'hard' wrap mode, the length of a line is never allowed to extend past 'columns'
|
|
228070
|
+
if (options.hard && lengths[index] > columns) {
|
|
228071
|
+
const remainingColumns = (columns - rowLength);
|
|
228072
|
+
const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);
|
|
228073
|
+
const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns);
|
|
228074
|
+
if (breaksStartingNextLine < breaksStartingThisLine) {
|
|
228075
|
+
rows.push('');
|
|
228076
|
+
}
|
|
228613
228077
|
|
|
228614
|
-
|
|
228078
|
+
wrapWord(rows, word, columns);
|
|
228079
|
+
continue;
|
|
228080
|
+
}
|
|
228615
228081
|
|
|
228616
|
-
|
|
228617
|
-
|
|
228082
|
+
if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) {
|
|
228083
|
+
if (options.wordWrap === false && rowLength < columns) {
|
|
228084
|
+
wrapWord(rows, word, columns);
|
|
228085
|
+
continue;
|
|
228086
|
+
}
|
|
228618
228087
|
|
|
228619
|
-
|
|
228088
|
+
rows.push('');
|
|
228089
|
+
}
|
|
228620
228090
|
|
|
228091
|
+
if (rowLength + lengths[index] > columns && options.wordWrap === false) {
|
|
228092
|
+
wrapWord(rows, word, columns);
|
|
228093
|
+
continue;
|
|
228094
|
+
}
|
|
228621
228095
|
|
|
228622
|
-
|
|
228623
|
-
|
|
228624
|
-
}));
|
|
228625
|
-
exports["default"] = void 0;
|
|
228096
|
+
rows[rows.length - 1] += word;
|
|
228097
|
+
}
|
|
228626
228098
|
|
|
228627
|
-
|
|
228099
|
+
if (options.trim !== false) {
|
|
228100
|
+
rows = rows.map(stringVisibleTrimSpacesRight);
|
|
228101
|
+
}
|
|
228628
228102
|
|
|
228629
|
-
|
|
228103
|
+
const pre = [...rows.join('\n')];
|
|
228630
228104
|
|
|
228631
|
-
|
|
228632
|
-
|
|
228633
|
-
throw TypeError('Invalid UUID');
|
|
228634
|
-
}
|
|
228105
|
+
for (const [index, character] of pre.entries()) {
|
|
228106
|
+
returnValue += character;
|
|
228635
228107
|
|
|
228636
|
-
|
|
228637
|
-
|
|
228108
|
+
if (ESCAPES.has(character)) {
|
|
228109
|
+
const {groups} = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`).exec(pre.slice(index).join('')) || {groups: {}};
|
|
228110
|
+
if (groups.code !== undefined) {
|
|
228111
|
+
const code = Number.parseFloat(groups.code);
|
|
228112
|
+
escapeCode = code === END_CODE ? undefined : code;
|
|
228113
|
+
} else if (groups.uri !== undefined) {
|
|
228114
|
+
escapeUrl = groups.uri.length === 0 ? undefined : groups.uri;
|
|
228115
|
+
}
|
|
228116
|
+
}
|
|
228638
228117
|
|
|
228639
|
-
|
|
228640
|
-
arr[1] = v >>> 16 & 0xff;
|
|
228641
|
-
arr[2] = v >>> 8 & 0xff;
|
|
228642
|
-
arr[3] = v & 0xff; // Parse ........-####-....-....-............
|
|
228118
|
+
const code = ansiStyles.codes.get(Number(escapeCode));
|
|
228643
228119
|
|
|
228644
|
-
|
|
228645
|
-
|
|
228120
|
+
if (pre[index + 1] === '\n') {
|
|
228121
|
+
if (escapeUrl) {
|
|
228122
|
+
returnValue += wrapAnsiHyperlink('');
|
|
228123
|
+
}
|
|
228646
228124
|
|
|
228647
|
-
|
|
228648
|
-
|
|
228125
|
+
if (escapeCode && code) {
|
|
228126
|
+
returnValue += wrapAnsi(code);
|
|
228127
|
+
}
|
|
228128
|
+
} else if (character === '\n') {
|
|
228129
|
+
if (escapeCode && code) {
|
|
228130
|
+
returnValue += wrapAnsi(escapeCode);
|
|
228131
|
+
}
|
|
228649
228132
|
|
|
228650
|
-
|
|
228651
|
-
|
|
228652
|
-
|
|
228133
|
+
if (escapeUrl) {
|
|
228134
|
+
returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
228135
|
+
}
|
|
228136
|
+
}
|
|
228137
|
+
}
|
|
228653
228138
|
|
|
228654
|
-
|
|
228655
|
-
|
|
228656
|
-
|
|
228657
|
-
|
|
228658
|
-
|
|
228659
|
-
|
|
228660
|
-
|
|
228661
|
-
|
|
228139
|
+
return returnValue;
|
|
228140
|
+
};
|
|
228141
|
+
|
|
228142
|
+
// For each newline, invoke the method separately
|
|
228143
|
+
module.exports = (string, columns, options) => {
|
|
228144
|
+
return String(string)
|
|
228145
|
+
.normalize()
|
|
228146
|
+
.replace(/\r\n/g, '\n')
|
|
228147
|
+
.split('\n')
|
|
228148
|
+
.map(line => exec(line, columns, options))
|
|
228149
|
+
.join('\n');
|
|
228150
|
+
};
|
|
228662
228151
|
|
|
228663
|
-
var _default = parse;
|
|
228664
|
-
exports["default"] = _default;
|
|
228665
228152
|
|
|
228666
228153
|
/***/ }),
|
|
228667
228154
|
|
|
228668
|
-
/***/
|
|
228669
|
-
/***/ ((
|
|
228155
|
+
/***/ 40256:
|
|
228156
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
228670
228157
|
|
|
228671
228158
|
"use strict";
|
|
228159
|
+
/* module decorator */ module = __nccwpck_require__.nmd(module);
|
|
228672
228160
|
|
|
228673
228161
|
|
|
228674
|
-
|
|
228675
|
-
|
|
228676
|
-
}
|
|
228677
|
-
|
|
228678
|
-
var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
228679
|
-
exports["default"] = _default;
|
|
228162
|
+
const wrapAnsi16 = (fn, offset) => (...args) => {
|
|
228163
|
+
const code = fn(...args);
|
|
228164
|
+
return `\u001B[${code + offset}m`;
|
|
228165
|
+
};
|
|
228680
228166
|
|
|
228681
|
-
|
|
228167
|
+
const wrapAnsi256 = (fn, offset) => (...args) => {
|
|
228168
|
+
const code = fn(...args);
|
|
228169
|
+
return `\u001B[${38 + offset};5;${code}m`;
|
|
228170
|
+
};
|
|
228682
228171
|
|
|
228683
|
-
|
|
228684
|
-
|
|
228172
|
+
const wrapAnsi16m = (fn, offset) => (...args) => {
|
|
228173
|
+
const rgb = fn(...args);
|
|
228174
|
+
return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
|
228175
|
+
};
|
|
228685
228176
|
|
|
228686
|
-
|
|
228177
|
+
const ansi2ansi = n => n;
|
|
228178
|
+
const rgb2rgb = (r, g, b) => [r, g, b];
|
|
228687
228179
|
|
|
228180
|
+
const setLazyProperty = (object, property, get) => {
|
|
228181
|
+
Object.defineProperty(object, property, {
|
|
228182
|
+
get: () => {
|
|
228183
|
+
const value = get();
|
|
228688
228184
|
|
|
228689
|
-
Object.defineProperty(
|
|
228690
|
-
|
|
228691
|
-
|
|
228692
|
-
|
|
228185
|
+
Object.defineProperty(object, property, {
|
|
228186
|
+
value,
|
|
228187
|
+
enumerable: true,
|
|
228188
|
+
configurable: true
|
|
228189
|
+
});
|
|
228693
228190
|
|
|
228694
|
-
|
|
228191
|
+
return value;
|
|
228192
|
+
},
|
|
228193
|
+
enumerable: true,
|
|
228194
|
+
configurable: true
|
|
228195
|
+
});
|
|
228196
|
+
};
|
|
228695
228197
|
|
|
228696
|
-
|
|
228198
|
+
/** @type {typeof import('color-convert')} */
|
|
228199
|
+
let colorConvert;
|
|
228200
|
+
const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
|
|
228201
|
+
if (colorConvert === undefined) {
|
|
228202
|
+
colorConvert = __nccwpck_require__(87773);
|
|
228203
|
+
}
|
|
228697
228204
|
|
|
228698
|
-
const
|
|
228205
|
+
const offset = isBackground ? 10 : 0;
|
|
228206
|
+
const styles = {};
|
|
228699
228207
|
|
|
228700
|
-
|
|
228208
|
+
for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
|
|
228209
|
+
const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;
|
|
228210
|
+
if (sourceSpace === targetSpace) {
|
|
228211
|
+
styles[name] = wrap(identity, offset);
|
|
228212
|
+
} else if (typeof suite === 'object') {
|
|
228213
|
+
styles[name] = wrap(suite[targetSpace], offset);
|
|
228214
|
+
}
|
|
228215
|
+
}
|
|
228701
228216
|
|
|
228702
|
-
|
|
228703
|
-
|
|
228704
|
-
_crypto.default.randomFillSync(rnds8Pool);
|
|
228217
|
+
return styles;
|
|
228218
|
+
};
|
|
228705
228219
|
|
|
228706
|
-
|
|
228707
|
-
|
|
228220
|
+
function assembleStyles() {
|
|
228221
|
+
const codes = new Map();
|
|
228222
|
+
const styles = {
|
|
228223
|
+
modifier: {
|
|
228224
|
+
reset: [0, 0],
|
|
228225
|
+
// 21 isn't widely supported and 22 does the same thing
|
|
228226
|
+
bold: [1, 22],
|
|
228227
|
+
dim: [2, 22],
|
|
228228
|
+
italic: [3, 23],
|
|
228229
|
+
underline: [4, 24],
|
|
228230
|
+
inverse: [7, 27],
|
|
228231
|
+
hidden: [8, 28],
|
|
228232
|
+
strikethrough: [9, 29]
|
|
228233
|
+
},
|
|
228234
|
+
color: {
|
|
228235
|
+
black: [30, 39],
|
|
228236
|
+
red: [31, 39],
|
|
228237
|
+
green: [32, 39],
|
|
228238
|
+
yellow: [33, 39],
|
|
228239
|
+
blue: [34, 39],
|
|
228240
|
+
magenta: [35, 39],
|
|
228241
|
+
cyan: [36, 39],
|
|
228242
|
+
white: [37, 39],
|
|
228708
228243
|
|
|
228709
|
-
|
|
228710
|
-
|
|
228244
|
+
// Bright color
|
|
228245
|
+
blackBright: [90, 39],
|
|
228246
|
+
redBright: [91, 39],
|
|
228247
|
+
greenBright: [92, 39],
|
|
228248
|
+
yellowBright: [93, 39],
|
|
228249
|
+
blueBright: [94, 39],
|
|
228250
|
+
magentaBright: [95, 39],
|
|
228251
|
+
cyanBright: [96, 39],
|
|
228252
|
+
whiteBright: [97, 39]
|
|
228253
|
+
},
|
|
228254
|
+
bgColor: {
|
|
228255
|
+
bgBlack: [40, 49],
|
|
228256
|
+
bgRed: [41, 49],
|
|
228257
|
+
bgGreen: [42, 49],
|
|
228258
|
+
bgYellow: [43, 49],
|
|
228259
|
+
bgBlue: [44, 49],
|
|
228260
|
+
bgMagenta: [45, 49],
|
|
228261
|
+
bgCyan: [46, 49],
|
|
228262
|
+
bgWhite: [47, 49],
|
|
228711
228263
|
|
|
228712
|
-
|
|
228264
|
+
// Bright color
|
|
228265
|
+
bgBlackBright: [100, 49],
|
|
228266
|
+
bgRedBright: [101, 49],
|
|
228267
|
+
bgGreenBright: [102, 49],
|
|
228268
|
+
bgYellowBright: [103, 49],
|
|
228269
|
+
bgBlueBright: [104, 49],
|
|
228270
|
+
bgMagentaBright: [105, 49],
|
|
228271
|
+
bgCyanBright: [106, 49],
|
|
228272
|
+
bgWhiteBright: [107, 49]
|
|
228273
|
+
}
|
|
228274
|
+
};
|
|
228713
228275
|
|
|
228714
|
-
|
|
228715
|
-
|
|
228276
|
+
// Alias bright black as gray (and grey)
|
|
228277
|
+
styles.color.gray = styles.color.blackBright;
|
|
228278
|
+
styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
|
|
228279
|
+
styles.color.grey = styles.color.blackBright;
|
|
228280
|
+
styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
|
|
228716
228281
|
|
|
228717
|
-
|
|
228282
|
+
for (const [groupName, group] of Object.entries(styles)) {
|
|
228283
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
228284
|
+
styles[styleName] = {
|
|
228285
|
+
open: `\u001B[${style[0]}m`,
|
|
228286
|
+
close: `\u001B[${style[1]}m`
|
|
228287
|
+
};
|
|
228718
228288
|
|
|
228289
|
+
group[styleName] = styles[styleName];
|
|
228719
228290
|
|
|
228720
|
-
|
|
228721
|
-
|
|
228722
|
-
}));
|
|
228723
|
-
exports["default"] = void 0;
|
|
228291
|
+
codes.set(style[0], style[1]);
|
|
228292
|
+
}
|
|
228724
228293
|
|
|
228725
|
-
|
|
228294
|
+
Object.defineProperty(styles, groupName, {
|
|
228295
|
+
value: group,
|
|
228296
|
+
enumerable: false
|
|
228297
|
+
});
|
|
228298
|
+
}
|
|
228726
228299
|
|
|
228727
|
-
|
|
228300
|
+
Object.defineProperty(styles, 'codes', {
|
|
228301
|
+
value: codes,
|
|
228302
|
+
enumerable: false
|
|
228303
|
+
});
|
|
228728
228304
|
|
|
228729
|
-
|
|
228730
|
-
|
|
228731
|
-
bytes = Buffer.from(bytes);
|
|
228732
|
-
} else if (typeof bytes === 'string') {
|
|
228733
|
-
bytes = Buffer.from(bytes, 'utf8');
|
|
228734
|
-
}
|
|
228305
|
+
styles.color.close = '\u001B[39m';
|
|
228306
|
+
styles.bgColor.close = '\u001B[49m';
|
|
228735
228307
|
|
|
228736
|
-
|
|
228308
|
+
setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));
|
|
228309
|
+
setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));
|
|
228310
|
+
setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));
|
|
228311
|
+
setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));
|
|
228312
|
+
setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));
|
|
228313
|
+
setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));
|
|
228314
|
+
|
|
228315
|
+
return styles;
|
|
228737
228316
|
}
|
|
228738
228317
|
|
|
228739
|
-
|
|
228740
|
-
exports
|
|
228318
|
+
// Make the export immutable
|
|
228319
|
+
Object.defineProperty(module, 'exports', {
|
|
228320
|
+
enumerable: true,
|
|
228321
|
+
get: assembleStyles
|
|
228322
|
+
});
|
|
228323
|
+
|
|
228741
228324
|
|
|
228742
228325
|
/***/ }),
|
|
228743
228326
|
|
|
228744
|
-
/***/
|
|
228745
|
-
/***/ ((
|
|
228327
|
+
/***/ 18756:
|
|
228328
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
228746
228329
|
|
|
228747
|
-
|
|
228330
|
+
/* MIT license */
|
|
228331
|
+
/* eslint-disable no-mixed-operators */
|
|
228332
|
+
const cssKeywords = __nccwpck_require__(39749);
|
|
228748
228333
|
|
|
228334
|
+
// NOTE: conversions should only return primitive values (i.e. arrays, or
|
|
228335
|
+
// values that give correct `typeof` results).
|
|
228336
|
+
// do not use box values types (i.e. Number(), String(), etc.)
|
|
228749
228337
|
|
|
228750
|
-
|
|
228751
|
-
|
|
228752
|
-
|
|
228753
|
-
|
|
228754
|
-
exports.unsafeStringify = unsafeStringify;
|
|
228338
|
+
const reverseKeywords = {};
|
|
228339
|
+
for (const key of Object.keys(cssKeywords)) {
|
|
228340
|
+
reverseKeywords[cssKeywords[key]] = key;
|
|
228341
|
+
}
|
|
228755
228342
|
|
|
228756
|
-
|
|
228343
|
+
const convert = {
|
|
228344
|
+
rgb: {channels: 3, labels: 'rgb'},
|
|
228345
|
+
hsl: {channels: 3, labels: 'hsl'},
|
|
228346
|
+
hsv: {channels: 3, labels: 'hsv'},
|
|
228347
|
+
hwb: {channels: 3, labels: 'hwb'},
|
|
228348
|
+
cmyk: {channels: 4, labels: 'cmyk'},
|
|
228349
|
+
xyz: {channels: 3, labels: 'xyz'},
|
|
228350
|
+
lab: {channels: 3, labels: 'lab'},
|
|
228351
|
+
lch: {channels: 3, labels: 'lch'},
|
|
228352
|
+
hex: {channels: 1, labels: ['hex']},
|
|
228353
|
+
keyword: {channels: 1, labels: ['keyword']},
|
|
228354
|
+
ansi16: {channels: 1, labels: ['ansi16']},
|
|
228355
|
+
ansi256: {channels: 1, labels: ['ansi256']},
|
|
228356
|
+
hcg: {channels: 3, labels: ['h', 'c', 'g']},
|
|
228357
|
+
apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
|
|
228358
|
+
gray: {channels: 1, labels: ['gray']}
|
|
228359
|
+
};
|
|
228757
228360
|
|
|
228758
|
-
|
|
228361
|
+
module.exports = convert;
|
|
228759
228362
|
|
|
228760
|
-
|
|
228761
|
-
|
|
228762
|
-
|
|
228763
|
-
|
|
228764
|
-
|
|
228363
|
+
// Hide .channels and .labels properties
|
|
228364
|
+
for (const model of Object.keys(convert)) {
|
|
228365
|
+
if (!('channels' in convert[model])) {
|
|
228366
|
+
throw new Error('missing channels property: ' + model);
|
|
228367
|
+
}
|
|
228765
228368
|
|
|
228766
|
-
|
|
228767
|
-
|
|
228768
|
-
}
|
|
228369
|
+
if (!('labels' in convert[model])) {
|
|
228370
|
+
throw new Error('missing channel labels property: ' + model);
|
|
228371
|
+
}
|
|
228769
228372
|
|
|
228770
|
-
|
|
228771
|
-
|
|
228772
|
-
|
|
228773
|
-
|
|
228373
|
+
if (convert[model].labels.length !== convert[model].channels) {
|
|
228374
|
+
throw new Error('channel and label counts mismatch: ' + model);
|
|
228375
|
+
}
|
|
228376
|
+
|
|
228377
|
+
const {channels, labels} = convert[model];
|
|
228378
|
+
delete convert[model].channels;
|
|
228379
|
+
delete convert[model].labels;
|
|
228380
|
+
Object.defineProperty(convert[model], 'channels', {value: channels});
|
|
228381
|
+
Object.defineProperty(convert[model], 'labels', {value: labels});
|
|
228774
228382
|
}
|
|
228775
228383
|
|
|
228776
|
-
function
|
|
228777
|
-
|
|
228778
|
-
|
|
228779
|
-
|
|
228780
|
-
|
|
228781
|
-
|
|
228384
|
+
convert.rgb.hsl = function (rgb) {
|
|
228385
|
+
const r = rgb[0] / 255;
|
|
228386
|
+
const g = rgb[1] / 255;
|
|
228387
|
+
const b = rgb[2] / 255;
|
|
228388
|
+
const min = Math.min(r, g, b);
|
|
228389
|
+
const max = Math.max(r, g, b);
|
|
228390
|
+
const delta = max - min;
|
|
228391
|
+
let h;
|
|
228392
|
+
let s;
|
|
228782
228393
|
|
|
228783
|
-
|
|
228784
|
-
|
|
228785
|
-
|
|
228394
|
+
if (max === min) {
|
|
228395
|
+
h = 0;
|
|
228396
|
+
} else if (r === max) {
|
|
228397
|
+
h = (g - b) / delta;
|
|
228398
|
+
} else if (g === max) {
|
|
228399
|
+
h = 2 + (b - r) / delta;
|
|
228400
|
+
} else if (b === max) {
|
|
228401
|
+
h = 4 + (r - g) / delta;
|
|
228402
|
+
}
|
|
228786
228403
|
|
|
228787
|
-
|
|
228788
|
-
}
|
|
228404
|
+
h = Math.min(h * 60, 360);
|
|
228789
228405
|
|
|
228790
|
-
|
|
228791
|
-
|
|
228406
|
+
if (h < 0) {
|
|
228407
|
+
h += 360;
|
|
228408
|
+
}
|
|
228792
228409
|
|
|
228793
|
-
|
|
228410
|
+
const l = (min + max) / 2;
|
|
228794
228411
|
|
|
228795
|
-
|
|
228796
|
-
|
|
228412
|
+
if (max === min) {
|
|
228413
|
+
s = 0;
|
|
228414
|
+
} else if (l <= 0.5) {
|
|
228415
|
+
s = delta / (max + min);
|
|
228416
|
+
} else {
|
|
228417
|
+
s = delta / (2 - max - min);
|
|
228418
|
+
}
|
|
228797
228419
|
|
|
228798
|
-
|
|
228420
|
+
return [h, s * 100, l * 100];
|
|
228421
|
+
};
|
|
228799
228422
|
|
|
228423
|
+
convert.rgb.hsv = function (rgb) {
|
|
228424
|
+
let rdif;
|
|
228425
|
+
let gdif;
|
|
228426
|
+
let bdif;
|
|
228427
|
+
let h;
|
|
228428
|
+
let s;
|
|
228800
228429
|
|
|
228801
|
-
|
|
228802
|
-
|
|
228803
|
-
|
|
228804
|
-
|
|
228430
|
+
const r = rgb[0] / 255;
|
|
228431
|
+
const g = rgb[1] / 255;
|
|
228432
|
+
const b = rgb[2] / 255;
|
|
228433
|
+
const v = Math.max(r, g, b);
|
|
228434
|
+
const diff = v - Math.min(r, g, b);
|
|
228435
|
+
const diffc = function (c) {
|
|
228436
|
+
return (v - c) / 6 / diff + 1 / 2;
|
|
228437
|
+
};
|
|
228805
228438
|
|
|
228806
|
-
|
|
228439
|
+
if (diff === 0) {
|
|
228440
|
+
h = 0;
|
|
228441
|
+
s = 0;
|
|
228442
|
+
} else {
|
|
228443
|
+
s = diff / v;
|
|
228444
|
+
rdif = diffc(r);
|
|
228445
|
+
gdif = diffc(g);
|
|
228446
|
+
bdif = diffc(b);
|
|
228807
228447
|
|
|
228808
|
-
|
|
228448
|
+
if (r === v) {
|
|
228449
|
+
h = bdif - gdif;
|
|
228450
|
+
} else if (g === v) {
|
|
228451
|
+
h = (1 / 3) + rdif - bdif;
|
|
228452
|
+
} else if (b === v) {
|
|
228453
|
+
h = (2 / 3) + gdif - rdif;
|
|
228454
|
+
}
|
|
228809
228455
|
|
|
228810
|
-
|
|
228456
|
+
if (h < 0) {
|
|
228457
|
+
h += 1;
|
|
228458
|
+
} else if (h > 1) {
|
|
228459
|
+
h -= 1;
|
|
228460
|
+
}
|
|
228461
|
+
}
|
|
228811
228462
|
|
|
228812
|
-
|
|
228813
|
-
|
|
228814
|
-
|
|
228815
|
-
|
|
228816
|
-
|
|
228463
|
+
return [
|
|
228464
|
+
h * 360,
|
|
228465
|
+
s * 100,
|
|
228466
|
+
v * 100
|
|
228467
|
+
];
|
|
228468
|
+
};
|
|
228817
228469
|
|
|
228818
|
-
|
|
228470
|
+
convert.rgb.hwb = function (rgb) {
|
|
228471
|
+
const r = rgb[0];
|
|
228472
|
+
const g = rgb[1];
|
|
228473
|
+
let b = rgb[2];
|
|
228474
|
+
const h = convert.rgb.hsl(rgb)[0];
|
|
228475
|
+
const w = 1 / 255 * Math.min(r, Math.min(g, b));
|
|
228819
228476
|
|
|
228477
|
+
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
|
|
228820
228478
|
|
|
228821
|
-
|
|
228822
|
-
|
|
228479
|
+
return [h, w * 100, b * 100];
|
|
228480
|
+
};
|
|
228823
228481
|
|
|
228824
|
-
function
|
|
228825
|
-
|
|
228826
|
-
|
|
228827
|
-
|
|
228828
|
-
let node = options.node || _nodeId;
|
|
228829
|
-
let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not
|
|
228830
|
-
// specified. We do this lazily to minimize issues related to insufficient
|
|
228831
|
-
// system entropy. See #189
|
|
228482
|
+
convert.rgb.cmyk = function (rgb) {
|
|
228483
|
+
const r = rgb[0] / 255;
|
|
228484
|
+
const g = rgb[1] / 255;
|
|
228485
|
+
const b = rgb[2] / 255;
|
|
228832
228486
|
|
|
228833
|
-
|
|
228834
|
-
|
|
228487
|
+
const k = Math.min(1 - r, 1 - g, 1 - b);
|
|
228488
|
+
const c = (1 - r - k) / (1 - k) || 0;
|
|
228489
|
+
const m = (1 - g - k) / (1 - k) || 0;
|
|
228490
|
+
const y = (1 - b - k) / (1 - k) || 0;
|
|
228835
228491
|
|
|
228836
|
-
|
|
228837
|
-
|
|
228838
|
-
node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];
|
|
228839
|
-
}
|
|
228492
|
+
return [c * 100, m * 100, y * 100, k * 100];
|
|
228493
|
+
};
|
|
228840
228494
|
|
|
228841
|
-
|
|
228842
|
-
|
|
228843
|
-
|
|
228844
|
-
|
|
228845
|
-
|
|
228846
|
-
|
|
228847
|
-
|
|
228848
|
-
|
|
228495
|
+
function comparativeDistance(x, y) {
|
|
228496
|
+
/*
|
|
228497
|
+
See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
|
|
228498
|
+
*/
|
|
228499
|
+
return (
|
|
228500
|
+
((x[0] - y[0]) ** 2) +
|
|
228501
|
+
((x[1] - y[1]) ** 2) +
|
|
228502
|
+
((x[2] - y[2]) ** 2)
|
|
228503
|
+
);
|
|
228504
|
+
}
|
|
228849
228505
|
|
|
228506
|
+
convert.rgb.keyword = function (rgb) {
|
|
228507
|
+
const reversed = reverseKeywords[rgb];
|
|
228508
|
+
if (reversed) {
|
|
228509
|
+
return reversed;
|
|
228510
|
+
}
|
|
228850
228511
|
|
|
228851
|
-
|
|
228852
|
-
|
|
228512
|
+
let currentClosestDistance = Infinity;
|
|
228513
|
+
let currentClosestKeyword;
|
|
228853
228514
|
|
|
228854
|
-
|
|
228515
|
+
for (const keyword of Object.keys(cssKeywords)) {
|
|
228516
|
+
const value = cssKeywords[keyword];
|
|
228855
228517
|
|
|
228856
|
-
|
|
228518
|
+
// Compute comparative distance
|
|
228519
|
+
const distance = comparativeDistance(rgb, value);
|
|
228857
228520
|
|
|
228858
|
-
|
|
228859
|
-
|
|
228860
|
-
|
|
228861
|
-
|
|
228521
|
+
// Check if its less, if so set as closest
|
|
228522
|
+
if (distance < currentClosestDistance) {
|
|
228523
|
+
currentClosestDistance = distance;
|
|
228524
|
+
currentClosestKeyword = keyword;
|
|
228525
|
+
}
|
|
228526
|
+
}
|
|
228862
228527
|
|
|
228528
|
+
return currentClosestKeyword;
|
|
228529
|
+
};
|
|
228863
228530
|
|
|
228864
|
-
|
|
228865
|
-
|
|
228866
|
-
|
|
228531
|
+
convert.keyword.rgb = function (keyword) {
|
|
228532
|
+
return cssKeywords[keyword];
|
|
228533
|
+
};
|
|
228867
228534
|
|
|
228535
|
+
convert.rgb.xyz = function (rgb) {
|
|
228536
|
+
let r = rgb[0] / 255;
|
|
228537
|
+
let g = rgb[1] / 255;
|
|
228538
|
+
let b = rgb[2] / 255;
|
|
228868
228539
|
|
|
228869
|
-
|
|
228870
|
-
|
|
228871
|
-
|
|
228540
|
+
// Assume sRGB
|
|
228541
|
+
r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);
|
|
228542
|
+
g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);
|
|
228543
|
+
b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);
|
|
228872
228544
|
|
|
228873
|
-
|
|
228874
|
-
|
|
228875
|
-
|
|
228545
|
+
const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
|
|
228546
|
+
const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
|
|
228547
|
+
const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
|
|
228876
228548
|
|
|
228877
|
-
|
|
228549
|
+
return [x * 100, y * 100, z * 100];
|
|
228550
|
+
};
|
|
228878
228551
|
|
|
228879
|
-
|
|
228880
|
-
|
|
228881
|
-
|
|
228882
|
-
|
|
228883
|
-
|
|
228552
|
+
convert.rgb.lab = function (rgb) {
|
|
228553
|
+
const xyz = convert.rgb.xyz(rgb);
|
|
228554
|
+
let x = xyz[0];
|
|
228555
|
+
let y = xyz[1];
|
|
228556
|
+
let z = xyz[2];
|
|
228884
228557
|
|
|
228885
|
-
|
|
228886
|
-
|
|
228887
|
-
|
|
228558
|
+
x /= 95.047;
|
|
228559
|
+
y /= 100;
|
|
228560
|
+
z /= 108.883;
|
|
228888
228561
|
|
|
228889
|
-
|
|
228562
|
+
x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
|
|
228563
|
+
y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
|
|
228564
|
+
z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
|
|
228890
228565
|
|
|
228891
|
-
|
|
228566
|
+
const l = (116 * y) - 16;
|
|
228567
|
+
const a = 500 * (x - y);
|
|
228568
|
+
const b = 200 * (y - z);
|
|
228892
228569
|
|
|
228893
|
-
|
|
228570
|
+
return [l, a, b];
|
|
228571
|
+
};
|
|
228894
228572
|
|
|
228895
|
-
|
|
228573
|
+
convert.hsl.rgb = function (hsl) {
|
|
228574
|
+
const h = hsl[0] / 360;
|
|
228575
|
+
const s = hsl[1] / 100;
|
|
228576
|
+
const l = hsl[2] / 100;
|
|
228577
|
+
let t2;
|
|
228578
|
+
let t3;
|
|
228579
|
+
let val;
|
|
228896
228580
|
|
|
228897
|
-
|
|
228898
|
-
|
|
228899
|
-
|
|
228581
|
+
if (s === 0) {
|
|
228582
|
+
val = l * 255;
|
|
228583
|
+
return [val, val, val];
|
|
228584
|
+
}
|
|
228900
228585
|
|
|
228901
|
-
|
|
228902
|
-
|
|
228586
|
+
if (l < 0.5) {
|
|
228587
|
+
t2 = l * (1 + s);
|
|
228588
|
+
} else {
|
|
228589
|
+
t2 = l + s - l * s;
|
|
228590
|
+
}
|
|
228903
228591
|
|
|
228904
|
-
|
|
228905
|
-
exports["default"] = _default;
|
|
228592
|
+
const t1 = 2 * l - t2;
|
|
228906
228593
|
|
|
228907
|
-
|
|
228594
|
+
const rgb = [0, 0, 0];
|
|
228595
|
+
for (let i = 0; i < 3; i++) {
|
|
228596
|
+
t3 = h + 1 / 3 * -(i - 1);
|
|
228597
|
+
if (t3 < 0) {
|
|
228598
|
+
t3++;
|
|
228599
|
+
}
|
|
228908
228600
|
|
|
228909
|
-
|
|
228910
|
-
|
|
228601
|
+
if (t3 > 1) {
|
|
228602
|
+
t3--;
|
|
228603
|
+
}
|
|
228911
228604
|
|
|
228912
|
-
|
|
228605
|
+
if (6 * t3 < 1) {
|
|
228606
|
+
val = t1 + (t2 - t1) * 6 * t3;
|
|
228607
|
+
} else if (2 * t3 < 1) {
|
|
228608
|
+
val = t2;
|
|
228609
|
+
} else if (3 * t3 < 2) {
|
|
228610
|
+
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
|
|
228611
|
+
} else {
|
|
228612
|
+
val = t1;
|
|
228613
|
+
}
|
|
228913
228614
|
|
|
228615
|
+
rgb[i] = val * 255;
|
|
228616
|
+
}
|
|
228914
228617
|
|
|
228915
|
-
|
|
228916
|
-
|
|
228917
|
-
}));
|
|
228918
|
-
exports["default"] = void 0;
|
|
228618
|
+
return rgb;
|
|
228619
|
+
};
|
|
228919
228620
|
|
|
228920
|
-
|
|
228621
|
+
convert.hsl.hsv = function (hsl) {
|
|
228622
|
+
const h = hsl[0];
|
|
228623
|
+
let s = hsl[1] / 100;
|
|
228624
|
+
let l = hsl[2] / 100;
|
|
228625
|
+
let smin = s;
|
|
228626
|
+
const lmin = Math.max(l, 0.01);
|
|
228921
228627
|
|
|
228922
|
-
|
|
228628
|
+
l *= 2;
|
|
228629
|
+
s *= (l <= 1) ? l : 2 - l;
|
|
228630
|
+
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
|
228631
|
+
const v = (l + s) / 2;
|
|
228632
|
+
const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
|
|
228923
228633
|
|
|
228924
|
-
|
|
228634
|
+
return [h, sv * 100, v * 100];
|
|
228635
|
+
};
|
|
228925
228636
|
|
|
228926
|
-
|
|
228927
|
-
|
|
228928
|
-
|
|
228637
|
+
convert.hsv.rgb = function (hsv) {
|
|
228638
|
+
const h = hsv[0] / 60;
|
|
228639
|
+
const s = hsv[1] / 100;
|
|
228640
|
+
let v = hsv[2] / 100;
|
|
228641
|
+
const hi = Math.floor(h) % 6;
|
|
228929
228642
|
|
|
228930
|
-
|
|
228643
|
+
const f = h - Math.floor(h);
|
|
228644
|
+
const p = 255 * v * (1 - s);
|
|
228645
|
+
const q = 255 * v * (1 - (s * f));
|
|
228646
|
+
const t = 255 * v * (1 - (s * (1 - f)));
|
|
228647
|
+
v *= 255;
|
|
228931
228648
|
|
|
228932
|
-
|
|
228933
|
-
|
|
228649
|
+
switch (hi) {
|
|
228650
|
+
case 0:
|
|
228651
|
+
return [v, t, p];
|
|
228652
|
+
case 1:
|
|
228653
|
+
return [q, v, p];
|
|
228654
|
+
case 2:
|
|
228655
|
+
return [p, v, t];
|
|
228656
|
+
case 3:
|
|
228657
|
+
return [p, q, v];
|
|
228658
|
+
case 4:
|
|
228659
|
+
return [t, p, v];
|
|
228660
|
+
case 5:
|
|
228661
|
+
return [v, p, q];
|
|
228662
|
+
}
|
|
228663
|
+
};
|
|
228934
228664
|
|
|
228935
|
-
|
|
228665
|
+
convert.hsv.hsl = function (hsv) {
|
|
228666
|
+
const h = hsv[0];
|
|
228667
|
+
const s = hsv[1] / 100;
|
|
228668
|
+
const v = hsv[2] / 100;
|
|
228669
|
+
const vmin = Math.max(v, 0.01);
|
|
228670
|
+
let sl;
|
|
228671
|
+
let l;
|
|
228936
228672
|
|
|
228673
|
+
l = (2 - s) * v;
|
|
228674
|
+
const lmin = (2 - s) * vmin;
|
|
228675
|
+
sl = s * vmin;
|
|
228676
|
+
sl /= (lmin <= 1) ? lmin : 2 - lmin;
|
|
228677
|
+
sl = sl || 0;
|
|
228678
|
+
l /= 2;
|
|
228937
228679
|
|
|
228938
|
-
|
|
228939
|
-
|
|
228940
|
-
}));
|
|
228941
|
-
exports.URL = exports.DNS = void 0;
|
|
228942
|
-
exports["default"] = v35;
|
|
228680
|
+
return [h, sl * 100, l * 100];
|
|
228681
|
+
};
|
|
228943
228682
|
|
|
228944
|
-
|
|
228683
|
+
// http://dev.w3.org/csswg/css-color/#hwb-to-rgb
|
|
228684
|
+
convert.hwb.rgb = function (hwb) {
|
|
228685
|
+
const h = hwb[0] / 360;
|
|
228686
|
+
let wh = hwb[1] / 100;
|
|
228687
|
+
let bl = hwb[2] / 100;
|
|
228688
|
+
const ratio = wh + bl;
|
|
228689
|
+
let f;
|
|
228945
228690
|
|
|
228946
|
-
|
|
228691
|
+
// Wh + bl cant be > 1
|
|
228692
|
+
if (ratio > 1) {
|
|
228693
|
+
wh /= ratio;
|
|
228694
|
+
bl /= ratio;
|
|
228695
|
+
}
|
|
228947
228696
|
|
|
228948
|
-
|
|
228697
|
+
const i = Math.floor(6 * h);
|
|
228698
|
+
const v = 1 - bl;
|
|
228699
|
+
f = 6 * h - i;
|
|
228949
228700
|
|
|
228950
|
-
|
|
228951
|
-
|
|
228701
|
+
if ((i & 0x01) !== 0) {
|
|
228702
|
+
f = 1 - f;
|
|
228703
|
+
}
|
|
228952
228704
|
|
|
228953
|
-
|
|
228705
|
+
const n = wh + f * (v - wh); // Linear interpolation
|
|
228954
228706
|
|
|
228955
|
-
|
|
228956
|
-
|
|
228957
|
-
|
|
228707
|
+
let r;
|
|
228708
|
+
let g;
|
|
228709
|
+
let b;
|
|
228710
|
+
/* eslint-disable max-statements-per-line,no-multi-spaces */
|
|
228711
|
+
switch (i) {
|
|
228712
|
+
default:
|
|
228713
|
+
case 6:
|
|
228714
|
+
case 0: r = v; g = n; b = wh; break;
|
|
228715
|
+
case 1: r = n; g = v; b = wh; break;
|
|
228716
|
+
case 2: r = wh; g = v; b = n; break;
|
|
228717
|
+
case 3: r = wh; g = n; b = v; break;
|
|
228718
|
+
case 4: r = n; g = wh; b = v; break;
|
|
228719
|
+
case 5: r = v; g = wh; b = n; break;
|
|
228720
|
+
}
|
|
228721
|
+
/* eslint-enable max-statements-per-line,no-multi-spaces */
|
|
228958
228722
|
|
|
228959
|
-
|
|
228960
|
-
}
|
|
228723
|
+
return [r * 255, g * 255, b * 255];
|
|
228724
|
+
};
|
|
228961
228725
|
|
|
228962
|
-
|
|
228963
|
-
|
|
228964
|
-
const
|
|
228965
|
-
|
|
228726
|
+
convert.cmyk.rgb = function (cmyk) {
|
|
228727
|
+
const c = cmyk[0] / 100;
|
|
228728
|
+
const m = cmyk[1] / 100;
|
|
228729
|
+
const y = cmyk[2] / 100;
|
|
228730
|
+
const k = cmyk[3] / 100;
|
|
228966
228731
|
|
|
228967
|
-
|
|
228968
|
-
|
|
228969
|
-
|
|
228732
|
+
const r = 1 - Math.min(1, c * (1 - k) + k);
|
|
228733
|
+
const g = 1 - Math.min(1, m * (1 - k) + k);
|
|
228734
|
+
const b = 1 - Math.min(1, y * (1 - k) + k);
|
|
228970
228735
|
|
|
228971
|
-
|
|
228972
|
-
|
|
228973
|
-
}
|
|
228736
|
+
return [r * 255, g * 255, b * 255];
|
|
228737
|
+
};
|
|
228974
228738
|
|
|
228975
|
-
|
|
228976
|
-
|
|
228977
|
-
|
|
228739
|
+
convert.xyz.rgb = function (xyz) {
|
|
228740
|
+
const x = xyz[0] / 100;
|
|
228741
|
+
const y = xyz[1] / 100;
|
|
228742
|
+
const z = xyz[2] / 100;
|
|
228743
|
+
let r;
|
|
228744
|
+
let g;
|
|
228745
|
+
let b;
|
|
228978
228746
|
|
|
228979
|
-
|
|
228980
|
-
|
|
228981
|
-
|
|
228982
|
-
// Future: Use spread syntax when supported on all platforms, e.g. `bytes =
|
|
228983
|
-
// hashfunc([...namespace, ... value])`
|
|
228747
|
+
r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
|
|
228748
|
+
g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
|
|
228749
|
+
b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
|
|
228984
228750
|
|
|
228751
|
+
// Assume sRGB
|
|
228752
|
+
r = r > 0.0031308
|
|
228753
|
+
? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)
|
|
228754
|
+
: r * 12.92;
|
|
228985
228755
|
|
|
228986
|
-
|
|
228987
|
-
|
|
228988
|
-
|
|
228989
|
-
|
|
228990
|
-
|
|
228991
|
-
|
|
228756
|
+
g = g > 0.0031308
|
|
228757
|
+
? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)
|
|
228758
|
+
: g * 12.92;
|
|
228759
|
+
|
|
228760
|
+
b = b > 0.0031308
|
|
228761
|
+
? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)
|
|
228762
|
+
: b * 12.92;
|
|
228763
|
+
|
|
228764
|
+
r = Math.min(Math.max(0, r), 1);
|
|
228765
|
+
g = Math.min(Math.max(0, g), 1);
|
|
228766
|
+
b = Math.min(Math.max(0, b), 1);
|
|
228767
|
+
|
|
228768
|
+
return [r * 255, g * 255, b * 255];
|
|
228769
|
+
};
|
|
228770
|
+
|
|
228771
|
+
convert.xyz.lab = function (xyz) {
|
|
228772
|
+
let x = xyz[0];
|
|
228773
|
+
let y = xyz[1];
|
|
228774
|
+
let z = xyz[2];
|
|
228775
|
+
|
|
228776
|
+
x /= 95.047;
|
|
228777
|
+
y /= 100;
|
|
228778
|
+
z /= 108.883;
|
|
228779
|
+
|
|
228780
|
+
x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
|
|
228781
|
+
y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
|
|
228782
|
+
z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
|
|
228783
|
+
|
|
228784
|
+
const l = (116 * y) - 16;
|
|
228785
|
+
const a = 500 * (x - y);
|
|
228786
|
+
const b = 200 * (y - z);
|
|
228992
228787
|
|
|
228993
|
-
|
|
228994
|
-
|
|
228788
|
+
return [l, a, b];
|
|
228789
|
+
};
|
|
228995
228790
|
|
|
228996
|
-
|
|
228997
|
-
|
|
228998
|
-
|
|
228791
|
+
convert.lab.xyz = function (lab) {
|
|
228792
|
+
const l = lab[0];
|
|
228793
|
+
const a = lab[1];
|
|
228794
|
+
const b = lab[2];
|
|
228795
|
+
let x;
|
|
228796
|
+
let y;
|
|
228797
|
+
let z;
|
|
228999
228798
|
|
|
229000
|
-
|
|
229001
|
-
|
|
228799
|
+
y = (l + 16) / 116;
|
|
228800
|
+
x = a / 500 + y;
|
|
228801
|
+
z = y - b / 200;
|
|
229002
228802
|
|
|
229003
|
-
|
|
229004
|
-
|
|
228803
|
+
const y2 = y ** 3;
|
|
228804
|
+
const x2 = x ** 3;
|
|
228805
|
+
const z2 = z ** 3;
|
|
228806
|
+
y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
|
|
228807
|
+
x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
|
|
228808
|
+
z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
|
|
229005
228809
|
|
|
228810
|
+
x *= 95.047;
|
|
228811
|
+
y *= 100;
|
|
228812
|
+
z *= 108.883;
|
|
229006
228813
|
|
|
229007
|
-
|
|
229008
|
-
|
|
229009
|
-
} catch (err) {} // For CommonJS default export support
|
|
228814
|
+
return [x, y, z];
|
|
228815
|
+
};
|
|
229010
228816
|
|
|
228817
|
+
convert.lab.lch = function (lab) {
|
|
228818
|
+
const l = lab[0];
|
|
228819
|
+
const a = lab[1];
|
|
228820
|
+
const b = lab[2];
|
|
228821
|
+
let h;
|
|
229011
228822
|
|
|
229012
|
-
|
|
229013
|
-
|
|
229014
|
-
return generateUUID;
|
|
229015
|
-
}
|
|
228823
|
+
const hr = Math.atan2(b, a);
|
|
228824
|
+
h = hr * 360 / 2 / Math.PI;
|
|
229016
228825
|
|
|
229017
|
-
|
|
228826
|
+
if (h < 0) {
|
|
228827
|
+
h += 360;
|
|
228828
|
+
}
|
|
229018
228829
|
|
|
229019
|
-
|
|
229020
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
228830
|
+
const c = Math.sqrt(a * a + b * b);
|
|
229021
228831
|
|
|
229022
|
-
|
|
228832
|
+
return [l, c, h];
|
|
228833
|
+
};
|
|
229023
228834
|
|
|
228835
|
+
convert.lch.lab = function (lch) {
|
|
228836
|
+
const l = lch[0];
|
|
228837
|
+
const c = lch[1];
|
|
228838
|
+
const h = lch[2];
|
|
229024
228839
|
|
|
229025
|
-
|
|
229026
|
-
|
|
229027
|
-
|
|
229028
|
-
exports["default"] = void 0;
|
|
228840
|
+
const hr = h / 360 * 2 * Math.PI;
|
|
228841
|
+
const a = c * Math.cos(hr);
|
|
228842
|
+
const b = c * Math.sin(hr);
|
|
229029
228843
|
|
|
229030
|
-
|
|
228844
|
+
return [l, a, b];
|
|
228845
|
+
};
|
|
229031
228846
|
|
|
229032
|
-
|
|
228847
|
+
convert.rgb.ansi16 = function (args, saturation = null) {
|
|
228848
|
+
const [r, g, b] = args;
|
|
228849
|
+
let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
|
|
229033
228850
|
|
|
229034
|
-
|
|
228851
|
+
value = Math.round(value / 50);
|
|
229035
228852
|
|
|
229036
|
-
|
|
228853
|
+
if (value === 0) {
|
|
228854
|
+
return 30;
|
|
228855
|
+
}
|
|
229037
228856
|
|
|
229038
|
-
|
|
229039
|
-
|
|
229040
|
-
|
|
229041
|
-
|
|
228857
|
+
let ansi = 30
|
|
228858
|
+
+ ((Math.round(b / 255) << 2)
|
|
228859
|
+
| (Math.round(g / 255) << 1)
|
|
228860
|
+
| Math.round(r / 255));
|
|
229042
228861
|
|
|
229043
|
-
|
|
228862
|
+
if (value === 2) {
|
|
228863
|
+
ansi += 60;
|
|
228864
|
+
}
|
|
229044
228865
|
|
|
229045
|
-
|
|
228866
|
+
return ansi;
|
|
228867
|
+
};
|
|
229046
228868
|
|
|
228869
|
+
convert.hsv.ansi16 = function (args) {
|
|
228870
|
+
// Optimization here; we already know the value and don't need to get
|
|
228871
|
+
// it converted for us.
|
|
228872
|
+
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
|
|
228873
|
+
};
|
|
229047
228874
|
|
|
229048
|
-
|
|
229049
|
-
|
|
228875
|
+
convert.rgb.ansi256 = function (args) {
|
|
228876
|
+
const r = args[0];
|
|
228877
|
+
const g = args[1];
|
|
228878
|
+
const b = args[2];
|
|
229050
228879
|
|
|
229051
|
-
|
|
229052
|
-
|
|
228880
|
+
// We use the extended greyscale palette here, with the exception of
|
|
228881
|
+
// black and white. normal palette only has 4 greyscale shades.
|
|
228882
|
+
if (r === g && g === b) {
|
|
228883
|
+
if (r < 8) {
|
|
228884
|
+
return 16;
|
|
228885
|
+
}
|
|
229053
228886
|
|
|
229054
|
-
|
|
229055
|
-
|
|
229056
|
-
|
|
228887
|
+
if (r > 248) {
|
|
228888
|
+
return 231;
|
|
228889
|
+
}
|
|
229057
228890
|
|
|
229058
|
-
|
|
229059
|
-
|
|
228891
|
+
return Math.round(((r - 8) / 247) * 24) + 232;
|
|
228892
|
+
}
|
|
229060
228893
|
|
|
229061
|
-
|
|
229062
|
-
|
|
228894
|
+
const ansi = 16
|
|
228895
|
+
+ (36 * Math.round(r / 255 * 5))
|
|
228896
|
+
+ (6 * Math.round(g / 255 * 5))
|
|
228897
|
+
+ Math.round(b / 255 * 5);
|
|
229063
228898
|
|
|
229064
|
-
|
|
229065
|
-
|
|
228899
|
+
return ansi;
|
|
228900
|
+
};
|
|
229066
228901
|
|
|
229067
|
-
|
|
228902
|
+
convert.ansi16.rgb = function (args) {
|
|
228903
|
+
let color = args % 10;
|
|
229068
228904
|
|
|
229069
|
-
|
|
229070
|
-
|
|
228905
|
+
// Handle greyscale
|
|
228906
|
+
if (color === 0 || color === 7) {
|
|
228907
|
+
if (args > 50) {
|
|
228908
|
+
color += 3.5;
|
|
228909
|
+
}
|
|
229071
228910
|
|
|
229072
|
-
|
|
228911
|
+
color = color / 10.5 * 255;
|
|
229073
228912
|
|
|
228913
|
+
return [color, color, color];
|
|
228914
|
+
}
|
|
229074
228915
|
|
|
229075
|
-
|
|
229076
|
-
|
|
229077
|
-
|
|
229078
|
-
|
|
228916
|
+
const mult = (~~(args > 50) + 1) * 0.5;
|
|
228917
|
+
const r = ((color & 1) * mult) * 255;
|
|
228918
|
+
const g = (((color >> 1) & 1) * mult) * 255;
|
|
228919
|
+
const b = (((color >> 2) & 1) * mult) * 255;
|
|
229079
228920
|
|
|
229080
|
-
|
|
228921
|
+
return [r, g, b];
|
|
228922
|
+
};
|
|
229081
228923
|
|
|
229082
|
-
|
|
228924
|
+
convert.ansi256.rgb = function (args) {
|
|
228925
|
+
// Handle greyscale
|
|
228926
|
+
if (args >= 232) {
|
|
228927
|
+
const c = (args - 232) * 10 + 8;
|
|
228928
|
+
return [c, c, c];
|
|
228929
|
+
}
|
|
229083
228930
|
|
|
229084
|
-
|
|
228931
|
+
args -= 16;
|
|
229085
228932
|
|
|
229086
|
-
|
|
229087
|
-
|
|
229088
|
-
|
|
228933
|
+
let rem;
|
|
228934
|
+
const r = Math.floor(args / 36) / 5 * 255;
|
|
228935
|
+
const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
|
228936
|
+
const b = (rem % 6) / 5 * 255;
|
|
229089
228937
|
|
|
229090
|
-
|
|
228938
|
+
return [r, g, b];
|
|
228939
|
+
};
|
|
229091
228940
|
|
|
229092
|
-
|
|
229093
|
-
|
|
228941
|
+
convert.rgb.hex = function (args) {
|
|
228942
|
+
const integer = ((Math.round(args[0]) & 0xFF) << 16)
|
|
228943
|
+
+ ((Math.round(args[1]) & 0xFF) << 8)
|
|
228944
|
+
+ (Math.round(args[2]) & 0xFF);
|
|
229094
228945
|
|
|
229095
|
-
|
|
228946
|
+
const string = integer.toString(16).toUpperCase();
|
|
228947
|
+
return '000000'.substring(string.length) + string;
|
|
228948
|
+
};
|
|
229096
228949
|
|
|
228950
|
+
convert.hex.rgb = function (args) {
|
|
228951
|
+
const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
|
|
228952
|
+
if (!match) {
|
|
228953
|
+
return [0, 0, 0];
|
|
228954
|
+
}
|
|
229097
228955
|
|
|
229098
|
-
|
|
229099
|
-
value: true
|
|
229100
|
-
}));
|
|
229101
|
-
exports["default"] = void 0;
|
|
228956
|
+
let colorString = match[0];
|
|
229102
228957
|
|
|
229103
|
-
|
|
228958
|
+
if (match[0].length === 3) {
|
|
228959
|
+
colorString = colorString.split('').map(char => {
|
|
228960
|
+
return char + char;
|
|
228961
|
+
}).join('');
|
|
228962
|
+
}
|
|
229104
228963
|
|
|
229105
|
-
|
|
228964
|
+
const integer = parseInt(colorString, 16);
|
|
228965
|
+
const r = (integer >> 16) & 0xFF;
|
|
228966
|
+
const g = (integer >> 8) & 0xFF;
|
|
228967
|
+
const b = integer & 0xFF;
|
|
229106
228968
|
|
|
229107
|
-
|
|
229108
|
-
|
|
229109
|
-
}
|
|
228969
|
+
return [r, g, b];
|
|
228970
|
+
};
|
|
229110
228971
|
|
|
229111
|
-
|
|
229112
|
-
|
|
228972
|
+
convert.rgb.hcg = function (rgb) {
|
|
228973
|
+
const r = rgb[0] / 255;
|
|
228974
|
+
const g = rgb[1] / 255;
|
|
228975
|
+
const b = rgb[2] / 255;
|
|
228976
|
+
const max = Math.max(Math.max(r, g), b);
|
|
228977
|
+
const min = Math.min(Math.min(r, g), b);
|
|
228978
|
+
const chroma = (max - min);
|
|
228979
|
+
let grayscale;
|
|
228980
|
+
let hue;
|
|
229113
228981
|
|
|
229114
|
-
|
|
228982
|
+
if (chroma < 1) {
|
|
228983
|
+
grayscale = min / (1 - chroma);
|
|
228984
|
+
} else {
|
|
228985
|
+
grayscale = 0;
|
|
228986
|
+
}
|
|
229115
228987
|
|
|
229116
|
-
|
|
229117
|
-
|
|
228988
|
+
if (chroma <= 0) {
|
|
228989
|
+
hue = 0;
|
|
228990
|
+
} else
|
|
228991
|
+
if (max === r) {
|
|
228992
|
+
hue = ((g - b) / chroma) % 6;
|
|
228993
|
+
} else
|
|
228994
|
+
if (max === g) {
|
|
228995
|
+
hue = 2 + (b - r) / chroma;
|
|
228996
|
+
} else {
|
|
228997
|
+
hue = 4 + (r - g) / chroma;
|
|
228998
|
+
}
|
|
229118
228999
|
|
|
229119
|
-
|
|
229000
|
+
hue /= 6;
|
|
229001
|
+
hue %= 1;
|
|
229120
229002
|
|
|
229003
|
+
return [hue * 360, chroma * 100, grayscale * 100];
|
|
229004
|
+
};
|
|
229121
229005
|
|
|
229122
|
-
|
|
229123
|
-
|
|
229124
|
-
|
|
229125
|
-
exports["default"] = void 0;
|
|
229006
|
+
convert.hsl.hcg = function (hsl) {
|
|
229007
|
+
const s = hsl[1] / 100;
|
|
229008
|
+
const l = hsl[2] / 100;
|
|
229126
229009
|
|
|
229127
|
-
|
|
229010
|
+
const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));
|
|
229128
229011
|
|
|
229129
|
-
|
|
229012
|
+
let f = 0;
|
|
229013
|
+
if (c < 1.0) {
|
|
229014
|
+
f = (l - 0.5 * c) / (1.0 - c);
|
|
229015
|
+
}
|
|
229130
229016
|
|
|
229131
|
-
|
|
229132
|
-
|
|
229133
|
-
throw TypeError('Invalid UUID');
|
|
229134
|
-
}
|
|
229017
|
+
return [hsl[0], c * 100, f * 100];
|
|
229018
|
+
};
|
|
229135
229019
|
|
|
229136
|
-
|
|
229137
|
-
|
|
229020
|
+
convert.hsv.hcg = function (hsv) {
|
|
229021
|
+
const s = hsv[1] / 100;
|
|
229022
|
+
const v = hsv[2] / 100;
|
|
229138
229023
|
|
|
229139
|
-
|
|
229140
|
-
|
|
229024
|
+
const c = s * v;
|
|
229025
|
+
let f = 0;
|
|
229141
229026
|
|
|
229142
|
-
|
|
229027
|
+
if (c < 1.0) {
|
|
229028
|
+
f = (v - c) / (1 - c);
|
|
229029
|
+
}
|
|
229143
229030
|
|
|
229144
|
-
|
|
229145
|
-
|
|
229031
|
+
return [hsv[0], c * 100, f * 100];
|
|
229032
|
+
};
|
|
229146
229033
|
|
|
229147
|
-
|
|
229148
|
-
|
|
229149
|
-
|
|
229150
|
-
|
|
229151
|
-
* MIT Licensed
|
|
229152
|
-
*/
|
|
229034
|
+
convert.hcg.rgb = function (hcg) {
|
|
229035
|
+
const h = hcg[0] / 360;
|
|
229036
|
+
const c = hcg[1] / 100;
|
|
229037
|
+
const g = hcg[2] / 100;
|
|
229153
229038
|
|
|
229039
|
+
if (c === 0.0) {
|
|
229040
|
+
return [g * 255, g * 255, g * 255];
|
|
229041
|
+
}
|
|
229154
229042
|
|
|
229043
|
+
const pure = [0, 0, 0];
|
|
229044
|
+
const hi = (h % 1) * 6;
|
|
229045
|
+
const v = hi % 1;
|
|
229046
|
+
const w = 1 - v;
|
|
229047
|
+
let mg = 0;
|
|
229155
229048
|
|
|
229156
|
-
|
|
229157
|
-
|
|
229158
|
-
|
|
229049
|
+
/* eslint-disable max-statements-per-line */
|
|
229050
|
+
switch (Math.floor(hi)) {
|
|
229051
|
+
case 0:
|
|
229052
|
+
pure[0] = 1; pure[1] = v; pure[2] = 0; break;
|
|
229053
|
+
case 1:
|
|
229054
|
+
pure[0] = w; pure[1] = 1; pure[2] = 0; break;
|
|
229055
|
+
case 2:
|
|
229056
|
+
pure[0] = 0; pure[1] = 1; pure[2] = v; break;
|
|
229057
|
+
case 3:
|
|
229058
|
+
pure[0] = 0; pure[1] = w; pure[2] = 1; break;
|
|
229059
|
+
case 4:
|
|
229060
|
+
pure[0] = v; pure[1] = 0; pure[2] = 1; break;
|
|
229061
|
+
default:
|
|
229062
|
+
pure[0] = 1; pure[1] = 0; pure[2] = w;
|
|
229063
|
+
}
|
|
229064
|
+
/* eslint-enable max-statements-per-line */
|
|
229159
229065
|
|
|
229160
|
-
|
|
229161
|
-
module.exports.append = append
|
|
229066
|
+
mg = (1.0 - c) * g;
|
|
229162
229067
|
|
|
229163
|
-
|
|
229164
|
-
*
|
|
229165
|
-
*
|
|
229166
|
-
*
|
|
229167
|
-
|
|
229168
|
-
|
|
229169
|
-
* / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
|
|
229170
|
-
* / DIGIT / ALPHA
|
|
229171
|
-
* ; any VCHAR, except delimiters
|
|
229172
|
-
*/
|
|
229068
|
+
return [
|
|
229069
|
+
(c * pure[0] + mg) * 255,
|
|
229070
|
+
(c * pure[1] + mg) * 255,
|
|
229071
|
+
(c * pure[2] + mg) * 255
|
|
229072
|
+
];
|
|
229073
|
+
};
|
|
229173
229074
|
|
|
229174
|
-
|
|
229075
|
+
convert.hcg.hsv = function (hcg) {
|
|
229076
|
+
const c = hcg[1] / 100;
|
|
229077
|
+
const g = hcg[2] / 100;
|
|
229175
229078
|
|
|
229176
|
-
|
|
229177
|
-
|
|
229178
|
-
*
|
|
229179
|
-
* @param {String} header
|
|
229180
|
-
* @param {String|Array} field
|
|
229181
|
-
* @return {String}
|
|
229182
|
-
* @public
|
|
229183
|
-
*/
|
|
229079
|
+
const v = c + g * (1.0 - c);
|
|
229080
|
+
let f = 0;
|
|
229184
229081
|
|
|
229185
|
-
|
|
229186
|
-
|
|
229187
|
-
|
|
229188
|
-
}
|
|
229082
|
+
if (v > 0.0) {
|
|
229083
|
+
f = c / v;
|
|
229084
|
+
}
|
|
229189
229085
|
|
|
229190
|
-
|
|
229191
|
-
|
|
229192
|
-
}
|
|
229086
|
+
return [hcg[0], f * 100, v * 100];
|
|
229087
|
+
};
|
|
229193
229088
|
|
|
229194
|
-
|
|
229195
|
-
|
|
229196
|
-
|
|
229197
|
-
: field
|
|
229089
|
+
convert.hcg.hsl = function (hcg) {
|
|
229090
|
+
const c = hcg[1] / 100;
|
|
229091
|
+
const g = hcg[2] / 100;
|
|
229198
229092
|
|
|
229199
|
-
|
|
229200
|
-
|
|
229201
|
-
if (!FIELD_NAME_REGEXP.test(fields[j])) {
|
|
229202
|
-
throw new TypeError('field argument contains an invalid header name')
|
|
229203
|
-
}
|
|
229204
|
-
}
|
|
229093
|
+
const l = g * (1.0 - c) + 0.5 * c;
|
|
229094
|
+
let s = 0;
|
|
229205
229095
|
|
|
229206
|
-
|
|
229207
|
-
|
|
229208
|
-
|
|
229209
|
-
|
|
229096
|
+
if (l > 0.0 && l < 0.5) {
|
|
229097
|
+
s = c / (2 * l);
|
|
229098
|
+
} else
|
|
229099
|
+
if (l >= 0.5 && l < 1.0) {
|
|
229100
|
+
s = c / (2 * (1 - l));
|
|
229101
|
+
}
|
|
229210
229102
|
|
|
229211
|
-
|
|
229212
|
-
|
|
229213
|
-
var vals = parse(header.toLowerCase())
|
|
229103
|
+
return [hcg[0], s * 100, l * 100];
|
|
229104
|
+
};
|
|
229214
229105
|
|
|
229215
|
-
|
|
229216
|
-
|
|
229217
|
-
|
|
229218
|
-
|
|
229106
|
+
convert.hcg.hwb = function (hcg) {
|
|
229107
|
+
const c = hcg[1] / 100;
|
|
229108
|
+
const g = hcg[2] / 100;
|
|
229109
|
+
const v = c + g * (1.0 - c);
|
|
229110
|
+
return [hcg[0], (v - c) * 100, (1 - v) * 100];
|
|
229111
|
+
};
|
|
229219
229112
|
|
|
229220
|
-
|
|
229221
|
-
|
|
229113
|
+
convert.hwb.hcg = function (hwb) {
|
|
229114
|
+
const w = hwb[1] / 100;
|
|
229115
|
+
const b = hwb[2] / 100;
|
|
229116
|
+
const v = 1 - b;
|
|
229117
|
+
const c = v - w;
|
|
229118
|
+
let g = 0;
|
|
229222
229119
|
|
|
229223
|
-
|
|
229224
|
-
|
|
229225
|
-
|
|
229226
|
-
val = val
|
|
229227
|
-
? val + ', ' + fields[i]
|
|
229228
|
-
: fields[i]
|
|
229229
|
-
}
|
|
229230
|
-
}
|
|
229120
|
+
if (c < 1) {
|
|
229121
|
+
g = (v - c) / (1 - c);
|
|
229122
|
+
}
|
|
229231
229123
|
|
|
229232
|
-
|
|
229233
|
-
}
|
|
229124
|
+
return [hwb[0], c * 100, g * 100];
|
|
229125
|
+
};
|
|
229234
229126
|
|
|
229235
|
-
|
|
229236
|
-
*
|
|
229237
|
-
|
|
229238
|
-
* @param {String} header
|
|
229239
|
-
* @return {Array}
|
|
229240
|
-
* @private
|
|
229241
|
-
*/
|
|
229127
|
+
convert.apple.rgb = function (apple) {
|
|
229128
|
+
return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
|
|
229129
|
+
};
|
|
229242
229130
|
|
|
229243
|
-
function
|
|
229244
|
-
|
|
229245
|
-
|
|
229246
|
-
var start = 0
|
|
229131
|
+
convert.rgb.apple = function (rgb) {
|
|
229132
|
+
return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
|
|
229133
|
+
};
|
|
229247
229134
|
|
|
229248
|
-
|
|
229249
|
-
|
|
229250
|
-
|
|
229251
|
-
case 0x20: /* */
|
|
229252
|
-
if (start === end) {
|
|
229253
|
-
start = end = i + 1
|
|
229254
|
-
}
|
|
229255
|
-
break
|
|
229256
|
-
case 0x2c: /* , */
|
|
229257
|
-
list.push(header.substring(start, end))
|
|
229258
|
-
start = end = i + 1
|
|
229259
|
-
break
|
|
229260
|
-
default:
|
|
229261
|
-
end = i + 1
|
|
229262
|
-
break
|
|
229263
|
-
}
|
|
229264
|
-
}
|
|
229135
|
+
convert.gray.rgb = function (args) {
|
|
229136
|
+
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
|
229137
|
+
};
|
|
229265
229138
|
|
|
229266
|
-
|
|
229267
|
-
|
|
229139
|
+
convert.gray.hsl = function (args) {
|
|
229140
|
+
return [0, 0, args[0]];
|
|
229141
|
+
};
|
|
229268
229142
|
|
|
229269
|
-
|
|
229270
|
-
}
|
|
229143
|
+
convert.gray.hsv = convert.gray.hsl;
|
|
229271
229144
|
|
|
229272
|
-
|
|
229273
|
-
|
|
229274
|
-
|
|
229275
|
-
* @param {Object} res
|
|
229276
|
-
* @param {String|Array} field
|
|
229277
|
-
* @public
|
|
229278
|
-
*/
|
|
229145
|
+
convert.gray.hwb = function (gray) {
|
|
229146
|
+
return [0, 100, gray[0]];
|
|
229147
|
+
};
|
|
229279
229148
|
|
|
229280
|
-
function
|
|
229281
|
-
|
|
229282
|
-
|
|
229283
|
-
throw new TypeError('res argument is required')
|
|
229284
|
-
}
|
|
229149
|
+
convert.gray.cmyk = function (gray) {
|
|
229150
|
+
return [0, 0, 0, gray[0]];
|
|
229151
|
+
};
|
|
229285
229152
|
|
|
229286
|
-
|
|
229287
|
-
|
|
229288
|
-
|
|
229289
|
-
? val.join(', ')
|
|
229290
|
-
: String(val)
|
|
229153
|
+
convert.gray.lab = function (gray) {
|
|
229154
|
+
return [gray[0], 0, 0];
|
|
229155
|
+
};
|
|
229291
229156
|
|
|
229292
|
-
|
|
229293
|
-
|
|
229294
|
-
|
|
229295
|
-
|
|
229296
|
-
|
|
229157
|
+
convert.gray.hex = function (gray) {
|
|
229158
|
+
const val = Math.round(gray[0] / 100 * 255) & 0xFF;
|
|
229159
|
+
const integer = (val << 16) + (val << 8) + val;
|
|
229160
|
+
|
|
229161
|
+
const string = integer.toString(16).toUpperCase();
|
|
229162
|
+
return '000000'.substring(string.length) + string;
|
|
229163
|
+
};
|
|
229164
|
+
|
|
229165
|
+
convert.rgb.gray = function (rgb) {
|
|
229166
|
+
const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
|
229167
|
+
return [val / 255 * 100];
|
|
229168
|
+
};
|
|
229297
229169
|
|
|
229298
229170
|
|
|
229299
229171
|
/***/ }),
|
|
229300
229172
|
|
|
229301
|
-
/***/
|
|
229173
|
+
/***/ 87773:
|
|
229302
229174
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
229303
229175
|
|
|
229304
|
-
|
|
229305
|
-
|
|
229306
|
-
const stringWidth = __nccwpck_require__(60060);
|
|
229307
|
-
const stripAnsi = __nccwpck_require__(13958);
|
|
229308
|
-
const ansiStyles = __nccwpck_require__(54412);
|
|
229176
|
+
const conversions = __nccwpck_require__(18756);
|
|
229177
|
+
const route = __nccwpck_require__(29524);
|
|
229309
229178
|
|
|
229310
|
-
const
|
|
229311
|
-
'\u001B',
|
|
229312
|
-
'\u009B'
|
|
229313
|
-
]);
|
|
229179
|
+
const convert = {};
|
|
229314
229180
|
|
|
229315
|
-
const
|
|
229181
|
+
const models = Object.keys(conversions);
|
|
229316
229182
|
|
|
229317
|
-
|
|
229318
|
-
const
|
|
229319
|
-
const
|
|
229320
|
-
|
|
229321
|
-
|
|
229183
|
+
function wrapRaw(fn) {
|
|
229184
|
+
const wrappedFn = function (...args) {
|
|
229185
|
+
const arg0 = args[0];
|
|
229186
|
+
if (arg0 === undefined || arg0 === null) {
|
|
229187
|
+
return arg0;
|
|
229188
|
+
}
|
|
229322
229189
|
|
|
229323
|
-
|
|
229324
|
-
|
|
229190
|
+
if (arg0.length > 1) {
|
|
229191
|
+
args = arg0;
|
|
229192
|
+
}
|
|
229325
229193
|
|
|
229326
|
-
|
|
229327
|
-
|
|
229328
|
-
const wordLengths = string => string.split(' ').map(character => stringWidth(character));
|
|
229194
|
+
return fn(args);
|
|
229195
|
+
};
|
|
229329
229196
|
|
|
229330
|
-
//
|
|
229331
|
-
|
|
229332
|
-
|
|
229333
|
-
|
|
229197
|
+
// Preserve .conversion property if there is one
|
|
229198
|
+
if ('conversion' in fn) {
|
|
229199
|
+
wrappedFn.conversion = fn.conversion;
|
|
229200
|
+
}
|
|
229334
229201
|
|
|
229335
|
-
|
|
229336
|
-
|
|
229337
|
-
let visible = stringWidth(stripAnsi(rows[rows.length - 1]));
|
|
229202
|
+
return wrappedFn;
|
|
229203
|
+
}
|
|
229338
229204
|
|
|
229339
|
-
|
|
229340
|
-
|
|
229205
|
+
function wrapRounded(fn) {
|
|
229206
|
+
const wrappedFn = function (...args) {
|
|
229207
|
+
const arg0 = args[0];
|
|
229341
229208
|
|
|
229342
|
-
if (
|
|
229343
|
-
|
|
229344
|
-
} else {
|
|
229345
|
-
rows.push(character);
|
|
229346
|
-
visible = 0;
|
|
229209
|
+
if (arg0 === undefined || arg0 === null) {
|
|
229210
|
+
return arg0;
|
|
229347
229211
|
}
|
|
229348
229212
|
|
|
229349
|
-
if (
|
|
229350
|
-
|
|
229351
|
-
isInsideLinkEscape = characters.slice(index + 1).join('').startsWith(ANSI_ESCAPE_LINK);
|
|
229213
|
+
if (arg0.length > 1) {
|
|
229214
|
+
args = arg0;
|
|
229352
229215
|
}
|
|
229353
229216
|
|
|
229354
|
-
|
|
229355
|
-
if (isInsideLinkEscape) {
|
|
229356
|
-
if (character === ANSI_ESCAPE_BELL) {
|
|
229357
|
-
isInsideEscape = false;
|
|
229358
|
-
isInsideLinkEscape = false;
|
|
229359
|
-
}
|
|
229360
|
-
} else if (character === ANSI_SGR_TERMINATOR) {
|
|
229361
|
-
isInsideEscape = false;
|
|
229362
|
-
}
|
|
229217
|
+
const result = fn(args);
|
|
229363
229218
|
|
|
229364
|
-
|
|
229219
|
+
// We're assuming the result is an array here.
|
|
229220
|
+
// see notice in conversions.js; don't use box types
|
|
229221
|
+
// in conversion functions.
|
|
229222
|
+
if (typeof result === 'object') {
|
|
229223
|
+
for (let len = result.length, i = 0; i < len; i++) {
|
|
229224
|
+
result[i] = Math.round(result[i]);
|
|
229225
|
+
}
|
|
229365
229226
|
}
|
|
229366
229227
|
|
|
229367
|
-
|
|
229368
|
-
|
|
229369
|
-
if (visible === columns && index < characters.length - 1) {
|
|
229370
|
-
rows.push('');
|
|
229371
|
-
visible = 0;
|
|
229372
|
-
}
|
|
229373
|
-
}
|
|
229228
|
+
return result;
|
|
229229
|
+
};
|
|
229374
229230
|
|
|
229375
|
-
//
|
|
229376
|
-
|
|
229377
|
-
|
|
229378
|
-
rows[rows.length - 2] += rows.pop();
|
|
229231
|
+
// Preserve .conversion property if there is one
|
|
229232
|
+
if ('conversion' in fn) {
|
|
229233
|
+
wrappedFn.conversion = fn.conversion;
|
|
229379
229234
|
}
|
|
229380
|
-
};
|
|
229381
229235
|
|
|
229382
|
-
|
|
229383
|
-
|
|
229384
|
-
const words = string.split(' ');
|
|
229385
|
-
let last = words.length;
|
|
229236
|
+
return wrappedFn;
|
|
229237
|
+
}
|
|
229386
229238
|
|
|
229387
|
-
|
|
229388
|
-
|
|
229389
|
-
break;
|
|
229390
|
-
}
|
|
229239
|
+
models.forEach(fromModel => {
|
|
229240
|
+
convert[fromModel] = {};
|
|
229391
229241
|
|
|
229392
|
-
|
|
229393
|
-
}
|
|
229242
|
+
Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
|
|
229243
|
+
Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
|
|
229394
229244
|
|
|
229395
|
-
|
|
229396
|
-
|
|
229397
|
-
}
|
|
229245
|
+
const routes = route(fromModel);
|
|
229246
|
+
const routeModels = Object.keys(routes);
|
|
229398
229247
|
|
|
229399
|
-
|
|
229400
|
-
|
|
229248
|
+
routeModels.forEach(toModel => {
|
|
229249
|
+
const fn = routes[toModel];
|
|
229401
229250
|
|
|
229402
|
-
|
|
229403
|
-
|
|
229404
|
-
|
|
229405
|
-
|
|
229406
|
-
// 'soft' allows long words to expand past the column length
|
|
229407
|
-
const exec = (string, columns, options = {}) => {
|
|
229408
|
-
if (options.trim !== false && string.trim() === '') {
|
|
229409
|
-
return '';
|
|
229410
|
-
}
|
|
229251
|
+
convert[fromModel][toModel] = wrapRounded(fn);
|
|
229252
|
+
convert[fromModel][toModel].raw = wrapRaw(fn);
|
|
229253
|
+
});
|
|
229254
|
+
});
|
|
229411
229255
|
|
|
229412
|
-
|
|
229413
|
-
let escapeCode;
|
|
229414
|
-
let escapeUrl;
|
|
229256
|
+
module.exports = convert;
|
|
229415
229257
|
|
|
229416
|
-
const lengths = wordLengths(string);
|
|
229417
|
-
let rows = [''];
|
|
229418
229258
|
|
|
229419
|
-
|
|
229420
|
-
if (options.trim !== false) {
|
|
229421
|
-
rows[rows.length - 1] = rows[rows.length - 1].trimStart();
|
|
229422
|
-
}
|
|
229259
|
+
/***/ }),
|
|
229423
229260
|
|
|
229424
|
-
|
|
229261
|
+
/***/ 29524:
|
|
229262
|
+
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
229425
229263
|
|
|
229426
|
-
|
|
229427
|
-
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
229428
|
-
// If we start with a new word but the current row length equals the length of the columns, add a new row
|
|
229429
|
-
rows.push('');
|
|
229430
|
-
rowLength = 0;
|
|
229431
|
-
}
|
|
229264
|
+
const conversions = __nccwpck_require__(18756);
|
|
229432
229265
|
|
|
229433
|
-
|
|
229434
|
-
|
|
229435
|
-
rowLength++;
|
|
229436
|
-
}
|
|
229437
|
-
}
|
|
229266
|
+
/*
|
|
229267
|
+
This function routes a model to all other models.
|
|
229438
229268
|
|
|
229439
|
-
|
|
229440
|
-
|
|
229441
|
-
|
|
229442
|
-
|
|
229443
|
-
const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns);
|
|
229444
|
-
if (breaksStartingNextLine < breaksStartingThisLine) {
|
|
229445
|
-
rows.push('');
|
|
229446
|
-
}
|
|
229269
|
+
all functions that are routed have a property `.conversion` attached
|
|
229270
|
+
to the returned synthetic function. This property is an array
|
|
229271
|
+
of strings, each with the steps in between the 'from' and 'to'
|
|
229272
|
+
color models (inclusive).
|
|
229447
229273
|
|
|
229448
|
-
|
|
229449
|
-
|
|
229450
|
-
}
|
|
229274
|
+
conversions that are not possible simply are not included.
|
|
229275
|
+
*/
|
|
229451
229276
|
|
|
229452
|
-
|
|
229453
|
-
|
|
229454
|
-
|
|
229455
|
-
|
|
229456
|
-
}
|
|
229277
|
+
function buildGraph() {
|
|
229278
|
+
const graph = {};
|
|
229279
|
+
// https://jsperf.com/object-keys-vs-for-in-with-closure/3
|
|
229280
|
+
const models = Object.keys(conversions);
|
|
229457
229281
|
|
|
229458
|
-
|
|
229459
|
-
|
|
229282
|
+
for (let len = models.length, i = 0; i < len; i++) {
|
|
229283
|
+
graph[models[i]] = {
|
|
229284
|
+
// http://jsperf.com/1-vs-infinity
|
|
229285
|
+
// micro-opt, but this is simple.
|
|
229286
|
+
distance: -1,
|
|
229287
|
+
parent: null
|
|
229288
|
+
};
|
|
229289
|
+
}
|
|
229460
229290
|
|
|
229461
|
-
|
|
229462
|
-
|
|
229463
|
-
continue;
|
|
229464
|
-
}
|
|
229291
|
+
return graph;
|
|
229292
|
+
}
|
|
229465
229293
|
|
|
229466
|
-
|
|
229467
|
-
|
|
229294
|
+
// https://en.wikipedia.org/wiki/Breadth-first_search
|
|
229295
|
+
function deriveBFS(fromModel) {
|
|
229296
|
+
const graph = buildGraph();
|
|
229297
|
+
const queue = [fromModel]; // Unshift -> queue -> pop
|
|
229468
229298
|
|
|
229469
|
-
|
|
229470
|
-
rows = rows.map(stringVisibleTrimSpacesRight);
|
|
229471
|
-
}
|
|
229299
|
+
graph[fromModel].distance = 0;
|
|
229472
229300
|
|
|
229473
|
-
|
|
229301
|
+
while (queue.length) {
|
|
229302
|
+
const current = queue.pop();
|
|
229303
|
+
const adjacents = Object.keys(conversions[current]);
|
|
229474
229304
|
|
|
229475
|
-
|
|
229476
|
-
|
|
229305
|
+
for (let len = adjacents.length, i = 0; i < len; i++) {
|
|
229306
|
+
const adjacent = adjacents[i];
|
|
229307
|
+
const node = graph[adjacent];
|
|
229477
229308
|
|
|
229478
|
-
|
|
229479
|
-
|
|
229480
|
-
|
|
229481
|
-
|
|
229482
|
-
escapeCode = code === END_CODE ? undefined : code;
|
|
229483
|
-
} else if (groups.uri !== undefined) {
|
|
229484
|
-
escapeUrl = groups.uri.length === 0 ? undefined : groups.uri;
|
|
229309
|
+
if (node.distance === -1) {
|
|
229310
|
+
node.distance = graph[current].distance + 1;
|
|
229311
|
+
node.parent = current;
|
|
229312
|
+
queue.unshift(adjacent);
|
|
229485
229313
|
}
|
|
229486
229314
|
}
|
|
229315
|
+
}
|
|
229487
229316
|
|
|
229488
|
-
|
|
229317
|
+
return graph;
|
|
229318
|
+
}
|
|
229489
229319
|
|
|
229490
|
-
|
|
229491
|
-
|
|
229492
|
-
|
|
229493
|
-
|
|
229320
|
+
function link(from, to) {
|
|
229321
|
+
return function (args) {
|
|
229322
|
+
return to(from(args));
|
|
229323
|
+
};
|
|
229324
|
+
}
|
|
229494
229325
|
|
|
229495
|
-
|
|
229496
|
-
|
|
229497
|
-
|
|
229498
|
-
} else if (character === '\n') {
|
|
229499
|
-
if (escapeCode && code) {
|
|
229500
|
-
returnValue += wrapAnsi(escapeCode);
|
|
229501
|
-
}
|
|
229326
|
+
function wrapConversion(toModel, graph) {
|
|
229327
|
+
const path = [graph[toModel].parent, toModel];
|
|
229328
|
+
let fn = conversions[graph[toModel].parent][toModel];
|
|
229502
229329
|
|
|
229503
|
-
|
|
229504
|
-
|
|
229505
|
-
|
|
229330
|
+
let cur = graph[toModel].parent;
|
|
229331
|
+
while (graph[cur].parent) {
|
|
229332
|
+
path.unshift(graph[cur].parent);
|
|
229333
|
+
fn = link(conversions[graph[cur].parent][cur], fn);
|
|
229334
|
+
cur = graph[cur].parent;
|
|
229335
|
+
}
|
|
229336
|
+
|
|
229337
|
+
fn.conversion = path;
|
|
229338
|
+
return fn;
|
|
229339
|
+
}
|
|
229340
|
+
|
|
229341
|
+
module.exports = function (fromModel) {
|
|
229342
|
+
const graph = deriveBFS(fromModel);
|
|
229343
|
+
const conversion = {};
|
|
229344
|
+
|
|
229345
|
+
const models = Object.keys(graph);
|
|
229346
|
+
for (let len = models.length, i = 0; i < len; i++) {
|
|
229347
|
+
const toModel = models[i];
|
|
229348
|
+
const node = graph[toModel];
|
|
229349
|
+
|
|
229350
|
+
if (node.parent === null) {
|
|
229351
|
+
// No possible conversion, or this node is the source model.
|
|
229352
|
+
continue;
|
|
229506
229353
|
}
|
|
229354
|
+
|
|
229355
|
+
conversion[toModel] = wrapConversion(toModel, graph);
|
|
229507
229356
|
}
|
|
229508
229357
|
|
|
229509
|
-
return
|
|
229358
|
+
return conversion;
|
|
229510
229359
|
};
|
|
229511
229360
|
|
|
229512
|
-
|
|
229513
|
-
|
|
229514
|
-
|
|
229515
|
-
|
|
229516
|
-
|
|
229517
|
-
|
|
229518
|
-
|
|
229519
|
-
|
|
229520
|
-
|
|
229361
|
+
|
|
229362
|
+
|
|
229363
|
+
/***/ }),
|
|
229364
|
+
|
|
229365
|
+
/***/ 39749:
|
|
229366
|
+
/***/ ((module) => {
|
|
229367
|
+
|
|
229368
|
+
"use strict";
|
|
229369
|
+
|
|
229370
|
+
|
|
229371
|
+
module.exports = {
|
|
229372
|
+
"aliceblue": [240, 248, 255],
|
|
229373
|
+
"antiquewhite": [250, 235, 215],
|
|
229374
|
+
"aqua": [0, 255, 255],
|
|
229375
|
+
"aquamarine": [127, 255, 212],
|
|
229376
|
+
"azure": [240, 255, 255],
|
|
229377
|
+
"beige": [245, 245, 220],
|
|
229378
|
+
"bisque": [255, 228, 196],
|
|
229379
|
+
"black": [0, 0, 0],
|
|
229380
|
+
"blanchedalmond": [255, 235, 205],
|
|
229381
|
+
"blue": [0, 0, 255],
|
|
229382
|
+
"blueviolet": [138, 43, 226],
|
|
229383
|
+
"brown": [165, 42, 42],
|
|
229384
|
+
"burlywood": [222, 184, 135],
|
|
229385
|
+
"cadetblue": [95, 158, 160],
|
|
229386
|
+
"chartreuse": [127, 255, 0],
|
|
229387
|
+
"chocolate": [210, 105, 30],
|
|
229388
|
+
"coral": [255, 127, 80],
|
|
229389
|
+
"cornflowerblue": [100, 149, 237],
|
|
229390
|
+
"cornsilk": [255, 248, 220],
|
|
229391
|
+
"crimson": [220, 20, 60],
|
|
229392
|
+
"cyan": [0, 255, 255],
|
|
229393
|
+
"darkblue": [0, 0, 139],
|
|
229394
|
+
"darkcyan": [0, 139, 139],
|
|
229395
|
+
"darkgoldenrod": [184, 134, 11],
|
|
229396
|
+
"darkgray": [169, 169, 169],
|
|
229397
|
+
"darkgreen": [0, 100, 0],
|
|
229398
|
+
"darkgrey": [169, 169, 169],
|
|
229399
|
+
"darkkhaki": [189, 183, 107],
|
|
229400
|
+
"darkmagenta": [139, 0, 139],
|
|
229401
|
+
"darkolivegreen": [85, 107, 47],
|
|
229402
|
+
"darkorange": [255, 140, 0],
|
|
229403
|
+
"darkorchid": [153, 50, 204],
|
|
229404
|
+
"darkred": [139, 0, 0],
|
|
229405
|
+
"darksalmon": [233, 150, 122],
|
|
229406
|
+
"darkseagreen": [143, 188, 143],
|
|
229407
|
+
"darkslateblue": [72, 61, 139],
|
|
229408
|
+
"darkslategray": [47, 79, 79],
|
|
229409
|
+
"darkslategrey": [47, 79, 79],
|
|
229410
|
+
"darkturquoise": [0, 206, 209],
|
|
229411
|
+
"darkviolet": [148, 0, 211],
|
|
229412
|
+
"deeppink": [255, 20, 147],
|
|
229413
|
+
"deepskyblue": [0, 191, 255],
|
|
229414
|
+
"dimgray": [105, 105, 105],
|
|
229415
|
+
"dimgrey": [105, 105, 105],
|
|
229416
|
+
"dodgerblue": [30, 144, 255],
|
|
229417
|
+
"firebrick": [178, 34, 34],
|
|
229418
|
+
"floralwhite": [255, 250, 240],
|
|
229419
|
+
"forestgreen": [34, 139, 34],
|
|
229420
|
+
"fuchsia": [255, 0, 255],
|
|
229421
|
+
"gainsboro": [220, 220, 220],
|
|
229422
|
+
"ghostwhite": [248, 248, 255],
|
|
229423
|
+
"gold": [255, 215, 0],
|
|
229424
|
+
"goldenrod": [218, 165, 32],
|
|
229425
|
+
"gray": [128, 128, 128],
|
|
229426
|
+
"green": [0, 128, 0],
|
|
229427
|
+
"greenyellow": [173, 255, 47],
|
|
229428
|
+
"grey": [128, 128, 128],
|
|
229429
|
+
"honeydew": [240, 255, 240],
|
|
229430
|
+
"hotpink": [255, 105, 180],
|
|
229431
|
+
"indianred": [205, 92, 92],
|
|
229432
|
+
"indigo": [75, 0, 130],
|
|
229433
|
+
"ivory": [255, 255, 240],
|
|
229434
|
+
"khaki": [240, 230, 140],
|
|
229435
|
+
"lavender": [230, 230, 250],
|
|
229436
|
+
"lavenderblush": [255, 240, 245],
|
|
229437
|
+
"lawngreen": [124, 252, 0],
|
|
229438
|
+
"lemonchiffon": [255, 250, 205],
|
|
229439
|
+
"lightblue": [173, 216, 230],
|
|
229440
|
+
"lightcoral": [240, 128, 128],
|
|
229441
|
+
"lightcyan": [224, 255, 255],
|
|
229442
|
+
"lightgoldenrodyellow": [250, 250, 210],
|
|
229443
|
+
"lightgray": [211, 211, 211],
|
|
229444
|
+
"lightgreen": [144, 238, 144],
|
|
229445
|
+
"lightgrey": [211, 211, 211],
|
|
229446
|
+
"lightpink": [255, 182, 193],
|
|
229447
|
+
"lightsalmon": [255, 160, 122],
|
|
229448
|
+
"lightseagreen": [32, 178, 170],
|
|
229449
|
+
"lightskyblue": [135, 206, 250],
|
|
229450
|
+
"lightslategray": [119, 136, 153],
|
|
229451
|
+
"lightslategrey": [119, 136, 153],
|
|
229452
|
+
"lightsteelblue": [176, 196, 222],
|
|
229453
|
+
"lightyellow": [255, 255, 224],
|
|
229454
|
+
"lime": [0, 255, 0],
|
|
229455
|
+
"limegreen": [50, 205, 50],
|
|
229456
|
+
"linen": [250, 240, 230],
|
|
229457
|
+
"magenta": [255, 0, 255],
|
|
229458
|
+
"maroon": [128, 0, 0],
|
|
229459
|
+
"mediumaquamarine": [102, 205, 170],
|
|
229460
|
+
"mediumblue": [0, 0, 205],
|
|
229461
|
+
"mediumorchid": [186, 85, 211],
|
|
229462
|
+
"mediumpurple": [147, 112, 219],
|
|
229463
|
+
"mediumseagreen": [60, 179, 113],
|
|
229464
|
+
"mediumslateblue": [123, 104, 238],
|
|
229465
|
+
"mediumspringgreen": [0, 250, 154],
|
|
229466
|
+
"mediumturquoise": [72, 209, 204],
|
|
229467
|
+
"mediumvioletred": [199, 21, 133],
|
|
229468
|
+
"midnightblue": [25, 25, 112],
|
|
229469
|
+
"mintcream": [245, 255, 250],
|
|
229470
|
+
"mistyrose": [255, 228, 225],
|
|
229471
|
+
"moccasin": [255, 228, 181],
|
|
229472
|
+
"navajowhite": [255, 222, 173],
|
|
229473
|
+
"navy": [0, 0, 128],
|
|
229474
|
+
"oldlace": [253, 245, 230],
|
|
229475
|
+
"olive": [128, 128, 0],
|
|
229476
|
+
"olivedrab": [107, 142, 35],
|
|
229477
|
+
"orange": [255, 165, 0],
|
|
229478
|
+
"orangered": [255, 69, 0],
|
|
229479
|
+
"orchid": [218, 112, 214],
|
|
229480
|
+
"palegoldenrod": [238, 232, 170],
|
|
229481
|
+
"palegreen": [152, 251, 152],
|
|
229482
|
+
"paleturquoise": [175, 238, 238],
|
|
229483
|
+
"palevioletred": [219, 112, 147],
|
|
229484
|
+
"papayawhip": [255, 239, 213],
|
|
229485
|
+
"peachpuff": [255, 218, 185],
|
|
229486
|
+
"peru": [205, 133, 63],
|
|
229487
|
+
"pink": [255, 192, 203],
|
|
229488
|
+
"plum": [221, 160, 221],
|
|
229489
|
+
"powderblue": [176, 224, 230],
|
|
229490
|
+
"purple": [128, 0, 128],
|
|
229491
|
+
"rebeccapurple": [102, 51, 153],
|
|
229492
|
+
"red": [255, 0, 0],
|
|
229493
|
+
"rosybrown": [188, 143, 143],
|
|
229494
|
+
"royalblue": [65, 105, 225],
|
|
229495
|
+
"saddlebrown": [139, 69, 19],
|
|
229496
|
+
"salmon": [250, 128, 114],
|
|
229497
|
+
"sandybrown": [244, 164, 96],
|
|
229498
|
+
"seagreen": [46, 139, 87],
|
|
229499
|
+
"seashell": [255, 245, 238],
|
|
229500
|
+
"sienna": [160, 82, 45],
|
|
229501
|
+
"silver": [192, 192, 192],
|
|
229502
|
+
"skyblue": [135, 206, 235],
|
|
229503
|
+
"slateblue": [106, 90, 205],
|
|
229504
|
+
"slategray": [112, 128, 144],
|
|
229505
|
+
"slategrey": [112, 128, 144],
|
|
229506
|
+
"snow": [255, 250, 250],
|
|
229507
|
+
"springgreen": [0, 255, 127],
|
|
229508
|
+
"steelblue": [70, 130, 180],
|
|
229509
|
+
"tan": [210, 180, 140],
|
|
229510
|
+
"teal": [0, 128, 128],
|
|
229511
|
+
"thistle": [216, 191, 216],
|
|
229512
|
+
"tomato": [255, 99, 71],
|
|
229513
|
+
"turquoise": [64, 224, 208],
|
|
229514
|
+
"violet": [238, 130, 238],
|
|
229515
|
+
"wheat": [245, 222, 179],
|
|
229516
|
+
"white": [255, 255, 255],
|
|
229517
|
+
"whitesmoke": [245, 245, 245],
|
|
229518
|
+
"yellow": [255, 255, 0],
|
|
229519
|
+
"yellowgreen": [154, 205, 50]
|
|
229520
|
+
};
|
|
229521
229521
|
|
|
229522
229522
|
|
|
229523
229523
|
/***/ }),
|
|
@@ -240172,7 +240172,7 @@ async function npmInstall(packageSpec, options = {}) {
|
|
|
240172
240172
|
// Set NODE_OPTIONS to increase heap memory and optimize GC for heavy installs
|
|
240173
240173
|
env: {
|
|
240174
240174
|
...process.env,
|
|
240175
|
-
NODE_OPTIONS: "--max-old-space-size=16384
|
|
240175
|
+
NODE_OPTIONS: "--max-old-space-size=16384"
|
|
240176
240176
|
}
|
|
240177
240177
|
};
|
|
240178
240178
|
if (options.cwd) {
|
|
@@ -240915,15 +240915,8 @@ async function installNpmModule(moduleDefinition, targetDir) {
|
|
|
240915
240915
|
fs5.writeFileSync(prefixPackageJson, JSON.stringify({
|
|
240916
240916
|
name: "habits-nodes",
|
|
240917
240917
|
version: "1.0.0",
|
|
240918
|
-
private: true
|
|
240919
|
-
packageManager: "pnpm@10.0.0"
|
|
240918
|
+
private: true
|
|
240920
240919
|
}, null, 2));
|
|
240921
|
-
} else {
|
|
240922
|
-
const existingPkg = JSON.parse(fs5.readFileSync(prefixPackageJson, "utf-8"));
|
|
240923
|
-
if (!existingPkg.packageManager) {
|
|
240924
|
-
existingPkg.packageManager = "pnpm@10.0.0";
|
|
240925
|
-
fs5.writeFileSync(prefixPackageJson, JSON.stringify(existingPkg, null, 2));
|
|
240926
|
-
}
|
|
240927
240920
|
}
|
|
240928
240921
|
const { stdout, stderr } = await npmInstall(packageName, {
|
|
240929
240922
|
prefix,
|
|
@@ -240983,8 +240976,7 @@ async function linkNpmModule(moduleDefinition, targetDir) {
|
|
|
240983
240976
|
fs5.writeFileSync(prefixPackageJson, JSON.stringify({
|
|
240984
240977
|
name: "habits-nodes",
|
|
240985
240978
|
version: "1.0.0",
|
|
240986
|
-
private: true
|
|
240987
|
-
packageManager: "pnpm@10.0.0"
|
|
240979
|
+
private: true
|
|
240988
240980
|
}, null, 2));
|
|
240989
240981
|
}
|
|
240990
240982
|
const linkCommand = `npm link ${packageName}`;
|
|
@@ -241023,8 +241015,37 @@ function getModulePath(moduleDefinition) {
|
|
|
241023
241015
|
return localPath;
|
|
241024
241016
|
}
|
|
241025
241017
|
}
|
|
241018
|
+
const packageJsonPath = path5.join(targetPath, "package.json");
|
|
241019
|
+
if (!fs5.existsSync(packageJsonPath) && fs5.existsSync(targetPath)) {
|
|
241020
|
+
const pnpmStorePath = findPnpmStorePath(targetPath, moduleName);
|
|
241021
|
+
if (pnpmStorePath) {
|
|
241022
|
+
return pnpmStorePath;
|
|
241023
|
+
}
|
|
241024
|
+
}
|
|
241026
241025
|
return targetPath;
|
|
241027
241026
|
}
|
|
241027
|
+
function findPnpmStorePath(expectedPath, moduleName) {
|
|
241028
|
+
const parentDir = path5.dirname(expectedPath);
|
|
241029
|
+
if (!fs5.existsSync(parentDir)) {
|
|
241030
|
+
return null;
|
|
241031
|
+
}
|
|
241032
|
+
const baseName = moduleName.includes("/") ? moduleName.split("/").pop() : moduleName;
|
|
241033
|
+
try {
|
|
241034
|
+
const entries = fs5.readdirSync(parentDir, { withFileTypes: true });
|
|
241035
|
+
for (const entry of entries) {
|
|
241036
|
+
if (entry.isDirectory() && entry.name.startsWith(`.${baseName}`)) {
|
|
241037
|
+
const candidatePath = path5.join(parentDir, entry.name);
|
|
241038
|
+
const candidatePackageJson = path5.join(candidatePath, "package.json");
|
|
241039
|
+
if (fs5.existsSync(candidatePackageJson)) {
|
|
241040
|
+
console.log(`\u{1F4E6} Found store path for ${moduleName}: ${candidatePath}`);
|
|
241041
|
+
return candidatePath;
|
|
241042
|
+
}
|
|
241043
|
+
}
|
|
241044
|
+
}
|
|
241045
|
+
} catch (error) {
|
|
241046
|
+
}
|
|
241047
|
+
return null;
|
|
241048
|
+
}
|
|
241028
241049
|
function getModuleMainFile(moduleDefinition) {
|
|
241029
241050
|
const modulePath = getModulePath(moduleDefinition);
|
|
241030
241051
|
const packageJsonPath = path5.join(modulePath, "package.json");
|
|
@@ -243633,9 +243654,8 @@ function convertDenoImports(code) {
|
|
|
243633
243654
|
const imports = [];
|
|
243634
243655
|
let convertedCode = code;
|
|
243635
243656
|
const denoImportPatterns = [
|
|
243636
|
-
// Windmill SDK
|
|
243637
243657
|
{
|
|
243638
|
-
pattern: /import\s+\*\s+as\s+wmill\s+from\s+["']https:\/\/deno\.land\/x\/
|
|
243658
|
+
pattern: /import\s+\*\s+as\s+wmill\s+from\s+["']https:\/\/deno\.land\/x\/[@\w.]*\/mod\.ts["'];?/g,
|
|
243639
243659
|
replacement: `// Script SDK (mocked for Node.js)
|
|
243640
243660
|
const wmill = {
|
|
243641
243661
|
getInternalStatePath: () => '__internal_state__',
|
|
@@ -244715,6 +244735,18 @@ var WorkflowExecutor = class {
|
|
|
244715
244735
|
status: "pending"
|
|
244716
244736
|
}));
|
|
244717
244737
|
let context = options?.initialContext ? { ...options.initialContext } : {};
|
|
244738
|
+
if (!context.habits) {
|
|
244739
|
+
context.habits = {};
|
|
244740
|
+
}
|
|
244741
|
+
context.habits.context = {
|
|
244742
|
+
workflowId: workflow.id,
|
|
244743
|
+
workflowName: workflow.name,
|
|
244744
|
+
executionId,
|
|
244745
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
244746
|
+
startTime: execution.startTime.toISOString(),
|
|
244747
|
+
nodeId: ""
|
|
244748
|
+
// Will be set per-node during execution
|
|
244749
|
+
};
|
|
244718
244750
|
const securityConfig = getSecurityConfig();
|
|
244719
244751
|
if (context.habits?.input) {
|
|
244720
244752
|
context.habits.input = await scanInputForSecurity(context.habits.input, securityConfig, this.logger);
|
|
@@ -244760,6 +244792,9 @@ var WorkflowExecutor = class {
|
|
|
244760
244792
|
execution.currentNode = nodeId;
|
|
244761
244793
|
this.logger.log(`
|
|
244762
244794
|
\u{1F4DD} Executing node: ${nodeId} (${node.data.label})`);
|
|
244795
|
+
if (context.habits?.context) {
|
|
244796
|
+
context.habits.context.nodeId = nodeId;
|
|
244797
|
+
}
|
|
244763
244798
|
this.updateNodeStatus(execution, nodeId, "running");
|
|
244764
244799
|
emitStreamEvent({
|
|
244765
244800
|
type: "node_started",
|
|
@@ -244862,7 +244897,7 @@ var WorkflowExecutor = class {
|
|
|
244862
244897
|
this.logger.log(`\u26A0\uFE0F Workflow incomplete - ${totalProcessed}/${workflow.nodes.length} nodes processed (${completedNodes.length} completed, ${skippedNodes.length} skipped)`);
|
|
244863
244898
|
}
|
|
244864
244899
|
const workflowOutput = workflow.output || workflow.outputs;
|
|
244865
|
-
if (workflowOutput
|
|
244900
|
+
if (workflowOutput) {
|
|
244866
244901
|
try {
|
|
244867
244902
|
this.logger.log(`
|
|
244868
244903
|
\u{1F4E4} Processing workflow output...`);
|
|
@@ -245247,6 +245282,11 @@ var WorkflowExecutor = class {
|
|
|
245247
245282
|
while ((match = templateRegex.exec(value)) !== null) {
|
|
245248
245283
|
const expression = match[1].trim();
|
|
245249
245284
|
const evaluatedValue = this.evaluateExpression(expression, context);
|
|
245285
|
+
if (typeof evaluatedValue === "object") {
|
|
245286
|
+
this.logger.warn(`\u26A0\uFE0F Evaluated value for expression "${expression}" is an object, serializing to JSON string`);
|
|
245287
|
+
resolvedString = resolvedString.replace(match[0], JSON.stringify(evaluatedValue));
|
|
245288
|
+
continue;
|
|
245289
|
+
}
|
|
245250
245290
|
resolvedString = resolvedString.replace(match[0], String(evaluatedValue));
|
|
245251
245291
|
}
|
|
245252
245292
|
resolved[key] = resolvedString;
|
|
@@ -245291,6 +245331,30 @@ var WorkflowExecutor = class {
|
|
|
245291
245331
|
}
|
|
245292
245332
|
return value || "";
|
|
245293
245333
|
}
|
|
245334
|
+
if (expression.startsWith("habits.function.")) {
|
|
245335
|
+
const funcCall = expression.slice("habits.function.".length);
|
|
245336
|
+
return this.evaluateHabitsFunction(funcCall);
|
|
245337
|
+
}
|
|
245338
|
+
if (expression.startsWith("habits.context.")) {
|
|
245339
|
+
const contextKey = expression.slice("habits.context.".length);
|
|
245340
|
+
const habitsContext = context.habits?.context || {};
|
|
245341
|
+
if (contextKey in habitsContext) {
|
|
245342
|
+
return habitsContext[contextKey];
|
|
245343
|
+
}
|
|
245344
|
+
this.logger.warn(`\u26A0\uFE0F Context key '${contextKey}' not found`);
|
|
245345
|
+
return "";
|
|
245346
|
+
}
|
|
245347
|
+
if (expression.startsWith("habits.header.")) {
|
|
245348
|
+
const headerName = expression.slice("habits.header.".length).toLowerCase();
|
|
245349
|
+
const headers = context.habits?.headers || {};
|
|
245350
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
245351
|
+
if (key.toLowerCase() === headerName) {
|
|
245352
|
+
return value;
|
|
245353
|
+
}
|
|
245354
|
+
}
|
|
245355
|
+
this.logger.warn(`\u26A0\uFE0F Header '${headerName}' not found`);
|
|
245356
|
+
return "";
|
|
245357
|
+
}
|
|
245294
245358
|
if (expression.includes(".") || expression.includes("[")) {
|
|
245295
245359
|
const parts = [];
|
|
245296
245360
|
let current = "";
|
|
@@ -245347,6 +245411,58 @@ var WorkflowExecutor = class {
|
|
|
245347
245411
|
return false;
|
|
245348
245412
|
}
|
|
245349
245413
|
}
|
|
245414
|
+
// TODO: Allow functions to use context and node outputs
|
|
245415
|
+
// TODO: Implement a way to register custom functions that can be used in habits.function.* expressions, with access to context and other utilities
|
|
245416
|
+
/**
|
|
245417
|
+
* Evaluate habits.function.* utility functions
|
|
245418
|
+
* Supported functions:
|
|
245419
|
+
* - date() - Returns current date in ISO format
|
|
245420
|
+
* - now() - Alias for date()
|
|
245421
|
+
* - timestamp() - Returns Unix timestamp in milliseconds
|
|
245422
|
+
* - uuid() - Generates a random UUID
|
|
245423
|
+
* - random(min, max) - Generates random number in range
|
|
245424
|
+
* - stringify(value) - Converts value to JSON string (value should be context path)
|
|
245425
|
+
*/
|
|
245426
|
+
evaluateHabitsFunction(funcCall) {
|
|
245427
|
+
const funcMatch = funcCall.match(/^(\w+)\((.*)\)$/);
|
|
245428
|
+
if (!funcMatch) {
|
|
245429
|
+
this.logger.warn(`\u26A0\uFE0F Invalid function call: ${funcCall}`);
|
|
245430
|
+
return "";
|
|
245431
|
+
}
|
|
245432
|
+
const [, funcName, argsStr] = funcMatch;
|
|
245433
|
+
const args = argsStr ? argsStr.split(",").map((a) => a.trim()) : [];
|
|
245434
|
+
switch (funcName) {
|
|
245435
|
+
case "date":
|
|
245436
|
+
case "now":
|
|
245437
|
+
return (/* @__PURE__ */ new Date()).toISOString();
|
|
245438
|
+
case "timestamp":
|
|
245439
|
+
return Date.now();
|
|
245440
|
+
case "uuid":
|
|
245441
|
+
return (0, import_uuid.v4)();
|
|
245442
|
+
case "random": {
|
|
245443
|
+
const min = args[0] ? parseFloat(args[0]) : 0;
|
|
245444
|
+
const max = args[1] ? parseFloat(args[1]) : 1;
|
|
245445
|
+
return Math.random() * (max - min) + min;
|
|
245446
|
+
}
|
|
245447
|
+
case "randomInt": {
|
|
245448
|
+
const min = args[0] ? parseInt(args[0], 10) : 0;
|
|
245449
|
+
const max = args[1] ? parseInt(args[1], 10) : 100;
|
|
245450
|
+
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
245451
|
+
}
|
|
245452
|
+
case "stringify":
|
|
245453
|
+
if (args[0]) {
|
|
245454
|
+
try {
|
|
245455
|
+
return JSON.stringify(args[0]);
|
|
245456
|
+
} catch {
|
|
245457
|
+
return String(args[0]);
|
|
245458
|
+
}
|
|
245459
|
+
}
|
|
245460
|
+
return "";
|
|
245461
|
+
default:
|
|
245462
|
+
this.logger.warn(`\u26A0\uFE0F Unknown function: ${funcName}`);
|
|
245463
|
+
return "";
|
|
245464
|
+
}
|
|
245465
|
+
}
|
|
245350
245466
|
/**
|
|
245351
245467
|
* Get execution status
|
|
245352
245468
|
*/
|
|
@@ -246182,8 +246298,8 @@ function generateWebhookPaths() {
|
|
|
246182
246298
|
};
|
|
246183
246299
|
}
|
|
246184
246300
|
function generateWorkflowExecutePath(loadedWorkflow, schemas) {
|
|
246185
|
-
const workflowId = loadedWorkflow.reference.id || loadedWorkflow.workflow.id || "unnamed";
|
|
246186
246301
|
const workflow = loadedWorkflow.workflow;
|
|
246302
|
+
const workflowId = workflow.id;
|
|
246187
246303
|
const habitsSchema = extractWorkflowHabitsSchema(workflow);
|
|
246188
246304
|
const requestSchema = generateWorkflowRequestSchema(habitsSchema);
|
|
246189
246305
|
const headerParams = generateWorkflowHeaderParams(habitsSchema);
|
|
@@ -246249,7 +246365,7 @@ ${workflow.description}`;
|
|
|
246249
246365
|
executionId: "exec-uuid-1234",
|
|
246250
246366
|
workflowId,
|
|
246251
246367
|
status: "completed",
|
|
246252
|
-
output: { result: "
|
|
246368
|
+
output: { result: "output data" },
|
|
246253
246369
|
startTime: "2025-12-29T10:00:00.000Z",
|
|
246254
246370
|
endTime: "2025-12-29T10:00:05.000Z",
|
|
246255
246371
|
nodeResults: []
|
|
@@ -247082,7 +247198,11 @@ var WorkflowExecutorServer = class {
|
|
|
247082
247198
|
}
|
|
247083
247199
|
}
|
|
247084
247200
|
if (isDebugMode) {
|
|
247085
|
-
|
|
247201
|
+
if (execution.status === "failed") {
|
|
247202
|
+
res.status(500).json(execution);
|
|
247203
|
+
} else {
|
|
247204
|
+
res.json(execution);
|
|
247205
|
+
}
|
|
247086
247206
|
} else {
|
|
247087
247207
|
const nodeResults = execution.nodeStatuses.filter((ns) => {
|
|
247088
247208
|
if (ns.status !== "completed") return false;
|
|
@@ -247109,7 +247229,11 @@ var WorkflowExecutorServer = class {
|
|
|
247109
247229
|
endTime: execution.endTime?.toISOString() || (/* @__PURE__ */ new Date()).toISOString(),
|
|
247110
247230
|
nodeResults
|
|
247111
247231
|
};
|
|
247112
|
-
|
|
247232
|
+
if (execution.status === "failed") {
|
|
247233
|
+
res.status(500).json(response);
|
|
247234
|
+
} else {
|
|
247235
|
+
res.json(response);
|
|
247236
|
+
}
|
|
247113
247237
|
}
|
|
247114
247238
|
}
|
|
247115
247239
|
} catch (error) {
|
|
@@ -247161,13 +247285,13 @@ var WorkflowExecutorServer = class {
|
|
|
247161
247285
|
} else {
|
|
247162
247286
|
console.warn(`\u26A0\uFE0F Frontend path not found: ${frontendPath}`);
|
|
247163
247287
|
this.app.get("/", (req, res) => {
|
|
247164
|
-
res.send("Habits
|
|
247288
|
+
res.send("Habits Cortex - Frontend path configured but not found");
|
|
247165
247289
|
});
|
|
247166
247290
|
}
|
|
247167
247291
|
} else {
|
|
247168
247292
|
this.app.get("/", (req, res) => {
|
|
247169
247293
|
const workflows = this.executor.getAllWorkflows();
|
|
247170
|
-
res.send(`Habits
|
|
247294
|
+
res.send(`Habits Cortex
|
|
247171
247295
|
|
|
247172
247296
|
Loaded workflows: ${workflows.length}
|
|
247173
247297
|
|