@visactor/react-vtable 1.9.2-alpha.0 → 1.9.2-alpha.2

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.
@@ -714,104 +714,64 @@
714
714
  var eventemitter3Exports = eventemitter3.exports;
715
715
  var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
716
716
 
717
- const isType = (value, type) => Object.prototype.toString.call(value) === `[object ${type}]`;
718
- var isType$1 = isType;
719
-
720
- const isBoolean = function (value) {
721
- let fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
722
- return fuzzy ? "boolean" == typeof value : !0 === value || !1 === value || isType$1(value, "Boolean");
723
- };
724
- var isBoolean$1 = isBoolean;
717
+ const isType$2 = (value, type) => Object.prototype.toString.call(value) === `[object ${type}]`;
718
+ var isType$3 = isType$2;
725
719
 
726
- const isFunction = value => "function" == typeof value;
727
- var isFunction$1 = isFunction;
720
+ const isFunction$2 = value => "function" == typeof value;
721
+ var isFunction$3 = isFunction$2;
728
722
 
729
- const isNil = value => null == value;
730
- var isNil$1 = isNil;
723
+ const isNil$2 = value => null == value;
724
+ var isNil$3 = isNil$2;
731
725
 
732
- const isValid = value => null != value;
733
- var isValid$1 = isValid;
726
+ const isValid$2 = value => null != value;
727
+ var isValid$3 = isValid$2;
734
728
 
735
- const isObject = value => {
729
+ const isObject$2 = value => {
736
730
  const type = typeof value;
737
731
  return null !== value && "object" === type || "function" === type;
738
732
  };
739
- var isObject$1 = isObject;
733
+ var isObject$3 = isObject$2;
740
734
 
741
- const isObjectLike = value => "object" == typeof value && null !== value;
742
- var isObjectLike$1 = isObjectLike;
735
+ const isObjectLike$2 = value => "object" == typeof value && null !== value;
736
+ var isObjectLike$3 = isObjectLike$2;
743
737
 
744
- const isPlainObject = function (value) {
745
- if (!isObjectLike$1(value) || !isType$1(value, "Object")) return !1;
738
+ const isPlainObject$2 = function (value) {
739
+ if (!isObjectLike$3(value) || !isType$3(value, "Object")) return !1;
746
740
  if (null === Object.getPrototypeOf(value)) return !0;
747
741
  let proto = value;
748
742
  for (; null !== Object.getPrototypeOf(proto);) proto = Object.getPrototypeOf(proto);
749
743
  return Object.getPrototypeOf(value) === proto;
750
744
  };
751
- var isPlainObject$1 = isPlainObject;
745
+ var isPlainObject$3 = isPlainObject$2;
752
746
 
753
- const isString = function (value) {
747
+ const isString$2 = function (value) {
754
748
  let fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
755
749
  const type = typeof value;
756
- return fuzzy ? "string" === type : "string" === type || isType$1(value, "String");
750
+ return fuzzy ? "string" === type : "string" === type || isType$3(value, "String");
757
751
  };
758
- var isString$1 = isString;
752
+ var isString$3 = isString$2;
759
753
 
760
- const isArray = value => Array.isArray ? Array.isArray(value) : isType$1(value, "Array");
761
- var isArray$1 = isArray;
754
+ const isArray$2 = value => Array.isArray ? Array.isArray(value) : isType$3(value, "Array");
755
+ var isArray$3 = isArray$2;
762
756
 
763
- const isArrayLike = function (value) {
757
+ const isArrayLike$2 = function (value) {
764
758
  return null !== value && "function" != typeof value && Number.isFinite(value.length);
765
759
  };
766
- var isArrayLike$1 = isArrayLike;
760
+ var isArrayLike$3 = isArrayLike$2;
767
761
 
768
- const isNumber = function (value) {
762
+ const isNumber$2 = function (value) {
769
763
  let fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
770
764
  const type = typeof value;
771
- return fuzzy ? "number" === type : "number" === type || isType$1(value, "Number");
765
+ return fuzzy ? "number" === type : "number" === type || isType$3(value, "Number");
772
766
  };
773
- var isNumber$1 = isNumber;
774
-
775
- const isValidNumber = value => isNumber$1(value) && Number.isFinite(value);
776
- var isValidNumber$1 = isValidNumber;
777
-
778
- const isValidUrl = value => new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(value);
779
- var isValidUrl$1 = isValidUrl;
780
-
781
- const isBase64 = value => new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(value);
782
- var isBase64$1 = isBase64;
783
-
784
- const getType = value => ({}).toString.call(value).replace(/^\[object /, "").replace(/]$/, "");
785
- var getType$1 = getType;
786
-
787
- const objectProto = Object.prototype,
788
- isPrototype = function (value) {
789
- const Ctor = value && value.constructor;
790
- return value === ("function" == typeof Ctor && Ctor.prototype || objectProto);
791
- };
792
- var isPrototype$1 = isPrototype;
793
-
794
- const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
795
- function isEmpty(value) {
796
- if (isNil$1(value)) return !0;
797
- if (isArrayLike$1(value)) return !value.length;
798
- const type = getType$1(value);
799
- if ("Map" === type || "Set" === type) return !value.size;
800
- if (isPrototype$1(value)) return !Object.keys(value).length;
801
- for (const key in value) if (hasOwnProperty$1.call(value, key)) return !1;
802
- return !0;
803
- }
804
-
805
- const hasOwnProperty = Object.prototype.hasOwnProperty,
806
- has = (object, key) => null != object && hasOwnProperty.call(object, key);
807
- var has$1 = has;
767
+ var isNumber$3 = isNumber$2;
808
768
 
809
- function baseMerge(target, source) {
769
+ function baseMerge$1(target, source) {
810
770
  let shallowArray = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
811
771
  let skipTargetArray = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
812
772
  if (source) {
813
773
  if (target === source) return;
814
- if (isValid$1(source) && "object" == typeof source) {
774
+ if (isValid$3(source) && "object" == typeof source) {
815
775
  const iterable = Object(source),
816
776
  props = [];
817
777
  for (const key in iterable) props.push(key);
@@ -821,51 +781,51 @@
821
781
  propIndex = -1;
822
782
  for (; length--;) {
823
783
  const key = props[++propIndex];
824
- !isValid$1(iterable[key]) || "object" != typeof iterable[key] || skipTargetArray && isArray$1(target[key]) ? assignMergeValue(target, key, iterable[key]) : baseMergeDeep(target, source, key, shallowArray, skipTargetArray);
784
+ !isValid$3(iterable[key]) || "object" != typeof iterable[key] || skipTargetArray && isArray$3(target[key]) ? assignMergeValue$1(target, key, iterable[key]) : baseMergeDeep$1(target, source, key, shallowArray, skipTargetArray);
825
785
  }
826
786
  }
827
787
  }
828
788
  }
829
- function baseMergeDeep(target, source, key) {
789
+ function baseMergeDeep$1(target, source, key) {
830
790
  let shallowArray = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
831
791
  let skipTargetArray = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : !1;
832
792
  const objValue = target[key],
833
793
  srcValue = source[key];
834
794
  let newValue = source[key],
835
795
  isCommon = !0;
836
- if (isArray$1(srcValue)) {
837
- if (shallowArray) newValue = [];else if (isArray$1(objValue)) newValue = objValue;else if (isArrayLike$1(objValue)) {
796
+ if (isArray$3(srcValue)) {
797
+ if (shallowArray) newValue = [];else if (isArray$3(objValue)) newValue = objValue;else if (isArrayLike$3(objValue)) {
838
798
  newValue = new Array(objValue.length);
839
799
  let index = -1;
840
800
  const length = objValue.length;
841
801
  for (; ++index < length;) newValue[index] = objValue[index];
842
802
  }
843
- } else isPlainObject$1(srcValue) ? (newValue = null != objValue ? objValue : {}, "function" != typeof objValue && "object" == typeof objValue || (newValue = {})) : isCommon = !1;
844
- isCommon && baseMerge(newValue, srcValue, shallowArray, skipTargetArray), assignMergeValue(target, key, newValue);
803
+ } else isPlainObject$3(srcValue) ? (newValue = null != objValue ? objValue : {}, "function" != typeof objValue && "object" == typeof objValue || (newValue = {})) : isCommon = !1;
804
+ isCommon && baseMerge$1(newValue, srcValue, shallowArray, skipTargetArray), assignMergeValue$1(target, key, newValue);
845
805
  }
846
- function assignMergeValue(target, key, value) {
847
- (void 0 !== value && !eq(target[key], value) || void 0 === value && !(key in target)) && (target[key] = value);
806
+ function assignMergeValue$1(target, key, value) {
807
+ (void 0 !== value && !eq$1(target[key], value) || void 0 === value && !(key in target)) && (target[key] = value);
848
808
  }
849
- function eq(value, other) {
809
+ function eq$1(value, other) {
850
810
  return value === other || Number.isNaN(value) && Number.isNaN(other);
851
811
  }
852
- function merge(target) {
812
+ function merge$1(target) {
853
813
  let sourceIndex = -1;
854
814
  const length = arguments.length <= 1 ? 0 : arguments.length - 1;
855
815
  for (; ++sourceIndex < length;) {
856
- baseMerge(target, sourceIndex + 1 < 1 || arguments.length <= sourceIndex + 1 ? undefined : arguments[sourceIndex + 1], !0);
816
+ baseMerge$1(target, sourceIndex + 1 < 1 || arguments.length <= sourceIndex + 1 ? undefined : arguments[sourceIndex + 1], !0);
857
817
  }
858
818
  return target;
859
819
  }
860
820
 
861
821
  function pickWithout(obj, keys) {
862
- if (!obj || !isPlainObject$1(obj)) return obj;
822
+ if (!obj || !isPlainObject$3(obj)) return obj;
863
823
  const result = {};
864
824
  return Object.keys(obj).forEach(k => {
865
825
  const v = obj[k];
866
826
  let match = !1;
867
827
  keys.forEach(itKey => {
868
- (isString$1(itKey) && itKey === k || itKey instanceof RegExp && k.match(itKey)) && (match = !0);
828
+ (isString$3(itKey) && itKey === k || itKey instanceof RegExp && k.match(itKey)) && (match = !0);
869
829
  }), match || (result[k] = v);
870
830
  }), result;
871
831
  }
@@ -882,14 +842,14 @@
882
842
  if (null == a || null == b) return !1;
883
843
  if (Number.isNaN(a) && Number.isNaN(b)) return !0;
884
844
  if (objToString(a) !== objToString(b)) return !1;
885
- if (isFunction$1(a)) return !!(null == options ? void 0 : options.skipFunction);
845
+ if (isFunction$3(a)) return !!(null == options ? void 0 : options.skipFunction);
886
846
  if ("object" != typeof a) return !1;
887
- if (isArray$1(a)) {
847
+ if (isArray$3(a)) {
888
848
  if (a.length !== b.length) return !1;
889
849
  for (let i = a.length - 1; i >= 0; i--) if (!isEqual(a[i], b[i], options)) return !1;
890
850
  return !0;
891
851
  }
892
- if (!isPlainObject$1(a)) return !1;
852
+ if (!isPlainObject$3(a)) return !1;
893
853
  const ka = objectKeys(a),
894
854
  kb = objectKeys(b);
895
855
  if (ka.length !== kb.length) return !1;
@@ -902,1871 +862,2078 @@
902
862
  return !0;
903
863
  }
904
864
 
905
- function arrayEqual(a, b) {
906
- if (!isArray$1(a) || !isArray$1(b)) return !1;
907
- if (a.length !== b.length) return !1;
908
- for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return !1;
909
- return !0;
910
- }
911
-
912
- const hasConsole = "undefined" != typeof console;
913
- function log(method, level, input) {
914
- const args = [level].concat([].slice.call(input));
915
- hasConsole && console[method].apply(console, args);
916
- }
917
- var LoggerLevel;
918
- !function (LoggerLevel) {
919
- LoggerLevel[LoggerLevel.None = 0] = "None", LoggerLevel[LoggerLevel.Error = 1] = "Error", LoggerLevel[LoggerLevel.Warn = 2] = "Warn", LoggerLevel[LoggerLevel.Info = 3] = "Info", LoggerLevel[LoggerLevel.Debug = 4] = "Debug";
920
- }(LoggerLevel || (LoggerLevel = {}));
921
- class Logger {
922
- static getInstance(level, method) {
923
- return Logger._instance && isNumber$1(level) ? Logger._instance.level(level) : Logger._instance || (Logger._instance = new Logger(level, method)), Logger._instance;
924
- }
925
- static setInstance(logger) {
926
- return Logger._instance = logger;
927
- }
928
- static setInstanceLevel(level) {
929
- Logger._instance ? Logger._instance.level(level) : Logger._instance = new Logger(level);
930
- }
931
- static clearInstance() {
932
- Logger._instance = null;
933
- }
934
- constructor() {
935
- let level = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : LoggerLevel.None;
936
- let method = arguments.length > 1 ? arguments[1] : undefined;
937
- this._onErrorHandler = [], this._level = level, this._method = method;
938
- }
939
- addErrorHandler(handler) {
940
- this._onErrorHandler.find(h => h === handler) || this._onErrorHandler.push(handler);
941
- }
942
- removeErrorHandler(handler) {
943
- const index = this._onErrorHandler.findIndex(h => h === handler);
944
- index < 0 || this._onErrorHandler.splice(index, 1);
945
- }
946
- callErrorHandler() {
947
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
948
- args[_key] = arguments[_key];
949
- }
950
- this._onErrorHandler.forEach(h => h(...args));
951
- }
952
- canLogInfo() {
953
- return this._level >= LoggerLevel.Info;
954
- }
955
- canLogDebug() {
956
- return this._level >= LoggerLevel.Debug;
957
- }
958
- canLogError() {
959
- return this._level >= LoggerLevel.Error;
960
- }
961
- canLogWarn() {
962
- return this._level >= LoggerLevel.Warn;
963
- }
964
- level(levelValue) {
965
- return arguments.length ? (this._level = +levelValue, this) : this._level;
966
- }
967
- error() {
968
- var _a;
969
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
970
- args[_key2] = arguments[_key2];
971
- }
972
- return this._level >= LoggerLevel.Error && (this._onErrorHandler.length ? this.callErrorHandler(...args) : log(null !== (_a = this._method) && void 0 !== _a ? _a : "error", "ERROR", args)), this;
973
- }
974
- warn() {
975
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
976
- args[_key3] = arguments[_key3];
977
- }
978
- return this._level >= LoggerLevel.Warn && log(this._method || "warn", "WARN", args), this;
979
- }
980
- info() {
981
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
982
- args[_key4] = arguments[_key4];
983
- }
984
- return this._level >= LoggerLevel.Info && log(this._method || "log", "INFO", args), this;
985
- }
986
- debug() {
987
- for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
988
- args[_key5] = arguments[_key5];
989
- }
990
- return this._level >= LoggerLevel.Debug && log(this._method || "log", "DEBUG", args), this;
865
+ const calculateAnchorOfBounds$1 = (bounds, anchorType) => {
866
+ const {
867
+ x1: x1,
868
+ x2: x2,
869
+ y1: y1,
870
+ y2: y2
871
+ } = bounds,
872
+ rectWidth = Math.abs(x2 - x1),
873
+ rectHeight = Math.abs(y2 - y1);
874
+ let anchorX = (x1 + x2) / 2,
875
+ anchorY = (y1 + y2) / 2,
876
+ sx = 0,
877
+ sy = 0;
878
+ switch (anchorType) {
879
+ case "top":
880
+ case "inside-top":
881
+ sy = -.5;
882
+ break;
883
+ case "bottom":
884
+ case "inside-bottom":
885
+ sy = .5;
886
+ break;
887
+ case "left":
888
+ case "inside-left":
889
+ sx = -.5;
890
+ break;
891
+ case "right":
892
+ case "inside-right":
893
+ sx = .5;
894
+ break;
895
+ case "top-right":
896
+ sx = .5, sy = -.5;
897
+ break;
898
+ case "top-left":
899
+ sx = -.5, sy = -.5;
900
+ break;
901
+ case "bottom-right":
902
+ sx = .5, sy = .5;
903
+ break;
904
+ case "bottom-left":
905
+ sx = -.5, sy = .5;
991
906
  }
992
- }
993
- Logger._instance = null;
907
+ return anchorX += sx * rectWidth, anchorY += sy * rectHeight, {
908
+ x: anchorX,
909
+ y: anchorY
910
+ };
911
+ };
994
912
 
995
- const clamp = function (input, min, max) {
996
- return input < min ? min : input > max ? max : input;
913
+ const styleStringToObject$1 = function () {
914
+ let styleStr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
915
+ const res = {};
916
+ return styleStr.split(";").forEach(item => {
917
+ if (item) {
918
+ const arr = item.split(":");
919
+ if (2 === arr.length) {
920
+ const key = arr[0].trim(),
921
+ value = arr[1].trim();
922
+ key && value && (res[key] = value);
923
+ }
924
+ }
925
+ }), res;
997
926
  };
998
- var clamp$1 = clamp;
999
927
 
1000
- const epsilon = 1e-12;
1001
- const pi = Math.PI;
1002
- const halfPi$1 = pi / 2;
1003
- const tau = 2 * pi;
1004
- const pi2 = 2 * Math.PI;
1005
- const abs = Math.abs;
1006
- const atan2 = Math.atan2;
1007
- const cos = Math.cos;
1008
- const max = Math.max;
1009
- const min = Math.min;
1010
- const sin = Math.sin;
1011
- const sqrt = Math.sqrt;
1012
- const pow = Math.pow;
1013
- function asin(x) {
1014
- return x >= 1 ? halfPi$1 : x <= -1 ? -halfPi$1 : Math.asin(x);
1015
- }
928
+ var reactIs = {exports: {}};
1016
929
 
1017
- class Point {
1018
- constructor() {
1019
- let x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1020
- let y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1021
- let x1 = arguments.length > 2 ? arguments[2] : undefined;
1022
- let y1 = arguments.length > 3 ? arguments[3] : undefined;
1023
- this.x = 0, this.y = 0, this.x = x, this.y = y, this.x1 = x1, this.y1 = y1;
1024
- }
1025
- clone() {
1026
- return new Point(this.x, this.y);
1027
- }
1028
- copyFrom(p) {
1029
- return this.x = p.x, this.y = p.y, this.x1 = p.x1, this.y1 = p.y1, this.defined = p.defined, this.context = p.context, this;
1030
- }
1031
- set(x, y) {
1032
- return this.x = x, this.y = y, this;
1033
- }
1034
- add(point) {
1035
- return isNumber$1(point) ? (this.x += point, void (this.y += point)) : (this.x += point.x, this.y += point.y, this);
1036
- }
1037
- sub(point) {
1038
- return isNumber$1(point) ? (this.x -= point, void (this.y -= point)) : (this.x -= point.x, this.y -= point.y, this);
1039
- }
1040
- multi(point) {
1041
- throw new Error("暂不支持");
1042
- }
1043
- div(point) {
1044
- throw new Error("暂不支持");
1045
- }
1046
- }
1047
- class PointService {
1048
- static distancePP(p1, p2) {
1049
- return sqrt(pow(p1.x - p2.x, 2) + pow(p1.y - p2.y, 2));
1050
- }
1051
- static distanceNN(x, y, x1, y1) {
1052
- return sqrt(pow(x - x1, 2) + pow(y - y1, 2));
1053
- }
1054
- static distancePN(point, x, y) {
1055
- return sqrt(pow(x - point.x, 2) + pow(y - point.y, 2));
1056
- }
1057
- static pointAtPP(p1, p2, t) {
1058
- return new Point((p2.x - p1.x) * t + p1.x, (p2.y - p1.y) * t + p1.y);
1059
- }
1060
- }
1061
-
1062
- function degreeToRadian(degree) {
1063
- return degree * (Math.PI / 180);
1064
- }
1065
- function radianToDegree(radian) {
1066
- return 180 * radian / Math.PI;
1067
- }
1068
- const clampRadian = function () {
1069
- let angle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1070
- if (angle < 0) for (; angle < -tau;) angle += tau;else if (angle > 0) for (; angle > tau;) angle -= tau;
1071
- return angle;
1072
- };
1073
- const clampAngleByRadian = clampRadian;
930
+ var reactIs_production_min = {};
1074
931
 
1075
- var InnerBBox;
1076
- !function (InnerBBox) {
1077
- InnerBBox[InnerBBox.NONE = 0] = "NONE", InnerBBox[InnerBBox.BBOX1 = 1] = "BBOX1", InnerBBox[InnerBBox.BBOX2 = 2] = "BBOX2";
1078
- }(InnerBBox || (InnerBBox = {}));
1079
- function getProjectionRadius(checkAxis, axis) {
1080
- return Math.abs(axis[0] * checkAxis[0] + axis[1] * checkAxis[1]);
1081
- }
1082
- function rotatePoint(_ref, rad) {
1083
- let {
1084
- x: x,
1085
- y: y
1086
- } = _ref;
1087
- let origin = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
1088
- x: 0,
1089
- y: 0
932
+ /**
933
+ * @license React
934
+ * react-is.production.min.js
935
+ *
936
+ * Copyright (c) Facebook, Inc. and its affiliates.
937
+ *
938
+ * This source code is licensed under the MIT license found in the
939
+ * LICENSE file in the root directory of this source tree.
940
+ */
941
+ var hasRequiredReactIs_production_min;
942
+ function requireReactIs_production_min() {
943
+ if (hasRequiredReactIs_production_min) return reactIs_production_min;
944
+ hasRequiredReactIs_production_min = 1;
945
+ var b = Symbol.for("react.element"),
946
+ c = Symbol.for("react.portal"),
947
+ d = Symbol.for("react.fragment"),
948
+ e = Symbol.for("react.strict_mode"),
949
+ f = Symbol.for("react.profiler"),
950
+ g = Symbol.for("react.provider"),
951
+ h = Symbol.for("react.context"),
952
+ k = Symbol.for("react.server_context"),
953
+ l = Symbol.for("react.forward_ref"),
954
+ m = Symbol.for("react.suspense"),
955
+ n = Symbol.for("react.suspense_list"),
956
+ p = Symbol.for("react.memo"),
957
+ q = Symbol.for("react.lazy"),
958
+ t = Symbol.for("react.offscreen"),
959
+ u;
960
+ u = Symbol.for("react.module.reference");
961
+ function v(a) {
962
+ if ("object" === typeof a && null !== a) {
963
+ var r = a.$$typeof;
964
+ switch (r) {
965
+ case b:
966
+ switch (a = a.type, a) {
967
+ case d:
968
+ case f:
969
+ case e:
970
+ case m:
971
+ case n:
972
+ return a;
973
+ default:
974
+ switch (a = a && a.$$typeof, a) {
975
+ case k:
976
+ case h:
977
+ case l:
978
+ case q:
979
+ case p:
980
+ case g:
981
+ return a;
982
+ default:
983
+ return r;
984
+ }
985
+ }
986
+ case c:
987
+ return r;
988
+ }
989
+ }
990
+ }
991
+ reactIs_production_min.ContextConsumer = h;
992
+ reactIs_production_min.ContextProvider = g;
993
+ reactIs_production_min.Element = b;
994
+ reactIs_production_min.ForwardRef = l;
995
+ reactIs_production_min.Fragment = d;
996
+ reactIs_production_min.Lazy = q;
997
+ reactIs_production_min.Memo = p;
998
+ reactIs_production_min.Portal = c;
999
+ reactIs_production_min.Profiler = f;
1000
+ reactIs_production_min.StrictMode = e;
1001
+ reactIs_production_min.Suspense = m;
1002
+ reactIs_production_min.SuspenseList = n;
1003
+ reactIs_production_min.isAsyncMode = function () {
1004
+ return !1;
1090
1005
  };
1091
- return {
1092
- x: (x - origin.x) * Math.cos(rad) - (y - origin.y) * Math.sin(rad) + origin.x,
1093
- y: (x - origin.x) * Math.sin(rad) + (y - origin.y) * Math.cos(rad) + origin.y
1006
+ reactIs_production_min.isConcurrentMode = function () {
1007
+ return !1;
1094
1008
  };
1095
- }
1096
- function getCenterPoint(box) {
1097
- return {
1098
- x: (box.x1 + box.x2) / 2,
1099
- y: (box.y1 + box.y2) / 2
1009
+ reactIs_production_min.isContextConsumer = function (a) {
1010
+ return v(a) === h;
1100
1011
  };
1101
- }
1102
- function toRect(box, isDeg) {
1103
- const deg = isDeg ? degreeToRadian(box.angle) : box.angle,
1104
- cp = getCenterPoint(box);
1105
- return [rotatePoint({
1106
- x: box.x1,
1107
- y: box.y1
1108
- }, deg, cp), rotatePoint({
1109
- x: box.x2,
1110
- y: box.y1
1111
- }, deg, cp), rotatePoint({
1112
- x: box.x2,
1113
- y: box.y2
1114
- }, deg, cp), rotatePoint({
1115
- x: box.x1,
1116
- y: box.y2
1117
- }, deg, cp)];
1118
- }
1119
- function isRotateAABBIntersect(box1, box2) {
1120
- let isDeg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
1121
- let ctx = arguments.length > 3 ? arguments[3] : undefined;
1122
- const rect1 = toRect(box1, isDeg),
1123
- rect2 = toRect(box2, isDeg),
1124
- vector = (start, end) => [end.x - start.x, end.y - start.y];
1125
- ctx && (ctx.save(), ctx.fillStyle = "red", ctx.globalAlpha = .6, rect1.forEach((item, index) => {
1126
- 0 === index ? ctx.moveTo(item.x, item.y) : ctx.lineTo(item.x, item.y);
1127
- }), ctx.fill(), ctx.restore(), ctx.save(), ctx.fillStyle = "green", ctx.globalAlpha = .6, rect2.forEach((item, index) => {
1128
- 0 === index ? ctx.moveTo(item.x, item.y) : ctx.lineTo(item.x, item.y);
1129
- }), ctx.fill(), ctx.restore());
1130
- const p1 = getCenterPoint(box1),
1131
- p2 = getCenterPoint(box2);
1132
- ctx && ctx.fillRect(p1.x, p1.y, 2, 2), ctx && ctx.fillRect(p2.x, p2.y, 2, 2);
1133
- const vp1p2 = vector(p1, p2),
1134
- AB = vector(rect1[0], rect1[1]),
1135
- BC = vector(rect1[1], rect1[2]),
1136
- A1B1 = vector(rect2[0], rect2[1]),
1137
- B1C1 = vector(rect2[1], rect2[2]),
1138
- deg11 = isDeg ? degreeToRadian(box1.angle) : box1.angle;
1139
- let deg12 = isDeg ? degreeToRadian(90 - box1.angle) : box1.angle + halfPi$1;
1140
- const deg21 = isDeg ? degreeToRadian(box2.angle) : box2.angle;
1141
- let deg22 = isDeg ? degreeToRadian(90 - box2.angle) : box2.angle + halfPi$1;
1142
- deg12 > pi2 && (deg12 -= pi2), deg22 > pi2 && (deg22 -= pi2);
1143
- const isCover = (checkAxisRadius, deg, targetAxis1, targetAxis2) => {
1144
- const checkAxis = [Math.cos(deg), Math.sin(deg)];
1145
- return checkAxisRadius + (getProjectionRadius(checkAxis, targetAxis1) + getProjectionRadius(checkAxis, targetAxis2)) / 2 > getProjectionRadius(checkAxis, vp1p2);
1012
+ reactIs_production_min.isContextProvider = function (a) {
1013
+ return v(a) === g;
1146
1014
  };
1147
- return isCover((box1.x2 - box1.x1) / 2, deg11, A1B1, B1C1) && isCover((box1.y2 - box1.y1) / 2, deg12, A1B1, B1C1) && isCover((box2.x2 - box2.x1) / 2, deg21, AB, BC) && isCover((box2.y2 - box2.y1) / 2, deg22, AB, BC);
1015
+ reactIs_production_min.isElement = function (a) {
1016
+ return "object" === typeof a && null !== a && a.$$typeof === b;
1017
+ };
1018
+ reactIs_production_min.isForwardRef = function (a) {
1019
+ return v(a) === l;
1020
+ };
1021
+ reactIs_production_min.isFragment = function (a) {
1022
+ return v(a) === d;
1023
+ };
1024
+ reactIs_production_min.isLazy = function (a) {
1025
+ return v(a) === q;
1026
+ };
1027
+ reactIs_production_min.isMemo = function (a) {
1028
+ return v(a) === p;
1029
+ };
1030
+ reactIs_production_min.isPortal = function (a) {
1031
+ return v(a) === c;
1032
+ };
1033
+ reactIs_production_min.isProfiler = function (a) {
1034
+ return v(a) === f;
1035
+ };
1036
+ reactIs_production_min.isStrictMode = function (a) {
1037
+ return v(a) === e;
1038
+ };
1039
+ reactIs_production_min.isSuspense = function (a) {
1040
+ return v(a) === m;
1041
+ };
1042
+ reactIs_production_min.isSuspenseList = function (a) {
1043
+ return v(a) === n;
1044
+ };
1045
+ reactIs_production_min.isValidElementType = function (a) {
1046
+ return "string" === typeof a || "function" === typeof a || a === d || a === f || a === e || a === m || a === n || a === t || "object" === typeof a && null !== a && (a.$$typeof === q || a.$$typeof === p || a.$$typeof === g || a.$$typeof === h || a.$$typeof === l || a.$$typeof === u || void 0 !== a.getModuleId) ? !0 : !1;
1047
+ };
1048
+ reactIs_production_min.typeOf = v;
1049
+ return reactIs_production_min;
1148
1050
  }
1149
1051
 
1150
- function getContextFont(text) {
1151
- let defaultAttr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1152
- let fontSizeScale = arguments.length > 2 ? arguments[2] : undefined;
1153
- fontSizeScale || (fontSizeScale = 1);
1154
- const {
1155
- fontStyle = defaultAttr.fontStyle,
1156
- fontVariant = defaultAttr.fontVariant,
1157
- fontWeight = defaultAttr.fontWeight,
1158
- fontSize = defaultAttr.fontSize,
1159
- fontFamily = defaultAttr.fontFamily
1160
- } = text;
1161
- return (fontStyle ? fontStyle + " " : "") + (fontVariant ? fontVariant + " " : "") + (fontWeight ? fontWeight + " " : "") + fontSize * fontSizeScale + "px " + (fontFamily || "sans-serif");
1052
+ {
1053
+ reactIs.exports = requireReactIs_production_min();
1162
1054
  }
1055
+ var reactIsExports = reactIs.exports;
1163
1056
 
1164
- const calculateAnchorOfBounds = (bounds, anchorType) => {
1165
- const {
1166
- x1: x1,
1167
- x2: x2,
1168
- y1: y1,
1169
- y2: y2
1170
- } = bounds,
1171
- rectWidth = Math.abs(x2 - x1),
1172
- rectHeight = Math.abs(y2 - y1);
1173
- let anchorX = (x1 + x2) / 2,
1174
- anchorY = (y1 + y2) / 2,
1175
- sx = 0,
1176
- sy = 0;
1177
- switch (anchorType) {
1178
- case "top":
1179
- case "inside-top":
1180
- sy = -.5;
1181
- break;
1182
- case "bottom":
1183
- case "inside-bottom":
1184
- sy = .5;
1185
- break;
1186
- case "left":
1187
- case "inside-left":
1188
- sx = -.5;
1189
- break;
1190
- case "right":
1191
- case "inside-right":
1192
- sx = .5;
1193
- break;
1194
- case "top-right":
1195
- sx = .5, sy = -.5;
1196
- break;
1197
- case "top-left":
1198
- sx = -.5, sy = -.5;
1199
- break;
1200
- case "bottom-right":
1201
- sx = .5, sy = .5;
1202
- break;
1203
- case "bottom-left":
1204
- sx = -.5, sy = .5;
1205
- }
1206
- return anchorX += sx * rectWidth, anchorY += sy * rectHeight, {
1207
- x: anchorX,
1208
- y: anchorY
1209
- };
1057
+ const toArray = (children) => {
1058
+ let result = [];
1059
+ React.Children.forEach(children, child => {
1060
+ if (isNil$3(child)) {
1061
+ return;
1062
+ }
1063
+ if (reactIsExports.isFragment(child)) {
1064
+ result = result.concat(toArray(child.props.children));
1065
+ }
1066
+ else {
1067
+ result.push(child);
1068
+ }
1069
+ });
1070
+ return result;
1210
1071
  };
1211
1072
 
1212
- function transformBoundsWithMatrix(out, bounds, matrix) {
1213
- const {
1214
- x1: x1,
1215
- y1: y1,
1216
- x2: x2,
1217
- y2: y2
1218
- } = bounds;
1219
- return matrix.onlyTranslate() ? (out !== bounds && out.setValue(bounds.x1, bounds.y1, bounds.x2, bounds.y2), out.translate(matrix.e, matrix.f), bounds) : (out.clear(), out.add(matrix.a * x1 + matrix.c * y1 + matrix.e, matrix.b * x1 + matrix.d * y1 + matrix.f), out.add(matrix.a * x2 + matrix.c * y1 + matrix.e, matrix.b * x2 + matrix.d * y1 + matrix.f), out.add(matrix.a * x2 + matrix.c * y2 + matrix.e, matrix.b * x2 + matrix.d * y2 + matrix.f), out.add(matrix.a * x1 + matrix.c * y2 + matrix.e, matrix.b * x1 + matrix.d * y2 + matrix.f), bounds);
1220
- }
1221
- class Bounds {
1222
- constructor(bounds) {
1223
- bounds ? this.setValue(bounds.x1, bounds.y1, bounds.x2, bounds.y2) : this.clear();
1224
- }
1225
- clone() {
1226
- return new Bounds(this);
1227
- }
1228
- clear() {
1229
- return this.x1 = +Number.MAX_VALUE, this.y1 = +Number.MAX_VALUE, this.x2 = -Number.MAX_VALUE, this.y2 = -Number.MAX_VALUE, this;
1230
- }
1231
- empty() {
1232
- return this.x1 === +Number.MAX_VALUE && this.y1 === +Number.MAX_VALUE && this.x2 === -Number.MAX_VALUE && this.y2 === -Number.MAX_VALUE;
1233
- }
1234
- equals(b) {
1235
- return this.x1 === b.x1 && this.y1 === b.y1 && this.x2 === b.x2 && this.y2 === b.y2;
1236
- }
1237
- setValue() {
1238
- let x1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1239
- let y1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1240
- let x2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1241
- let y2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
1242
- return this.x1 = x1, this.y1 = y1, this.x2 = x2, this.y2 = y2, this;
1243
- }
1244
- set() {
1245
- let x1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1246
- let y1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1247
- let x2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1248
- let y2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
1249
- return x2 < x1 ? (this.x2 = x1, this.x1 = x2) : (this.x1 = x1, this.x2 = x2), y2 < y1 ? (this.y2 = y1, this.y1 = y2) : (this.y1 = y1, this.y2 = y2), this;
1250
- }
1251
- add() {
1252
- let x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1253
- let y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1254
- return x < this.x1 && (this.x1 = x), y < this.y1 && (this.y1 = y), x > this.x2 && (this.x2 = x), y > this.y2 && (this.y2 = y), this;
1255
- }
1256
- expand() {
1257
- let d = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1258
- return isArray$1(d) ? (this.y1 -= d[0], this.x2 += d[1], this.y2 += d[2], this.x1 -= d[3]) : (this.x1 -= d, this.y1 -= d, this.x2 += d, this.y2 += d), this;
1259
- }
1260
- round() {
1261
- return this.x1 = Math.floor(this.x1), this.y1 = Math.floor(this.y1), this.x2 = Math.ceil(this.x2), this.y2 = Math.ceil(this.y2), this;
1262
- }
1263
- translate() {
1264
- let dx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1265
- let dy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1266
- return this.x1 += dx, this.x2 += dx, this.y1 += dy, this.y2 += dy, this;
1267
- }
1268
- rotate() {
1269
- let angle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1270
- let x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1271
- let y = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1272
- const p = this.rotatedPoints(angle, x, y);
1273
- return this.clear().add(p[0], p[1]).add(p[2], p[3]).add(p[4], p[5]).add(p[6], p[7]);
1274
- }
1275
- scale() {
1276
- let sx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1277
- let sy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1278
- let x = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1279
- let y = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
1280
- const p = this.scalePoints(sx, sy, x, y);
1281
- return this.clear().add(p[0], p[1]).add(p[2], p[3]);
1282
- }
1283
- union(b) {
1284
- return b.x1 < this.x1 && (this.x1 = b.x1), b.y1 < this.y1 && (this.y1 = b.y1), b.x2 > this.x2 && (this.x2 = b.x2), b.y2 > this.y2 && (this.y2 = b.y2), this;
1285
- }
1286
- intersect(b) {
1287
- return b.x1 > this.x1 && (this.x1 = b.x1), b.y1 > this.y1 && (this.y1 = b.y1), b.x2 < this.x2 && (this.x2 = b.x2), b.y2 < this.y2 && (this.y2 = b.y2), this;
1288
- }
1289
- encloses(b) {
1290
- return b && this.x1 <= b.x1 && this.x2 >= b.x2 && this.y1 <= b.y1 && this.y2 >= b.y2;
1291
- }
1292
- alignsWith(b) {
1293
- return b && (this.x1 === b.x1 || this.x2 === b.x2 || this.y1 === b.y1 || this.y2 === b.y2);
1294
- }
1295
- intersects(b) {
1296
- return b && !(this.x2 < b.x1 || this.x1 > b.x2 || this.y2 < b.y1 || this.y1 > b.y2);
1073
+ const REACT_PRIVATE_PROPS = ['children', 'hooks', 'ref'];
1074
+
1075
+ const EVENT_TYPE = {
1076
+ ...vtable.TABLE_EVENT_TYPE,
1077
+ ...vtable.PIVOT_TABLE_EVENT_TYPE,
1078
+ ...vtable.PIVOT_CHART_EVENT_TYPE
1079
+ };
1080
+ const TABLE_EVENTS = {
1081
+ onClickCell: EVENT_TYPE.CLICK_CELL,
1082
+ onDblClickCell: EVENT_TYPE.DBLCLICK_CELL,
1083
+ onMouseDownCell: EVENT_TYPE.MOUSEDOWN_CELL,
1084
+ onMouseUpCell: EVENT_TYPE.MOUSEUP_CELL,
1085
+ onSelectedCell: EVENT_TYPE.SELECTED_CELL,
1086
+ onSelectedClear: EVENT_TYPE.SELECTED_CLEAR,
1087
+ onKeyDown: EVENT_TYPE.KEYDOWN,
1088
+ onMouseEnterTable: EVENT_TYPE.MOUSEENTER_TABLE,
1089
+ onMouseLeaveTable: EVENT_TYPE.MOUSELEAVE_TABLE,
1090
+ onMouseDownTable: EVENT_TYPE.MOUSEDOWN_TABLE,
1091
+ onMouseMoveCell: EVENT_TYPE.MOUSEMOVE_CELL,
1092
+ onMouseEnterCell: EVENT_TYPE.MOUSEENTER_CELL,
1093
+ onMouseLeaveCell: EVENT_TYPE.MOUSELEAVE_CELL,
1094
+ onContextMenuCell: EVENT_TYPE.CONTEXTMENU_CELL,
1095
+ onResizeColumn: EVENT_TYPE.RESIZE_COLUMN,
1096
+ onResizeColumnEnd: EVENT_TYPE.RESIZE_COLUMN_END,
1097
+ onChangeHeaderPosition: EVENT_TYPE.CHANGE_HEADER_POSITION,
1098
+ onSortClick: EVENT_TYPE.SORT_CLICK,
1099
+ onFreezeClick: EVENT_TYPE.FREEZE_CLICK,
1100
+ onScroll: EVENT_TYPE.SCROLL,
1101
+ onDropdownMenuClick: EVENT_TYPE.DROPDOWN_MENU_CLICK,
1102
+ onMouseOverChartSymbol: EVENT_TYPE.MOUSEOVER_CHART_SYMBOL,
1103
+ onDragSelectEnd: EVENT_TYPE.DRAG_SELECT_END,
1104
+ onDropdownIconClick: EVENT_TYPE.DROPDOWN_ICON_CLICK,
1105
+ onDropdownMenuClear: EVENT_TYPE.DROPDOWN_MENU_CLEAR,
1106
+ onTreeHierarchyStateChange: EVENT_TYPE.TREE_HIERARCHY_STATE_CHANGE,
1107
+ onShowMenu: EVENT_TYPE.SHOW_MENU,
1108
+ onHideMenu: EVENT_TYPE.HIDE_MENU,
1109
+ onIconClick: EVENT_TYPE.ICON_CLICK,
1110
+ onLegendItemClick: EVENT_TYPE.LEGEND_ITEM_CLICK,
1111
+ onLegendItemHover: EVENT_TYPE.LEGEND_ITEM_HOVER,
1112
+ onLegendItemUnHover: EVENT_TYPE.LEGEND_ITEM_UNHOVER,
1113
+ onLegendChange: EVENT_TYPE.LEGEND_CHANGE,
1114
+ onMouseEnterAxis: EVENT_TYPE.MOUSEENTER_AXIS,
1115
+ onMouseLeaveAxis: EVENT_TYPE.MOUSELEAVE_AXIS,
1116
+ onCheckboxStateChange: EVENT_TYPE.CHECKBOX_STATE_CHANGE,
1117
+ onRadioStateChange: EVENT_TYPE.RADIO_STATE_CHANGE,
1118
+ onAfterRender: EVENT_TYPE.AFTER_RENDER,
1119
+ onInitialized: EVENT_TYPE.INITIALIZED,
1120
+ onPivotSortClick: EVENT_TYPE.PIVOT_SORT_CLICK,
1121
+ onDrillMenuClick: EVENT_TYPE.DRILLMENU_CLICK,
1122
+ onVChartEventType: EVENT_TYPE.VCHART_EVENT_TYPE,
1123
+ onChangCellValue: EVENT_TYPE.CHANGE_CELL_VALUE,
1124
+ onMousedownFillHandle: EVENT_TYPE.MOUSEDOWN_FILL_HANDLE,
1125
+ onDragFillHandleEnd: EVENT_TYPE.DRAG_FILL_HANDLE_END,
1126
+ onDblclickFillHandle: EVENT_TYPE.DBLCLICK_FILL_HANDLE,
1127
+ onScrollVerticalEnd: EVENT_TYPE.SCROLL_VERTICAL_END,
1128
+ onScrollHorizontalEnd: EVENT_TYPE.SCROLL_HORIZONTAL_END
1129
+ };
1130
+ const TABLE_EVENTS_KEYS = Object.keys(TABLE_EVENTS);
1131
+ const findEventProps = (props, supportedEvents = TABLE_EVENTS) => {
1132
+ const result = {};
1133
+ Object.keys(props).forEach(key => {
1134
+ if (supportedEvents[key] && props[key]) {
1135
+ result[key] = props[key];
1136
+ }
1137
+ });
1138
+ return result;
1139
+ };
1140
+ const bindEventsToTable = (table, newProps, prevProps, supportedEvents = TABLE_EVENTS) => {
1141
+ if ((!newProps && !prevProps) || !table) {
1142
+ return false;
1143
+ }
1144
+ const prevEventProps = prevProps ? findEventProps(prevProps, supportedEvents) : null;
1145
+ const newEventProps = newProps ? findEventProps(newProps, supportedEvents) : null;
1146
+ if (prevEventProps) {
1147
+ Object.keys(prevEventProps).forEach(eventKey => {
1148
+ if (!newEventProps ||
1149
+ !newEventProps[eventKey] ||
1150
+ newEventProps[eventKey] !== prevEventProps[eventKey]) {
1151
+ table.off(supportedEvents[eventKey], prevProps[eventKey]);
1152
+ }
1153
+ });
1154
+ }
1155
+ if (newEventProps) {
1156
+ Object.keys(newEventProps).forEach(eventKey => {
1157
+ if (!prevEventProps ||
1158
+ !prevEventProps[eventKey] ||
1159
+ prevEventProps[eventKey] !== newEventProps[eventKey]) {
1160
+ table.on(supportedEvents[eventKey], newEventProps[eventKey]);
1161
+ }
1162
+ });
1163
+ }
1164
+ return true;
1165
+ };
1166
+
1167
+ class Generator {
1168
+ static GenAutoIncrementId() {
1169
+ return Generator.auto_increment_id++;
1297
1170
  }
1298
- contains() {
1299
- let x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1300
- let y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1301
- return !(x < this.x1 || x > this.x2 || y < this.y1 || y > this.y2);
1171
+ }
1172
+ Generator.auto_increment_id = 0;
1173
+
1174
+ class ContainerModule {
1175
+ constructor(registry) {
1176
+ this.id = Generator.GenAutoIncrementId(), this.registry = registry;
1302
1177
  }
1303
- containsPoint(p) {
1304
- return !(p.x < this.x1 || p.x > this.x2 || p.y < this.y1 || p.y > this.y2);
1178
+ }
1179
+
1180
+ const NAMED_TAG = "named";
1181
+ const INJECT_TAG = "inject";
1182
+ const MULTI_INJECT_TAG = "multi_inject";
1183
+ const TAGGED = "inversify:tagged";
1184
+ const PARAM_TYPES = "inversify:paramtypes";
1185
+
1186
+ class Metadata {
1187
+ constructor(key, value) {
1188
+ this.key = key, this.value = value;
1305
1189
  }
1306
- width() {
1307
- return this.empty() ? 0 : this.x2 - this.x1;
1190
+ toString() {
1191
+ return this.key === NAMED_TAG ? `named: ${String(this.value).toString()} ` : `tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`;
1308
1192
  }
1309
- height() {
1310
- return this.empty() ? 0 : this.y2 - this.y1;
1311
- }
1312
- scaleX() {
1313
- let s = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1314
- return this.x1 *= s, this.x2 *= s, this;
1193
+ }
1194
+
1195
+ var Reflect$1 = (function (Reflect) {
1196
+ var target;
1197
+ return function (exporter) {
1198
+ const supportsSymbol = "function" == typeof Symbol,
1199
+ toPrimitiveSymbol = supportsSymbol && void 0 !== Symbol.toPrimitive ? Symbol.toPrimitive : "@@toPrimitive",
1200
+ functionPrototype = (Object.getPrototypeOf(Function)),
1201
+ _Map = ("object" == typeof process && process.env && process.env.REFLECT_METADATA_USE_MAP_POLYFILL, Map),
1202
+ Metadata = (new WeakMap());
1203
+ function defineMetadata(metadataKey, metadataValue, target, propertyKey) {
1204
+ if (!IsObject(target)) throw new TypeError();
1205
+ return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);
1206
+ }
1207
+ function hasMetadata(metadataKey, target, propertyKey) {
1208
+ if (!IsObject(target)) throw new TypeError();
1209
+ return IsUndefined(propertyKey) || (propertyKey = ToPropertyKey(propertyKey)), OrdinaryHasMetadata(metadataKey, target, propertyKey);
1210
+ }
1211
+ function hasOwnMetadata(metadataKey, target, propertyKey) {
1212
+ if (!IsObject(target)) throw new TypeError();
1213
+ return IsUndefined(propertyKey) || (propertyKey = ToPropertyKey(propertyKey)), OrdinaryHasOwnMetadata(metadataKey, target, propertyKey);
1214
+ }
1215
+ function getMetadata(metadataKey, target, propertyKey) {
1216
+ if (!IsObject(target)) throw new TypeError();
1217
+ return IsUndefined(propertyKey) || (propertyKey = ToPropertyKey(propertyKey)), OrdinaryGetMetadata(metadataKey, target, propertyKey);
1218
+ }
1219
+ function GetOrCreateMetadataMap(O, P, Create) {
1220
+ let targetMetadata = Metadata.get(O);
1221
+ if (IsUndefined(targetMetadata)) {
1222
+ if (!Create) return;
1223
+ targetMetadata = new _Map(), Metadata.set(O, targetMetadata);
1224
+ }
1225
+ let metadataMap = targetMetadata.get(P);
1226
+ if (IsUndefined(metadataMap)) {
1227
+ if (!Create) return;
1228
+ metadataMap = new _Map(), targetMetadata.set(P, metadataMap);
1229
+ }
1230
+ return metadataMap;
1231
+ }
1232
+ function OrdinaryHasMetadata(MetadataKey, O, P) {
1233
+ if (OrdinaryHasOwnMetadata(MetadataKey, O, P)) return !0;
1234
+ const parent = OrdinaryGetPrototypeOf(O);
1235
+ return !IsNull(parent) && OrdinaryHasMetadata(MetadataKey, parent, P);
1236
+ }
1237
+ function OrdinaryHasOwnMetadata(MetadataKey, O, P) {
1238
+ const metadataMap = GetOrCreateMetadataMap(O, P, !1);
1239
+ return !IsUndefined(metadataMap) && ToBoolean(metadataMap.has(MetadataKey));
1240
+ }
1241
+ function OrdinaryGetMetadata(MetadataKey, O, P) {
1242
+ if (OrdinaryHasOwnMetadata(MetadataKey, O, P)) return OrdinaryGetOwnMetadata(MetadataKey, O, P);
1243
+ const parent = OrdinaryGetPrototypeOf(O);
1244
+ return IsNull(parent) ? void 0 : OrdinaryGetMetadata(MetadataKey, parent, P);
1245
+ }
1246
+ function OrdinaryGetOwnMetadata(MetadataKey, O, P) {
1247
+ const metadataMap = GetOrCreateMetadataMap(O, P, !1);
1248
+ if (!IsUndefined(metadataMap)) return metadataMap.get(MetadataKey);
1249
+ }
1250
+ function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) {
1251
+ GetOrCreateMetadataMap(O, P, !0).set(MetadataKey, MetadataValue);
1252
+ }
1253
+ function Type(x) {
1254
+ if (null === x) return 1;
1255
+ switch (typeof x) {
1256
+ case "undefined":
1257
+ return 0;
1258
+ case "boolean":
1259
+ return 2;
1260
+ case "string":
1261
+ return 3;
1262
+ case "symbol":
1263
+ return 4;
1264
+ case "number":
1265
+ return 5;
1266
+ case "object":
1267
+ return null === x ? 1 : 6;
1268
+ default:
1269
+ return 6;
1270
+ }
1271
+ }
1272
+ function IsUndefined(x) {
1273
+ return void 0 === x;
1274
+ }
1275
+ function IsNull(x) {
1276
+ return null === x;
1277
+ }
1278
+ function IsSymbol(x) {
1279
+ return "symbol" == typeof x;
1280
+ }
1281
+ function IsObject(x) {
1282
+ return "object" == typeof x ? null !== x : "function" == typeof x;
1283
+ }
1284
+ function ToPrimitive(input, PreferredType) {
1285
+ switch (Type(input)) {
1286
+ case 0:
1287
+ case 1:
1288
+ case 2:
1289
+ case 3:
1290
+ case 4:
1291
+ case 5:
1292
+ return input;
1293
+ }
1294
+ const hint = 3 === PreferredType ? "string" : 5 === PreferredType ? "number" : "default",
1295
+ exoticToPrim = GetMethod(input, toPrimitiveSymbol);
1296
+ if (void 0 !== exoticToPrim) {
1297
+ const result = exoticToPrim.call(input, hint);
1298
+ if (IsObject(result)) throw new TypeError();
1299
+ return result;
1300
+ }
1301
+ return OrdinaryToPrimitive(input, "default" === hint ? "number" : hint);
1302
+ }
1303
+ function OrdinaryToPrimitive(O, hint) {
1304
+ if ("string" === hint) {
1305
+ const toString_1 = O.toString;
1306
+ if (IsCallable(toString_1)) {
1307
+ const result = toString_1.call(O);
1308
+ if (!IsObject(result)) return result;
1309
+ }
1310
+ const valueOf = O.valueOf;
1311
+ if (IsCallable(valueOf)) {
1312
+ const result = valueOf.call(O);
1313
+ if (!IsObject(result)) return result;
1314
+ }
1315
+ } else {
1316
+ const valueOf = O.valueOf;
1317
+ if (IsCallable(valueOf)) {
1318
+ const result = valueOf.call(O);
1319
+ if (!IsObject(result)) return result;
1320
+ }
1321
+ const toString_2 = O.toString;
1322
+ if (IsCallable(toString_2)) {
1323
+ const result = toString_2.call(O);
1324
+ if (!IsObject(result)) return result;
1325
+ }
1326
+ }
1327
+ throw new TypeError();
1328
+ }
1329
+ function ToBoolean(argument) {
1330
+ return !!argument;
1331
+ }
1332
+ function ToString(argument) {
1333
+ return "" + argument;
1334
+ }
1335
+ function ToPropertyKey(argument) {
1336
+ const key = ToPrimitive(argument, 3);
1337
+ return IsSymbol(key) ? key : ToString(key);
1338
+ }
1339
+ function IsCallable(argument) {
1340
+ return "function" == typeof argument;
1341
+ }
1342
+ function GetMethod(V, P) {
1343
+ const func = V[P];
1344
+ if (null != func) {
1345
+ if (!IsCallable(func)) throw new TypeError();
1346
+ return func;
1347
+ }
1348
+ }
1349
+ function OrdinaryGetPrototypeOf(O) {
1350
+ const proto = Object.getPrototypeOf(O);
1351
+ if ("function" != typeof O || O === functionPrototype) return proto;
1352
+ if (proto !== functionPrototype) return proto;
1353
+ const prototype = O.prototype,
1354
+ prototypeProto = prototype && Object.getPrototypeOf(prototype);
1355
+ if (null == prototypeProto || prototypeProto === Object.prototype) return proto;
1356
+ const constructor = prototypeProto.constructor;
1357
+ return "function" != typeof constructor || constructor === O ? proto : constructor;
1358
+ }
1359
+ exporter("defineMetadata", defineMetadata), exporter("hasMetadata", hasMetadata), exporter("hasOwnMetadata", hasOwnMetadata), exporter("getMetadata", getMetadata);
1360
+ }((target = Reflect, function (key, value) {
1361
+ "function" != typeof target[key] && Object.defineProperty(target, key, {
1362
+ configurable: !0,
1363
+ writable: !0,
1364
+ value: value
1365
+ });
1366
+ })), Reflect;
1367
+ })({});
1368
+
1369
+ function _tagParameterOrProperty(metadataKey, annotationTarget, key, metadata) {
1370
+ const metadatas = [metadata];
1371
+ let paramsOrPropertiesMetadata = {};
1372
+ Reflect$1.hasOwnMetadata(metadataKey, annotationTarget) && (paramsOrPropertiesMetadata = Reflect$1.getMetadata(metadataKey, annotationTarget));
1373
+ let paramOrPropertyMetadata = paramsOrPropertiesMetadata[key];
1374
+ void 0 === paramOrPropertyMetadata && (paramOrPropertyMetadata = []), paramOrPropertyMetadata.push(...metadatas), paramsOrPropertiesMetadata[key] = paramOrPropertyMetadata, Reflect$1.defineMetadata(metadataKey, paramsOrPropertiesMetadata, annotationTarget);
1375
+ }
1376
+ function tagParameter(annotationTarget, parameterName, parameterIndex, metadata) {
1377
+ _tagParameterOrProperty(TAGGED, annotationTarget, parameterIndex.toString(), metadata);
1378
+ }
1379
+ function createTaggedDecorator(metadata) {
1380
+ return (target, targetKey, indexOrPropertyDescriptor) => {
1381
+ tagParameter(target, targetKey, indexOrPropertyDescriptor, metadata);
1382
+ };
1383
+ }
1384
+ function injectBase(metadataKey) {
1385
+ return serviceIdentifier => (target, targetKey, indexOrPropertyDescriptor) => createTaggedDecorator(new Metadata(metadataKey, serviceIdentifier))(target, targetKey, indexOrPropertyDescriptor);
1386
+ }
1387
+
1388
+ const inject = injectBase(INJECT_TAG);
1389
+
1390
+ function injectable() {
1391
+ return function (target) {
1392
+ return Reflect$1.defineMetadata(PARAM_TYPES, null, target), target;
1393
+ };
1394
+ }
1395
+
1396
+ function named(name) {
1397
+ return createTaggedDecorator(new Metadata(NAMED_TAG, name));
1398
+ }
1399
+
1400
+ const BindingScopeEnum = {
1401
+ Singleton: "Singleton",
1402
+ Transient: "Transient"
1403
+ },
1404
+ BindingTypeEnum = {
1405
+ ConstantValue: "ConstantValue",
1406
+ Constructor: "Constructor",
1407
+ DynamicValue: "DynamicValue",
1408
+ Factory: "Factory",
1409
+ Function: "Function",
1410
+ Instance: "Instance",
1411
+ Invalid: "Invalid",
1412
+ Provider: "Provider"
1413
+ };
1414
+
1415
+ class Binding {
1416
+ constructor(serviceIdentifier, scope) {
1417
+ this.id = Generator.GenAutoIncrementId(), this.activated = !1, this.serviceIdentifier = serviceIdentifier, this.scope = scope, this.type = BindingTypeEnum.Invalid, this.constraint = request => !0, this.implementationType = null, this.cache = null, this.factory = null, this.provider = null, this.dynamicValue = null;
1315
1418
  }
1316
- scaleY() {
1317
- let s = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1318
- return this.y1 *= s, this.y2 *= s, this;
1419
+ clone() {
1420
+ const clone = new Binding(this.serviceIdentifier, this.scope);
1421
+ return clone.activated = clone.scope === BindingScopeEnum.Singleton && this.activated, clone.implementationType = this.implementationType, clone.dynamicValue = this.dynamicValue, clone.scope = this.scope, clone.type = this.type, clone.provider = this.provider, clone.constraint = this.constraint, clone.cache = this.cache, clone;
1319
1422
  }
1320
- transformWithMatrix(matrix) {
1321
- return transformBoundsWithMatrix(this, this, matrix), this;
1423
+ }
1424
+
1425
+ class MetadataReader {
1426
+ getConstructorMetadata(constructorFunc) {
1427
+ return {
1428
+ compilerGeneratedMetadata: Reflect$1.getMetadata(PARAM_TYPES, constructorFunc),
1429
+ userGeneratedMetadata: Reflect$1.getMetadata(TAGGED, constructorFunc) || {}
1430
+ };
1322
1431
  }
1323
- copy(b) {
1324
- return this.x1 = b.x1, this.y1 = b.y1, this.x2 = b.x2, this.y2 = b.y2, this;
1432
+ getPropertiesMetadata(constructorFunc) {
1433
+ throw new Error("暂未实现");
1325
1434
  }
1326
- rotatedPoints(angle, x, y) {
1327
- const {
1328
- x1: x1,
1329
- y1: y1,
1330
- x2: x2,
1331
- y2: y2
1332
- } = this,
1333
- cos = Math.cos(angle),
1334
- sin = Math.sin(angle),
1335
- cx = x - x * cos + y * sin,
1336
- cy = y - x * sin - y * cos;
1337
- return [cos * x1 - sin * y1 + cx, sin * x1 + cos * y1 + cy, cos * x1 - sin * y2 + cx, sin * x1 + cos * y2 + cy, cos * x2 - sin * y1 + cx, sin * x2 + cos * y1 + cy, cos * x2 - sin * y2 + cx, sin * x2 + cos * y2 + cy];
1435
+ }
1436
+
1437
+ const taggedConstraint = key => value => {
1438
+ const constraint = request => {
1439
+ if (null == request) return !1;
1440
+ if (request.key === key && request.value === value) return !0;
1441
+ if (null == request.constructorArgsMetadata) return !1;
1442
+ const constructorArgsMetadata = request.constructorArgsMetadata;
1443
+ for (let i = 0; i < constructorArgsMetadata.length; i++) if (constructorArgsMetadata[i].key === key && constructorArgsMetadata[i].value === value) return !0;
1444
+ return !1;
1445
+ };
1446
+ return constraint.metaData = new Metadata(key, value), constraint;
1447
+ };
1448
+ const namedConstraint = taggedConstraint(NAMED_TAG);
1449
+
1450
+ class BindingInSyntax {
1451
+ constructor(binding) {
1452
+ this._binding = binding;
1338
1453
  }
1339
- scalePoints(sx, sy, x, y) {
1340
- const {
1341
- x1: x1,
1342
- y1: y1,
1343
- x2: x2,
1344
- y2: y2
1345
- } = this;
1346
- return [sx * x1 + (1 - sx) * x, sy * y1 + (1 - sy) * y, sx * x2 + (1 - sx) * x, sy * y2 + (1 - sy) * y];
1454
+ inRequestScope() {
1455
+ throw new Error("暂未实现");
1347
1456
  }
1348
- }
1349
- class AABBBounds extends Bounds {}
1350
- class OBBBounds extends Bounds {
1351
- constructor(bounds) {
1352
- let angle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1353
- super(bounds), bounds && (this.angle = angle);
1457
+ inSingletonScope() {
1458
+ return this._binding.scope = BindingScopeEnum.Singleton, this;
1354
1459
  }
1355
- intersects(b) {
1356
- return isRotateAABBIntersect(this, b);
1460
+ inTransientScope() {
1461
+ return this._binding.scope = BindingScopeEnum.Transient, this;
1357
1462
  }
1358
- setValue() {
1359
- let x1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1360
- let y1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1361
- let x2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1362
- let y2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
1363
- let angle = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
1364
- return super.setValue(x1, y1, x2, y2), this.angle = angle, this;
1463
+ whenTargetNamed(name) {
1464
+ return this._binding.constraint = namedConstraint(name), this;
1365
1465
  }
1366
1466
  }
1367
1467
 
1368
- class Matrix {
1369
- constructor() {
1370
- let a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
1371
- let b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1372
- let c = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1373
- let d = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
1374
- let e = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
1375
- let f = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
1376
- this.a = a, this.b = b, this.c = c, this.d = d, this.e = e, this.f = f;
1468
+ class BindingToSyntax {
1469
+ constructor(binding) {
1470
+ this._binding = binding;
1377
1471
  }
1378
- equalToMatrix(m2) {
1379
- return !(this.e !== m2.e || this.f !== m2.f || this.a !== m2.a || this.d !== m2.d || this.b !== m2.b || this.c !== m2.c);
1472
+ to(constructor) {
1473
+ return this._binding.type = BindingTypeEnum.Instance, this._binding.implementationType = constructor, new BindingInSyntax(this._binding);
1380
1474
  }
1381
- equalTo(a, b, c, d, e, f) {
1382
- return !(this.e !== e || this.f !== f || this.a !== a || this.d !== d || this.b !== b || this.c !== c);
1475
+ toSelf() {
1476
+ const self = this._binding.serviceIdentifier;
1477
+ return this.to(self);
1478
+ }
1479
+ toDynamicValue(func) {
1480
+ return this._binding.type = BindingTypeEnum.DynamicValue, this._binding.cache = null, this._binding.dynamicValue = func, this._binding.implementationType = null, new BindingInSyntax(this._binding);
1481
+ }
1482
+ toConstantValue(value) {
1483
+ return this._binding.type = BindingTypeEnum.ConstantValue, this._binding.cache = value, this._binding.dynamicValue = null, this._binding.implementationType = null, this._binding.scope = BindingScopeEnum.Singleton, new BindingInSyntax(this._binding);
1484
+ }
1485
+ toFactory(factory) {
1486
+ return this._binding.type = BindingTypeEnum.Factory, this._binding.factory = factory, this._binding.scope = BindingScopeEnum.Singleton, new BindingInSyntax(this._binding);
1487
+ }
1488
+ toService(service) {
1489
+ this.toDynamicValue(context => context.container.get(service));
1490
+ }
1491
+ }
1492
+
1493
+ class Container {
1494
+ constructor(containerOptions) {
1495
+ const options = containerOptions || {};
1496
+ options.defaultScope = options.defaultScope || BindingScopeEnum.Transient, this.options = options, this.id = Generator.GenAutoIncrementId(), this._bindingDictionary = new Map(), this._metadataReader = new MetadataReader();
1383
1497
  }
1384
- setValue(a, b, c, d, e, f) {
1385
- return this.a = a, this.b = b, this.c = c, this.d = d, this.e = e, this.f = f, this;
1498
+ load(module) {
1499
+ const containerModuleHelpers = this._getContainerModuleHelpersFactory()(module.id);
1500
+ module.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction);
1386
1501
  }
1387
- reset() {
1388
- return this.a = 1, this.b = 0, this.c = 0, this.d = 1, this.e = 0, this.f = 0, this;
1502
+ get(serviceIdentifier) {
1503
+ const getArgs = this._getNotAllArgs(serviceIdentifier, !1);
1504
+ return this._get(getArgs);
1389
1505
  }
1390
- getInverse() {
1391
- const a = this.a,
1392
- b = this.b,
1393
- c = this.c,
1394
- d = this.d,
1395
- e = this.e,
1396
- f = this.f,
1397
- m = new Matrix(),
1398
- dt = a * d - b * c;
1399
- return m.a = d / dt, m.b = -b / dt, m.c = -c / dt, m.d = a / dt, m.e = (c * f - d * e) / dt, m.f = -(a * f - b * e) / dt, m;
1506
+ getAll(serviceIdentifier) {
1507
+ const getArgs = this._getAllArgs(serviceIdentifier);
1508
+ return this._get(getArgs);
1400
1509
  }
1401
- rotate(rad) {
1402
- const c = Math.cos(rad),
1403
- s = Math.sin(rad),
1404
- m11 = this.a * c + this.c * s,
1405
- m12 = this.b * c + this.d * s,
1406
- m21 = this.a * -s + this.c * c,
1407
- m22 = this.b * -s + this.d * c;
1408
- return this.a = m11, this.b = m12, this.c = m21, this.d = m22, this;
1510
+ getTagged(serviceIdentifier, key, value) {
1511
+ const getArgs = this._getNotAllArgs(serviceIdentifier, !1, key, value);
1512
+ return this._get(getArgs);
1409
1513
  }
1410
- rotateByCenter(rad, cx, cy) {
1411
- const cos = Math.cos(rad),
1412
- sin = Math.sin(rad),
1413
- rotateM13 = (1 - cos) * cx + sin * cy,
1414
- rotateM23 = (1 - cos) * cy - sin * cx,
1415
- m11 = cos * this.a - sin * this.b,
1416
- m21 = sin * this.a + cos * this.b,
1417
- m12 = cos * this.c - sin * this.d,
1418
- m22 = sin * this.c + cos * this.d,
1419
- m13 = cos * this.e - sin * this.f + rotateM13,
1420
- m23 = sin * this.e + cos * this.f + rotateM23;
1421
- return this.a = m11, this.b = m21, this.c = m12, this.d = m22, this.e = m13, this.f = m23, this;
1514
+ getNamed(serviceIdentifier, named) {
1515
+ return this.getTagged(serviceIdentifier, NAMED_TAG, named);
1422
1516
  }
1423
- scale(sx, sy) {
1424
- return this.a *= sx, this.b *= sx, this.c *= sy, this.d *= sy, this;
1517
+ isBound(serviceIdentifier) {
1518
+ return this._bindingDictionary.has(serviceIdentifier);
1425
1519
  }
1426
- setScale(sx, sy) {
1427
- return this.b = this.b / this.a * sx, this.c = this.c / this.d * sy, this.a = sx, this.d = sy, this;
1520
+ bind(serviceIdentifier) {
1521
+ const scope = this.options.defaultScope,
1522
+ binding = new Binding(serviceIdentifier, scope),
1523
+ list = this._bindingDictionary.get(serviceIdentifier) || [];
1524
+ return list.push(binding), this._bindingDictionary.set(serviceIdentifier, list), new BindingToSyntax(binding);
1428
1525
  }
1429
- transform(a, b, c, d, e, f) {
1430
- return this.multiply(a, b, c, d, e, f), this;
1526
+ unbind(serviceIdentifier) {
1527
+ this._bindingDictionary.delete(serviceIdentifier);
1431
1528
  }
1432
- translate(x, y) {
1433
- return this.e += this.a * x + this.c * y, this.f += this.b * x + this.d * y, this;
1529
+ rebind(serviceIdentifier) {
1530
+ return this.unbind(serviceIdentifier), this.bind(serviceIdentifier);
1434
1531
  }
1435
- transpose() {
1436
- const {
1437
- a: a,
1438
- b: b,
1439
- c: c,
1440
- d: d,
1441
- e: e,
1442
- f: f
1443
- } = this;
1444
- return this.a = b, this.b = a, this.c = d, this.d = c, this.e = f, this.f = e, this;
1532
+ _getContainerModuleHelpersFactory() {
1533
+ const setModuleId = (bindingToSyntax, moduleId) => {
1534
+ bindingToSyntax._binding.moduleId = moduleId;
1535
+ },
1536
+ getBindFunction = moduleId => serviceIdentifier => {
1537
+ const bindingToSyntax = this.bind(serviceIdentifier);
1538
+ return setModuleId(bindingToSyntax, moduleId), bindingToSyntax;
1539
+ },
1540
+ getUnbindFunction = () => serviceIdentifier => this.unbind(serviceIdentifier),
1541
+ getIsboundFunction = () => serviceIdentifier => this.isBound(serviceIdentifier),
1542
+ getRebindFunction = moduleId => serviceIdentifier => {
1543
+ const bindingToSyntax = this.rebind(serviceIdentifier);
1544
+ return setModuleId(bindingToSyntax, moduleId), bindingToSyntax;
1545
+ };
1546
+ return mId => ({
1547
+ bindFunction: getBindFunction(mId),
1548
+ isboundFunction: getIsboundFunction(),
1549
+ rebindFunction: getRebindFunction(mId),
1550
+ unbindFunction: getUnbindFunction(),
1551
+ unbindAsyncFunction: serviceIdentifier => null
1552
+ });
1445
1553
  }
1446
- multiply(a2, b2, c2, d2, e2, f2) {
1447
- const a1 = this.a,
1448
- b1 = this.b,
1449
- c1 = this.c,
1450
- d1 = this.d,
1451
- m11 = a1 * a2 + c1 * b2,
1452
- m12 = b1 * a2 + d1 * b2,
1453
- m21 = a1 * c2 + c1 * d2,
1454
- m22 = b1 * c2 + d1 * d2,
1455
- dx = a1 * e2 + c1 * f2 + this.e,
1456
- dy = b1 * e2 + d1 * f2 + this.f;
1457
- return this.a = m11, this.b = m12, this.c = m21, this.d = m22, this.e = dx, this.f = dy, this;
1554
+ _getNotAllArgs(serviceIdentifier, isMultiInject, key, value) {
1555
+ return {
1556
+ avoidConstraints: !1,
1557
+ isMultiInject: isMultiInject,
1558
+ serviceIdentifier: serviceIdentifier,
1559
+ key: key,
1560
+ value: value
1561
+ };
1458
1562
  }
1459
- interpolate(m2, t) {
1460
- const m = new Matrix();
1461
- return m.a = this.a + (m2.a - this.a) * t, m.b = this.b + (m2.b - this.b) * t, m.c = this.c + (m2.c - this.c) * t, m.d = this.d + (m2.d - this.d) * t, m.e = this.e + (m2.e - this.e) * t, m.f = this.f + (m2.f - this.f) * t, m;
1563
+ _getAllArgs(serviceIdentifier) {
1564
+ return {
1565
+ avoidConstraints: !0,
1566
+ isMultiInject: !0,
1567
+ serviceIdentifier: serviceIdentifier
1568
+ };
1462
1569
  }
1463
- transformPoint(source, target) {
1464
- const {
1465
- a: a,
1466
- b: b,
1467
- c: c,
1468
- d: d,
1469
- e: e,
1470
- f: f
1471
- } = this,
1472
- dt = a * d - b * c,
1473
- nextA = d / dt,
1474
- nextB = -b / dt,
1475
- nextC = -c / dt,
1476
- nextD = a / dt,
1477
- nextE = (c * f - d * e) / dt,
1478
- nextF = -(a * f - b * e) / dt,
1479
- {
1480
- x: x,
1481
- y: y
1482
- } = source;
1483
- target.x = x * nextA + y * nextC + nextE, target.y = x * nextB + y * nextD + nextF;
1570
+ _get(getArgs) {
1571
+ const result = [];
1572
+ return this._bindingDictionary.get(getArgs.serviceIdentifier).filter(b => b.constraint(getArgs)).forEach(binding => {
1573
+ result.push(this._resolveFromBinding(binding));
1574
+ }), getArgs.isMultiInject || 1 !== result.length ? result : result[0];
1484
1575
  }
1485
- onlyTranslate() {
1486
- let scale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
1487
- return this.a === scale && 0 === this.b && 0 === this.c && this.d === scale;
1576
+ _getChildRequest(binding) {
1577
+ const constr = binding.implementationType,
1578
+ {
1579
+ userGeneratedMetadata: userGeneratedMetadata
1580
+ } = this._metadataReader.getConstructorMetadata(constr),
1581
+ keys = Object.keys(userGeneratedMetadata),
1582
+ arr = [];
1583
+ for (let i = 0; i < keys.length; i++) {
1584
+ const constructorArgsMetadata = userGeneratedMetadata[i],
1585
+ targetMetadataMap = {};
1586
+ constructorArgsMetadata.forEach(md => {
1587
+ targetMetadataMap[md.key] = md.value;
1588
+ });
1589
+ const metadata = {
1590
+ inject: targetMetadataMap[INJECT_TAG],
1591
+ multiInject: targetMetadataMap[MULTI_INJECT_TAG]
1592
+ },
1593
+ injectIdentifier = metadata.inject || metadata.multiInject,
1594
+ target = {
1595
+ serviceIdentifier: injectIdentifier,
1596
+ constructorArgsMetadata: constructorArgsMetadata
1597
+ },
1598
+ request = {
1599
+ injectIdentifier: injectIdentifier,
1600
+ metadata: constructorArgsMetadata,
1601
+ bindings: this._bindingDictionary.get(injectIdentifier).filter(b => b.constraint(target))
1602
+ };
1603
+ arr.push(request);
1604
+ }
1605
+ return arr;
1488
1606
  }
1489
- clone() {
1490
- return new Matrix(this.a, this.b, this.c, this.d, this.e, this.f);
1607
+ _resolveFromBinding(binding) {
1608
+ const result = this._getResolvedFromBinding(binding);
1609
+ return this._saveToScope(binding, result), result;
1491
1610
  }
1492
- toTransformAttrs() {
1493
- const a = this.a,
1494
- b = this.b,
1495
- c = this.c,
1496
- d = this.d,
1497
- delta = a * d - b * c,
1498
- result = {
1499
- x: this.e,
1500
- y: this.f,
1501
- rotateDeg: 0,
1502
- scaleX: 0,
1503
- scaleY: 0,
1504
- skewX: 0,
1505
- skewY: 0
1506
- };
1507
- if (0 !== a || 0 !== b) {
1508
- const r = Math.sqrt(a * a + b * b);
1509
- result.rotateDeg = b > 0 ? Math.acos(a / r) : -Math.acos(a / r), result.scaleX = r, result.scaleY = delta / r, result.skewX = (a * c + b * d) / delta, result.skewY = 0;
1510
- } else if (0 !== c || 0 !== d) {
1511
- const s = Math.sqrt(c * c + d * d);
1512
- result.rotateDeg = Math.PI / 2 - (d > 0 ? Math.acos(-c / s) : -Math.acos(c / s)), result.scaleX = delta / s, result.scaleY = s, result.skewX = 0, result.skewY = (a * c + b * d) / delta;
1611
+ _getResolvedFromBinding(binding) {
1612
+ let result;
1613
+ switch (binding.type) {
1614
+ case BindingTypeEnum.ConstantValue:
1615
+ case BindingTypeEnum.Function:
1616
+ result = binding.cache;
1617
+ break;
1618
+ case BindingTypeEnum.Instance:
1619
+ result = this._resolveInstance(binding, binding.implementationType);
1620
+ break;
1621
+ default:
1622
+ result = binding.dynamicValue({
1623
+ container: this
1624
+ });
1513
1625
  }
1514
- return result.rotateDeg = radianToDegree(result.rotateDeg), result;
1626
+ return result;
1627
+ }
1628
+ _resolveInstance(binding, constr) {
1629
+ if (binding.activated) return binding.cache;
1630
+ const childRequests = this._getChildRequest(binding);
1631
+ return this._createInstance(constr, childRequests);
1632
+ }
1633
+ _createInstance(constr, childRequests) {
1634
+ if (childRequests.length) {
1635
+ return new constr(...this._resolveRequests(childRequests));
1636
+ }
1637
+ return new constr();
1638
+ }
1639
+ _resolveRequests(childRequests) {
1640
+ return childRequests.map(request => request.bindings.length > 1 ? request.bindings.map(binding => this._resolveFromBinding(binding)) : this._resolveFromBinding(request.bindings[0]));
1641
+ }
1642
+ _saveToScope(binding, result) {
1643
+ binding.scope === BindingScopeEnum.Singleton && (binding.cache = result, binding.activated = !0);
1515
1644
  }
1516
- }
1517
- function normalTransform(out, origin, x, y, scaleX, scaleY, angle, rotateCenter) {
1518
- const oa = origin.a,
1519
- ob = origin.b,
1520
- oc = origin.c,
1521
- od = origin.d,
1522
- oe = origin.e,
1523
- of = origin.f,
1524
- cosTheta = cos(angle),
1525
- sinTheta = sin(angle);
1526
- let rotateCenterX, rotateCenterY;
1527
- rotateCenter ? (rotateCenterX = rotateCenter[0], rotateCenterY = rotateCenter[1]) : (rotateCenterX = x, rotateCenterY = y);
1528
- const offsetX = rotateCenterX - x,
1529
- offsetY = rotateCenterY - y,
1530
- a1 = oa * cosTheta + oc * sinTheta,
1531
- b1 = ob * cosTheta + od * sinTheta,
1532
- c1 = oc * cosTheta - oa * sinTheta,
1533
- d1 = od * cosTheta - ob * sinTheta;
1534
- out.a = scaleX * a1, out.b = scaleX * b1, out.c = scaleY * c1, out.d = scaleY * d1, out.e = oe + oa * rotateCenterX + oc * rotateCenterY - a1 * offsetX - c1 * offsetY, out.f = of + ob * rotateCenterX + od * rotateCenterY - b1 * offsetX - d1 * offsetY;
1535
1645
  }
1536
1646
 
1537
- function hslToRgb(h, s, l) {
1538
- s /= 100, l /= 100;
1539
- const c = (1 - Math.abs(2 * l - 1)) * s,
1540
- x = c * (1 - Math.abs(h / 60 % 2 - 1)),
1541
- m = l - c / 2;
1542
- let r = 0,
1543
- g = 0,
1544
- b = 0;
1545
- return 0 <= h && h < 60 ? (r = c, g = x, b = 0) : 60 <= h && h < 120 ? (r = x, g = c, b = 0) : 120 <= h && h < 180 ? (r = 0, g = c, b = x) : 180 <= h && h < 240 ? (r = 0, g = x, b = c) : 240 <= h && h < 300 ? (r = x, g = 0, b = c) : 300 <= h && h < 360 && (r = c, g = 0, b = x), r = Math.round(255 * (r + m)), g = Math.round(255 * (g + m)), b = Math.round(255 * (b + m)), {
1546
- r: r,
1547
- g: g,
1548
- b: b
1549
- };
1647
+ const ContributionProvider = Symbol("ContributionProvider");
1648
+ class ContributionProviderCache {
1649
+ constructor(serviceIdentifier, container) {
1650
+ this.serviceIdentifier = serviceIdentifier, this.container = container;
1651
+ }
1652
+ getContributions() {
1653
+ return this.caches || (this.caches = [], this.container && this.container.isBound(this.serviceIdentifier) && this.caches.push(...this.container.getAll(this.serviceIdentifier))), this.caches;
1654
+ }
1655
+ }
1656
+ function bindContributionProvider(bind, id) {
1657
+ bind(ContributionProvider).toDynamicValue(_ref => {
1658
+ let {
1659
+ container: container
1660
+ } = _ref;
1661
+ return new ContributionProviderCache(id, container);
1662
+ }).inSingletonScope().whenTargetNamed(id);
1550
1663
  }
1551
1664
 
1552
- function rgbToHsl(r, g, b) {
1553
- r /= 255, g /= 255, b /= 255;
1554
- const cMin = Math.min(r, g, b),
1555
- cMax = Math.max(r, g, b),
1556
- delta = cMax - cMin;
1557
- let h = 0,
1558
- s = 0,
1559
- l = 0;
1560
- return h = 0 === delta ? 0 : cMax === r ? (g - b) / delta % 6 : cMax === g ? (b - r) / delta + 2 : (r - g) / delta + 4, h = Math.round(60 * h), h < 0 && (h += 360), l = (cMax + cMin) / 2, s = 0 === delta ? 0 : delta / (1 - Math.abs(2 * l - 1)), s = +(100 * s).toFixed(1), l = +(100 * l).toFixed(1), {
1561
- h: h,
1562
- s: s,
1563
- l: l
1564
- };
1665
+ class Hook {
1666
+ constructor(args, name) {
1667
+ this._args = args, this.name = name, this.taps = [];
1668
+ }
1669
+ tap(options, fn) {
1670
+ this._tap("sync", options, fn);
1671
+ }
1672
+ unTap(options, fn) {
1673
+ const name = "string" == typeof options ? options.trim() : options.name;
1674
+ name && (this.taps = this.taps.filter(tap => !(tap.name === name && (!fn || tap.fn === fn))));
1675
+ }
1676
+ _parseOptions(type, options, fn) {
1677
+ let _options;
1678
+ if ("string" == typeof options) _options = {
1679
+ name: options.trim()
1680
+ };else if ("object" != typeof options || null === options) throw new Error("Invalid tap options");
1681
+ if ("string" != typeof _options.name || "" === _options.name) throw new Error("Missing name for tap");
1682
+ return _options = Object.assign({
1683
+ type: type,
1684
+ fn: fn
1685
+ }, _options), _options;
1686
+ }
1687
+ _tap(type, options, fn) {
1688
+ this._insert(this._parseOptions(type, options, fn));
1689
+ }
1690
+ _insert(item) {
1691
+ let before;
1692
+ "string" == typeof item.before ? before = new Set([item.before]) : Array.isArray(item.before) && (before = new Set(item.before));
1693
+ let stage = 0;
1694
+ "number" == typeof item.stage && (stage = item.stage);
1695
+ let i = this.taps.length;
1696
+ for (; i > 0;) {
1697
+ i--;
1698
+ const x = this.taps[i];
1699
+ this.taps[i + 1] = x;
1700
+ const xStage = x.stage || 0;
1701
+ if (before) {
1702
+ if (before.has(x.name)) {
1703
+ before.delete(x.name);
1704
+ continue;
1705
+ }
1706
+ if (before.size > 0) continue;
1707
+ }
1708
+ if (!(xStage > stage)) {
1709
+ i++;
1710
+ break;
1711
+ }
1712
+ }
1713
+ this.taps[i] = item;
1714
+ }
1565
1715
  }
1566
1716
 
1567
- const REG_HEX = /^#([0-9a-f]{3,8})$/,
1568
- DEFAULT_COLORS_OPACITY = {
1569
- transparent: 4294967040
1570
- };
1571
- const DEFAULT_COLORS = {
1572
- aliceblue: 15792383,
1573
- antiquewhite: 16444375,
1574
- aqua: 65535,
1575
- aquamarine: 8388564,
1576
- azure: 15794175,
1577
- beige: 16119260,
1578
- bisque: 16770244,
1579
- black: 0,
1580
- blanchedalmond: 16772045,
1581
- blue: 255,
1582
- blueviolet: 9055202,
1583
- brown: 10824234,
1584
- burlywood: 14596231,
1585
- cadetblue: 6266528,
1586
- chartreuse: 8388352,
1587
- chocolate: 13789470,
1588
- coral: 16744272,
1589
- cornflowerblue: 6591981,
1590
- cornsilk: 16775388,
1591
- crimson: 14423100,
1592
- cyan: 65535,
1593
- darkblue: 139,
1594
- darkcyan: 35723,
1595
- darkgoldenrod: 12092939,
1596
- darkgray: 11119017,
1597
- darkgreen: 25600,
1598
- darkgrey: 11119017,
1599
- darkkhaki: 12433259,
1600
- darkmagenta: 9109643,
1601
- darkolivegreen: 5597999,
1602
- darkorange: 16747520,
1603
- darkorchid: 10040012,
1604
- darkred: 9109504,
1605
- darksalmon: 15308410,
1606
- darkseagreen: 9419919,
1607
- darkslateblue: 4734347,
1608
- darkslategray: 3100495,
1609
- darkslategrey: 3100495,
1610
- darkturquoise: 52945,
1611
- darkviolet: 9699539,
1612
- deeppink: 16716947,
1613
- deepskyblue: 49151,
1614
- dimgray: 6908265,
1615
- dimgrey: 6908265,
1616
- dodgerblue: 2003199,
1617
- firebrick: 11674146,
1618
- floralwhite: 16775920,
1619
- forestgreen: 2263842,
1620
- fuchsia: 16711935,
1621
- gainsboro: 14474460,
1622
- ghostwhite: 16316671,
1623
- gold: 16766720,
1624
- goldenrod: 14329120,
1625
- gray: 8421504,
1626
- green: 32768,
1627
- greenyellow: 11403055,
1628
- grey: 8421504,
1629
- honeydew: 15794160,
1630
- hotpink: 16738740,
1631
- indianred: 13458524,
1632
- indigo: 4915330,
1633
- ivory: 16777200,
1634
- khaki: 15787660,
1635
- lavender: 15132410,
1636
- lavenderblush: 16773365,
1637
- lawngreen: 8190976,
1638
- lemonchiffon: 16775885,
1639
- lightblue: 11393254,
1640
- lightcoral: 15761536,
1641
- lightcyan: 14745599,
1642
- lightgoldenrodyellow: 16448210,
1643
- lightgray: 13882323,
1644
- lightgreen: 9498256,
1645
- lightgrey: 13882323,
1646
- lightpink: 16758465,
1647
- lightsalmon: 16752762,
1648
- lightseagreen: 2142890,
1649
- lightskyblue: 8900346,
1650
- lightslategray: 7833753,
1651
- lightslategrey: 7833753,
1652
- lightsteelblue: 11584734,
1653
- lightyellow: 16777184,
1654
- lime: 65280,
1655
- limegreen: 3329330,
1656
- linen: 16445670,
1657
- magenta: 16711935,
1658
- maroon: 8388608,
1659
- mediumaquamarine: 6737322,
1660
- mediumblue: 205,
1661
- mediumorchid: 12211667,
1662
- mediumpurple: 9662683,
1663
- mediumseagreen: 3978097,
1664
- mediumslateblue: 8087790,
1665
- mediumspringgreen: 64154,
1666
- mediumturquoise: 4772300,
1667
- mediumvioletred: 13047173,
1668
- midnightblue: 1644912,
1669
- mintcream: 16121850,
1670
- mistyrose: 16770273,
1671
- moccasin: 16770229,
1672
- navajowhite: 16768685,
1673
- navy: 128,
1674
- oldlace: 16643558,
1675
- olive: 8421376,
1676
- olivedrab: 7048739,
1677
- orange: 16753920,
1678
- orangered: 16729344,
1679
- orchid: 14315734,
1680
- palegoldenrod: 15657130,
1681
- palegreen: 10025880,
1682
- paleturquoise: 11529966,
1683
- palevioletred: 14381203,
1684
- papayawhip: 16773077,
1685
- peachpuff: 16767673,
1686
- peru: 13468991,
1687
- pink: 16761035,
1688
- plum: 14524637,
1689
- powderblue: 11591910,
1690
- purple: 8388736,
1691
- rebeccapurple: 6697881,
1692
- red: 16711680,
1693
- rosybrown: 12357519,
1694
- royalblue: 4286945,
1695
- saddlebrown: 9127187,
1696
- salmon: 16416882,
1697
- sandybrown: 16032864,
1698
- seagreen: 3050327,
1699
- seashell: 16774638,
1700
- sienna: 10506797,
1701
- silver: 12632256,
1702
- skyblue: 8900331,
1703
- slateblue: 6970061,
1704
- slategray: 7372944,
1705
- slategrey: 7372944,
1706
- snow: 16775930,
1707
- springgreen: 65407,
1708
- steelblue: 4620980,
1709
- tan: 13808780,
1710
- teal: 32896,
1711
- thistle: 14204888,
1712
- tomato: 16737095,
1713
- turquoise: 4251856,
1714
- violet: 15631086,
1715
- wheat: 16113331,
1716
- white: 16777215,
1717
- whitesmoke: 16119285,
1718
- yellow: 16776960,
1719
- yellowgreen: 10145074
1717
+ class SyncHook extends Hook {
1718
+ call() {
1719
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1720
+ args[_key] = arguments[_key];
1721
+ }
1722
+ this.taps.map(t => t.fn).forEach(cb => cb(...args));
1723
+ }
1724
+ }
1725
+
1726
+ const EnvContribution = Symbol.for("EnvContribution");
1727
+
1728
+ const isType = (value, type) => Object.prototype.toString.call(value) === `[object ${type}]`;
1729
+ var isType$1 = isType;
1730
+
1731
+ const isBoolean = function (value) {
1732
+ let fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
1733
+ return fuzzy ? "boolean" == typeof value : !0 === value || !1 === value || isType$1(value, "Boolean");
1720
1734
  };
1721
- function hex(value) {
1722
- return ((value = Math.max(0, Math.min(255, Math.round(value) || 0))) < 16 ? "0" : "") + value.toString(16);
1735
+ var isBoolean$1 = isBoolean;
1736
+
1737
+ const isFunction = value => "function" == typeof value;
1738
+ var isFunction$1 = isFunction;
1739
+
1740
+ const isNil = value => null == value;
1741
+ var isNil$1 = isNil;
1742
+
1743
+ const isValid = value => null != value;
1744
+ var isValid$1 = isValid;
1745
+
1746
+ const isObject = value => {
1747
+ const type = typeof value;
1748
+ return null !== value && "object" === type || "function" === type;
1749
+ };
1750
+ var isObject$1 = isObject;
1751
+
1752
+ const isObjectLike = value => "object" == typeof value && null !== value;
1753
+ var isObjectLike$1 = isObjectLike;
1754
+
1755
+ const isPlainObject = function (value) {
1756
+ if (!isObjectLike$1(value) || !isType$1(value, "Object")) return !1;
1757
+ if (null === Object.getPrototypeOf(value)) return !0;
1758
+ let proto = value;
1759
+ for (; null !== Object.getPrototypeOf(proto);) proto = Object.getPrototypeOf(proto);
1760
+ return Object.getPrototypeOf(value) === proto;
1761
+ };
1762
+ var isPlainObject$1 = isPlainObject;
1763
+
1764
+ const isString = function (value) {
1765
+ let fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
1766
+ const type = typeof value;
1767
+ return fuzzy ? "string" === type : "string" === type || isType$1(value, "String");
1768
+ };
1769
+ var isString$1 = isString;
1770
+
1771
+ const isArray = value => Array.isArray ? Array.isArray(value) : isType$1(value, "Array");
1772
+ var isArray$1 = isArray;
1773
+
1774
+ const isArrayLike = function (value) {
1775
+ return null !== value && "function" != typeof value && Number.isFinite(value.length);
1776
+ };
1777
+ var isArrayLike$1 = isArrayLike;
1778
+
1779
+ const isNumber = function (value) {
1780
+ let fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
1781
+ const type = typeof value;
1782
+ return fuzzy ? "number" === type : "number" === type || isType$1(value, "Number");
1783
+ };
1784
+ var isNumber$1 = isNumber;
1785
+
1786
+ const isValidNumber = value => isNumber$1(value) && Number.isFinite(value);
1787
+ var isValidNumber$1 = isValidNumber;
1788
+
1789
+ const isValidUrl = value => new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(value);
1790
+ var isValidUrl$1 = isValidUrl;
1791
+
1792
+ const isBase64 = value => new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(value);
1793
+ var isBase64$1 = isBase64;
1794
+
1795
+ const getType = value => ({}).toString.call(value).replace(/^\[object /, "").replace(/]$/, "");
1796
+ var getType$1 = getType;
1797
+
1798
+ const objectProto = Object.prototype,
1799
+ isPrototype = function (value) {
1800
+ const Ctor = value && value.constructor;
1801
+ return value === ("function" == typeof Ctor && Ctor.prototype || objectProto);
1802
+ };
1803
+ var isPrototype$1 = isPrototype;
1804
+
1805
+ const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
1806
+ function isEmpty(value) {
1807
+ if (isNil$1(value)) return !0;
1808
+ if (isArrayLike$1(value)) return !value.length;
1809
+ const type = getType$1(value);
1810
+ if ("Map" === type || "Set" === type) return !value.size;
1811
+ if (isPrototype$1(value)) return !Object.keys(value).length;
1812
+ for (const key in value) if (hasOwnProperty$1.call(value, key)) return !1;
1813
+ return !0;
1723
1814
  }
1724
- function rgb(value) {
1725
- return isNumber$1(value) ? new RGB(value >> 16, value >> 8 & 255, 255 & value, 1) : isArray$1(value) ? new RGB(value[0], value[1], value[2]) : new RGB(255, 255, 255);
1815
+
1816
+ const hasOwnProperty = Object.prototype.hasOwnProperty,
1817
+ has = (object, key) => null != object && hasOwnProperty.call(object, key);
1818
+ var has$1 = has;
1819
+
1820
+ function baseMerge(target, source) {
1821
+ let shallowArray = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
1822
+ let skipTargetArray = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
1823
+ if (source) {
1824
+ if (target === source) return;
1825
+ if (isValid$1(source) && "object" == typeof source) {
1826
+ const iterable = Object(source),
1827
+ props = [];
1828
+ for (const key in iterable) props.push(key);
1829
+ let {
1830
+ length: length
1831
+ } = props,
1832
+ propIndex = -1;
1833
+ for (; length--;) {
1834
+ const key = props[++propIndex];
1835
+ !isValid$1(iterable[key]) || "object" != typeof iterable[key] || skipTargetArray && isArray$1(target[key]) ? assignMergeValue(target, key, iterable[key]) : baseMergeDeep(target, source, key, shallowArray, skipTargetArray);
1836
+ }
1837
+ }
1838
+ }
1726
1839
  }
1727
- function rgba(value) {
1728
- return isNumber$1(value) ? new RGB(value >>> 24, value >>> 16 & 255, value >>> 8 & 255, 255 & value) : isArray$1(value) ? new RGB(value[0], value[1], value[2], value[3]) : new RGB(255, 255, 255, 1);
1840
+ function baseMergeDeep(target, source, key) {
1841
+ let shallowArray = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
1842
+ let skipTargetArray = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : !1;
1843
+ const objValue = target[key],
1844
+ srcValue = source[key];
1845
+ let newValue = source[key],
1846
+ isCommon = !0;
1847
+ if (isArray$1(srcValue)) {
1848
+ if (shallowArray) newValue = [];else if (isArray$1(objValue)) newValue = objValue;else if (isArrayLike$1(objValue)) {
1849
+ newValue = new Array(objValue.length);
1850
+ let index = -1;
1851
+ const length = objValue.length;
1852
+ for (; ++index < length;) newValue[index] = objValue[index];
1853
+ }
1854
+ } else isPlainObject$1(srcValue) ? (newValue = null != objValue ? objValue : {}, "function" != typeof objValue && "object" == typeof objValue || (newValue = {})) : isCommon = !1;
1855
+ isCommon && baseMerge(newValue, srcValue, shallowArray, skipTargetArray), assignMergeValue(target, key, newValue);
1729
1856
  }
1730
- function SRGBToLinear(c) {
1731
- return c < .04045 ? .0773993808 * c : Math.pow(.9478672986 * c + .0521327014, 2.4);
1857
+ function assignMergeValue(target, key, value) {
1858
+ (void 0 !== value && !eq(target[key], value) || void 0 === value && !(key in target)) && (target[key] = value);
1732
1859
  }
1733
- function LinearToSRGB(c) {
1734
- return c < .0031308 ? 12.92 * c : 1.055 * Math.pow(c, .41666) - .055;
1860
+ function eq(value, other) {
1861
+ return value === other || Number.isNaN(value) && Number.isNaN(other);
1735
1862
  }
1736
- const setHex = (formatValue, forceHex) => {
1737
- const isHex = REG_HEX.exec(formatValue);
1738
- if (forceHex || isHex) {
1739
- const hex = parseInt(isHex[1], 16),
1740
- hexLength = isHex[1].length;
1741
- return 3 === hexLength ? new RGB((hex >> 8 & 15) + ((hex >> 8 & 15) << 4), (hex >> 4 & 15) + ((hex >> 4 & 15) << 4), (15 & hex) + ((15 & hex) << 4), 1) : 6 === hexLength ? rgb(hex) : 8 === hexLength ? new RGB(hex >> 24 & 255, hex >> 16 & 255, hex >> 8 & 255, (255 & hex) / 255) : null;
1863
+ function merge(target) {
1864
+ let sourceIndex = -1;
1865
+ const length = arguments.length <= 1 ? 0 : arguments.length - 1;
1866
+ for (; ++sourceIndex < length;) {
1867
+ baseMerge(target, sourceIndex + 1 < 1 || arguments.length <= sourceIndex + 1 ? undefined : arguments[sourceIndex + 1], !0);
1742
1868
  }
1743
- };
1744
- class Color {
1745
- static Brighter(source) {
1746
- let b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
1747
- return 1 === b ? source : new Color(source).brighter(b).toRGBA();
1869
+ return target;
1870
+ }
1871
+
1872
+ function arrayEqual(a, b) {
1873
+ if (!isArray$1(a) || !isArray$1(b)) return !1;
1874
+ if (a.length !== b.length) return !1;
1875
+ for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return !1;
1876
+ return !0;
1877
+ }
1878
+
1879
+ const hasConsole = "undefined" != typeof console;
1880
+ function log(method, level, input) {
1881
+ const args = [level].concat([].slice.call(input));
1882
+ hasConsole && console[method].apply(console, args);
1883
+ }
1884
+ var LoggerLevel;
1885
+ !function (LoggerLevel) {
1886
+ LoggerLevel[LoggerLevel.None = 0] = "None", LoggerLevel[LoggerLevel.Error = 1] = "Error", LoggerLevel[LoggerLevel.Warn = 2] = "Warn", LoggerLevel[LoggerLevel.Info = 3] = "Info", LoggerLevel[LoggerLevel.Debug = 4] = "Debug";
1887
+ }(LoggerLevel || (LoggerLevel = {}));
1888
+ class Logger {
1889
+ static getInstance(level, method) {
1890
+ return Logger._instance && isNumber$1(level) ? Logger._instance.level(level) : Logger._instance || (Logger._instance = new Logger(level, method)), Logger._instance;
1748
1891
  }
1749
- static SetOpacity(source) {
1750
- let o = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
1751
- return 1 === o ? source : new Color(source).setOpacity(o).toRGBA();
1892
+ static setInstance(logger) {
1893
+ return Logger._instance = logger;
1752
1894
  }
1753
- static getColorBrightness(source) {
1754
- let model = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "hsl";
1755
- const color = source instanceof Color ? source : new Color(source);
1756
- switch (model) {
1757
- case "hsv":
1758
- default:
1759
- return color.getHSVBrightness();
1760
- case "hsl":
1761
- return color.getHSLBrightness();
1762
- case "lum":
1763
- return color.getLuminance();
1764
- case "lum2":
1765
- return color.getLuminance2();
1766
- case "lum3":
1767
- return color.getLuminance3();
1768
- }
1895
+ static setInstanceLevel(level) {
1896
+ Logger._instance ? Logger._instance.level(level) : Logger._instance = new Logger(level);
1769
1897
  }
1770
- static parseColorString(value) {
1771
- if (isValid$1(DEFAULT_COLORS_OPACITY[value])) return rgba(DEFAULT_COLORS_OPACITY[value]);
1772
- if (isValid$1(DEFAULT_COLORS[value])) return rgb(DEFAULT_COLORS[value]);
1773
- const formatValue = `${value}`.trim().toLowerCase(),
1774
- hexRes = setHex(formatValue);
1775
- if (void 0 !== hexRes) return hexRes;
1776
- if (/^(rgb|RGB|rgba|RGBA)/.test(formatValue)) {
1777
- const aColor = formatValue.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g, "").split(",");
1778
- return new RGB(parseInt(aColor[0], 10), parseInt(aColor[1], 10), parseInt(aColor[2], 10), parseFloat(aColor[3]));
1898
+ static clearInstance() {
1899
+ Logger._instance = null;
1900
+ }
1901
+ constructor() {
1902
+ let level = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : LoggerLevel.None;
1903
+ let method = arguments.length > 1 ? arguments[1] : undefined;
1904
+ this._onErrorHandler = [], this._level = level, this._method = method;
1905
+ }
1906
+ addErrorHandler(handler) {
1907
+ this._onErrorHandler.find(h => h === handler) || this._onErrorHandler.push(handler);
1908
+ }
1909
+ removeErrorHandler(handler) {
1910
+ const index = this._onErrorHandler.findIndex(h => h === handler);
1911
+ index < 0 || this._onErrorHandler.splice(index, 1);
1912
+ }
1913
+ callErrorHandler() {
1914
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1915
+ args[_key] = arguments[_key];
1779
1916
  }
1780
- if (/^(hsl|HSL|hsla|HSLA)/.test(formatValue)) {
1781
- const aColor = formatValue.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g, "").split(","),
1782
- rgb = hslToRgb(parseInt(aColor[0], 10), parseInt(aColor[1], 10), parseInt(aColor[2], 10));
1783
- return new RGB(rgb.r, rgb.g, rgb.b, parseFloat(aColor[3]));
1917
+ this._onErrorHandler.forEach(h => h(...args));
1918
+ }
1919
+ canLogInfo() {
1920
+ return this._level >= LoggerLevel.Info;
1921
+ }
1922
+ canLogDebug() {
1923
+ return this._level >= LoggerLevel.Debug;
1924
+ }
1925
+ canLogError() {
1926
+ return this._level >= LoggerLevel.Error;
1927
+ }
1928
+ canLogWarn() {
1929
+ return this._level >= LoggerLevel.Warn;
1930
+ }
1931
+ level(levelValue) {
1932
+ return arguments.length ? (this._level = +levelValue, this) : this._level;
1933
+ }
1934
+ error() {
1935
+ var _a;
1936
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1937
+ args[_key2] = arguments[_key2];
1784
1938
  }
1939
+ return this._level >= LoggerLevel.Error && (this._onErrorHandler.length ? this.callErrorHandler(...args) : log(null !== (_a = this._method) && void 0 !== _a ? _a : "error", "ERROR", args)), this;
1785
1940
  }
1786
- constructor(value) {
1787
- const color = Color.parseColorString(value);
1788
- color ? this.color = color : (this.color = new RGB(255, 255, 255));
1941
+ warn() {
1942
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
1943
+ args[_key3] = arguments[_key3];
1944
+ }
1945
+ return this._level >= LoggerLevel.Warn && log(this._method || "warn", "WARN", args), this;
1789
1946
  }
1790
- toRGBA() {
1791
- return this.color.formatRgb();
1947
+ info() {
1948
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
1949
+ args[_key4] = arguments[_key4];
1950
+ }
1951
+ return this._level >= LoggerLevel.Info && log(this._method || "log", "INFO", args), this;
1792
1952
  }
1793
- toString() {
1794
- return this.color.formatRgb();
1953
+ debug() {
1954
+ for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
1955
+ args[_key5] = arguments[_key5];
1956
+ }
1957
+ return this._level >= LoggerLevel.Debug && log(this._method || "log", "DEBUG", args), this;
1795
1958
  }
1796
- toHex() {
1797
- return this.color.formatHex();
1959
+ }
1960
+ Logger._instance = null;
1961
+
1962
+ const clamp = function (input, min, max) {
1963
+ return input < min ? min : input > max ? max : input;
1964
+ };
1965
+ var clamp$1 = clamp;
1966
+
1967
+ const epsilon = 1e-12;
1968
+ const pi = Math.PI;
1969
+ const halfPi$1 = pi / 2;
1970
+ const tau = 2 * pi;
1971
+ const pi2 = 2 * Math.PI;
1972
+ const abs = Math.abs;
1973
+ const atan2 = Math.atan2;
1974
+ const cos = Math.cos;
1975
+ const max = Math.max;
1976
+ const min = Math.min;
1977
+ const sin = Math.sin;
1978
+ const sqrt = Math.sqrt;
1979
+ const pow = Math.pow;
1980
+ function asin(x) {
1981
+ return x >= 1 ? halfPi$1 : x <= -1 ? -halfPi$1 : Math.asin(x);
1982
+ }
1983
+
1984
+ class Point {
1985
+ constructor() {
1986
+ let x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1987
+ let y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1988
+ let x1 = arguments.length > 2 ? arguments[2] : undefined;
1989
+ let y1 = arguments.length > 3 ? arguments[3] : undefined;
1990
+ this.x = 0, this.y = 0, this.x = x, this.y = y, this.x1 = x1, this.y1 = y1;
1798
1991
  }
1799
- toHsl() {
1800
- return this.color.formatHsl();
1992
+ clone() {
1993
+ return new Point(this.x, this.y);
1801
1994
  }
1802
- brighter(k) {
1803
- const {
1804
- r: r,
1805
- g: g,
1806
- b: b
1807
- } = this.color;
1808
- return this.color.r = Math.max(0, Math.min(255, Math.floor(r * k))), this.color.g = Math.max(0, Math.min(255, Math.floor(g * k))), this.color.b = Math.max(0, Math.min(255, Math.floor(b * k))), this;
1995
+ copyFrom(p) {
1996
+ return this.x = p.x, this.y = p.y, this.x1 = p.x1, this.y1 = p.y1, this.defined = p.defined, this.context = p.context, this;
1809
1997
  }
1810
- add(color) {
1811
- const {
1812
- r: r,
1813
- g: g,
1814
- b: b
1815
- } = this.color;
1816
- return this.color.r += Math.min(255, r + color.color.r), this.color.g += Math.min(255, g + color.color.g), this.color.b += Math.min(255, b + color.color.b), this;
1998
+ set(x, y) {
1999
+ return this.x = x, this.y = y, this;
1817
2000
  }
1818
- sub(color) {
1819
- return this.color.r = Math.max(0, this.color.r - color.color.r), this.color.g = Math.max(0, this.color.g - color.color.g), this.color.b = Math.max(0, this.color.b - color.color.b), this;
2001
+ add(point) {
2002
+ return isNumber$1(point) ? (this.x += point, void (this.y += point)) : (this.x += point.x, this.y += point.y, this);
1820
2003
  }
1821
- multiply(color) {
1822
- const {
1823
- r: r,
1824
- g: g,
1825
- b: b
1826
- } = this.color;
1827
- return this.color.r = Math.max(0, Math.min(255, Math.floor(r * color.color.r))), this.color.g = Math.max(0, Math.min(255, Math.floor(g * color.color.g))), this.color.b = Math.max(0, Math.min(255, Math.floor(b * color.color.b))), this;
2004
+ sub(point) {
2005
+ return isNumber$1(point) ? (this.x -= point, void (this.y -= point)) : (this.x -= point.x, this.y -= point.y, this);
1828
2006
  }
1829
- getHSVBrightness() {
1830
- return Math.max(this.color.r, this.color.g, this.color.b) / 255;
2007
+ multi(point) {
2008
+ throw new Error("暂不支持");
1831
2009
  }
1832
- getHSLBrightness() {
1833
- return .5 * (Math.max(this.color.r, this.color.g, this.color.b) / 255 + Math.min(this.color.r, this.color.g, this.color.b) / 255);
2010
+ div(point) {
2011
+ throw new Error("暂不支持");
1834
2012
  }
1835
- setHsl(h, s, l) {
1836
- const opacity = this.color.opacity,
1837
- hsl = rgbToHsl(this.color.r, this.color.g, this.color.b),
1838
- rgb = hslToRgb(isNil$1(h) ? hsl.h : clamp$1(h, 0, 360), isNil$1(s) ? hsl.s : s >= 0 && s <= 1 ? 100 * s : s, isNil$1(l) ? hsl.l : l <= 1 && l >= 0 ? 100 * l : l);
1839
- return this.color = new RGB(rgb.r, rgb.g, rgb.b, opacity), this;
2013
+ }
2014
+ class PointService {
2015
+ static distancePP(p1, p2) {
2016
+ return sqrt(pow(p1.x - p2.x, 2) + pow(p1.y - p2.y, 2));
1840
2017
  }
1841
- setRGB(r, g, b) {
1842
- return !isNil$1(r) && (this.color.r = r), !isNil$1(g) && (this.color.g = g), !isNil$1(b) && (this.color.b = b), this;
2018
+ static distanceNN(x, y, x1, y1) {
2019
+ return sqrt(pow(x - x1, 2) + pow(y - y1, 2));
1843
2020
  }
1844
- setHex(value) {
1845
- const formatValue = `${value}`.trim().toLowerCase(),
1846
- res = setHex(formatValue, !0);
1847
- return null != res ? res : this;
2021
+ static distancePN(point, x, y) {
2022
+ return sqrt(pow(x - point.x, 2) + pow(y - point.y, 2));
1848
2023
  }
1849
- setColorName(name) {
1850
- const hex = DEFAULT_COLORS[name.toLowerCase()];
1851
- return void 0 !== hex ? this.setHex(hex) : (void 0), this;
2024
+ static pointAtPP(p1, p2, t) {
2025
+ return new Point((p2.x - p1.x) * t + p1.x, (p2.y - p1.y) * t + p1.y);
1852
2026
  }
1853
- setScalar(scalar) {
1854
- return this.color.r = scalar, this.color.g = scalar, this.color.b = scalar, this;
2027
+ }
2028
+
2029
+ function degreeToRadian(degree) {
2030
+ return degree * (Math.PI / 180);
2031
+ }
2032
+ function radianToDegree(radian) {
2033
+ return 180 * radian / Math.PI;
2034
+ }
2035
+ const clampRadian = function () {
2036
+ let angle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
2037
+ if (angle < 0) for (; angle < -tau;) angle += tau;else if (angle > 0) for (; angle > tau;) angle -= tau;
2038
+ return angle;
2039
+ };
2040
+ const clampAngleByRadian = clampRadian;
2041
+
2042
+ var InnerBBox;
2043
+ !function (InnerBBox) {
2044
+ InnerBBox[InnerBBox.NONE = 0] = "NONE", InnerBBox[InnerBBox.BBOX1 = 1] = "BBOX1", InnerBBox[InnerBBox.BBOX2 = 2] = "BBOX2";
2045
+ }(InnerBBox || (InnerBBox = {}));
2046
+ function getProjectionRadius(checkAxis, axis) {
2047
+ return Math.abs(axis[0] * checkAxis[0] + axis[1] * checkAxis[1]);
2048
+ }
2049
+ function rotatePoint(_ref, rad) {
2050
+ let {
2051
+ x: x,
2052
+ y: y
2053
+ } = _ref;
2054
+ let origin = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
2055
+ x: 0,
2056
+ y: 0
2057
+ };
2058
+ return {
2059
+ x: (x - origin.x) * Math.cos(rad) - (y - origin.y) * Math.sin(rad) + origin.x,
2060
+ y: (x - origin.x) * Math.sin(rad) + (y - origin.y) * Math.cos(rad) + origin.y
2061
+ };
2062
+ }
2063
+ function getCenterPoint(box) {
2064
+ return {
2065
+ x: (box.x1 + box.x2) / 2,
2066
+ y: (box.y1 + box.y2) / 2
2067
+ };
2068
+ }
2069
+ function toRect(box, isDeg) {
2070
+ const deg = isDeg ? degreeToRadian(box.angle) : box.angle,
2071
+ cp = getCenterPoint(box);
2072
+ return [rotatePoint({
2073
+ x: box.x1,
2074
+ y: box.y1
2075
+ }, deg, cp), rotatePoint({
2076
+ x: box.x2,
2077
+ y: box.y1
2078
+ }, deg, cp), rotatePoint({
2079
+ x: box.x2,
2080
+ y: box.y2
2081
+ }, deg, cp), rotatePoint({
2082
+ x: box.x1,
2083
+ y: box.y2
2084
+ }, deg, cp)];
2085
+ }
2086
+ function isRotateAABBIntersect(box1, box2) {
2087
+ let isDeg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
2088
+ let ctx = arguments.length > 3 ? arguments[3] : undefined;
2089
+ const rect1 = toRect(box1, isDeg),
2090
+ rect2 = toRect(box2, isDeg),
2091
+ vector = (start, end) => [end.x - start.x, end.y - start.y];
2092
+ ctx && (ctx.save(), ctx.fillStyle = "red", ctx.globalAlpha = .6, rect1.forEach((item, index) => {
2093
+ 0 === index ? ctx.moveTo(item.x, item.y) : ctx.lineTo(item.x, item.y);
2094
+ }), ctx.fill(), ctx.restore(), ctx.save(), ctx.fillStyle = "green", ctx.globalAlpha = .6, rect2.forEach((item, index) => {
2095
+ 0 === index ? ctx.moveTo(item.x, item.y) : ctx.lineTo(item.x, item.y);
2096
+ }), ctx.fill(), ctx.restore());
2097
+ const p1 = getCenterPoint(box1),
2098
+ p2 = getCenterPoint(box2);
2099
+ ctx && ctx.fillRect(p1.x, p1.y, 2, 2), ctx && ctx.fillRect(p2.x, p2.y, 2, 2);
2100
+ const vp1p2 = vector(p1, p2),
2101
+ AB = vector(rect1[0], rect1[1]),
2102
+ BC = vector(rect1[1], rect1[2]),
2103
+ A1B1 = vector(rect2[0], rect2[1]),
2104
+ B1C1 = vector(rect2[1], rect2[2]),
2105
+ deg11 = isDeg ? degreeToRadian(box1.angle) : box1.angle;
2106
+ let deg12 = isDeg ? degreeToRadian(90 - box1.angle) : box1.angle + halfPi$1;
2107
+ const deg21 = isDeg ? degreeToRadian(box2.angle) : box2.angle;
2108
+ let deg22 = isDeg ? degreeToRadian(90 - box2.angle) : box2.angle + halfPi$1;
2109
+ deg12 > pi2 && (deg12 -= pi2), deg22 > pi2 && (deg22 -= pi2);
2110
+ const isCover = (checkAxisRadius, deg, targetAxis1, targetAxis2) => {
2111
+ const checkAxis = [Math.cos(deg), Math.sin(deg)];
2112
+ return checkAxisRadius + (getProjectionRadius(checkAxis, targetAxis1) + getProjectionRadius(checkAxis, targetAxis2)) / 2 > getProjectionRadius(checkAxis, vp1p2);
2113
+ };
2114
+ return isCover((box1.x2 - box1.x1) / 2, deg11, A1B1, B1C1) && isCover((box1.y2 - box1.y1) / 2, deg12, A1B1, B1C1) && isCover((box2.x2 - box2.x1) / 2, deg21, AB, BC) && isCover((box2.y2 - box2.y1) / 2, deg22, AB, BC);
2115
+ }
2116
+
2117
+ function getContextFont(text) {
2118
+ let defaultAttr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2119
+ let fontSizeScale = arguments.length > 2 ? arguments[2] : undefined;
2120
+ fontSizeScale || (fontSizeScale = 1);
2121
+ const {
2122
+ fontStyle = defaultAttr.fontStyle,
2123
+ fontVariant = defaultAttr.fontVariant,
2124
+ fontWeight = defaultAttr.fontWeight,
2125
+ fontSize = defaultAttr.fontSize,
2126
+ fontFamily = defaultAttr.fontFamily
2127
+ } = text;
2128
+ return (fontStyle ? fontStyle + " " : "") + (fontVariant ? fontVariant + " " : "") + (fontWeight ? fontWeight + " " : "") + fontSize * fontSizeScale + "px " + (fontFamily || "sans-serif");
2129
+ }
2130
+
2131
+ const calculateAnchorOfBounds = (bounds, anchorType) => {
2132
+ const {
2133
+ x1: x1,
2134
+ x2: x2,
2135
+ y1: y1,
2136
+ y2: y2
2137
+ } = bounds,
2138
+ rectWidth = Math.abs(x2 - x1),
2139
+ rectHeight = Math.abs(y2 - y1);
2140
+ let anchorX = (x1 + x2) / 2,
2141
+ anchorY = (y1 + y2) / 2,
2142
+ sx = 0,
2143
+ sy = 0;
2144
+ switch (anchorType) {
2145
+ case "top":
2146
+ case "inside-top":
2147
+ sy = -.5;
2148
+ break;
2149
+ case "bottom":
2150
+ case "inside-bottom":
2151
+ sy = .5;
2152
+ break;
2153
+ case "left":
2154
+ case "inside-left":
2155
+ sx = -.5;
2156
+ break;
2157
+ case "right":
2158
+ case "inside-right":
2159
+ sx = .5;
2160
+ break;
2161
+ case "top-right":
2162
+ sx = .5, sy = -.5;
2163
+ break;
2164
+ case "top-left":
2165
+ sx = -.5, sy = -.5;
2166
+ break;
2167
+ case "bottom-right":
2168
+ sx = .5, sy = .5;
2169
+ break;
2170
+ case "bottom-left":
2171
+ sx = -.5, sy = .5;
1855
2172
  }
1856
- setOpacity() {
1857
- let o = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
1858
- return this.color.opacity = o, this;
2173
+ return anchorX += sx * rectWidth, anchorY += sy * rectHeight, {
2174
+ x: anchorX,
2175
+ y: anchorY
2176
+ };
2177
+ };
2178
+
2179
+ function transformBoundsWithMatrix(out, bounds, matrix) {
2180
+ const {
2181
+ x1: x1,
2182
+ y1: y1,
2183
+ x2: x2,
2184
+ y2: y2
2185
+ } = bounds;
2186
+ return matrix.onlyTranslate() ? (out !== bounds && out.setValue(bounds.x1, bounds.y1, bounds.x2, bounds.y2), out.translate(matrix.e, matrix.f), bounds) : (out.clear(), out.add(matrix.a * x1 + matrix.c * y1 + matrix.e, matrix.b * x1 + matrix.d * y1 + matrix.f), out.add(matrix.a * x2 + matrix.c * y1 + matrix.e, matrix.b * x2 + matrix.d * y1 + matrix.f), out.add(matrix.a * x2 + matrix.c * y2 + matrix.e, matrix.b * x2 + matrix.d * y2 + matrix.f), out.add(matrix.a * x1 + matrix.c * y2 + matrix.e, matrix.b * x1 + matrix.d * y2 + matrix.f), bounds);
2187
+ }
2188
+ class Bounds {
2189
+ constructor(bounds) {
2190
+ bounds ? this.setValue(bounds.x1, bounds.y1, bounds.x2, bounds.y2) : this.clear();
1859
2191
  }
1860
- getLuminance() {
1861
- return (.2126 * this.color.r + .7152 * this.color.g + .0722 * this.color.b) / 255;
2192
+ clone() {
2193
+ return new Bounds(this);
1862
2194
  }
1863
- getLuminance2() {
1864
- return (.2627 * this.color.r + .678 * this.color.g + .0593 * this.color.b) / 255;
2195
+ clear() {
2196
+ return this.x1 = +Number.MAX_VALUE, this.y1 = +Number.MAX_VALUE, this.x2 = -Number.MAX_VALUE, this.y2 = -Number.MAX_VALUE, this;
1865
2197
  }
1866
- getLuminance3() {
1867
- return (.299 * this.color.r + .587 * this.color.g + .114 * this.color.b) / 255;
2198
+ empty() {
2199
+ return this.x1 === +Number.MAX_VALUE && this.y1 === +Number.MAX_VALUE && this.x2 === -Number.MAX_VALUE && this.y2 === -Number.MAX_VALUE;
1868
2200
  }
1869
- clone() {
1870
- return new Color(this.color.toString());
2201
+ equals(b) {
2202
+ return this.x1 === b.x1 && this.y1 === b.y1 && this.x2 === b.x2 && this.y2 === b.y2;
1871
2203
  }
1872
- copyGammaToLinear(color) {
1873
- let gammaFactor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
1874
- return this.color.r = Math.pow(color.color.r, gammaFactor), this.color.g = Math.pow(color.color.g, gammaFactor), this.color.b = Math.pow(color.color.b, gammaFactor), this;
2204
+ setValue() {
2205
+ let x1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
2206
+ let y1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
2207
+ let x2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
2208
+ let y2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
2209
+ return this.x1 = x1, this.y1 = y1, this.x2 = x2, this.y2 = y2, this;
1875
2210
  }
1876
- copyLinearToGamma(color) {
1877
- let gammaFactor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
1878
- const safeInverse = gammaFactor > 0 ? 1 / gammaFactor : 1;
1879
- return this.color.r = Math.pow(color.color.r, safeInverse), this.color.g = Math.pow(color.color.g, safeInverse), this.color.b = Math.pow(color.color.b, safeInverse), this;
2211
+ set() {
2212
+ let x1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
2213
+ let y1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
2214
+ let x2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
2215
+ let y2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
2216
+ return x2 < x1 ? (this.x2 = x1, this.x1 = x2) : (this.x1 = x1, this.x2 = x2), y2 < y1 ? (this.y2 = y1, this.y1 = y2) : (this.y1 = y1, this.y2 = y2), this;
1880
2217
  }
1881
- convertGammaToLinear(gammaFactor) {
1882
- return this.copyGammaToLinear(this, gammaFactor), this;
2218
+ add() {
2219
+ let x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
2220
+ let y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
2221
+ return x < this.x1 && (this.x1 = x), y < this.y1 && (this.y1 = y), x > this.x2 && (this.x2 = x), y > this.y2 && (this.y2 = y), this;
1883
2222
  }
1884
- convertLinearToGamma(gammaFactor) {
1885
- return this.copyLinearToGamma(this, gammaFactor), this;
2223
+ expand() {
2224
+ let d = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
2225
+ return isArray$1(d) ? (this.y1 -= d[0], this.x2 += d[1], this.y2 += d[2], this.x1 -= d[3]) : (this.x1 -= d, this.y1 -= d, this.x2 += d, this.y2 += d), this;
1886
2226
  }
1887
- copySRGBToLinear(color) {
1888
- return this.color.r = SRGBToLinear(color.color.r), this.color.g = SRGBToLinear(color.color.g), this.color.b = SRGBToLinear(color.color.b), this;
2227
+ round() {
2228
+ return this.x1 = Math.floor(this.x1), this.y1 = Math.floor(this.y1), this.x2 = Math.ceil(this.x2), this.y2 = Math.ceil(this.y2), this;
1889
2229
  }
1890
- copyLinearToSRGB(color) {
1891
- return this.color.r = LinearToSRGB(color.color.r), this.color.g = LinearToSRGB(color.color.g), this.color.b = LinearToSRGB(color.color.b), this;
2230
+ translate() {
2231
+ let dx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
2232
+ let dy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
2233
+ return this.x1 += dx, this.x2 += dx, this.y1 += dy, this.y2 += dy, this;
1892
2234
  }
1893
- convertSRGBToLinear() {
1894
- return this.copySRGBToLinear(this), this;
2235
+ rotate() {
2236
+ let angle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
2237
+ let x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
2238
+ let y = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
2239
+ const p = this.rotatedPoints(angle, x, y);
2240
+ return this.clear().add(p[0], p[1]).add(p[2], p[3]).add(p[4], p[5]).add(p[6], p[7]);
1895
2241
  }
1896
- convertLinearToSRGB() {
1897
- return this.copyLinearToSRGB(this), this;
2242
+ scale() {
2243
+ let sx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
2244
+ let sy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
2245
+ let x = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
2246
+ let y = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
2247
+ const p = this.scalePoints(sx, sy, x, y);
2248
+ return this.clear().add(p[0], p[1]).add(p[2], p[3]);
1898
2249
  }
1899
- }
1900
- class RGB {
1901
- constructor(r, g, b, opacity) {
1902
- this.r = isNaN(+r) ? 255 : Math.max(0, Math.min(255, +r)), this.g = isNaN(+g) ? 255 : Math.max(0, Math.min(255, +g)), this.b = isNaN(+b) ? 255 : Math.max(0, Math.min(255, +b)), isValid$1(opacity) ? this.opacity = isNaN(+opacity) ? 1 : Math.max(0, Math.min(1, +opacity)) : this.opacity = 1;
2250
+ union(b) {
2251
+ return b.x1 < this.x1 && (this.x1 = b.x1), b.y1 < this.y1 && (this.y1 = b.y1), b.x2 > this.x2 && (this.x2 = b.x2), b.y2 > this.y2 && (this.y2 = b.y2), this;
1903
2252
  }
1904
- formatHex() {
1905
- return `#${hex(this.r) + hex(this.g) + hex(this.b) + (1 === this.opacity ? "" : hex(255 * this.opacity))}`;
2253
+ intersect(b) {
2254
+ return b.x1 > this.x1 && (this.x1 = b.x1), b.y1 > this.y1 && (this.y1 = b.y1), b.x2 < this.x2 && (this.x2 = b.x2), b.y2 < this.y2 && (this.y2 = b.y2), this;
1906
2255
  }
1907
- formatRgb() {
1908
- const opacity = this.opacity;
1909
- return `${1 === opacity ? "rgb(" : "rgba("}${this.r},${this.g},${this.b}${1 === opacity ? ")" : `,${opacity})`}`;
2256
+ encloses(b) {
2257
+ return b && this.x1 <= b.x1 && this.x2 >= b.x2 && this.y1 <= b.y1 && this.y2 >= b.y2;
1910
2258
  }
1911
- formatHsl() {
1912
- const opacity = this.opacity,
1913
- {
1914
- h: h,
1915
- s: s,
1916
- l: l
1917
- } = rgbToHsl(this.r, this.g, this.b);
1918
- return `${1 === opacity ? "hsl(" : "hsla("}${h},${s}%,${l}%${1 === opacity ? ")" : `,${opacity})`}`;
2259
+ alignsWith(b) {
2260
+ return b && (this.x1 === b.x1 || this.x2 === b.x2 || this.y1 === b.y1 || this.y2 === b.y2);
1919
2261
  }
1920
- toString() {
1921
- return this.formatHex();
2262
+ intersects(b) {
2263
+ return b && !(this.x2 < b.x1 || this.x1 > b.x2 || this.y2 < b.y1 || this.y1 > b.y2);
1922
2264
  }
1923
- }
1924
-
1925
- function normalizePadding(padding) {
1926
- if (isValidNumber$1(padding)) return [padding, padding, padding, padding];
1927
- if (isArray$1(padding)) {
1928
- const length = padding.length;
1929
- if (1 === length) {
1930
- const paddingValue = padding[0];
1931
- return [paddingValue, paddingValue, paddingValue, paddingValue];
1932
- }
1933
- if (2 === length) {
1934
- const [vertical, horizontal] = padding;
1935
- return [vertical, horizontal, vertical, horizontal];
1936
- }
1937
- if (3 === length) {
1938
- const [top, horizontal, bottom] = padding;
1939
- return [top, horizontal, bottom, horizontal];
1940
- }
1941
- if (4 === length) return padding;
2265
+ contains() {
2266
+ let x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
2267
+ let y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
2268
+ return !(x < this.x1 || x > this.x2 || y < this.y1 || y > this.y2);
1942
2269
  }
1943
- if (isObject$1(padding)) {
1944
- const {
1945
- top = 0,
1946
- right = 0,
1947
- bottom = 0,
1948
- left = 0
1949
- } = padding;
1950
- return [top, right, bottom, left];
2270
+ containsPoint(p) {
2271
+ return !(p.x < this.x1 || p.x > this.x2 || p.y < this.y1 || p.y > this.y2);
1951
2272
  }
1952
- return [0, 0, 0, 0];
1953
- }
1954
-
1955
- const styleStringToObject = function () {
1956
- let styleStr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
1957
- const res = {};
1958
- return styleStr.split(";").forEach(item => {
1959
- if (item) {
1960
- const arr = item.split(":");
1961
- if (2 === arr.length) {
1962
- const key = arr[0].trim(),
1963
- value = arr[1].trim();
1964
- key && value && (res[key] = value);
1965
- }
1966
- }
1967
- }), res;
1968
- };
1969
- const lowerCamelCaseToMiddle = str => str.replace(/([A-Z])/g, "-$1").toLowerCase();
1970
-
1971
- var reactIs = {exports: {}};
1972
-
1973
- var reactIs_production_min = {};
1974
-
1975
- /**
1976
- * @license React
1977
- * react-is.production.min.js
1978
- *
1979
- * Copyright (c) Facebook, Inc. and its affiliates.
1980
- *
1981
- * This source code is licensed under the MIT license found in the
1982
- * LICENSE file in the root directory of this source tree.
1983
- */
1984
- var hasRequiredReactIs_production_min;
1985
- function requireReactIs_production_min() {
1986
- if (hasRequiredReactIs_production_min) return reactIs_production_min;
1987
- hasRequiredReactIs_production_min = 1;
1988
- var b = Symbol.for("react.element"),
1989
- c = Symbol.for("react.portal"),
1990
- d = Symbol.for("react.fragment"),
1991
- e = Symbol.for("react.strict_mode"),
1992
- f = Symbol.for("react.profiler"),
1993
- g = Symbol.for("react.provider"),
1994
- h = Symbol.for("react.context"),
1995
- k = Symbol.for("react.server_context"),
1996
- l = Symbol.for("react.forward_ref"),
1997
- m = Symbol.for("react.suspense"),
1998
- n = Symbol.for("react.suspense_list"),
1999
- p = Symbol.for("react.memo"),
2000
- q = Symbol.for("react.lazy"),
2001
- t = Symbol.for("react.offscreen"),
2002
- u;
2003
- u = Symbol.for("react.module.reference");
2004
- function v(a) {
2005
- if ("object" === typeof a && null !== a) {
2006
- var r = a.$$typeof;
2007
- switch (r) {
2008
- case b:
2009
- switch (a = a.type, a) {
2010
- case d:
2011
- case f:
2012
- case e:
2013
- case m:
2014
- case n:
2015
- return a;
2016
- default:
2017
- switch (a = a && a.$$typeof, a) {
2018
- case k:
2019
- case h:
2020
- case l:
2021
- case q:
2022
- case p:
2023
- case g:
2024
- return a;
2025
- default:
2026
- return r;
2027
- }
2028
- }
2029
- case c:
2030
- return r;
2031
- }
2032
- }
2273
+ width() {
2274
+ return this.empty() ? 0 : this.x2 - this.x1;
2275
+ }
2276
+ height() {
2277
+ return this.empty() ? 0 : this.y2 - this.y1;
2278
+ }
2279
+ scaleX() {
2280
+ let s = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
2281
+ return this.x1 *= s, this.x2 *= s, this;
2282
+ }
2283
+ scaleY() {
2284
+ let s = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
2285
+ return this.y1 *= s, this.y2 *= s, this;
2286
+ }
2287
+ transformWithMatrix(matrix) {
2288
+ return transformBoundsWithMatrix(this, this, matrix), this;
2289
+ }
2290
+ copy(b) {
2291
+ return this.x1 = b.x1, this.y1 = b.y1, this.x2 = b.x2, this.y2 = b.y2, this;
2292
+ }
2293
+ rotatedPoints(angle, x, y) {
2294
+ const {
2295
+ x1: x1,
2296
+ y1: y1,
2297
+ x2: x2,
2298
+ y2: y2
2299
+ } = this,
2300
+ cos = Math.cos(angle),
2301
+ sin = Math.sin(angle),
2302
+ cx = x - x * cos + y * sin,
2303
+ cy = y - x * sin - y * cos;
2304
+ return [cos * x1 - sin * y1 + cx, sin * x1 + cos * y1 + cy, cos * x1 - sin * y2 + cx, sin * x1 + cos * y2 + cy, cos * x2 - sin * y1 + cx, sin * x2 + cos * y1 + cy, cos * x2 - sin * y2 + cx, sin * x2 + cos * y2 + cy];
2305
+ }
2306
+ scalePoints(sx, sy, x, y) {
2307
+ const {
2308
+ x1: x1,
2309
+ y1: y1,
2310
+ x2: x2,
2311
+ y2: y2
2312
+ } = this;
2313
+ return [sx * x1 + (1 - sx) * x, sy * y1 + (1 - sy) * y, sx * x2 + (1 - sx) * x, sy * y2 + (1 - sy) * y];
2033
2314
  }
2034
- reactIs_production_min.ContextConsumer = h;
2035
- reactIs_production_min.ContextProvider = g;
2036
- reactIs_production_min.Element = b;
2037
- reactIs_production_min.ForwardRef = l;
2038
- reactIs_production_min.Fragment = d;
2039
- reactIs_production_min.Lazy = q;
2040
- reactIs_production_min.Memo = p;
2041
- reactIs_production_min.Portal = c;
2042
- reactIs_production_min.Profiler = f;
2043
- reactIs_production_min.StrictMode = e;
2044
- reactIs_production_min.Suspense = m;
2045
- reactIs_production_min.SuspenseList = n;
2046
- reactIs_production_min.isAsyncMode = function () {
2047
- return !1;
2048
- };
2049
- reactIs_production_min.isConcurrentMode = function () {
2050
- return !1;
2051
- };
2052
- reactIs_production_min.isContextConsumer = function (a) {
2053
- return v(a) === h;
2054
- };
2055
- reactIs_production_min.isContextProvider = function (a) {
2056
- return v(a) === g;
2057
- };
2058
- reactIs_production_min.isElement = function (a) {
2059
- return "object" === typeof a && null !== a && a.$$typeof === b;
2060
- };
2061
- reactIs_production_min.isForwardRef = function (a) {
2062
- return v(a) === l;
2063
- };
2064
- reactIs_production_min.isFragment = function (a) {
2065
- return v(a) === d;
2066
- };
2067
- reactIs_production_min.isLazy = function (a) {
2068
- return v(a) === q;
2069
- };
2070
- reactIs_production_min.isMemo = function (a) {
2071
- return v(a) === p;
2072
- };
2073
- reactIs_production_min.isPortal = function (a) {
2074
- return v(a) === c;
2075
- };
2076
- reactIs_production_min.isProfiler = function (a) {
2077
- return v(a) === f;
2078
- };
2079
- reactIs_production_min.isStrictMode = function (a) {
2080
- return v(a) === e;
2081
- };
2082
- reactIs_production_min.isSuspense = function (a) {
2083
- return v(a) === m;
2084
- };
2085
- reactIs_production_min.isSuspenseList = function (a) {
2086
- return v(a) === n;
2087
- };
2088
- reactIs_production_min.isValidElementType = function (a) {
2089
- return "string" === typeof a || "function" === typeof a || a === d || a === f || a === e || a === m || a === n || a === t || "object" === typeof a && null !== a && (a.$$typeof === q || a.$$typeof === p || a.$$typeof === g || a.$$typeof === h || a.$$typeof === l || a.$$typeof === u || void 0 !== a.getModuleId) ? !0 : !1;
2090
- };
2091
- reactIs_production_min.typeOf = v;
2092
- return reactIs_production_min;
2093
2315
  }
2094
-
2095
- {
2096
- reactIs.exports = requireReactIs_production_min();
2316
+ class AABBBounds extends Bounds {}
2317
+ class OBBBounds extends Bounds {
2318
+ constructor(bounds) {
2319
+ let angle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
2320
+ super(bounds), bounds && (this.angle = angle);
2321
+ }
2322
+ intersects(b) {
2323
+ return isRotateAABBIntersect(this, b);
2324
+ }
2325
+ setValue() {
2326
+ let x1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
2327
+ let y1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
2328
+ let x2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
2329
+ let y2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
2330
+ let angle = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
2331
+ return super.setValue(x1, y1, x2, y2), this.angle = angle, this;
2332
+ }
2097
2333
  }
2098
- var reactIsExports = reactIs.exports;
2099
-
2100
- const toArray = (children) => {
2101
- let result = [];
2102
- React.Children.forEach(children, child => {
2103
- if (isNil$1(child)) {
2104
- return;
2105
- }
2106
- if (reactIsExports.isFragment(child)) {
2107
- result = result.concat(toArray(child.props.children));
2108
- }
2109
- else {
2110
- result.push(child);
2111
- }
2112
- });
2113
- return result;
2114
- };
2115
-
2116
- const REACT_PRIVATE_PROPS = ['children', 'hooks', 'ref'];
2117
-
2118
- const EVENT_TYPE = {
2119
- ...vtable.TABLE_EVENT_TYPE,
2120
- ...vtable.PIVOT_TABLE_EVENT_TYPE,
2121
- ...vtable.PIVOT_CHART_EVENT_TYPE
2122
- };
2123
- const TABLE_EVENTS = {
2124
- onClickCell: EVENT_TYPE.CLICK_CELL,
2125
- onDblClickCell: EVENT_TYPE.DBLCLICK_CELL,
2126
- onMouseDownCell: EVENT_TYPE.MOUSEDOWN_CELL,
2127
- onMouseUpCell: EVENT_TYPE.MOUSEUP_CELL,
2128
- onSelectedCell: EVENT_TYPE.SELECTED_CELL,
2129
- onSelectedClear: EVENT_TYPE.SELECTED_CLEAR,
2130
- onKeyDown: EVENT_TYPE.KEYDOWN,
2131
- onMouseEnterTable: EVENT_TYPE.MOUSEENTER_TABLE,
2132
- onMouseLeaveTable: EVENT_TYPE.MOUSELEAVE_TABLE,
2133
- onMouseDownTable: EVENT_TYPE.MOUSEDOWN_TABLE,
2134
- onMouseMoveCell: EVENT_TYPE.MOUSEMOVE_CELL,
2135
- onMouseEnterCell: EVENT_TYPE.MOUSEENTER_CELL,
2136
- onMouseLeaveCell: EVENT_TYPE.MOUSELEAVE_CELL,
2137
- onContextMenuCell: EVENT_TYPE.CONTEXTMENU_CELL,
2138
- onResizeColumn: EVENT_TYPE.RESIZE_COLUMN,
2139
- onResizeColumnEnd: EVENT_TYPE.RESIZE_COLUMN_END,
2140
- onChangeHeaderPosition: EVENT_TYPE.CHANGE_HEADER_POSITION,
2141
- onSortClick: EVENT_TYPE.SORT_CLICK,
2142
- onFreezeClick: EVENT_TYPE.FREEZE_CLICK,
2143
- onScroll: EVENT_TYPE.SCROLL,
2144
- onDropdownMenuClick: EVENT_TYPE.DROPDOWN_MENU_CLICK,
2145
- onMouseOverChartSymbol: EVENT_TYPE.MOUSEOVER_CHART_SYMBOL,
2146
- onDragSelectEnd: EVENT_TYPE.DRAG_SELECT_END,
2147
- onDropdownIconClick: EVENT_TYPE.DROPDOWN_ICON_CLICK,
2148
- onDropdownMenuClear: EVENT_TYPE.DROPDOWN_MENU_CLEAR,
2149
- onTreeHierarchyStateChange: EVENT_TYPE.TREE_HIERARCHY_STATE_CHANGE,
2150
- onShowMenu: EVENT_TYPE.SHOW_MENU,
2151
- onHideMenu: EVENT_TYPE.HIDE_MENU,
2152
- onIconClick: EVENT_TYPE.ICON_CLICK,
2153
- onLegendItemClick: EVENT_TYPE.LEGEND_ITEM_CLICK,
2154
- onLegendItemHover: EVENT_TYPE.LEGEND_ITEM_HOVER,
2155
- onLegendItemUnHover: EVENT_TYPE.LEGEND_ITEM_UNHOVER,
2156
- onLegendChange: EVENT_TYPE.LEGEND_CHANGE,
2157
- onMouseEnterAxis: EVENT_TYPE.MOUSEENTER_AXIS,
2158
- onMouseLeaveAxis: EVENT_TYPE.MOUSELEAVE_AXIS,
2159
- onCheckboxStateChange: EVENT_TYPE.CHECKBOX_STATE_CHANGE,
2160
- onRadioStateChange: EVENT_TYPE.RADIO_STATE_CHANGE,
2161
- onAfterRender: EVENT_TYPE.AFTER_RENDER,
2162
- onInitialized: EVENT_TYPE.INITIALIZED,
2163
- onPivotSortClick: EVENT_TYPE.PIVOT_SORT_CLICK,
2164
- onDrillMenuClick: EVENT_TYPE.DRILLMENU_CLICK,
2165
- onVChartEventType: EVENT_TYPE.VCHART_EVENT_TYPE,
2166
- onChangCellValue: EVENT_TYPE.CHANGE_CELL_VALUE,
2167
- onMousedownFillHandle: EVENT_TYPE.MOUSEDOWN_FILL_HANDLE,
2168
- onDragFillHandleEnd: EVENT_TYPE.DRAG_FILL_HANDLE_END,
2169
- onDblclickFillHandle: EVENT_TYPE.DBLCLICK_FILL_HANDLE,
2170
- onScrollVerticalEnd: EVENT_TYPE.SCROLL_VERTICAL_END,
2171
- onScrollHorizontalEnd: EVENT_TYPE.SCROLL_HORIZONTAL_END
2172
- };
2173
- const TABLE_EVENTS_KEYS = Object.keys(TABLE_EVENTS);
2174
- const findEventProps = (props, supportedEvents = TABLE_EVENTS) => {
2175
- const result = {};
2176
- Object.keys(props).forEach(key => {
2177
- if (supportedEvents[key] && props[key]) {
2178
- result[key] = props[key];
2179
- }
2180
- });
2181
- return result;
2182
- };
2183
- const bindEventsToTable = (table, newProps, prevProps, supportedEvents = TABLE_EVENTS) => {
2184
- if ((!newProps && !prevProps) || !table) {
2185
- return false;
2186
- }
2187
- const prevEventProps = prevProps ? findEventProps(prevProps, supportedEvents) : null;
2188
- const newEventProps = newProps ? findEventProps(newProps, supportedEvents) : null;
2189
- if (prevEventProps) {
2190
- Object.keys(prevEventProps).forEach(eventKey => {
2191
- if (!newEventProps ||
2192
- !newEventProps[eventKey] ||
2193
- newEventProps[eventKey] !== prevEventProps[eventKey]) {
2194
- table.off(supportedEvents[eventKey], prevProps[eventKey]);
2195
- }
2196
- });
2197
- }
2198
- if (newEventProps) {
2199
- Object.keys(newEventProps).forEach(eventKey => {
2200
- if (!prevEventProps ||
2201
- !prevEventProps[eventKey] ||
2202
- prevEventProps[eventKey] !== newEventProps[eventKey]) {
2203
- table.on(supportedEvents[eventKey], newEventProps[eventKey]);
2204
- }
2205
- });
2206
- }
2207
- return true;
2208
- };
2209
2334
 
2210
- class Generator {
2211
- static GenAutoIncrementId() {
2212
- return Generator.auto_increment_id++;
2335
+ class Matrix {
2336
+ constructor() {
2337
+ let a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
2338
+ let b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
2339
+ let c = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
2340
+ let d = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
2341
+ let e = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
2342
+ let f = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
2343
+ this.a = a, this.b = b, this.c = c, this.d = d, this.e = e, this.f = f;
2344
+ }
2345
+ equalToMatrix(m2) {
2346
+ return !(this.e !== m2.e || this.f !== m2.f || this.a !== m2.a || this.d !== m2.d || this.b !== m2.b || this.c !== m2.c);
2347
+ }
2348
+ equalTo(a, b, c, d, e, f) {
2349
+ return !(this.e !== e || this.f !== f || this.a !== a || this.d !== d || this.b !== b || this.c !== c);
2350
+ }
2351
+ setValue(a, b, c, d, e, f) {
2352
+ return this.a = a, this.b = b, this.c = c, this.d = d, this.e = e, this.f = f, this;
2353
+ }
2354
+ reset() {
2355
+ return this.a = 1, this.b = 0, this.c = 0, this.d = 1, this.e = 0, this.f = 0, this;
2356
+ }
2357
+ getInverse() {
2358
+ const a = this.a,
2359
+ b = this.b,
2360
+ c = this.c,
2361
+ d = this.d,
2362
+ e = this.e,
2363
+ f = this.f,
2364
+ m = new Matrix(),
2365
+ dt = a * d - b * c;
2366
+ return m.a = d / dt, m.b = -b / dt, m.c = -c / dt, m.d = a / dt, m.e = (c * f - d * e) / dt, m.f = -(a * f - b * e) / dt, m;
2213
2367
  }
2214
- }
2215
- Generator.auto_increment_id = 0;
2216
-
2217
- class ContainerModule {
2218
- constructor(registry) {
2219
- this.id = Generator.GenAutoIncrementId(), this.registry = registry;
2368
+ rotate(rad) {
2369
+ const c = Math.cos(rad),
2370
+ s = Math.sin(rad),
2371
+ m11 = this.a * c + this.c * s,
2372
+ m12 = this.b * c + this.d * s,
2373
+ m21 = this.a * -s + this.c * c,
2374
+ m22 = this.b * -s + this.d * c;
2375
+ return this.a = m11, this.b = m12, this.c = m21, this.d = m22, this;
2220
2376
  }
2221
- }
2222
-
2223
- const NAMED_TAG = "named";
2224
- const INJECT_TAG = "inject";
2225
- const MULTI_INJECT_TAG = "multi_inject";
2226
- const TAGGED = "inversify:tagged";
2227
- const PARAM_TYPES = "inversify:paramtypes";
2228
-
2229
- class Metadata {
2230
- constructor(key, value) {
2231
- this.key = key, this.value = value;
2377
+ rotateByCenter(rad, cx, cy) {
2378
+ const cos = Math.cos(rad),
2379
+ sin = Math.sin(rad),
2380
+ rotateM13 = (1 - cos) * cx + sin * cy,
2381
+ rotateM23 = (1 - cos) * cy - sin * cx,
2382
+ m11 = cos * this.a - sin * this.b,
2383
+ m21 = sin * this.a + cos * this.b,
2384
+ m12 = cos * this.c - sin * this.d,
2385
+ m22 = sin * this.c + cos * this.d,
2386
+ m13 = cos * this.e - sin * this.f + rotateM13,
2387
+ m23 = sin * this.e + cos * this.f + rotateM23;
2388
+ return this.a = m11, this.b = m21, this.c = m12, this.d = m22, this.e = m13, this.f = m23, this;
2232
2389
  }
2233
- toString() {
2234
- return this.key === NAMED_TAG ? `named: ${String(this.value).toString()} ` : `tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`;
2390
+ scale(sx, sy) {
2391
+ return this.a *= sx, this.b *= sx, this.c *= sy, this.d *= sy, this;
2235
2392
  }
2236
- }
2237
-
2238
- var Reflect$1 = (function (Reflect) {
2239
- var target;
2240
- return function (exporter) {
2241
- const supportsSymbol = "function" == typeof Symbol,
2242
- toPrimitiveSymbol = supportsSymbol && void 0 !== Symbol.toPrimitive ? Symbol.toPrimitive : "@@toPrimitive",
2243
- functionPrototype = (Object.getPrototypeOf(Function)),
2244
- _Map = ("object" == typeof process && process.env && process.env.REFLECT_METADATA_USE_MAP_POLYFILL, Map),
2245
- Metadata = (new WeakMap());
2246
- function defineMetadata(metadataKey, metadataValue, target, propertyKey) {
2247
- if (!IsObject(target)) throw new TypeError();
2248
- return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);
2249
- }
2250
- function hasMetadata(metadataKey, target, propertyKey) {
2251
- if (!IsObject(target)) throw new TypeError();
2252
- return IsUndefined(propertyKey) || (propertyKey = ToPropertyKey(propertyKey)), OrdinaryHasMetadata(metadataKey, target, propertyKey);
2253
- }
2254
- function hasOwnMetadata(metadataKey, target, propertyKey) {
2255
- if (!IsObject(target)) throw new TypeError();
2256
- return IsUndefined(propertyKey) || (propertyKey = ToPropertyKey(propertyKey)), OrdinaryHasOwnMetadata(metadataKey, target, propertyKey);
2257
- }
2258
- function getMetadata(metadataKey, target, propertyKey) {
2259
- if (!IsObject(target)) throw new TypeError();
2260
- return IsUndefined(propertyKey) || (propertyKey = ToPropertyKey(propertyKey)), OrdinaryGetMetadata(metadataKey, target, propertyKey);
2261
- }
2262
- function GetOrCreateMetadataMap(O, P, Create) {
2263
- let targetMetadata = Metadata.get(O);
2264
- if (IsUndefined(targetMetadata)) {
2265
- if (!Create) return;
2266
- targetMetadata = new _Map(), Metadata.set(O, targetMetadata);
2267
- }
2268
- let metadataMap = targetMetadata.get(P);
2269
- if (IsUndefined(metadataMap)) {
2270
- if (!Create) return;
2271
- metadataMap = new _Map(), targetMetadata.set(P, metadataMap);
2272
- }
2273
- return metadataMap;
2274
- }
2275
- function OrdinaryHasMetadata(MetadataKey, O, P) {
2276
- if (OrdinaryHasOwnMetadata(MetadataKey, O, P)) return !0;
2277
- const parent = OrdinaryGetPrototypeOf(O);
2278
- return !IsNull(parent) && OrdinaryHasMetadata(MetadataKey, parent, P);
2279
- }
2280
- function OrdinaryHasOwnMetadata(MetadataKey, O, P) {
2281
- const metadataMap = GetOrCreateMetadataMap(O, P, !1);
2282
- return !IsUndefined(metadataMap) && ToBoolean(metadataMap.has(MetadataKey));
2283
- }
2284
- function OrdinaryGetMetadata(MetadataKey, O, P) {
2285
- if (OrdinaryHasOwnMetadata(MetadataKey, O, P)) return OrdinaryGetOwnMetadata(MetadataKey, O, P);
2286
- const parent = OrdinaryGetPrototypeOf(O);
2287
- return IsNull(parent) ? void 0 : OrdinaryGetMetadata(MetadataKey, parent, P);
2288
- }
2289
- function OrdinaryGetOwnMetadata(MetadataKey, O, P) {
2290
- const metadataMap = GetOrCreateMetadataMap(O, P, !1);
2291
- if (!IsUndefined(metadataMap)) return metadataMap.get(MetadataKey);
2292
- }
2293
- function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) {
2294
- GetOrCreateMetadataMap(O, P, !0).set(MetadataKey, MetadataValue);
2295
- }
2296
- function Type(x) {
2297
- if (null === x) return 1;
2298
- switch (typeof x) {
2299
- case "undefined":
2300
- return 0;
2301
- case "boolean":
2302
- return 2;
2303
- case "string":
2304
- return 3;
2305
- case "symbol":
2306
- return 4;
2307
- case "number":
2308
- return 5;
2309
- case "object":
2310
- return null === x ? 1 : 6;
2311
- default:
2312
- return 6;
2313
- }
2314
- }
2315
- function IsUndefined(x) {
2316
- return void 0 === x;
2317
- }
2318
- function IsNull(x) {
2319
- return null === x;
2320
- }
2321
- function IsSymbol(x) {
2322
- return "symbol" == typeof x;
2323
- }
2324
- function IsObject(x) {
2325
- return "object" == typeof x ? null !== x : "function" == typeof x;
2326
- }
2327
- function ToPrimitive(input, PreferredType) {
2328
- switch (Type(input)) {
2329
- case 0:
2330
- case 1:
2331
- case 2:
2332
- case 3:
2333
- case 4:
2334
- case 5:
2335
- return input;
2336
- }
2337
- const hint = 3 === PreferredType ? "string" : 5 === PreferredType ? "number" : "default",
2338
- exoticToPrim = GetMethod(input, toPrimitiveSymbol);
2339
- if (void 0 !== exoticToPrim) {
2340
- const result = exoticToPrim.call(input, hint);
2341
- if (IsObject(result)) throw new TypeError();
2342
- return result;
2343
- }
2344
- return OrdinaryToPrimitive(input, "default" === hint ? "number" : hint);
2345
- }
2346
- function OrdinaryToPrimitive(O, hint) {
2347
- if ("string" === hint) {
2348
- const toString_1 = O.toString;
2349
- if (IsCallable(toString_1)) {
2350
- const result = toString_1.call(O);
2351
- if (!IsObject(result)) return result;
2352
- }
2353
- const valueOf = O.valueOf;
2354
- if (IsCallable(valueOf)) {
2355
- const result = valueOf.call(O);
2356
- if (!IsObject(result)) return result;
2357
- }
2358
- } else {
2359
- const valueOf = O.valueOf;
2360
- if (IsCallable(valueOf)) {
2361
- const result = valueOf.call(O);
2362
- if (!IsObject(result)) return result;
2363
- }
2364
- const toString_2 = O.toString;
2365
- if (IsCallable(toString_2)) {
2366
- const result = toString_2.call(O);
2367
- if (!IsObject(result)) return result;
2368
- }
2369
- }
2370
- throw new TypeError();
2371
- }
2372
- function ToBoolean(argument) {
2373
- return !!argument;
2374
- }
2375
- function ToString(argument) {
2376
- return "" + argument;
2377
- }
2378
- function ToPropertyKey(argument) {
2379
- const key = ToPrimitive(argument, 3);
2380
- return IsSymbol(key) ? key : ToString(key);
2381
- }
2382
- function IsCallable(argument) {
2383
- return "function" == typeof argument;
2384
- }
2385
- function GetMethod(V, P) {
2386
- const func = V[P];
2387
- if (null != func) {
2388
- if (!IsCallable(func)) throw new TypeError();
2389
- return func;
2390
- }
2391
- }
2392
- function OrdinaryGetPrototypeOf(O) {
2393
- const proto = Object.getPrototypeOf(O);
2394
- if ("function" != typeof O || O === functionPrototype) return proto;
2395
- if (proto !== functionPrototype) return proto;
2396
- const prototype = O.prototype,
2397
- prototypeProto = prototype && Object.getPrototypeOf(prototype);
2398
- if (null == prototypeProto || prototypeProto === Object.prototype) return proto;
2399
- const constructor = prototypeProto.constructor;
2400
- return "function" != typeof constructor || constructor === O ? proto : constructor;
2393
+ setScale(sx, sy) {
2394
+ return this.b = this.b / this.a * sx, this.c = this.c / this.d * sy, this.a = sx, this.d = sy, this;
2395
+ }
2396
+ transform(a, b, c, d, e, f) {
2397
+ return this.multiply(a, b, c, d, e, f), this;
2398
+ }
2399
+ translate(x, y) {
2400
+ return this.e += this.a * x + this.c * y, this.f += this.b * x + this.d * y, this;
2401
+ }
2402
+ transpose() {
2403
+ const {
2404
+ a: a,
2405
+ b: b,
2406
+ c: c,
2407
+ d: d,
2408
+ e: e,
2409
+ f: f
2410
+ } = this;
2411
+ return this.a = b, this.b = a, this.c = d, this.d = c, this.e = f, this.f = e, this;
2412
+ }
2413
+ multiply(a2, b2, c2, d2, e2, f2) {
2414
+ const a1 = this.a,
2415
+ b1 = this.b,
2416
+ c1 = this.c,
2417
+ d1 = this.d,
2418
+ m11 = a1 * a2 + c1 * b2,
2419
+ m12 = b1 * a2 + d1 * b2,
2420
+ m21 = a1 * c2 + c1 * d2,
2421
+ m22 = b1 * c2 + d1 * d2,
2422
+ dx = a1 * e2 + c1 * f2 + this.e,
2423
+ dy = b1 * e2 + d1 * f2 + this.f;
2424
+ return this.a = m11, this.b = m12, this.c = m21, this.d = m22, this.e = dx, this.f = dy, this;
2425
+ }
2426
+ interpolate(m2, t) {
2427
+ const m = new Matrix();
2428
+ return m.a = this.a + (m2.a - this.a) * t, m.b = this.b + (m2.b - this.b) * t, m.c = this.c + (m2.c - this.c) * t, m.d = this.d + (m2.d - this.d) * t, m.e = this.e + (m2.e - this.e) * t, m.f = this.f + (m2.f - this.f) * t, m;
2429
+ }
2430
+ transformPoint(source, target) {
2431
+ const {
2432
+ a: a,
2433
+ b: b,
2434
+ c: c,
2435
+ d: d,
2436
+ e: e,
2437
+ f: f
2438
+ } = this,
2439
+ dt = a * d - b * c,
2440
+ nextA = d / dt,
2441
+ nextB = -b / dt,
2442
+ nextC = -c / dt,
2443
+ nextD = a / dt,
2444
+ nextE = (c * f - d * e) / dt,
2445
+ nextF = -(a * f - b * e) / dt,
2446
+ {
2447
+ x: x,
2448
+ y: y
2449
+ } = source;
2450
+ target.x = x * nextA + y * nextC + nextE, target.y = x * nextB + y * nextD + nextF;
2451
+ }
2452
+ onlyTranslate() {
2453
+ let scale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
2454
+ return this.a === scale && 0 === this.b && 0 === this.c && this.d === scale;
2455
+ }
2456
+ clone() {
2457
+ return new Matrix(this.a, this.b, this.c, this.d, this.e, this.f);
2458
+ }
2459
+ toTransformAttrs() {
2460
+ const a = this.a,
2461
+ b = this.b,
2462
+ c = this.c,
2463
+ d = this.d,
2464
+ delta = a * d - b * c,
2465
+ result = {
2466
+ x: this.e,
2467
+ y: this.f,
2468
+ rotateDeg: 0,
2469
+ scaleX: 0,
2470
+ scaleY: 0,
2471
+ skewX: 0,
2472
+ skewY: 0
2473
+ };
2474
+ if (0 !== a || 0 !== b) {
2475
+ const r = Math.sqrt(a * a + b * b);
2476
+ result.rotateDeg = b > 0 ? Math.acos(a / r) : -Math.acos(a / r), result.scaleX = r, result.scaleY = delta / r, result.skewX = (a * c + b * d) / delta, result.skewY = 0;
2477
+ } else if (0 !== c || 0 !== d) {
2478
+ const s = Math.sqrt(c * c + d * d);
2479
+ result.rotateDeg = Math.PI / 2 - (d > 0 ? Math.acos(-c / s) : -Math.acos(c / s)), result.scaleX = delta / s, result.scaleY = s, result.skewX = 0, result.skewY = (a * c + b * d) / delta;
2401
2480
  }
2402
- exporter("defineMetadata", defineMetadata), exporter("hasMetadata", hasMetadata), exporter("hasOwnMetadata", hasOwnMetadata), exporter("getMetadata", getMetadata);
2403
- }((target = Reflect, function (key, value) {
2404
- "function" != typeof target[key] && Object.defineProperty(target, key, {
2405
- configurable: !0,
2406
- writable: !0,
2407
- value: value
2408
- });
2409
- })), Reflect;
2410
- })({});
2481
+ return result.rotateDeg = radianToDegree(result.rotateDeg), result;
2482
+ }
2483
+ }
2484
+ function normalTransform(out, origin, x, y, scaleX, scaleY, angle, rotateCenter) {
2485
+ const oa = origin.a,
2486
+ ob = origin.b,
2487
+ oc = origin.c,
2488
+ od = origin.d,
2489
+ oe = origin.e,
2490
+ of = origin.f,
2491
+ cosTheta = cos(angle),
2492
+ sinTheta = sin(angle);
2493
+ let rotateCenterX, rotateCenterY;
2494
+ rotateCenter ? (rotateCenterX = rotateCenter[0], rotateCenterY = rotateCenter[1]) : (rotateCenterX = x, rotateCenterY = y);
2495
+ const offsetX = rotateCenterX - x,
2496
+ offsetY = rotateCenterY - y,
2497
+ a1 = oa * cosTheta + oc * sinTheta,
2498
+ b1 = ob * cosTheta + od * sinTheta,
2499
+ c1 = oc * cosTheta - oa * sinTheta,
2500
+ d1 = od * cosTheta - ob * sinTheta;
2501
+ out.a = scaleX * a1, out.b = scaleX * b1, out.c = scaleY * c1, out.d = scaleY * d1, out.e = oe + oa * rotateCenterX + oc * rotateCenterY - a1 * offsetX - c1 * offsetY, out.f = of + ob * rotateCenterX + od * rotateCenterY - b1 * offsetX - d1 * offsetY;
2502
+ }
2411
2503
 
2412
- function _tagParameterOrProperty(metadataKey, annotationTarget, key, metadata) {
2413
- const metadatas = [metadata];
2414
- let paramsOrPropertiesMetadata = {};
2415
- Reflect$1.hasOwnMetadata(metadataKey, annotationTarget) && (paramsOrPropertiesMetadata = Reflect$1.getMetadata(metadataKey, annotationTarget));
2416
- let paramOrPropertyMetadata = paramsOrPropertiesMetadata[key];
2417
- void 0 === paramOrPropertyMetadata && (paramOrPropertyMetadata = []), paramOrPropertyMetadata.push(...metadatas), paramsOrPropertiesMetadata[key] = paramOrPropertyMetadata, Reflect$1.defineMetadata(metadataKey, paramsOrPropertiesMetadata, annotationTarget);
2504
+ function hslToRgb(h, s, l) {
2505
+ s /= 100, l /= 100;
2506
+ const c = (1 - Math.abs(2 * l - 1)) * s,
2507
+ x = c * (1 - Math.abs(h / 60 % 2 - 1)),
2508
+ m = l - c / 2;
2509
+ let r = 0,
2510
+ g = 0,
2511
+ b = 0;
2512
+ return 0 <= h && h < 60 ? (r = c, g = x, b = 0) : 60 <= h && h < 120 ? (r = x, g = c, b = 0) : 120 <= h && h < 180 ? (r = 0, g = c, b = x) : 180 <= h && h < 240 ? (r = 0, g = x, b = c) : 240 <= h && h < 300 ? (r = x, g = 0, b = c) : 300 <= h && h < 360 && (r = c, g = 0, b = x), r = Math.round(255 * (r + m)), g = Math.round(255 * (g + m)), b = Math.round(255 * (b + m)), {
2513
+ r: r,
2514
+ g: g,
2515
+ b: b
2516
+ };
2418
2517
  }
2419
- function tagParameter(annotationTarget, parameterName, parameterIndex, metadata) {
2420
- _tagParameterOrProperty(TAGGED, annotationTarget, parameterIndex.toString(), metadata);
2518
+
2519
+ function rgbToHsl(r, g, b) {
2520
+ r /= 255, g /= 255, b /= 255;
2521
+ const cMin = Math.min(r, g, b),
2522
+ cMax = Math.max(r, g, b),
2523
+ delta = cMax - cMin;
2524
+ let h = 0,
2525
+ s = 0,
2526
+ l = 0;
2527
+ return h = 0 === delta ? 0 : cMax === r ? (g - b) / delta % 6 : cMax === g ? (b - r) / delta + 2 : (r - g) / delta + 4, h = Math.round(60 * h), h < 0 && (h += 360), l = (cMax + cMin) / 2, s = 0 === delta ? 0 : delta / (1 - Math.abs(2 * l - 1)), s = +(100 * s).toFixed(1), l = +(100 * l).toFixed(1), {
2528
+ h: h,
2529
+ s: s,
2530
+ l: l
2531
+ };
2421
2532
  }
2422
- function createTaggedDecorator(metadata) {
2423
- return (target, targetKey, indexOrPropertyDescriptor) => {
2424
- tagParameter(target, targetKey, indexOrPropertyDescriptor, metadata);
2533
+
2534
+ const REG_HEX = /^#([0-9a-f]{3,8})$/,
2535
+ DEFAULT_COLORS_OPACITY = {
2536
+ transparent: 4294967040
2425
2537
  };
2538
+ const DEFAULT_COLORS = {
2539
+ aliceblue: 15792383,
2540
+ antiquewhite: 16444375,
2541
+ aqua: 65535,
2542
+ aquamarine: 8388564,
2543
+ azure: 15794175,
2544
+ beige: 16119260,
2545
+ bisque: 16770244,
2546
+ black: 0,
2547
+ blanchedalmond: 16772045,
2548
+ blue: 255,
2549
+ blueviolet: 9055202,
2550
+ brown: 10824234,
2551
+ burlywood: 14596231,
2552
+ cadetblue: 6266528,
2553
+ chartreuse: 8388352,
2554
+ chocolate: 13789470,
2555
+ coral: 16744272,
2556
+ cornflowerblue: 6591981,
2557
+ cornsilk: 16775388,
2558
+ crimson: 14423100,
2559
+ cyan: 65535,
2560
+ darkblue: 139,
2561
+ darkcyan: 35723,
2562
+ darkgoldenrod: 12092939,
2563
+ darkgray: 11119017,
2564
+ darkgreen: 25600,
2565
+ darkgrey: 11119017,
2566
+ darkkhaki: 12433259,
2567
+ darkmagenta: 9109643,
2568
+ darkolivegreen: 5597999,
2569
+ darkorange: 16747520,
2570
+ darkorchid: 10040012,
2571
+ darkred: 9109504,
2572
+ darksalmon: 15308410,
2573
+ darkseagreen: 9419919,
2574
+ darkslateblue: 4734347,
2575
+ darkslategray: 3100495,
2576
+ darkslategrey: 3100495,
2577
+ darkturquoise: 52945,
2578
+ darkviolet: 9699539,
2579
+ deeppink: 16716947,
2580
+ deepskyblue: 49151,
2581
+ dimgray: 6908265,
2582
+ dimgrey: 6908265,
2583
+ dodgerblue: 2003199,
2584
+ firebrick: 11674146,
2585
+ floralwhite: 16775920,
2586
+ forestgreen: 2263842,
2587
+ fuchsia: 16711935,
2588
+ gainsboro: 14474460,
2589
+ ghostwhite: 16316671,
2590
+ gold: 16766720,
2591
+ goldenrod: 14329120,
2592
+ gray: 8421504,
2593
+ green: 32768,
2594
+ greenyellow: 11403055,
2595
+ grey: 8421504,
2596
+ honeydew: 15794160,
2597
+ hotpink: 16738740,
2598
+ indianred: 13458524,
2599
+ indigo: 4915330,
2600
+ ivory: 16777200,
2601
+ khaki: 15787660,
2602
+ lavender: 15132410,
2603
+ lavenderblush: 16773365,
2604
+ lawngreen: 8190976,
2605
+ lemonchiffon: 16775885,
2606
+ lightblue: 11393254,
2607
+ lightcoral: 15761536,
2608
+ lightcyan: 14745599,
2609
+ lightgoldenrodyellow: 16448210,
2610
+ lightgray: 13882323,
2611
+ lightgreen: 9498256,
2612
+ lightgrey: 13882323,
2613
+ lightpink: 16758465,
2614
+ lightsalmon: 16752762,
2615
+ lightseagreen: 2142890,
2616
+ lightskyblue: 8900346,
2617
+ lightslategray: 7833753,
2618
+ lightslategrey: 7833753,
2619
+ lightsteelblue: 11584734,
2620
+ lightyellow: 16777184,
2621
+ lime: 65280,
2622
+ limegreen: 3329330,
2623
+ linen: 16445670,
2624
+ magenta: 16711935,
2625
+ maroon: 8388608,
2626
+ mediumaquamarine: 6737322,
2627
+ mediumblue: 205,
2628
+ mediumorchid: 12211667,
2629
+ mediumpurple: 9662683,
2630
+ mediumseagreen: 3978097,
2631
+ mediumslateblue: 8087790,
2632
+ mediumspringgreen: 64154,
2633
+ mediumturquoise: 4772300,
2634
+ mediumvioletred: 13047173,
2635
+ midnightblue: 1644912,
2636
+ mintcream: 16121850,
2637
+ mistyrose: 16770273,
2638
+ moccasin: 16770229,
2639
+ navajowhite: 16768685,
2640
+ navy: 128,
2641
+ oldlace: 16643558,
2642
+ olive: 8421376,
2643
+ olivedrab: 7048739,
2644
+ orange: 16753920,
2645
+ orangered: 16729344,
2646
+ orchid: 14315734,
2647
+ palegoldenrod: 15657130,
2648
+ palegreen: 10025880,
2649
+ paleturquoise: 11529966,
2650
+ palevioletred: 14381203,
2651
+ papayawhip: 16773077,
2652
+ peachpuff: 16767673,
2653
+ peru: 13468991,
2654
+ pink: 16761035,
2655
+ plum: 14524637,
2656
+ powderblue: 11591910,
2657
+ purple: 8388736,
2658
+ rebeccapurple: 6697881,
2659
+ red: 16711680,
2660
+ rosybrown: 12357519,
2661
+ royalblue: 4286945,
2662
+ saddlebrown: 9127187,
2663
+ salmon: 16416882,
2664
+ sandybrown: 16032864,
2665
+ seagreen: 3050327,
2666
+ seashell: 16774638,
2667
+ sienna: 10506797,
2668
+ silver: 12632256,
2669
+ skyblue: 8900331,
2670
+ slateblue: 6970061,
2671
+ slategray: 7372944,
2672
+ slategrey: 7372944,
2673
+ snow: 16775930,
2674
+ springgreen: 65407,
2675
+ steelblue: 4620980,
2676
+ tan: 13808780,
2677
+ teal: 32896,
2678
+ thistle: 14204888,
2679
+ tomato: 16737095,
2680
+ turquoise: 4251856,
2681
+ violet: 15631086,
2682
+ wheat: 16113331,
2683
+ white: 16777215,
2684
+ whitesmoke: 16119285,
2685
+ yellow: 16776960,
2686
+ yellowgreen: 10145074
2687
+ };
2688
+ function hex(value) {
2689
+ return ((value = Math.max(0, Math.min(255, Math.round(value) || 0))) < 16 ? "0" : "") + value.toString(16);
2426
2690
  }
2427
- function injectBase(metadataKey) {
2428
- return serviceIdentifier => (target, targetKey, indexOrPropertyDescriptor) => createTaggedDecorator(new Metadata(metadataKey, serviceIdentifier))(target, targetKey, indexOrPropertyDescriptor);
2691
+ function rgb(value) {
2692
+ return isNumber$1(value) ? new RGB(value >> 16, value >> 8 & 255, 255 & value, 1) : isArray$1(value) ? new RGB(value[0], value[1], value[2]) : new RGB(255, 255, 255);
2429
2693
  }
2430
-
2431
- const inject = injectBase(INJECT_TAG);
2432
-
2433
- function injectable() {
2434
- return function (target) {
2435
- return Reflect$1.defineMetadata(PARAM_TYPES, null, target), target;
2436
- };
2694
+ function rgba(value) {
2695
+ return isNumber$1(value) ? new RGB(value >>> 24, value >>> 16 & 255, value >>> 8 & 255, 255 & value) : isArray$1(value) ? new RGB(value[0], value[1], value[2], value[3]) : new RGB(255, 255, 255, 1);
2437
2696
  }
2438
-
2439
- function named(name) {
2440
- return createTaggedDecorator(new Metadata(NAMED_TAG, name));
2697
+ function SRGBToLinear(c) {
2698
+ return c < .04045 ? .0773993808 * c : Math.pow(.9478672986 * c + .0521327014, 2.4);
2441
2699
  }
2442
-
2443
- const BindingScopeEnum = {
2444
- Singleton: "Singleton",
2445
- Transient: "Transient"
2446
- },
2447
- BindingTypeEnum = {
2448
- ConstantValue: "ConstantValue",
2449
- Constructor: "Constructor",
2450
- DynamicValue: "DynamicValue",
2451
- Factory: "Factory",
2452
- Function: "Function",
2453
- Instance: "Instance",
2454
- Invalid: "Invalid",
2455
- Provider: "Provider"
2456
- };
2457
-
2458
- class Binding {
2459
- constructor(serviceIdentifier, scope) {
2460
- this.id = Generator.GenAutoIncrementId(), this.activated = !1, this.serviceIdentifier = serviceIdentifier, this.scope = scope, this.type = BindingTypeEnum.Invalid, this.constraint = request => !0, this.implementationType = null, this.cache = null, this.factory = null, this.provider = null, this.dynamicValue = null;
2461
- }
2462
- clone() {
2463
- const clone = new Binding(this.serviceIdentifier, this.scope);
2464
- return clone.activated = clone.scope === BindingScopeEnum.Singleton && this.activated, clone.implementationType = this.implementationType, clone.dynamicValue = this.dynamicValue, clone.scope = this.scope, clone.type = this.type, clone.provider = this.provider, clone.constraint = this.constraint, clone.cache = this.cache, clone;
2465
- }
2700
+ function LinearToSRGB(c) {
2701
+ return c < .0031308 ? 12.92 * c : 1.055 * Math.pow(c, .41666) - .055;
2466
2702
  }
2467
-
2468
- class MetadataReader {
2469
- getConstructorMetadata(constructorFunc) {
2470
- return {
2471
- compilerGeneratedMetadata: Reflect$1.getMetadata(PARAM_TYPES, constructorFunc),
2472
- userGeneratedMetadata: Reflect$1.getMetadata(TAGGED, constructorFunc) || {}
2473
- };
2474
- }
2475
- getPropertiesMetadata(constructorFunc) {
2476
- throw new Error("暂未实现");
2703
+ const setHex = (formatValue, forceHex) => {
2704
+ const isHex = REG_HEX.exec(formatValue);
2705
+ if (forceHex || isHex) {
2706
+ const hex = parseInt(isHex[1], 16),
2707
+ hexLength = isHex[1].length;
2708
+ return 3 === hexLength ? new RGB((hex >> 8 & 15) + ((hex >> 8 & 15) << 4), (hex >> 4 & 15) + ((hex >> 4 & 15) << 4), (15 & hex) + ((15 & hex) << 4), 1) : 6 === hexLength ? rgb(hex) : 8 === hexLength ? new RGB(hex >> 24 & 255, hex >> 16 & 255, hex >> 8 & 255, (255 & hex) / 255) : null;
2477
2709
  }
2478
- }
2479
-
2480
- const taggedConstraint = key => value => {
2481
- const constraint = request => {
2482
- if (null == request) return !1;
2483
- if (request.key === key && request.value === value) return !0;
2484
- if (null == request.constructorArgsMetadata) return !1;
2485
- const constructorArgsMetadata = request.constructorArgsMetadata;
2486
- for (let i = 0; i < constructorArgsMetadata.length; i++) if (constructorArgsMetadata[i].key === key && constructorArgsMetadata[i].value === value) return !0;
2487
- return !1;
2488
- };
2489
- return constraint.metaData = new Metadata(key, value), constraint;
2490
2710
  };
2491
- const namedConstraint = taggedConstraint(NAMED_TAG);
2492
-
2493
- class BindingInSyntax {
2494
- constructor(binding) {
2495
- this._binding = binding;
2496
- }
2497
- inRequestScope() {
2498
- throw new Error("暂未实现");
2499
- }
2500
- inSingletonScope() {
2501
- return this._binding.scope = BindingScopeEnum.Singleton, this;
2502
- }
2503
- inTransientScope() {
2504
- return this._binding.scope = BindingScopeEnum.Transient, this;
2505
- }
2506
- whenTargetNamed(name) {
2507
- return this._binding.constraint = namedConstraint(name), this;
2508
- }
2509
- }
2510
-
2511
- class BindingToSyntax {
2512
- constructor(binding) {
2513
- this._binding = binding;
2514
- }
2515
- to(constructor) {
2516
- return this._binding.type = BindingTypeEnum.Instance, this._binding.implementationType = constructor, new BindingInSyntax(this._binding);
2517
- }
2518
- toSelf() {
2519
- const self = this._binding.serviceIdentifier;
2520
- return this.to(self);
2711
+ class Color {
2712
+ static Brighter(source) {
2713
+ let b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
2714
+ return 1 === b ? source : new Color(source).brighter(b).toRGBA();
2521
2715
  }
2522
- toDynamicValue(func) {
2523
- return this._binding.type = BindingTypeEnum.DynamicValue, this._binding.cache = null, this._binding.dynamicValue = func, this._binding.implementationType = null, new BindingInSyntax(this._binding);
2716
+ static SetOpacity(source) {
2717
+ let o = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
2718
+ return 1 === o ? source : new Color(source).setOpacity(o).toRGBA();
2524
2719
  }
2525
- toConstantValue(value) {
2526
- return this._binding.type = BindingTypeEnum.ConstantValue, this._binding.cache = value, this._binding.dynamicValue = null, this._binding.implementationType = null, this._binding.scope = BindingScopeEnum.Singleton, new BindingInSyntax(this._binding);
2720
+ static getColorBrightness(source) {
2721
+ let model = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "hsl";
2722
+ const color = source instanceof Color ? source : new Color(source);
2723
+ switch (model) {
2724
+ case "hsv":
2725
+ default:
2726
+ return color.getHSVBrightness();
2727
+ case "hsl":
2728
+ return color.getHSLBrightness();
2729
+ case "lum":
2730
+ return color.getLuminance();
2731
+ case "lum2":
2732
+ return color.getLuminance2();
2733
+ case "lum3":
2734
+ return color.getLuminance3();
2735
+ }
2527
2736
  }
2528
- toFactory(factory) {
2529
- return this._binding.type = BindingTypeEnum.Factory, this._binding.factory = factory, this._binding.scope = BindingScopeEnum.Singleton, new BindingInSyntax(this._binding);
2737
+ static parseColorString(value) {
2738
+ if (isValid$1(DEFAULT_COLORS_OPACITY[value])) return rgba(DEFAULT_COLORS_OPACITY[value]);
2739
+ if (isValid$1(DEFAULT_COLORS[value])) return rgb(DEFAULT_COLORS[value]);
2740
+ const formatValue = `${value}`.trim().toLowerCase(),
2741
+ hexRes = setHex(formatValue);
2742
+ if (void 0 !== hexRes) return hexRes;
2743
+ if (/^(rgb|RGB|rgba|RGBA)/.test(formatValue)) {
2744
+ const aColor = formatValue.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g, "").split(",");
2745
+ return new RGB(parseInt(aColor[0], 10), parseInt(aColor[1], 10), parseInt(aColor[2], 10), parseFloat(aColor[3]));
2746
+ }
2747
+ if (/^(hsl|HSL|hsla|HSLA)/.test(formatValue)) {
2748
+ const aColor = formatValue.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g, "").split(","),
2749
+ rgb = hslToRgb(parseInt(aColor[0], 10), parseInt(aColor[1], 10), parseInt(aColor[2], 10));
2750
+ return new RGB(rgb.r, rgb.g, rgb.b, parseFloat(aColor[3]));
2751
+ }
2530
2752
  }
2531
- toService(service) {
2532
- this.toDynamicValue(context => context.container.get(service));
2753
+ constructor(value) {
2754
+ const color = Color.parseColorString(value);
2755
+ color ? this.color = color : (this.color = new RGB(255, 255, 255));
2533
2756
  }
2534
- }
2535
-
2536
- class Container {
2537
- constructor(containerOptions) {
2538
- const options = containerOptions || {};
2539
- options.defaultScope = options.defaultScope || BindingScopeEnum.Transient, this.options = options, this.id = Generator.GenAutoIncrementId(), this._bindingDictionary = new Map(), this._metadataReader = new MetadataReader();
2757
+ toRGBA() {
2758
+ return this.color.formatRgb();
2540
2759
  }
2541
- load(module) {
2542
- const containerModuleHelpers = this._getContainerModuleHelpersFactory()(module.id);
2543
- module.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction);
2760
+ toString() {
2761
+ return this.color.formatRgb();
2544
2762
  }
2545
- get(serviceIdentifier) {
2546
- const getArgs = this._getNotAllArgs(serviceIdentifier, !1);
2547
- return this._get(getArgs);
2763
+ toHex() {
2764
+ return this.color.formatHex();
2548
2765
  }
2549
- getAll(serviceIdentifier) {
2550
- const getArgs = this._getAllArgs(serviceIdentifier);
2551
- return this._get(getArgs);
2766
+ toHsl() {
2767
+ return this.color.formatHsl();
2552
2768
  }
2553
- getTagged(serviceIdentifier, key, value) {
2554
- const getArgs = this._getNotAllArgs(serviceIdentifier, !1, key, value);
2555
- return this._get(getArgs);
2769
+ brighter(k) {
2770
+ const {
2771
+ r: r,
2772
+ g: g,
2773
+ b: b
2774
+ } = this.color;
2775
+ return this.color.r = Math.max(0, Math.min(255, Math.floor(r * k))), this.color.g = Math.max(0, Math.min(255, Math.floor(g * k))), this.color.b = Math.max(0, Math.min(255, Math.floor(b * k))), this;
2556
2776
  }
2557
- getNamed(serviceIdentifier, named) {
2558
- return this.getTagged(serviceIdentifier, NAMED_TAG, named);
2777
+ add(color) {
2778
+ const {
2779
+ r: r,
2780
+ g: g,
2781
+ b: b
2782
+ } = this.color;
2783
+ return this.color.r += Math.min(255, r + color.color.r), this.color.g += Math.min(255, g + color.color.g), this.color.b += Math.min(255, b + color.color.b), this;
2559
2784
  }
2560
- isBound(serviceIdentifier) {
2561
- return this._bindingDictionary.has(serviceIdentifier);
2785
+ sub(color) {
2786
+ return this.color.r = Math.max(0, this.color.r - color.color.r), this.color.g = Math.max(0, this.color.g - color.color.g), this.color.b = Math.max(0, this.color.b - color.color.b), this;
2562
2787
  }
2563
- bind(serviceIdentifier) {
2564
- const scope = this.options.defaultScope,
2565
- binding = new Binding(serviceIdentifier, scope),
2566
- list = this._bindingDictionary.get(serviceIdentifier) || [];
2567
- return list.push(binding), this._bindingDictionary.set(serviceIdentifier, list), new BindingToSyntax(binding);
2788
+ multiply(color) {
2789
+ const {
2790
+ r: r,
2791
+ g: g,
2792
+ b: b
2793
+ } = this.color;
2794
+ return this.color.r = Math.max(0, Math.min(255, Math.floor(r * color.color.r))), this.color.g = Math.max(0, Math.min(255, Math.floor(g * color.color.g))), this.color.b = Math.max(0, Math.min(255, Math.floor(b * color.color.b))), this;
2568
2795
  }
2569
- unbind(serviceIdentifier) {
2570
- this._bindingDictionary.delete(serviceIdentifier);
2796
+ getHSVBrightness() {
2797
+ return Math.max(this.color.r, this.color.g, this.color.b) / 255;
2571
2798
  }
2572
- rebind(serviceIdentifier) {
2573
- return this.unbind(serviceIdentifier), this.bind(serviceIdentifier);
2799
+ getHSLBrightness() {
2800
+ return .5 * (Math.max(this.color.r, this.color.g, this.color.b) / 255 + Math.min(this.color.r, this.color.g, this.color.b) / 255);
2574
2801
  }
2575
- _getContainerModuleHelpersFactory() {
2576
- const setModuleId = (bindingToSyntax, moduleId) => {
2577
- bindingToSyntax._binding.moduleId = moduleId;
2578
- },
2579
- getBindFunction = moduleId => serviceIdentifier => {
2580
- const bindingToSyntax = this.bind(serviceIdentifier);
2581
- return setModuleId(bindingToSyntax, moduleId), bindingToSyntax;
2582
- },
2583
- getUnbindFunction = () => serviceIdentifier => this.unbind(serviceIdentifier),
2584
- getIsboundFunction = () => serviceIdentifier => this.isBound(serviceIdentifier),
2585
- getRebindFunction = moduleId => serviceIdentifier => {
2586
- const bindingToSyntax = this.rebind(serviceIdentifier);
2587
- return setModuleId(bindingToSyntax, moduleId), bindingToSyntax;
2588
- };
2589
- return mId => ({
2590
- bindFunction: getBindFunction(mId),
2591
- isboundFunction: getIsboundFunction(),
2592
- rebindFunction: getRebindFunction(mId),
2593
- unbindFunction: getUnbindFunction(),
2594
- unbindAsyncFunction: serviceIdentifier => null
2595
- });
2802
+ setHsl(h, s, l) {
2803
+ const opacity = this.color.opacity,
2804
+ hsl = rgbToHsl(this.color.r, this.color.g, this.color.b),
2805
+ rgb = hslToRgb(isNil$1(h) ? hsl.h : clamp$1(h, 0, 360), isNil$1(s) ? hsl.s : s >= 0 && s <= 1 ? 100 * s : s, isNil$1(l) ? hsl.l : l <= 1 && l >= 0 ? 100 * l : l);
2806
+ return this.color = new RGB(rgb.r, rgb.g, rgb.b, opacity), this;
2596
2807
  }
2597
- _getNotAllArgs(serviceIdentifier, isMultiInject, key, value) {
2598
- return {
2599
- avoidConstraints: !1,
2600
- isMultiInject: isMultiInject,
2601
- serviceIdentifier: serviceIdentifier,
2602
- key: key,
2603
- value: value
2604
- };
2808
+ setRGB(r, g, b) {
2809
+ return !isNil$1(r) && (this.color.r = r), !isNil$1(g) && (this.color.g = g), !isNil$1(b) && (this.color.b = b), this;
2605
2810
  }
2606
- _getAllArgs(serviceIdentifier) {
2607
- return {
2608
- avoidConstraints: !0,
2609
- isMultiInject: !0,
2610
- serviceIdentifier: serviceIdentifier
2611
- };
2811
+ setHex(value) {
2812
+ const formatValue = `${value}`.trim().toLowerCase(),
2813
+ res = setHex(formatValue, !0);
2814
+ return null != res ? res : this;
2612
2815
  }
2613
- _get(getArgs) {
2614
- const result = [];
2615
- return this._bindingDictionary.get(getArgs.serviceIdentifier).filter(b => b.constraint(getArgs)).forEach(binding => {
2616
- result.push(this._resolveFromBinding(binding));
2617
- }), getArgs.isMultiInject || 1 !== result.length ? result : result[0];
2816
+ setColorName(name) {
2817
+ const hex = DEFAULT_COLORS[name.toLowerCase()];
2818
+ return void 0 !== hex ? this.setHex(hex) : (void 0), this;
2618
2819
  }
2619
- _getChildRequest(binding) {
2620
- const constr = binding.implementationType,
2621
- {
2622
- userGeneratedMetadata: userGeneratedMetadata
2623
- } = this._metadataReader.getConstructorMetadata(constr),
2624
- keys = Object.keys(userGeneratedMetadata),
2625
- arr = [];
2626
- for (let i = 0; i < keys.length; i++) {
2627
- const constructorArgsMetadata = userGeneratedMetadata[i],
2628
- targetMetadataMap = {};
2629
- constructorArgsMetadata.forEach(md => {
2630
- targetMetadataMap[md.key] = md.value;
2631
- });
2632
- const metadata = {
2633
- inject: targetMetadataMap[INJECT_TAG],
2634
- multiInject: targetMetadataMap[MULTI_INJECT_TAG]
2635
- },
2636
- injectIdentifier = metadata.inject || metadata.multiInject,
2637
- target = {
2638
- serviceIdentifier: injectIdentifier,
2639
- constructorArgsMetadata: constructorArgsMetadata
2640
- },
2641
- request = {
2642
- injectIdentifier: injectIdentifier,
2643
- metadata: constructorArgsMetadata,
2644
- bindings: this._bindingDictionary.get(injectIdentifier).filter(b => b.constraint(target))
2645
- };
2646
- arr.push(request);
2647
- }
2648
- return arr;
2820
+ setScalar(scalar) {
2821
+ return this.color.r = scalar, this.color.g = scalar, this.color.b = scalar, this;
2649
2822
  }
2650
- _resolveFromBinding(binding) {
2651
- const result = this._getResolvedFromBinding(binding);
2652
- return this._saveToScope(binding, result), result;
2823
+ setOpacity() {
2824
+ let o = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
2825
+ return this.color.opacity = o, this;
2653
2826
  }
2654
- _getResolvedFromBinding(binding) {
2655
- let result;
2656
- switch (binding.type) {
2657
- case BindingTypeEnum.ConstantValue:
2658
- case BindingTypeEnum.Function:
2659
- result = binding.cache;
2660
- break;
2661
- case BindingTypeEnum.Instance:
2662
- result = this._resolveInstance(binding, binding.implementationType);
2663
- break;
2664
- default:
2665
- result = binding.dynamicValue({
2666
- container: this
2667
- });
2668
- }
2669
- return result;
2827
+ getLuminance() {
2828
+ return (.2126 * this.color.r + .7152 * this.color.g + .0722 * this.color.b) / 255;
2670
2829
  }
2671
- _resolveInstance(binding, constr) {
2672
- if (binding.activated) return binding.cache;
2673
- const childRequests = this._getChildRequest(binding);
2674
- return this._createInstance(constr, childRequests);
2830
+ getLuminance2() {
2831
+ return (.2627 * this.color.r + .678 * this.color.g + .0593 * this.color.b) / 255;
2675
2832
  }
2676
- _createInstance(constr, childRequests) {
2677
- if (childRequests.length) {
2678
- return new constr(...this._resolveRequests(childRequests));
2679
- }
2680
- return new constr();
2833
+ getLuminance3() {
2834
+ return (.299 * this.color.r + .587 * this.color.g + .114 * this.color.b) / 255;
2681
2835
  }
2682
- _resolveRequests(childRequests) {
2683
- return childRequests.map(request => request.bindings.length > 1 ? request.bindings.map(binding => this._resolveFromBinding(binding)) : this._resolveFromBinding(request.bindings[0]));
2836
+ clone() {
2837
+ return new Color(this.color.toString());
2684
2838
  }
2685
- _saveToScope(binding, result) {
2686
- binding.scope === BindingScopeEnum.Singleton && (binding.cache = result, binding.activated = !0);
2839
+ copyGammaToLinear(color) {
2840
+ let gammaFactor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
2841
+ return this.color.r = Math.pow(color.color.r, gammaFactor), this.color.g = Math.pow(color.color.g, gammaFactor), this.color.b = Math.pow(color.color.b, gammaFactor), this;
2687
2842
  }
2688
- }
2689
-
2690
- const ContributionProvider = Symbol("ContributionProvider");
2691
- class ContributionProviderCache {
2692
- constructor(serviceIdentifier, container) {
2693
- this.serviceIdentifier = serviceIdentifier, this.container = container;
2843
+ copyLinearToGamma(color) {
2844
+ let gammaFactor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
2845
+ const safeInverse = gammaFactor > 0 ? 1 / gammaFactor : 1;
2846
+ return this.color.r = Math.pow(color.color.r, safeInverse), this.color.g = Math.pow(color.color.g, safeInverse), this.color.b = Math.pow(color.color.b, safeInverse), this;
2694
2847
  }
2695
- getContributions() {
2696
- return this.caches || (this.caches = [], this.container && this.container.isBound(this.serviceIdentifier) && this.caches.push(...this.container.getAll(this.serviceIdentifier))), this.caches;
2848
+ convertGammaToLinear(gammaFactor) {
2849
+ return this.copyGammaToLinear(this, gammaFactor), this;
2697
2850
  }
2698
- }
2699
- function bindContributionProvider(bind, id) {
2700
- bind(ContributionProvider).toDynamicValue(_ref => {
2701
- let {
2702
- container: container
2703
- } = _ref;
2704
- return new ContributionProviderCache(id, container);
2705
- }).inSingletonScope().whenTargetNamed(id);
2706
- }
2707
-
2708
- class Hook {
2709
- constructor(args, name) {
2710
- this._args = args, this.name = name, this.taps = [];
2851
+ convertLinearToGamma(gammaFactor) {
2852
+ return this.copyLinearToGamma(this, gammaFactor), this;
2711
2853
  }
2712
- tap(options, fn) {
2713
- this._tap("sync", options, fn);
2854
+ copySRGBToLinear(color) {
2855
+ return this.color.r = SRGBToLinear(color.color.r), this.color.g = SRGBToLinear(color.color.g), this.color.b = SRGBToLinear(color.color.b), this;
2714
2856
  }
2715
- unTap(options, fn) {
2716
- const name = "string" == typeof options ? options.trim() : options.name;
2717
- name && (this.taps = this.taps.filter(tap => !(tap.name === name && (!fn || tap.fn === fn))));
2857
+ copyLinearToSRGB(color) {
2858
+ return this.color.r = LinearToSRGB(color.color.r), this.color.g = LinearToSRGB(color.color.g), this.color.b = LinearToSRGB(color.color.b), this;
2718
2859
  }
2719
- _parseOptions(type, options, fn) {
2720
- let _options;
2721
- if ("string" == typeof options) _options = {
2722
- name: options.trim()
2723
- };else if ("object" != typeof options || null === options) throw new Error("Invalid tap options");
2724
- if ("string" != typeof _options.name || "" === _options.name) throw new Error("Missing name for tap");
2725
- return _options = Object.assign({
2726
- type: type,
2727
- fn: fn
2728
- }, _options), _options;
2860
+ convertSRGBToLinear() {
2861
+ return this.copySRGBToLinear(this), this;
2729
2862
  }
2730
- _tap(type, options, fn) {
2731
- this._insert(this._parseOptions(type, options, fn));
2863
+ convertLinearToSRGB() {
2864
+ return this.copyLinearToSRGB(this), this;
2732
2865
  }
2733
- _insert(item) {
2734
- let before;
2735
- "string" == typeof item.before ? before = new Set([item.before]) : Array.isArray(item.before) && (before = new Set(item.before));
2736
- let stage = 0;
2737
- "number" == typeof item.stage && (stage = item.stage);
2738
- let i = this.taps.length;
2739
- for (; i > 0;) {
2740
- i--;
2741
- const x = this.taps[i];
2742
- this.taps[i + 1] = x;
2743
- const xStage = x.stage || 0;
2744
- if (before) {
2745
- if (before.has(x.name)) {
2746
- before.delete(x.name);
2747
- continue;
2748
- }
2749
- if (before.size > 0) continue;
2750
- }
2751
- if (!(xStage > stage)) {
2752
- i++;
2753
- break;
2754
- }
2755
- }
2756
- this.taps[i] = item;
2866
+ }
2867
+ class RGB {
2868
+ constructor(r, g, b, opacity) {
2869
+ this.r = isNaN(+r) ? 255 : Math.max(0, Math.min(255, +r)), this.g = isNaN(+g) ? 255 : Math.max(0, Math.min(255, +g)), this.b = isNaN(+b) ? 255 : Math.max(0, Math.min(255, +b)), isValid$1(opacity) ? this.opacity = isNaN(+opacity) ? 1 : Math.max(0, Math.min(1, +opacity)) : this.opacity = 1;
2870
+ }
2871
+ formatHex() {
2872
+ return `#${hex(this.r) + hex(this.g) + hex(this.b) + (1 === this.opacity ? "" : hex(255 * this.opacity))}`;
2873
+ }
2874
+ formatRgb() {
2875
+ const opacity = this.opacity;
2876
+ return `${1 === opacity ? "rgb(" : "rgba("}${this.r},${this.g},${this.b}${1 === opacity ? ")" : `,${opacity})`}`;
2877
+ }
2878
+ formatHsl() {
2879
+ const opacity = this.opacity,
2880
+ {
2881
+ h: h,
2882
+ s: s,
2883
+ l: l
2884
+ } = rgbToHsl(this.r, this.g, this.b);
2885
+ return `${1 === opacity ? "hsl(" : "hsla("}${h},${s}%,${l}%${1 === opacity ? ")" : `,${opacity})`}`;
2886
+ }
2887
+ toString() {
2888
+ return this.formatHex();
2757
2889
  }
2758
2890
  }
2759
2891
 
2760
- class SyncHook extends Hook {
2761
- call() {
2762
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2763
- args[_key] = arguments[_key];
2892
+ function normalizePadding(padding) {
2893
+ if (isValidNumber$1(padding)) return [padding, padding, padding, padding];
2894
+ if (isArray$1(padding)) {
2895
+ const length = padding.length;
2896
+ if (1 === length) {
2897
+ const paddingValue = padding[0];
2898
+ return [paddingValue, paddingValue, paddingValue, paddingValue];
2764
2899
  }
2765
- this.taps.map(t => t.fn).forEach(cb => cb(...args));
2900
+ if (2 === length) {
2901
+ const [vertical, horizontal] = padding;
2902
+ return [vertical, horizontal, vertical, horizontal];
2903
+ }
2904
+ if (3 === length) {
2905
+ const [top, horizontal, bottom] = padding;
2906
+ return [top, horizontal, bottom, horizontal];
2907
+ }
2908
+ if (4 === length) return padding;
2909
+ }
2910
+ if (isObject$1(padding)) {
2911
+ const {
2912
+ top = 0,
2913
+ right = 0,
2914
+ bottom = 0,
2915
+ left = 0
2916
+ } = padding;
2917
+ return [top, right, bottom, left];
2766
2918
  }
2919
+ return [0, 0, 0, 0];
2767
2920
  }
2768
2921
 
2769
- const EnvContribution = Symbol.for("EnvContribution");
2922
+ const styleStringToObject = function () {
2923
+ let styleStr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
2924
+ const res = {};
2925
+ return styleStr.split(";").forEach(item => {
2926
+ if (item) {
2927
+ const arr = item.split(":");
2928
+ if (2 === arr.length) {
2929
+ const key = arr[0].trim(),
2930
+ value = arr[1].trim();
2931
+ key && value && (res[key] = value);
2932
+ }
2933
+ }
2934
+ }), res;
2935
+ };
2936
+ const lowerCamelCaseToMiddle = str => str.replace(/([A-Z])/g, "-$1").toLowerCase();
2770
2937
 
2771
2938
  const circleThreshold = tau - 1e-8;
2772
2939
  class BoundsContext {
@@ -12551,7 +12718,7 @@
12551
12718
  if (!(element && ReactDOM && ReactDOM.createRoot)) {
12552
12719
  return;
12553
12720
  }
12554
- const id = isNil$1(react.id) ? `${graphic.id ?? graphic._uid}_react` : react.id;
12721
+ const id = isNil$3(react.id) ? `${graphic.id ?? graphic._uid}_react` : react.id;
12555
12722
  if (this.htmlMap && this.htmlMap[id] && container && container !== this.htmlMap[id].container) {
12556
12723
  this.removeElement(id);
12557
12724
  }
@@ -12606,7 +12773,7 @@
12606
12773
  let top = 0;
12607
12774
  const b = graphic.globalAABBBounds;
12608
12775
  let anchorType = options.anchorType;
12609
- if (isNil$1(anchorType)) {
12776
+ if (isNil$3(anchorType)) {
12610
12777
  anchorType = graphic.type === 'text' ? 'position' : 'boundsLeftTop';
12611
12778
  }
12612
12779
  if (anchorType === 'boundsLeftTop') {
@@ -12618,7 +12785,7 @@
12618
12785
  top = matrix.f;
12619
12786
  }
12620
12787
  else {
12621
- const anchor = calculateAnchorOfBounds(b, anchorType);
12788
+ const anchor = calculateAnchorOfBounds$1(b, anchorType);
12622
12789
  left = anchor.x;
12623
12790
  top = anchor.y;
12624
12791
  }
@@ -12634,17 +12801,17 @@
12634
12801
  ...this.getTransformOfText(graphic)
12635
12802
  };
12636
12803
  }
12637
- if (isFunction$1(options.style)) {
12804
+ if (isFunction$3(options.style)) {
12638
12805
  const userStyle = options.style({ top: offsetTop, left: offsetX, width: b.width(), height: b.height() }, graphic, wrapContainer);
12639
12806
  if (userStyle) {
12640
12807
  calculateStyle = { ...calculateStyle, ...userStyle };
12641
12808
  }
12642
12809
  }
12643
- else if (isObject$1(options.style)) {
12810
+ else if (isObject$3(options.style)) {
12644
12811
  calculateStyle = { ...calculateStyle, ...options.style };
12645
12812
  }
12646
- else if (isString$1(options.style) && options.style) {
12647
- calculateStyle = { ...calculateStyle, ...styleStringToObject(options.style) };
12813
+ else if (isString$3(options.style) && options.style) {
12814
+ calculateStyle = { ...calculateStyle, ...styleStringToObject$1(options.style) };
12648
12815
  }
12649
12816
  application.global.updateDom(wrapContainer, {
12650
12817
  width: options.width,
@@ -12731,7 +12898,7 @@
12731
12898
  }
12732
12899
  const { width, height, style } = params;
12733
12900
  if (style) {
12734
- if (isString$1(style)) {
12901
+ if (isString$3(style)) {
12735
12902
  dom.setAttribute('style', style);
12736
12903
  }
12737
12904
  else {
@@ -12773,7 +12940,7 @@
12773
12940
  toArray(props.children).map((child, index) => {
12774
12941
  const parseOption = child && child.type && child.type.parseOption;
12775
12942
  if (parseOption && child.props) {
12776
- const childProps = isNil$1(child.props.componentId)
12943
+ const childProps = isNil$3(child.props.componentId)
12777
12944
  ? {
12778
12945
  ...child.props,
12779
12946
  componentId: getComponentId(child, index)
@@ -12825,6 +12992,7 @@
12825
12992
  ...optionFromChildren.current,
12826
12993
  clearDOM: false,
12827
12994
  customConfig: {
12995
+ ...prevOption.current.customConfig,
12828
12996
  createReactContainer: true
12829
12997
  }
12830
12998
  };
@@ -18598,7 +18766,7 @@
18598
18766
  return graphic;
18599
18767
  }
18600
18768
  function isEventProp(key, props) {
18601
- return key.startsWith('on') && isFunction$1(props[key]);
18769
+ return key.startsWith('on') && isFunction$3(props[key]);
18602
18770
  }
18603
18771
  function bindEventsToGraphic(graphic, props) {
18604
18772
  for (const key in props) {
@@ -18618,7 +18786,7 @@
18618
18786
  graphic.addEventListener(REACT_TO_CANOPUS_EVENTS[propKey], newProps[propKey]);
18619
18787
  }
18620
18788
  }
18621
- const attribute = newProps.attribute ?? merge({}, newProps);
18789
+ const attribute = newProps.attribute ?? merge$1({}, newProps);
18622
18790
  graphic.initAttributes(attribute);
18623
18791
  if (graphic.type === 'image') {
18624
18792
  graphic.loadImage(attribute.image);
@@ -18877,7 +19045,7 @@
18877
19045
  styleTop = cellRect.top + dealWidthNumber(dy, cellRect.height) + cellRect.height + 'px';
18878
19046
  }
18879
19047
  }
18880
- const componentStyle = merge({}, style, {
19048
+ const componentStyle = merge$1({}, style, {
18881
19049
  position: 'absolute',
18882
19050
  zIndex: 1000,
18883
19051
  width: styleWidth,
@@ -18897,7 +19065,7 @@
18897
19065
  return { ...defaultProps };
18898
19066
  }, [defaultProps]);
18899
19067
  const props = reactExports.useMemo(() => {
18900
- const mProps = merge({}, componentProps);
19068
+ const mProps = merge$1({}, componentProps);
18901
19069
  for (const propName in _defaultProps) {
18902
19070
  if (mProps[propName] === undefined) {
18903
19071
  mProps[propName] = _defaultProps[propName];
@@ -18908,7 +19076,7 @@
18908
19076
  return props;
18909
19077
  }
18910
19078
  function dealWidthNumber(value, refenceValue) {
18911
- if (isNumber$1(value)) {
19079
+ if (isNumber$3(value)) {
18912
19080
  return value;
18913
19081
  }
18914
19082
  if (typeof value === 'string' && value.endsWith('%')) {
@@ -18956,7 +19124,7 @@
18956
19124
  }
18957
19125
  };
18958
19126
  function ButtonComponent(baseProps, ref) {
18959
- const props = merge({}, defaultProps$6, baseProps);
19127
+ const props = merge$1({}, defaultProps$6, baseProps);
18960
19128
  const { disabled, onClick } = props;
18961
19129
  let buttonRef = React.useRef(null);
18962
19130
  buttonRef = ref ? ref : buttonRef;
@@ -19051,7 +19219,7 @@
19051
19219
  }
19052
19220
  };
19053
19221
  function LinkComponent(baseProps, ref) {
19054
- const props = merge({}, defaultProps$5, baseProps);
19222
+ const props = merge$1({}, defaultProps$5, baseProps);
19055
19223
  const { disabled, href, onClick } = props;
19056
19224
  let linkRef = React.useRef(null);
19057
19225
  linkRef = ref ? ref : linkRef;
@@ -19144,7 +19312,7 @@
19144
19312
  autoFixFontSize: true
19145
19313
  };
19146
19314
  function AvatarComponent(baseProps, ref) {
19147
- const props = merge({}, defaultProps$4, baseProps);
19315
+ const props = merge$1({}, defaultProps$4, baseProps);
19148
19316
  const { size, children, onClick } = props;
19149
19317
  let avatarRef = React.useRef(null);
19150
19318
  avatarRef = ref ? ref : avatarRef;
@@ -19152,7 +19320,7 @@
19152
19320
  onClick && onClick(event);
19153
19321
  }, [onClick]);
19154
19322
  const groupAttribute = getGroupAttribute(props);
19155
- if (isString$1(children)) {
19323
+ if (isString$3(children)) {
19156
19324
  const textAttribute = getTextAttribute(props);
19157
19325
  return (React.createElement(Group, { ref: avatarRef, attribute: groupAttribute, onClick: handleClick },
19158
19326
  React.createElement(Text, { attribute: textAttribute })));
@@ -19233,7 +19401,7 @@
19233
19401
  React.createElement("div", { style: arrowStyle }))) : (React.createElement(React.Fragment, null));
19234
19402
  };
19235
19403
  function PopoverComponent(baseProps, ref) {
19236
- const props = merge({}, defaultProps$3, baseProps);
19404
+ const props = merge$1({}, defaultProps$3, baseProps);
19237
19405
  const { content, position, popupVisible, defaultPopupVisible, children } = props;
19238
19406
  let popoverRef = React.useRef(null);
19239
19407
  popoverRef = ref ? ref : popoverRef;
@@ -19265,14 +19433,14 @@
19265
19433
  }
19266
19434
  };
19267
19435
  const groupMouseEnter = reactExports.useCallback((event) => {
19268
- if (isValid$1(popupVisible)) {
19436
+ if (isValid$3(popupVisible)) {
19269
19437
  return;
19270
19438
  }
19271
19439
  setPopupOpen(true);
19272
19440
  event.currentTarget.stage.renderNextFrame();
19273
19441
  }, []);
19274
19442
  const groupMouseLeave = reactExports.useCallback((event) => {
19275
- if (isValid$1(popupVisible)) {
19443
+ if (isValid$3(popupVisible)) {
19276
19444
  return;
19277
19445
  }
19278
19446
  setPopupOpen(false);
@@ -19449,7 +19617,7 @@
19449
19617
  }
19450
19618
  };
19451
19619
  function TagComponent(baseProps, ref) {
19452
- const props = merge({}, defaultProps$2, baseProps);
19620
+ const props = merge$1({}, defaultProps$2, baseProps);
19453
19621
  const { attribute, panelStyle, children, ...rest } = props;
19454
19622
  let tagRef = React.useRef(null);
19455
19623
  tagRef = ref ? ref : tagRef;
@@ -19466,7 +19634,7 @@
19466
19634
 
19467
19635
  const defaultProps$1 = {};
19468
19636
  function RadioComponent(baseProps, ref) {
19469
- const props = merge({}, defaultProps$1, baseProps);
19637
+ const props = merge$1({}, defaultProps$1, baseProps);
19470
19638
  const { textStyle, circleStyle, children, ...rest } = props;
19471
19639
  let radioRef = React.useRef(null);
19472
19640
  radioRef = ref ? ref : radioRef;
@@ -19495,7 +19663,7 @@
19495
19663
 
19496
19664
  const defaultProps = {};
19497
19665
  function CheckboxComponent(baseProps, ref) {
19498
- const props = merge({}, defaultProps, baseProps);
19666
+ const props = merge$1({}, defaultProps, baseProps);
19499
19667
  const { textStyle, boxStyle, iconStyle, children, ...rest } = props;
19500
19668
  let checkboxRef = React.useRef(null);
19501
19669
  checkboxRef = ref ? ref : checkboxRef;
@@ -19521,7 +19689,7 @@
19521
19689
  const Checkbox = React.forwardRef(CheckboxComponent);
19522
19690
  Checkbox.displayName = 'Checkbox';
19523
19691
 
19524
- const version = "1.9.2-alpha.0";
19692
+ const version = "1.9.2-alpha.2";
19525
19693
 
19526
19694
  Object.defineProperty(exports, 'register', {
19527
19695
  enumerable: true,