@visactor/react-vtable 1.17.1-alpha.8 → 1.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -347,64 +347,104 @@
347
347
  var eventemitter3Exports = eventemitter3.exports;
348
348
  var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
349
349
 
350
- const isType$2 = (value, type) => Object.prototype.toString.call(value) === `[object ${type}]`;
351
- var isType$3 = isType$2;
350
+ const isType = (value, type) => Object.prototype.toString.call(value) === `[object ${type}]`;
351
+ var isType$1 = isType;
352
+
353
+ const isBoolean = function (value) {
354
+ let fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
355
+ return fuzzy ? "boolean" == typeof value : !0 === value || !1 === value || isType$1(value, "Boolean");
356
+ };
357
+ var isBoolean$1 = isBoolean;
352
358
 
353
- const isFunction$2 = value => "function" == typeof value;
354
- var isFunction$3 = isFunction$2;
359
+ const isFunction = value => "function" == typeof value;
360
+ var isFunction$1 = isFunction;
355
361
 
356
- const isNil$2 = value => null == value;
357
- var isNil$3 = isNil$2;
362
+ const isNil = value => null == value;
363
+ var isNil$1 = isNil;
358
364
 
359
- const isValid$2 = value => null != value;
360
- var isValid$3 = isValid$2;
365
+ const isValid = value => null != value;
366
+ var isValid$1 = isValid;
361
367
 
362
- const isObject$2 = value => {
368
+ const isObject = value => {
363
369
  const type = typeof value;
364
370
  return null !== value && "object" === type || "function" === type;
365
371
  };
366
- var isObject$3 = isObject$2;
372
+ var isObject$1 = isObject;
367
373
 
368
- const isObjectLike$2 = value => "object" == typeof value && null !== value;
369
- var isObjectLike$3 = isObjectLike$2;
374
+ const isObjectLike = value => "object" == typeof value && null !== value;
375
+ var isObjectLike$1 = isObjectLike;
370
376
 
371
- const isPlainObject$2 = function (value) {
372
- if (!isObjectLike$3(value) || !isType$3(value, "Object")) return !1;
377
+ const isPlainObject = function (value) {
378
+ if (!isObjectLike$1(value) || !isType$1(value, "Object")) return !1;
373
379
  if (null === Object.getPrototypeOf(value)) return !0;
374
380
  let proto = value;
375
381
  for (; null !== Object.getPrototypeOf(proto);) proto = Object.getPrototypeOf(proto);
376
382
  return Object.getPrototypeOf(value) === proto;
377
383
  };
378
- var isPlainObject$3 = isPlainObject$2;
384
+ var isPlainObject$1 = isPlainObject;
379
385
 
380
- const isString$2 = function (value) {
386
+ const isString = function (value) {
381
387
  let fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
382
388
  const type = typeof value;
383
- return fuzzy ? "string" === type : "string" === type || isType$3(value, "String");
389
+ return fuzzy ? "string" === type : "string" === type || isType$1(value, "String");
384
390
  };
385
- var isString$3 = isString$2;
391
+ var isString$1 = isString;
386
392
 
387
- const isArray$2 = value => Array.isArray ? Array.isArray(value) : isType$3(value, "Array");
388
- var isArray$3 = isArray$2;
393
+ const isArray = value => Array.isArray ? Array.isArray(value) : isType$1(value, "Array");
394
+ var isArray$1 = isArray;
389
395
 
390
- const isArrayLike$2 = function (value) {
396
+ const isArrayLike = function (value) {
391
397
  return null !== value && "function" != typeof value && Number.isFinite(value.length);
392
398
  };
393
- var isArrayLike$3 = isArrayLike$2;
399
+ var isArrayLike$1 = isArrayLike;
394
400
 
395
- const isNumber$2 = function (value) {
401
+ const isNumber = function (value) {
396
402
  let fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
397
403
  const type = typeof value;
398
- return fuzzy ? "number" === type : "number" === type || isType$3(value, "Number");
404
+ return fuzzy ? "number" === type : "number" === type || isType$1(value, "Number");
399
405
  };
400
- var isNumber$3 = isNumber$2;
406
+ var isNumber$1 = isNumber;
407
+
408
+ const isValidNumber = value => isNumber$1(value) && Number.isFinite(value);
409
+ var isValidNumber$1 = isValidNumber;
410
+
411
+ const isValidUrl = value => new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(value);
412
+ var isValidUrl$1 = isValidUrl;
413
+
414
+ 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);
415
+ var isBase64$1 = isBase64;
416
+
417
+ const getType = value => ({}).toString.call(value).replace(/^\[object /, "").replace(/]$/, "");
418
+ var getType$1 = getType;
419
+
420
+ const objectProto = Object.prototype,
421
+ isPrototype = function (value) {
422
+ const Ctor = value && value.constructor;
423
+ return value === ("function" == typeof Ctor && Ctor.prototype || objectProto);
424
+ };
425
+ var isPrototype$1 = isPrototype;
426
+
427
+ const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
428
+ function isEmpty(value) {
429
+ if (isNil$1(value)) return !0;
430
+ if (isArrayLike$1(value)) return !value.length;
431
+ const type = getType$1(value);
432
+ if ("Map" === type || "Set" === type) return !value.size;
433
+ if (isPrototype$1(value)) return !Object.keys(value).length;
434
+ for (const key in value) if (hasOwnProperty$1.call(value, key)) return !1;
435
+ return !0;
436
+ }
437
+
438
+ const hasOwnProperty = Object.prototype.hasOwnProperty,
439
+ has = (object, key) => null != object && hasOwnProperty.call(object, key);
440
+ var has$1 = has;
401
441
 
402
- function baseMerge$1(target, source) {
442
+ function baseMerge(target, source) {
403
443
  let shallowArray = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
404
444
  let skipTargetArray = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
405
445
  if (source) {
406
446
  if (target === source) return;
407
- if (isValid$3(source) && "object" == typeof source) {
447
+ if (isValid$1(source) && "object" == typeof source) {
408
448
  const iterable = Object(source),
409
449
  props = [];
410
450
  for (const key in iterable) props.push(key);
@@ -414,51 +454,51 @@
414
454
  propIndex = -1;
415
455
  for (; length--;) {
416
456
  const key = props[++propIndex];
417
- !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);
457
+ !isValid$1(iterable[key]) || "object" != typeof iterable[key] || skipTargetArray && isArray$1(target[key]) ? assignMergeValue(target, key, iterable[key]) : baseMergeDeep(target, source, key, shallowArray, skipTargetArray);
418
458
  }
419
459
  }
420
460
  }
421
461
  }
422
- function baseMergeDeep$1(target, source, key) {
462
+ function baseMergeDeep(target, source, key) {
423
463
  let shallowArray = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
424
464
  let skipTargetArray = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : !1;
425
465
  const objValue = target[key],
426
466
  srcValue = source[key];
427
467
  let newValue = source[key],
428
468
  isCommon = !0;
429
- if (isArray$3(srcValue)) {
430
- if (shallowArray) newValue = [];else if (isArray$3(objValue)) newValue = objValue;else if (isArrayLike$3(objValue)) {
469
+ if (isArray$1(srcValue)) {
470
+ if (shallowArray) newValue = [];else if (isArray$1(objValue)) newValue = objValue;else if (isArrayLike$1(objValue)) {
431
471
  newValue = new Array(objValue.length);
432
472
  let index = -1;
433
473
  const length = objValue.length;
434
474
  for (; ++index < length;) newValue[index] = objValue[index];
435
475
  }
436
- } else isPlainObject$3(srcValue) ? (newValue = null != objValue ? objValue : {}, "function" != typeof objValue && "object" == typeof objValue || (newValue = {})) : isCommon = !1;
437
- isCommon && baseMerge$1(newValue, srcValue, shallowArray, skipTargetArray), assignMergeValue$1(target, key, newValue);
476
+ } else isPlainObject$1(srcValue) ? (newValue = null != objValue ? objValue : {}, "function" != typeof objValue && "object" == typeof objValue || (newValue = {})) : isCommon = !1;
477
+ isCommon && baseMerge(newValue, srcValue, shallowArray, skipTargetArray), assignMergeValue(target, key, newValue);
438
478
  }
439
- function assignMergeValue$1(target, key, value) {
440
- (void 0 !== value && !eq$1(target[key], value) || void 0 === value && !(key in target)) && (target[key] = value);
479
+ function assignMergeValue(target, key, value) {
480
+ (void 0 !== value && !eq(target[key], value) || void 0 === value && !(key in target)) && (target[key] = value);
441
481
  }
442
- function eq$1(value, other) {
482
+ function eq(value, other) {
443
483
  return value === other || Number.isNaN(value) && Number.isNaN(other);
444
484
  }
445
- function merge$1(target) {
485
+ function merge(target) {
446
486
  let sourceIndex = -1;
447
487
  const length = arguments.length <= 1 ? 0 : arguments.length - 1;
448
488
  for (; ++sourceIndex < length;) {
449
- baseMerge$1(target, sourceIndex + 1 < 1 || arguments.length <= sourceIndex + 1 ? undefined : arguments[sourceIndex + 1], !0);
489
+ baseMerge(target, sourceIndex + 1 < 1 || arguments.length <= sourceIndex + 1 ? undefined : arguments[sourceIndex + 1], !0);
450
490
  }
451
491
  return target;
452
492
  }
453
493
 
454
494
  function pickWithout(obj, keys) {
455
- if (!obj || !isPlainObject$3(obj)) return obj;
495
+ if (!obj || !isPlainObject$1(obj)) return obj;
456
496
  const result = {};
457
497
  return Object.keys(obj).forEach(k => {
458
498
  const v = obj[k];
459
499
  let match = !1;
460
500
  keys.forEach(itKey => {
461
- (isString$3(itKey) && itKey === k || itKey instanceof RegExp && k.match(itKey)) && (match = !0);
501
+ (isString$1(itKey) && itKey === k || itKey instanceof RegExp && k.match(itKey)) && (match = !0);
462
502
  }), match || (result[k] = v);
463
503
  }), result;
464
504
  }
@@ -475,14 +515,14 @@
475
515
  if (null == a || null == b) return !1;
476
516
  if (Number.isNaN(a) && Number.isNaN(b)) return !0;
477
517
  if (objToString(a) !== objToString(b)) return !1;
478
- if (isFunction$3(a)) return !!(null == options ? void 0 : options.skipFunction);
518
+ if (isFunction$1(a)) return !!(null == options ? void 0 : options.skipFunction);
479
519
  if ("object" != typeof a) return !1;
480
- if (isArray$3(a)) {
520
+ if (isArray$1(a)) {
481
521
  if (a.length !== b.length) return !1;
482
522
  for (let i = a.length - 1; i >= 0; i--) if (!isEqual(a[i], b[i], options)) return !1;
483
523
  return !0;
484
524
  }
485
- if (!isPlainObject$3(a)) return !1;
525
+ if (!isPlainObject$1(a)) return !1;
486
526
  const ka = objectKeys(a),
487
527
  kb = objectKeys(b);
488
528
  if (ka.length !== kb.length) return !1;
@@ -495,2101 +535,1894 @@
495
535
  return !0;
496
536
  }
497
537
 
498
- const calculateAnchorOfBounds$1 = (bounds, anchorType) => {
499
- const {
500
- x1: x1,
501
- x2: x2,
502
- y1: y1,
503
- y2: y2
504
- } = bounds,
505
- rectWidth = Math.abs(x2 - x1),
506
- rectHeight = Math.abs(y2 - y1);
507
- let anchorX = (x1 + x2) / 2,
508
- anchorY = (y1 + y2) / 2,
509
- sx = 0,
510
- sy = 0;
511
- switch (anchorType) {
512
- case "top":
513
- case "inside-top":
514
- sy = -.5;
515
- break;
516
- case "bottom":
517
- case "inside-bottom":
518
- sy = .5;
519
- break;
520
- case "left":
521
- case "inside-left":
522
- sx = -.5;
523
- break;
524
- case "right":
525
- case "inside-right":
526
- sx = .5;
527
- break;
528
- case "top-right":
529
- sx = .5, sy = -.5;
530
- break;
531
- case "top-left":
532
- sx = -.5, sy = -.5;
533
- break;
534
- case "bottom-right":
535
- sx = .5, sy = .5;
536
- break;
537
- case "bottom-left":
538
- sx = -.5, sy = .5;
539
- }
540
- return anchorX += sx * rectWidth, anchorY += sy * rectHeight, {
541
- x: anchorX,
542
- y: anchorY
543
- };
544
- };
538
+ function arrayEqual(a, b) {
539
+ if (!isArray$1(a) || !isArray$1(b)) return !1;
540
+ if (a.length !== b.length) return !1;
541
+ for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return !1;
542
+ return !0;
543
+ }
545
544
 
546
- const styleStringToObject$1 = function () {
547
- let styleStr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
548
- const res = {};
549
- return styleStr.split(";").forEach(item => {
550
- if (item) {
551
- const arr = item.split(":");
552
- if (2 === arr.length) {
553
- const key = arr[0].trim(),
554
- value = arr[1].trim();
555
- key && value && (res[key] = value);
556
- }
545
+ const hasConsole = "undefined" != typeof console;
546
+ function log(method, level, input) {
547
+ const args = [level].concat([].slice.call(input));
548
+ hasConsole && console[method].apply(console, args);
549
+ }
550
+ var LoggerLevel;
551
+ !function (LoggerLevel) {
552
+ 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";
553
+ }(LoggerLevel || (LoggerLevel = {}));
554
+ class Logger {
555
+ static getInstance(level, method) {
556
+ return Logger._instance && isNumber$1(level) ? Logger._instance.level(level) : Logger._instance || (Logger._instance = new Logger(level, method)), Logger._instance;
557
+ }
558
+ static setInstance(logger) {
559
+ return Logger._instance = logger;
560
+ }
561
+ static setInstanceLevel(level) {
562
+ Logger._instance ? Logger._instance.level(level) : Logger._instance = new Logger(level);
563
+ }
564
+ static clearInstance() {
565
+ Logger._instance = null;
566
+ }
567
+ constructor() {
568
+ let level = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : LoggerLevel.None;
569
+ let method = arguments.length > 1 ? arguments[1] : undefined;
570
+ this._onErrorHandler = [], this._level = level, this._method = method;
571
+ }
572
+ addErrorHandler(handler) {
573
+ this._onErrorHandler.find(h => h === handler) || this._onErrorHandler.push(handler);
574
+ }
575
+ removeErrorHandler(handler) {
576
+ const index = this._onErrorHandler.findIndex(h => h === handler);
577
+ index < 0 || this._onErrorHandler.splice(index, 1);
578
+ }
579
+ callErrorHandler() {
580
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
581
+ args[_key] = arguments[_key];
557
582
  }
558
- }), res;
559
- };
583
+ this._onErrorHandler.forEach(h => h(...args));
584
+ }
585
+ canLogInfo() {
586
+ return this._level >= LoggerLevel.Info;
587
+ }
588
+ canLogDebug() {
589
+ return this._level >= LoggerLevel.Debug;
590
+ }
591
+ canLogError() {
592
+ return this._level >= LoggerLevel.Error;
593
+ }
594
+ canLogWarn() {
595
+ return this._level >= LoggerLevel.Warn;
596
+ }
597
+ level(levelValue) {
598
+ return arguments.length ? (this._level = +levelValue, this) : this._level;
599
+ }
600
+ error() {
601
+ var _a;
602
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
603
+ args[_key2] = arguments[_key2];
604
+ }
605
+ return this._level >= LoggerLevel.Error && (this._onErrorHandler.length ? this.callErrorHandler(...args) : log(null !== (_a = this._method) && void 0 !== _a ? _a : "error", "ERROR", args)), this;
606
+ }
607
+ warn() {
608
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
609
+ args[_key3] = arguments[_key3];
610
+ }
611
+ return this._level >= LoggerLevel.Warn && log(this._method || "warn", "WARN", args), this;
612
+ }
613
+ info() {
614
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
615
+ args[_key4] = arguments[_key4];
616
+ }
617
+ return this._level >= LoggerLevel.Info && log(this._method || "log", "INFO", args), this;
618
+ }
619
+ debug() {
620
+ for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
621
+ args[_key5] = arguments[_key5];
622
+ }
623
+ return this._level >= LoggerLevel.Debug && log(this._method || "log", "DEBUG", args), this;
624
+ }
625
+ }
626
+ Logger._instance = null;
560
627
 
561
- var reactIs = {exports: {}};
628
+ const clamp = function (input, min, max) {
629
+ return input < min ? min : input > max ? max : input;
630
+ };
631
+ var clamp$1 = clamp;
562
632
 
563
- var reactIs_production_min = {};
633
+ const epsilon = 1e-12;
634
+ const pi = Math.PI;
635
+ const halfPi$1 = pi / 2;
636
+ const tau = 2 * pi;
637
+ const pi2 = 2 * Math.PI;
638
+ const abs = Math.abs;
639
+ const atan2 = Math.atan2;
640
+ const cos = Math.cos;
641
+ const max = Math.max;
642
+ const min = Math.min;
643
+ const sin = Math.sin;
644
+ const sqrt = Math.sqrt;
645
+ const pow = Math.pow;
646
+ function asin(x) {
647
+ return x >= 1 ? halfPi$1 : x <= -1 ? -halfPi$1 : Math.asin(x);
648
+ }
564
649
 
565
- /**
566
- * @license React
567
- * react-is.production.min.js
568
- *
569
- * Copyright (c) Facebook, Inc. and its affiliates.
570
- *
571
- * This source code is licensed under the MIT license found in the
572
- * LICENSE file in the root directory of this source tree.
573
- */
574
- var hasRequiredReactIs_production_min;
575
- function requireReactIs_production_min() {
576
- if (hasRequiredReactIs_production_min) return reactIs_production_min;
577
- hasRequiredReactIs_production_min = 1;
578
- var b = Symbol.for("react.element"),
579
- c = Symbol.for("react.portal"),
580
- d = Symbol.for("react.fragment"),
581
- e = Symbol.for("react.strict_mode"),
582
- f = Symbol.for("react.profiler"),
583
- g = Symbol.for("react.provider"),
584
- h = Symbol.for("react.context"),
585
- k = Symbol.for("react.server_context"),
586
- l = Symbol.for("react.forward_ref"),
587
- m = Symbol.for("react.suspense"),
588
- n = Symbol.for("react.suspense_list"),
589
- p = Symbol.for("react.memo"),
590
- q = Symbol.for("react.lazy"),
591
- t = Symbol.for("react.offscreen"),
592
- u;
593
- u = Symbol.for("react.module.reference");
594
- function v(a) {
595
- if ("object" === typeof a && null !== a) {
596
- var r = a.$$typeof;
597
- switch (r) {
598
- case b:
599
- switch (a = a.type, a) {
600
- case d:
601
- case f:
602
- case e:
603
- case m:
604
- case n:
605
- return a;
606
- default:
607
- switch (a = a && a.$$typeof, a) {
608
- case k:
609
- case h:
610
- case l:
611
- case q:
612
- case p:
613
- case g:
614
- return a;
615
- default:
616
- return r;
617
- }
618
- }
619
- case c:
620
- return r;
621
- }
622
- }
650
+ class Point {
651
+ constructor() {
652
+ let x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
653
+ let y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
654
+ let x1 = arguments.length > 2 ? arguments[2] : undefined;
655
+ let y1 = arguments.length > 3 ? arguments[3] : undefined;
656
+ this.x = 0, this.y = 0, this.x = x, this.y = y, this.x1 = x1, this.y1 = y1;
623
657
  }
624
- reactIs_production_min.ContextConsumer = h;
625
- reactIs_production_min.ContextProvider = g;
626
- reactIs_production_min.Element = b;
627
- reactIs_production_min.ForwardRef = l;
628
- reactIs_production_min.Fragment = d;
629
- reactIs_production_min.Lazy = q;
630
- reactIs_production_min.Memo = p;
631
- reactIs_production_min.Portal = c;
632
- reactIs_production_min.Profiler = f;
633
- reactIs_production_min.StrictMode = e;
634
- reactIs_production_min.Suspense = m;
635
- reactIs_production_min.SuspenseList = n;
636
- reactIs_production_min.isAsyncMode = function () {
637
- return !1;
638
- };
639
- reactIs_production_min.isConcurrentMode = function () {
640
- return !1;
641
- };
642
- reactIs_production_min.isContextConsumer = function (a) {
643
- return v(a) === h;
644
- };
645
- reactIs_production_min.isContextProvider = function (a) {
646
- return v(a) === g;
647
- };
648
- reactIs_production_min.isElement = function (a) {
649
- return "object" === typeof a && null !== a && a.$$typeof === b;
650
- };
651
- reactIs_production_min.isForwardRef = function (a) {
652
- return v(a) === l;
653
- };
654
- reactIs_production_min.isFragment = function (a) {
655
- return v(a) === d;
656
- };
657
- reactIs_production_min.isLazy = function (a) {
658
- return v(a) === q;
659
- };
660
- reactIs_production_min.isMemo = function (a) {
661
- return v(a) === p;
662
- };
663
- reactIs_production_min.isPortal = function (a) {
664
- return v(a) === c;
665
- };
666
- reactIs_production_min.isProfiler = function (a) {
667
- return v(a) === f;
668
- };
669
- reactIs_production_min.isStrictMode = function (a) {
670
- return v(a) === e;
658
+ clone() {
659
+ return new Point(this.x, this.y);
660
+ }
661
+ copyFrom(p) {
662
+ 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;
663
+ }
664
+ set(x, y) {
665
+ return this.x = x, this.y = y, this;
666
+ }
667
+ add(point) {
668
+ return isNumber$1(point) ? (this.x += point, void (this.y += point)) : (this.x += point.x, this.y += point.y, this);
669
+ }
670
+ sub(point) {
671
+ return isNumber$1(point) ? (this.x -= point, void (this.y -= point)) : (this.x -= point.x, this.y -= point.y, this);
672
+ }
673
+ multi(point) {
674
+ throw new Error("暂不支持");
675
+ }
676
+ div(point) {
677
+ throw new Error("暂不支持");
678
+ }
679
+ }
680
+ class PointService {
681
+ static distancePP(p1, p2) {
682
+ return sqrt(pow(p1.x - p2.x, 2) + pow(p1.y - p2.y, 2));
683
+ }
684
+ static distanceNN(x, y, x1, y1) {
685
+ return sqrt(pow(x - x1, 2) + pow(y - y1, 2));
686
+ }
687
+ static distancePN(point, x, y) {
688
+ return sqrt(pow(x - point.x, 2) + pow(y - point.y, 2));
689
+ }
690
+ static pointAtPP(p1, p2, t) {
691
+ return new Point((p2.x - p1.x) * t + p1.x, (p2.y - p1.y) * t + p1.y);
692
+ }
693
+ }
694
+
695
+ function degreeToRadian(degree) {
696
+ return degree * (Math.PI / 180);
697
+ }
698
+ function radianToDegree(radian) {
699
+ return 180 * radian / Math.PI;
700
+ }
701
+ const clampRadian = function () {
702
+ let angle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
703
+ if (angle < 0) for (; angle < -tau;) angle += tau;else if (angle > 0) for (; angle > tau;) angle -= tau;
704
+ return angle;
705
+ };
706
+ const clampAngleByRadian = clampRadian;
707
+
708
+ var InnerBBox;
709
+ !function (InnerBBox) {
710
+ InnerBBox[InnerBBox.NONE = 0] = "NONE", InnerBBox[InnerBBox.BBOX1 = 1] = "BBOX1", InnerBBox[InnerBBox.BBOX2 = 2] = "BBOX2";
711
+ }(InnerBBox || (InnerBBox = {}));
712
+ function getProjectionRadius(checkAxis, axis) {
713
+ return Math.abs(axis[0] * checkAxis[0] + axis[1] * checkAxis[1]);
714
+ }
715
+ function rotatePoint(_ref, rad) {
716
+ let {
717
+ x: x,
718
+ y: y
719
+ } = _ref;
720
+ let origin = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
721
+ x: 0,
722
+ y: 0
671
723
  };
672
- reactIs_production_min.isSuspense = function (a) {
673
- return v(a) === m;
724
+ return {
725
+ x: (x - origin.x) * Math.cos(rad) - (y - origin.y) * Math.sin(rad) + origin.x,
726
+ y: (x - origin.x) * Math.sin(rad) + (y - origin.y) * Math.cos(rad) + origin.y
674
727
  };
675
- reactIs_production_min.isSuspenseList = function (a) {
676
- return v(a) === n;
728
+ }
729
+ function getCenterPoint(box) {
730
+ return {
731
+ x: (box.x1 + box.x2) / 2,
732
+ y: (box.y1 + box.y2) / 2
677
733
  };
678
- reactIs_production_min.isValidElementType = function (a) {
679
- 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;
734
+ }
735
+ function toRect(box, isDeg) {
736
+ const deg = isDeg ? degreeToRadian(box.angle) : box.angle,
737
+ cp = getCenterPoint(box);
738
+ return [rotatePoint({
739
+ x: box.x1,
740
+ y: box.y1
741
+ }, deg, cp), rotatePoint({
742
+ x: box.x2,
743
+ y: box.y1
744
+ }, deg, cp), rotatePoint({
745
+ x: box.x2,
746
+ y: box.y2
747
+ }, deg, cp), rotatePoint({
748
+ x: box.x1,
749
+ y: box.y2
750
+ }, deg, cp)];
751
+ }
752
+ function isRotateAABBIntersect(box1, box2) {
753
+ let isDeg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
754
+ const rect1 = toRect(box1, isDeg),
755
+ rect2 = toRect(box2, isDeg),
756
+ vector = (start, end) => [end.x - start.x, end.y - start.y],
757
+ vp1p2 = vector(getCenterPoint(box1), getCenterPoint(box2)),
758
+ AB = vector(rect1[0], rect1[1]),
759
+ BC = vector(rect1[1], rect1[2]),
760
+ A1B1 = vector(rect2[0], rect2[1]),
761
+ B1C1 = vector(rect2[1], rect2[2]),
762
+ deg11 = isDeg ? degreeToRadian(box1.angle) : box1.angle;
763
+ let deg12 = isDeg ? degreeToRadian(90 - box1.angle) : box1.angle + halfPi$1;
764
+ const deg21 = isDeg ? degreeToRadian(box2.angle) : box2.angle;
765
+ let deg22 = isDeg ? degreeToRadian(90 - box2.angle) : box2.angle + halfPi$1;
766
+ deg12 > pi2 && (deg12 -= pi2), deg22 > pi2 && (deg22 -= pi2);
767
+ const isCover = (checkAxisRadius, deg, targetAxis1, targetAxis2) => {
768
+ const checkAxis = [Math.cos(deg), Math.sin(deg)];
769
+ return checkAxisRadius + (getProjectionRadius(checkAxis, targetAxis1) + getProjectionRadius(checkAxis, targetAxis2)) / 2 > getProjectionRadius(checkAxis, vp1p2);
680
770
  };
681
- reactIs_production_min.typeOf = v;
682
- return reactIs_production_min;
771
+ 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);
683
772
  }
684
773
 
685
- {
686
- reactIs.exports = requireReactIs_production_min();
774
+ function getContextFont(text) {
775
+ let defaultAttr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
776
+ let fontSizeScale = arguments.length > 2 ? arguments[2] : undefined;
777
+ fontSizeScale || (fontSizeScale = 1);
778
+ const {
779
+ fontStyle = defaultAttr.fontStyle,
780
+ fontVariant = defaultAttr.fontVariant,
781
+ fontWeight = defaultAttr.fontWeight,
782
+ fontSize = defaultAttr.fontSize,
783
+ fontFamily = defaultAttr.fontFamily
784
+ } = text;
785
+ return (fontStyle ? fontStyle + " " : "") + (fontVariant ? fontVariant + " " : "") + (fontWeight ? fontWeight + " " : "") + fontSize * fontSizeScale + "px " + (fontFamily || "sans-serif");
687
786
  }
688
- var reactIsExports = reactIs.exports;
689
-
690
- const toArray = (children) => {
691
- let result = [];
692
- React.Children.forEach(children, child => {
693
- if (isNil$3(child)) {
694
- return;
695
- }
696
- if (reactIsExports.isFragment(child)) {
697
- result = result.concat(toArray(child.props.children));
698
- }
699
- else {
700
- result.push(child);
701
- }
702
- });
703
- return result;
704
- };
705
-
706
- const REACT_PRIVATE_PROPS = ['children', 'hooks', 'ref'];
707
787
 
708
- const EVENT_TYPE = {
709
- ...vtable.TABLE_EVENT_TYPE,
710
- ...vtable.PIVOT_TABLE_EVENT_TYPE,
711
- ...vtable.PIVOT_CHART_EVENT_TYPE
712
- };
713
- const TABLE_EVENTS = {
714
- onClickCell: EVENT_TYPE.CLICK_CELL,
715
- onDblClickCell: EVENT_TYPE.DBLCLICK_CELL,
716
- onMouseDownCell: EVENT_TYPE.MOUSEDOWN_CELL,
717
- onMouseUpCell: EVENT_TYPE.MOUSEUP_CELL,
718
- onSelectedCell: EVENT_TYPE.SELECTED_CELL,
719
- onSelectedClear: EVENT_TYPE.SELECTED_CLEAR,
720
- onKeyDown: EVENT_TYPE.KEYDOWN,
721
- onMouseEnterTable: EVENT_TYPE.MOUSEENTER_TABLE,
722
- onMouseLeaveTable: EVENT_TYPE.MOUSELEAVE_TABLE,
723
- onMouseDownTable: EVENT_TYPE.MOUSEDOWN_TABLE,
724
- onMouseMoveCell: EVENT_TYPE.MOUSEMOVE_CELL,
725
- onMouseMoveTable: EVENT_TYPE.MOUSEMOVE_TABLE,
726
- onMouseEnterCell: EVENT_TYPE.MOUSEENTER_CELL,
727
- onMouseLeaveCell: EVENT_TYPE.MOUSELEAVE_CELL,
728
- onContextMenuCell: EVENT_TYPE.CONTEXTMENU_CELL,
729
- onResizeColumn: EVENT_TYPE.RESIZE_COLUMN,
730
- onResizeColumnEnd: EVENT_TYPE.RESIZE_COLUMN_END,
731
- onResizeRow: EVENT_TYPE.RESIZE_ROW,
732
- onResizeRowEnd: EVENT_TYPE.RESIZE_ROW_END,
733
- onChangeHeaderPositionStart: EVENT_TYPE.CHANGE_HEADER_POSITION_START,
734
- onChangeHeaderPosition: EVENT_TYPE.CHANGE_HEADER_POSITION,
735
- onChangeHeaderPositionFail: EVENT_TYPE.CHANGE_HEADER_POSITION_FAIL,
736
- onSortClick: EVENT_TYPE.SORT_CLICK,
737
- onAfterSort: EVENT_TYPE.AFTER_SORT,
738
- onFreezeClick: EVENT_TYPE.FREEZE_CLICK,
739
- onScroll: EVENT_TYPE.SCROLL,
740
- onScrollHorizontalEnd: EVENT_TYPE.SCROLL_HORIZONTAL_END,
741
- onScrollVerticalEnd: EVENT_TYPE.SCROLL_VERTICAL_END,
742
- onDropdownMenuClick: EVENT_TYPE.DROPDOWN_MENU_CLICK,
743
- onMouseOverChartSymbol: EVENT_TYPE.MOUSEOVER_CHART_SYMBOL,
744
- onDragSelectEnd: EVENT_TYPE.DRAG_SELECT_END,
745
- onCopyData: EVENT_TYPE.COPY_DATA,
746
- onDropdownIconClick: EVENT_TYPE.DROPDOWN_ICON_CLICK,
747
- onDropdownMenuClear: EVENT_TYPE.DROPDOWN_MENU_CLEAR,
748
- onTreeHierarchyStateChange: EVENT_TYPE.TREE_HIERARCHY_STATE_CHANGE,
749
- onShowMenu: EVENT_TYPE.SHOW_MENU,
750
- onHideMenu: EVENT_TYPE.HIDE_MENU,
751
- onIconClick: EVENT_TYPE.ICON_CLICK,
752
- onLegendItemClick: EVENT_TYPE.LEGEND_ITEM_CLICK,
753
- onLegendItemHover: EVENT_TYPE.LEGEND_ITEM_HOVER,
754
- onLegendItemUnHover: EVENT_TYPE.LEGEND_ITEM_UNHOVER,
755
- onLegendChange: EVENT_TYPE.LEGEND_CHANGE,
756
- onMouseEnterAxis: EVENT_TYPE.MOUSEENTER_AXIS,
757
- onMouseLeaveAxis: EVENT_TYPE.MOUSELEAVE_AXIS,
758
- onCheckboxStateChange: EVENT_TYPE.CHECKBOX_STATE_CHANGE,
759
- onRadioStateChange: EVENT_TYPE.RADIO_STATE_CHANGE,
760
- onSwitchStateChange: EVENT_TYPE.SWITCH_STATE_CHANGE,
761
- onAfterRender: EVENT_TYPE.AFTER_RENDER,
762
- onInitialized: EVENT_TYPE.INITIALIZED,
763
- onChangeCellValue: EVENT_TYPE.CHANGE_CELL_VALUE,
764
- onDragFillHandleEnd: EVENT_TYPE.DRAG_FILL_HANDLE_END,
765
- onMousedownFillHandle: EVENT_TYPE.MOUSEDOWN_FILL_HANDLE,
766
- onDblclickFillHandle: EVENT_TYPE.DBLCLICK_FILL_HANDLE,
767
- onPivotSortClick: EVENT_TYPE.PIVOT_SORT_CLICK,
768
- onDrillMenuClick: EVENT_TYPE.DRILLMENU_CLICK,
769
- onVChartEventType: EVENT_TYPE.VCHART_EVENT_TYPE,
770
- onChangCellValue: EVENT_TYPE.CHANGE_CELL_VALUE,
771
- onEmptyTipClick: EVENT_TYPE.EMPTY_TIP_CLICK,
772
- onEmptyTipDblClick: EVENT_TYPE.EMPTY_TIP_DBLCLICK,
773
- onButtonClick: EVENT_TYPE.BUTTON_CLICK
774
- };
775
- const TABLE_EVENTS_KEYS = Object.keys(TABLE_EVENTS);
776
- const findEventProps = (props, supportedEvents = TABLE_EVENTS) => {
777
- const result = {};
778
- Object.keys(props).forEach(key => {
779
- if (supportedEvents[key] && props[key]) {
780
- result[key] = props[key];
781
- }
782
- });
783
- return result;
784
- };
785
- const bindEventsToTable = (table, newProps, prevProps, supportedEvents = TABLE_EVENTS) => {
786
- if ((!newProps && !prevProps) || !table) {
787
- return false;
788
- }
789
- const prevEventProps = prevProps ? findEventProps(prevProps, supportedEvents) : null;
790
- const newEventProps = newProps ? findEventProps(newProps, supportedEvents) : null;
791
- if (prevEventProps) {
792
- Object.keys(prevEventProps).forEach(eventKey => {
793
- if (!newEventProps ||
794
- !newEventProps[eventKey] ||
795
- newEventProps[eventKey] !== prevEventProps[eventKey]) {
796
- table.off(supportedEvents[eventKey], prevProps[eventKey]);
797
- }
798
- });
799
- }
800
- if (newEventProps) {
801
- Object.keys(newEventProps).forEach(eventKey => {
802
- if (!prevEventProps ||
803
- !prevEventProps[eventKey] ||
804
- prevEventProps[eventKey] !== newEventProps[eventKey]) {
805
- table.on(supportedEvents[eventKey], newEventProps[eventKey]);
806
- }
807
- });
808
- }
809
- return true;
788
+ const calculateAnchorOfBounds = (bounds, anchorType) => {
789
+ const {
790
+ x1: x1,
791
+ x2: x2,
792
+ y1: y1,
793
+ y2: y2
794
+ } = bounds,
795
+ rectWidth = Math.abs(x2 - x1),
796
+ rectHeight = Math.abs(y2 - y1);
797
+ let anchorX = (x1 + x2) / 2,
798
+ anchorY = (y1 + y2) / 2,
799
+ sx = 0,
800
+ sy = 0;
801
+ switch (anchorType) {
802
+ case "top":
803
+ case "inside-top":
804
+ sy = -.5;
805
+ break;
806
+ case "bottom":
807
+ case "inside-bottom":
808
+ sy = .5;
809
+ break;
810
+ case "left":
811
+ case "inside-left":
812
+ sx = -.5;
813
+ break;
814
+ case "right":
815
+ case "inside-right":
816
+ sx = .5;
817
+ break;
818
+ case "top-right":
819
+ sx = .5, sy = -.5;
820
+ break;
821
+ case "top-left":
822
+ sx = -.5, sy = -.5;
823
+ break;
824
+ case "bottom-right":
825
+ sx = .5, sy = .5;
826
+ break;
827
+ case "bottom-left":
828
+ sx = -.5, sy = .5;
829
+ }
830
+ return anchorX += sx * rectWidth, anchorY += sy * rectHeight, {
831
+ x: anchorX,
832
+ y: anchorY
833
+ };
810
834
  };
811
835
 
812
- class Generator {
813
- static GenAutoIncrementId() {
814
- return Generator.auto_increment_id++;
815
- }
836
+ function transformBoundsWithMatrix(out, bounds, matrix) {
837
+ const {
838
+ x1: x1,
839
+ y1: y1,
840
+ x2: x2,
841
+ y2: y2
842
+ } = bounds;
843
+ 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);
816
844
  }
817
- Generator.auto_increment_id = 0;
818
-
819
- class ContainerModule {
820
- constructor(registry) {
821
- this.id = Generator.GenAutoIncrementId(), this.registry = registry;
845
+ class Bounds {
846
+ constructor(bounds) {
847
+ bounds ? this.setValue(bounds.x1, bounds.y1, bounds.x2, bounds.y2) : this.clear();
822
848
  }
823
- }
824
-
825
- const NAMED_TAG = "named";
826
- const INJECT_TAG = "inject";
827
- const MULTI_INJECT_TAG = "multi_inject";
828
- const TAGGED = "inversify:tagged";
829
- const PARAM_TYPES = "inversify:paramtypes";
830
-
831
- class Metadata {
832
- constructor(key, value) {
833
- this.key = key, this.value = value;
849
+ clone() {
850
+ return new Bounds(this);
834
851
  }
835
- toString() {
836
- return this.key === NAMED_TAG ? `named: ${String(this.value).toString()} ` : `tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`;
852
+ clear() {
853
+ return this.x1 = +Number.MAX_VALUE, this.y1 = +Number.MAX_VALUE, this.x2 = -Number.MAX_VALUE, this.y2 = -Number.MAX_VALUE, this;
837
854
  }
838
- }
839
-
840
- var Reflect$1 = (function (Reflect) {
841
- var target;
842
- return function (exporter) {
843
- const supportsSymbol = "function" == typeof Symbol,
844
- toPrimitiveSymbol = supportsSymbol && void 0 !== Symbol.toPrimitive ? Symbol.toPrimitive : "@@toPrimitive",
845
- functionPrototype = (Object.getPrototypeOf(Function)),
846
- _Map = ("object" == typeof process && process.env && process.env.REFLECT_METADATA_USE_MAP_POLYFILL, Map),
847
- Metadata = (new WeakMap());
848
- function defineMetadata(metadataKey, metadataValue, target, propertyKey) {
849
- if (!IsObject(target)) throw new TypeError();
850
- return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);
851
- }
852
- function hasMetadata(metadataKey, target, propertyKey) {
853
- if (!IsObject(target)) throw new TypeError();
854
- return IsUndefined(propertyKey) || (propertyKey = ToPropertyKey(propertyKey)), OrdinaryHasMetadata(metadataKey, target, propertyKey);
855
- }
856
- function hasOwnMetadata(metadataKey, target, propertyKey) {
857
- if (!IsObject(target)) throw new TypeError();
858
- return IsUndefined(propertyKey) || (propertyKey = ToPropertyKey(propertyKey)), OrdinaryHasOwnMetadata(metadataKey, target, propertyKey);
859
- }
860
- function getMetadata(metadataKey, target, propertyKey) {
861
- if (!IsObject(target)) throw new TypeError();
862
- return IsUndefined(propertyKey) || (propertyKey = ToPropertyKey(propertyKey)), OrdinaryGetMetadata(metadataKey, target, propertyKey);
863
- }
864
- function GetOrCreateMetadataMap(O, P, Create) {
865
- let targetMetadata = Metadata.get(O);
866
- if (IsUndefined(targetMetadata)) {
867
- if (!Create) return;
868
- targetMetadata = new _Map(), Metadata.set(O, targetMetadata);
869
- }
870
- let metadataMap = targetMetadata.get(P);
871
- if (IsUndefined(metadataMap)) {
872
- if (!Create) return;
873
- metadataMap = new _Map(), targetMetadata.set(P, metadataMap);
874
- }
875
- return metadataMap;
876
- }
877
- function OrdinaryHasMetadata(MetadataKey, O, P) {
878
- if (OrdinaryHasOwnMetadata(MetadataKey, O, P)) return !0;
879
- const parent = OrdinaryGetPrototypeOf(O);
880
- return !IsNull(parent) && OrdinaryHasMetadata(MetadataKey, parent, P);
881
- }
882
- function OrdinaryHasOwnMetadata(MetadataKey, O, P) {
883
- const metadataMap = GetOrCreateMetadataMap(O, P, !1);
884
- return !IsUndefined(metadataMap) && ToBoolean(metadataMap.has(MetadataKey));
885
- }
886
- function OrdinaryGetMetadata(MetadataKey, O, P) {
887
- if (OrdinaryHasOwnMetadata(MetadataKey, O, P)) return OrdinaryGetOwnMetadata(MetadataKey, O, P);
888
- const parent = OrdinaryGetPrototypeOf(O);
889
- return IsNull(parent) ? void 0 : OrdinaryGetMetadata(MetadataKey, parent, P);
890
- }
891
- function OrdinaryGetOwnMetadata(MetadataKey, O, P) {
892
- const metadataMap = GetOrCreateMetadataMap(O, P, !1);
893
- if (!IsUndefined(metadataMap)) return metadataMap.get(MetadataKey);
894
- }
895
- function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) {
896
- GetOrCreateMetadataMap(O, P, !0).set(MetadataKey, MetadataValue);
897
- }
898
- function Type(x) {
899
- if (null === x) return 1;
900
- switch (typeof x) {
901
- case "undefined":
902
- return 0;
903
- case "boolean":
904
- return 2;
905
- case "string":
906
- return 3;
907
- case "symbol":
908
- return 4;
909
- case "number":
910
- return 5;
911
- case "object":
912
- return null === x ? 1 : 6;
913
- default:
914
- return 6;
915
- }
916
- }
917
- function IsUndefined(x) {
918
- return void 0 === x;
919
- }
920
- function IsNull(x) {
921
- return null === x;
922
- }
923
- function IsSymbol(x) {
924
- return "symbol" == typeof x;
925
- }
926
- function IsObject(x) {
927
- return "object" == typeof x ? null !== x : "function" == typeof x;
928
- }
929
- function ToPrimitive(input, PreferredType) {
930
- switch (Type(input)) {
931
- case 0:
932
- case 1:
933
- case 2:
934
- case 3:
935
- case 4:
936
- case 5:
937
- return input;
938
- }
939
- const hint = 3 === PreferredType ? "string" : 5 === PreferredType ? "number" : "default",
940
- exoticToPrim = GetMethod(input, toPrimitiveSymbol);
941
- if (void 0 !== exoticToPrim) {
942
- const result = exoticToPrim.call(input, hint);
943
- if (IsObject(result)) throw new TypeError();
944
- return result;
945
- }
946
- return OrdinaryToPrimitive(input, "default" === hint ? "number" : hint);
947
- }
948
- function OrdinaryToPrimitive(O, hint) {
949
- if ("string" === hint) {
950
- const toString_1 = O.toString;
951
- if (IsCallable(toString_1)) {
952
- const result = toString_1.call(O);
953
- if (!IsObject(result)) return result;
954
- }
955
- const valueOf = O.valueOf;
956
- if (IsCallable(valueOf)) {
957
- const result = valueOf.call(O);
958
- if (!IsObject(result)) return result;
959
- }
960
- } else {
961
- const valueOf = O.valueOf;
962
- if (IsCallable(valueOf)) {
963
- const result = valueOf.call(O);
964
- if (!IsObject(result)) return result;
965
- }
966
- const toString_2 = O.toString;
967
- if (IsCallable(toString_2)) {
968
- const result = toString_2.call(O);
969
- if (!IsObject(result)) return result;
970
- }
971
- }
972
- throw new TypeError();
973
- }
974
- function ToBoolean(argument) {
975
- return !!argument;
976
- }
977
- function ToString(argument) {
978
- return "" + argument;
979
- }
980
- function ToPropertyKey(argument) {
981
- const key = ToPrimitive(argument, 3);
982
- return IsSymbol(key) ? key : ToString(key);
983
- }
984
- function IsCallable(argument) {
985
- return "function" == typeof argument;
986
- }
987
- function GetMethod(V, P) {
988
- const func = V[P];
989
- if (null != func) {
990
- if (!IsCallable(func)) throw new TypeError();
991
- return func;
992
- }
993
- }
994
- function OrdinaryGetPrototypeOf(O) {
995
- const proto = Object.getPrototypeOf(O);
996
- if ("function" != typeof O || O === functionPrototype) return proto;
997
- if (proto !== functionPrototype) return proto;
998
- const prototype = O.prototype,
999
- prototypeProto = prototype && Object.getPrototypeOf(prototype);
1000
- if (null == prototypeProto || prototypeProto === Object.prototype) return proto;
1001
- const constructor = prototypeProto.constructor;
1002
- return "function" != typeof constructor || constructor === O ? proto : constructor;
1003
- }
1004
- exporter("defineMetadata", defineMetadata), exporter("hasMetadata", hasMetadata), exporter("hasOwnMetadata", hasOwnMetadata), exporter("getMetadata", getMetadata);
1005
- }((target = Reflect, function (key, value) {
1006
- "function" != typeof target[key] && Object.defineProperty(target, key, {
1007
- configurable: !0,
1008
- writable: !0,
1009
- value: value
1010
- });
1011
- })), Reflect;
1012
- })({});
1013
-
1014
- function _tagParameterOrProperty(metadataKey, annotationTarget, key, metadata) {
1015
- const metadatas = [metadata];
1016
- let paramsOrPropertiesMetadata = {};
1017
- Reflect$1.hasOwnMetadata(metadataKey, annotationTarget) && (paramsOrPropertiesMetadata = Reflect$1.getMetadata(metadataKey, annotationTarget));
1018
- let paramOrPropertyMetadata = paramsOrPropertiesMetadata[key];
1019
- void 0 === paramOrPropertyMetadata && (paramOrPropertyMetadata = []), paramOrPropertyMetadata.push(...metadatas), paramsOrPropertiesMetadata[key] = paramOrPropertyMetadata, Reflect$1.defineMetadata(metadataKey, paramsOrPropertiesMetadata, annotationTarget);
1020
- }
1021
- function tagParameter(annotationTarget, parameterName, parameterIndex, metadata) {
1022
- _tagParameterOrProperty(TAGGED, annotationTarget, parameterIndex.toString(), metadata);
1023
- }
1024
- function createTaggedDecorator(metadata) {
1025
- return (target, targetKey, indexOrPropertyDescriptor) => {
1026
- tagParameter(target, targetKey, indexOrPropertyDescriptor, metadata);
1027
- };
1028
- }
1029
- function injectBase(metadataKey) {
1030
- return serviceIdentifier => (target, targetKey, indexOrPropertyDescriptor) => createTaggedDecorator(new Metadata(metadataKey, serviceIdentifier))(target, targetKey, indexOrPropertyDescriptor);
1031
- }
1032
-
1033
- const inject = injectBase(INJECT_TAG);
1034
-
1035
- function injectable() {
1036
- return function (target) {
1037
- return Reflect$1.defineMetadata(PARAM_TYPES, null, target), target;
1038
- };
1039
- }
1040
-
1041
- function named(name) {
1042
- return createTaggedDecorator(new Metadata(NAMED_TAG, name));
1043
- }
1044
-
1045
- const BindingScopeEnum = {
1046
- Singleton: "Singleton",
1047
- Transient: "Transient"
1048
- },
1049
- BindingTypeEnum = {
1050
- ConstantValue: "ConstantValue",
1051
- Constructor: "Constructor",
1052
- DynamicValue: "DynamicValue",
1053
- Factory: "Factory",
1054
- Function: "Function",
1055
- Instance: "Instance",
1056
- Invalid: "Invalid",
1057
- Provider: "Provider"
1058
- };
1059
-
1060
- class Binding {
1061
- constructor(serviceIdentifier, scope) {
1062
- 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;
855
+ empty() {
856
+ return this.x1 === +Number.MAX_VALUE && this.y1 === +Number.MAX_VALUE && this.x2 === -Number.MAX_VALUE && this.y2 === -Number.MAX_VALUE;
1063
857
  }
1064
- clone() {
1065
- const clone = new Binding(this.serviceIdentifier, this.scope);
1066
- 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;
858
+ equals(b) {
859
+ return this.x1 === b.x1 && this.y1 === b.y1 && this.x2 === b.x2 && this.y2 === b.y2;
1067
860
  }
1068
- }
1069
-
1070
- class MetadataReader {
1071
- getConstructorMetadata(constructorFunc) {
1072
- return {
1073
- compilerGeneratedMetadata: Reflect$1.getMetadata(PARAM_TYPES, constructorFunc),
1074
- userGeneratedMetadata: Reflect$1.getMetadata(TAGGED, constructorFunc) || {}
1075
- };
861
+ setValue() {
862
+ let x1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
863
+ let y1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
864
+ let x2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
865
+ let y2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
866
+ return this.x1 = x1, this.y1 = y1, this.x2 = x2, this.y2 = y2, this;
1076
867
  }
1077
- getPropertiesMetadata(constructorFunc) {
1078
- throw new Error("暂未实现");
868
+ set() {
869
+ let x1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
870
+ let y1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
871
+ let x2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
872
+ let y2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
873
+ 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;
1079
874
  }
1080
- }
1081
-
1082
- const taggedConstraint = key => value => {
1083
- const constraint = request => {
1084
- if (null == request) return !1;
1085
- if (request.key === key && request.value === value) return !0;
1086
- if (null == request.constructorArgsMetadata) return !1;
1087
- const constructorArgsMetadata = request.constructorArgsMetadata;
1088
- for (let i = 0; i < constructorArgsMetadata.length; i++) if (constructorArgsMetadata[i].key === key && constructorArgsMetadata[i].value === value) return !0;
1089
- return !1;
1090
- };
1091
- return constraint.metaData = new Metadata(key, value), constraint;
1092
- };
1093
- const namedConstraint = taggedConstraint(NAMED_TAG);
1094
-
1095
- class BindingInSyntax {
1096
- constructor(binding) {
1097
- this._binding = binding;
875
+ add() {
876
+ let x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
877
+ let y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
878
+ 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;
1098
879
  }
1099
- inRequestScope() {
1100
- throw new Error("暂未实现");
880
+ expand() {
881
+ let d = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
882
+ 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;
1101
883
  }
1102
- inSingletonScope() {
1103
- return this._binding.scope = BindingScopeEnum.Singleton, this;
884
+ round() {
885
+ 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;
1104
886
  }
1105
- inTransientScope() {
1106
- return this._binding.scope = BindingScopeEnum.Transient, this;
887
+ translate() {
888
+ let dx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
889
+ let dy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
890
+ return this.x1 += dx, this.x2 += dx, this.y1 += dy, this.y2 += dy, this;
1107
891
  }
1108
- whenTargetNamed(name) {
1109
- return this._binding.constraint = namedConstraint(name), this;
892
+ rotate() {
893
+ let angle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
894
+ let x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
895
+ let y = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
896
+ const p = this.rotatedPoints(angle, x, y);
897
+ return this.clear().add(p[0], p[1]).add(p[2], p[3]).add(p[4], p[5]).add(p[6], p[7]);
1110
898
  }
1111
- }
1112
-
1113
- class BindingToSyntax {
1114
- constructor(binding) {
1115
- this._binding = binding;
899
+ scale() {
900
+ let sx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
901
+ let sy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
902
+ let x = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
903
+ let y = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
904
+ const p = this.scalePoints(sx, sy, x, y);
905
+ return this.clear().add(p[0], p[1]).add(p[2], p[3]);
1116
906
  }
1117
- to(constructor) {
1118
- return this._binding.type = BindingTypeEnum.Instance, this._binding.implementationType = constructor, new BindingInSyntax(this._binding);
907
+ union(b) {
908
+ 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;
1119
909
  }
1120
- toSelf() {
1121
- const self = this._binding.serviceIdentifier;
1122
- return this.to(self);
910
+ intersect(b) {
911
+ 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;
1123
912
  }
1124
- toDynamicValue(func) {
1125
- return this._binding.type = BindingTypeEnum.DynamicValue, this._binding.cache = null, this._binding.dynamicValue = func, this._binding.implementationType = null, new BindingInSyntax(this._binding);
913
+ encloses(b) {
914
+ return b && this.x1 <= b.x1 && this.x2 >= b.x2 && this.y1 <= b.y1 && this.y2 >= b.y2;
1126
915
  }
1127
- toConstantValue(value) {
1128
- 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);
916
+ alignsWith(b) {
917
+ return b && (this.x1 === b.x1 || this.x2 === b.x2 || this.y1 === b.y1 || this.y2 === b.y2);
1129
918
  }
1130
- toFactory(factory) {
1131
- return this._binding.type = BindingTypeEnum.Factory, this._binding.factory = factory, this._binding.scope = BindingScopeEnum.Singleton, new BindingInSyntax(this._binding);
919
+ intersects(b) {
920
+ return b && !(this.x2 < b.x1 || this.x1 > b.x2 || this.y2 < b.y1 || this.y1 > b.y2);
1132
921
  }
1133
- toService(service) {
1134
- this.toDynamicValue(context => context.container.get(service));
922
+ contains() {
923
+ let x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
924
+ let y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
925
+ return !(x < this.x1 || x > this.x2 || y < this.y1 || y > this.y2);
1135
926
  }
1136
- }
1137
-
1138
- class Container {
1139
- constructor(containerOptions) {
1140
- const options = containerOptions || {};
1141
- options.defaultScope = options.defaultScope || BindingScopeEnum.Transient, this.options = options, this.id = Generator.GenAutoIncrementId(), this._bindingDictionary = new Map(), this._metadataReader = new MetadataReader();
927
+ containsPoint(p) {
928
+ return !(p.x < this.x1 || p.x > this.x2 || p.y < this.y1 || p.y > this.y2);
1142
929
  }
1143
- load(module) {
1144
- const containerModuleHelpers = this._getContainerModuleHelpersFactory()(module.id);
1145
- module.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction);
930
+ width() {
931
+ return this.empty() ? 0 : this.x2 - this.x1;
1146
932
  }
1147
- get(serviceIdentifier) {
1148
- const getArgs = this._getNotAllArgs(serviceIdentifier, !1);
1149
- return this._get(getArgs);
933
+ height() {
934
+ return this.empty() ? 0 : this.y2 - this.y1;
1150
935
  }
1151
- getAll(serviceIdentifier) {
1152
- const getArgs = this._getAllArgs(serviceIdentifier);
1153
- return this._get(getArgs);
936
+ scaleX() {
937
+ let s = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
938
+ return this.x1 *= s, this.x2 *= s, this;
1154
939
  }
1155
- getTagged(serviceIdentifier, key, value) {
1156
- const getArgs = this._getNotAllArgs(serviceIdentifier, !1, key, value);
1157
- return this._get(getArgs);
940
+ scaleY() {
941
+ let s = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
942
+ return this.y1 *= s, this.y2 *= s, this;
1158
943
  }
1159
- getNamed(serviceIdentifier, named) {
1160
- return this.getTagged(serviceIdentifier, NAMED_TAG, named);
944
+ transformWithMatrix(matrix) {
945
+ return transformBoundsWithMatrix(this, this, matrix), this;
1161
946
  }
1162
- isBound(serviceIdentifier) {
1163
- return this._bindingDictionary.has(serviceIdentifier);
947
+ copy(b) {
948
+ return this.x1 = b.x1, this.y1 = b.y1, this.x2 = b.x2, this.y2 = b.y2, this;
1164
949
  }
1165
- bind(serviceIdentifier) {
1166
- const scope = this.options.defaultScope,
1167
- binding = new Binding(serviceIdentifier, scope),
1168
- list = this._bindingDictionary.get(serviceIdentifier) || [];
1169
- return list.push(binding), this._bindingDictionary.set(serviceIdentifier, list), new BindingToSyntax(binding);
950
+ rotatedPoints(angle, x, y) {
951
+ const {
952
+ x1: x1,
953
+ y1: y1,
954
+ x2: x2,
955
+ y2: y2
956
+ } = this,
957
+ cos = Math.cos(angle),
958
+ sin = Math.sin(angle),
959
+ cx = x - x * cos + y * sin,
960
+ cy = y - x * sin - y * cos;
961
+ 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];
1170
962
  }
1171
- unbind(serviceIdentifier) {
1172
- this._bindingDictionary.delete(serviceIdentifier);
963
+ scalePoints(sx, sy, x, y) {
964
+ const {
965
+ x1: x1,
966
+ y1: y1,
967
+ x2: x2,
968
+ y2: y2
969
+ } = this;
970
+ return [sx * x1 + (1 - sx) * x, sy * y1 + (1 - sy) * y, sx * x2 + (1 - sx) * x, sy * y2 + (1 - sy) * y];
1173
971
  }
1174
- rebind(serviceIdentifier) {
1175
- return this.unbind(serviceIdentifier), this.bind(serviceIdentifier);
972
+ }
973
+ class AABBBounds extends Bounds {}
974
+ class OBBBounds extends Bounds {
975
+ constructor(bounds) {
976
+ let angle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
977
+ var _a;
978
+ super(bounds), bounds && (this.angle = null !== (_a = bounds.angle) && void 0 !== _a ? _a : angle);
1176
979
  }
1177
- _getContainerModuleHelpersFactory() {
1178
- const setModuleId = (bindingToSyntax, moduleId) => {
1179
- bindingToSyntax._binding.moduleId = moduleId;
1180
- },
1181
- getBindFunction = moduleId => serviceIdentifier => {
1182
- const bindingToSyntax = this.bind(serviceIdentifier);
1183
- return setModuleId(bindingToSyntax, moduleId), bindingToSyntax;
1184
- },
1185
- getUnbindFunction = () => serviceIdentifier => this.unbind(serviceIdentifier),
1186
- getIsboundFunction = () => serviceIdentifier => this.isBound(serviceIdentifier),
1187
- getRebindFunction = moduleId => serviceIdentifier => {
1188
- const bindingToSyntax = this.rebind(serviceIdentifier);
1189
- return setModuleId(bindingToSyntax, moduleId), bindingToSyntax;
1190
- };
1191
- return mId => ({
1192
- bindFunction: getBindFunction(mId),
1193
- isboundFunction: getIsboundFunction(),
1194
- rebindFunction: getRebindFunction(mId),
1195
- unbindFunction: getUnbindFunction(),
1196
- unbindAsyncFunction: serviceIdentifier => null
1197
- });
980
+ intersects(b) {
981
+ return isRotateAABBIntersect(this, b);
1198
982
  }
1199
- _getNotAllArgs(serviceIdentifier, isMultiInject, key, value) {
1200
- return {
1201
- avoidConstraints: !1,
1202
- isMultiInject: isMultiInject,
1203
- serviceIdentifier: serviceIdentifier,
1204
- key: key,
1205
- value: value
1206
- };
983
+ setValue() {
984
+ let x1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
985
+ let y1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
986
+ let x2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
987
+ let y2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
988
+ let angle = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
989
+ return super.setValue(x1, y1, x2, y2), this.angle = angle, this;
1207
990
  }
1208
- _getAllArgs(serviceIdentifier) {
1209
- return {
1210
- avoidConstraints: !0,
1211
- isMultiInject: !0,
1212
- serviceIdentifier: serviceIdentifier
1213
- };
991
+ clone() {
992
+ return new OBBBounds(this);
1214
993
  }
1215
- _get(getArgs) {
1216
- const result = [];
1217
- return this._bindingDictionary.get(getArgs.serviceIdentifier).filter(b => b.constraint(getArgs)).forEach(binding => {
1218
- result.push(this._resolveFromBinding(binding));
1219
- }), getArgs.isMultiInject || 1 !== result.length ? result : result[0];
994
+ }
995
+
996
+ class Matrix {
997
+ constructor() {
998
+ let a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
999
+ let b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1000
+ let c = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1001
+ let d = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
1002
+ let e = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
1003
+ let f = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
1004
+ this.a = a, this.b = b, this.c = c, this.d = d, this.e = e, this.f = f;
1220
1005
  }
1221
- _getChildRequest(binding) {
1222
- const constr = binding.implementationType,
1223
- {
1224
- userGeneratedMetadata: userGeneratedMetadata
1225
- } = this._metadataReader.getConstructorMetadata(constr),
1226
- keys = Object.keys(userGeneratedMetadata),
1227
- arr = [];
1228
- for (let i = 0; i < keys.length; i++) {
1229
- const constructorArgsMetadata = userGeneratedMetadata[i],
1230
- targetMetadataMap = {};
1231
- constructorArgsMetadata.forEach(md => {
1232
- targetMetadataMap[md.key] = md.value;
1233
- });
1234
- const metadata = {
1235
- inject: targetMetadataMap[INJECT_TAG],
1236
- multiInject: targetMetadataMap[MULTI_INJECT_TAG]
1237
- },
1238
- injectIdentifier = metadata.inject || metadata.multiInject,
1239
- target = {
1240
- serviceIdentifier: injectIdentifier,
1241
- constructorArgsMetadata: constructorArgsMetadata
1242
- },
1243
- request = {
1244
- injectIdentifier: injectIdentifier,
1245
- metadata: constructorArgsMetadata,
1246
- bindings: this._bindingDictionary.get(injectIdentifier).filter(b => b.constraint(target))
1247
- };
1248
- arr.push(request);
1249
- }
1250
- return arr;
1006
+ equalToMatrix(m2) {
1007
+ 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);
1251
1008
  }
1252
- _resolveFromBinding(binding) {
1253
- const result = this._getResolvedFromBinding(binding);
1254
- return this._saveToScope(binding, result), result;
1009
+ equalTo(a, b, c, d, e, f) {
1010
+ return !(this.e !== e || this.f !== f || this.a !== a || this.d !== d || this.b !== b || this.c !== c);
1255
1011
  }
1256
- _getResolvedFromBinding(binding) {
1257
- let result;
1258
- switch (binding.type) {
1259
- case BindingTypeEnum.ConstantValue:
1260
- case BindingTypeEnum.Function:
1261
- result = binding.cache;
1262
- break;
1263
- case BindingTypeEnum.Instance:
1264
- result = this._resolveInstance(binding, binding.implementationType);
1265
- break;
1266
- default:
1267
- result = binding.dynamicValue({
1268
- container: this
1269
- });
1270
- }
1271
- return result;
1012
+ setValue(a, b, c, d, e, f) {
1013
+ return this.a = a, this.b = b, this.c = c, this.d = d, this.e = e, this.f = f, this;
1272
1014
  }
1273
- _resolveInstance(binding, constr) {
1274
- if (binding.activated) return binding.cache;
1275
- const childRequests = this._getChildRequest(binding);
1276
- return this._createInstance(constr, childRequests);
1015
+ reset() {
1016
+ return this.a = 1, this.b = 0, this.c = 0, this.d = 1, this.e = 0, this.f = 0, this;
1277
1017
  }
1278
- _createInstance(constr, childRequests) {
1279
- if (childRequests.length) {
1280
- return new constr(...this._resolveRequests(childRequests));
1281
- }
1282
- return new constr();
1018
+ getInverse() {
1019
+ const a = this.a,
1020
+ b = this.b,
1021
+ c = this.c,
1022
+ d = this.d,
1023
+ e = this.e,
1024
+ f = this.f,
1025
+ m = new Matrix(),
1026
+ dt = a * d - b * c;
1027
+ 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;
1283
1028
  }
1284
- _resolveRequests(childRequests) {
1285
- return childRequests.map(request => request.bindings.length > 1 ? request.bindings.map(binding => this._resolveFromBinding(binding)) : this._resolveFromBinding(request.bindings[0]));
1029
+ rotate(rad) {
1030
+ const c = Math.cos(rad),
1031
+ s = Math.sin(rad),
1032
+ m11 = this.a * c + this.c * s,
1033
+ m12 = this.b * c + this.d * s,
1034
+ m21 = this.a * -s + this.c * c,
1035
+ m22 = this.b * -s + this.d * c;
1036
+ return this.a = m11, this.b = m12, this.c = m21, this.d = m22, this;
1286
1037
  }
1287
- _saveToScope(binding, result) {
1288
- binding.scope === BindingScopeEnum.Singleton && (binding.cache = result, binding.activated = !0);
1038
+ rotateByCenter(rad, cx, cy) {
1039
+ const cos = Math.cos(rad),
1040
+ sin = Math.sin(rad),
1041
+ rotateM13 = (1 - cos) * cx + sin * cy,
1042
+ rotateM23 = (1 - cos) * cy - sin * cx,
1043
+ m11 = cos * this.a - sin * this.b,
1044
+ m21 = sin * this.a + cos * this.b,
1045
+ m12 = cos * this.c - sin * this.d,
1046
+ m22 = sin * this.c + cos * this.d,
1047
+ m13 = cos * this.e - sin * this.f + rotateM13,
1048
+ m23 = sin * this.e + cos * this.f + rotateM23;
1049
+ return this.a = m11, this.b = m21, this.c = m12, this.d = m22, this.e = m13, this.f = m23, this;
1289
1050
  }
1290
- }
1291
-
1292
- const ContributionProvider = Symbol("ContributionProvider");
1293
- class ContributionProviderCache {
1294
- constructor(serviceIdentifier, container) {
1295
- this.serviceIdentifier = serviceIdentifier, this.container = container;
1051
+ scale(sx, sy) {
1052
+ return this.a *= sx, this.b *= sx, this.c *= sy, this.d *= sy, this;
1296
1053
  }
1297
- getContributions() {
1298
- return this.caches || (this.caches = [], this.container && this.container.isBound(this.serviceIdentifier) && this.caches.push(...this.container.getAll(this.serviceIdentifier))), this.caches;
1054
+ setScale(sx, sy) {
1055
+ return this.b = this.b / this.a * sx, this.c = this.c / this.d * sy, this.a = sx, this.d = sy, this;
1299
1056
  }
1300
- }
1301
- function bindContributionProvider(bind, id) {
1302
- bind(ContributionProvider).toDynamicValue(_ref => {
1303
- let {
1304
- container: container
1305
- } = _ref;
1306
- return new ContributionProviderCache(id, container);
1307
- }).inSingletonScope().whenTargetNamed(id);
1308
- }
1309
-
1310
- class Hook {
1311
- constructor(args, name) {
1312
- this._args = args, this.name = name, this.taps = [];
1057
+ transform(a, b, c, d, e, f) {
1058
+ return this.multiply(a, b, c, d, e, f), this;
1313
1059
  }
1314
- tap(options, fn) {
1315
- this._tap("sync", options, fn);
1060
+ translate(x, y) {
1061
+ return this.e += this.a * x + this.c * y, this.f += this.b * x + this.d * y, this;
1316
1062
  }
1317
- unTap(options, fn) {
1318
- const name = "string" == typeof options ? options.trim() : options.name;
1319
- name && (this.taps = this.taps.filter(tap => !(tap.name === name && (!fn || tap.fn === fn))));
1063
+ transpose() {
1064
+ const {
1065
+ a: a,
1066
+ b: b,
1067
+ c: c,
1068
+ d: d,
1069
+ e: e,
1070
+ f: f
1071
+ } = this;
1072
+ return this.a = b, this.b = a, this.c = d, this.d = c, this.e = f, this.f = e, this;
1320
1073
  }
1321
- _parseOptions(type, options, fn) {
1322
- let _options;
1323
- if ("string" == typeof options) _options = {
1324
- name: options.trim()
1325
- };else if ("object" != typeof options || null === options) throw new Error("Invalid tap options");
1326
- if ("string" != typeof _options.name || "" === _options.name) throw new Error("Missing name for tap");
1327
- return _options = Object.assign({
1328
- type: type,
1329
- fn: fn
1330
- }, _options), _options;
1074
+ multiply(a2, b2, c2, d2, e2, f2) {
1075
+ const a1 = this.a,
1076
+ b1 = this.b,
1077
+ c1 = this.c,
1078
+ d1 = this.d,
1079
+ m11 = a1 * a2 + c1 * b2,
1080
+ m12 = b1 * a2 + d1 * b2,
1081
+ m21 = a1 * c2 + c1 * d2,
1082
+ m22 = b1 * c2 + d1 * d2,
1083
+ dx = a1 * e2 + c1 * f2 + this.e,
1084
+ dy = b1 * e2 + d1 * f2 + this.f;
1085
+ return this.a = m11, this.b = m12, this.c = m21, this.d = m22, this.e = dx, this.f = dy, this;
1331
1086
  }
1332
- _tap(type, options, fn) {
1333
- this._insert(this._parseOptions(type, options, fn));
1087
+ interpolate(m2, t) {
1088
+ const m = new Matrix();
1089
+ 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;
1334
1090
  }
1335
- _insert(item) {
1336
- let before;
1337
- "string" == typeof item.before ? before = new Set([item.before]) : Array.isArray(item.before) && (before = new Set(item.before));
1338
- let stage = 0;
1339
- "number" == typeof item.stage && (stage = item.stage);
1340
- let i = this.taps.length;
1341
- for (; i > 0;) {
1342
- i--;
1343
- const x = this.taps[i];
1344
- this.taps[i + 1] = x;
1345
- const xStage = x.stage || 0;
1346
- if (before) {
1347
- if (before.has(x.name)) {
1348
- before.delete(x.name);
1349
- continue;
1350
- }
1351
- if (before.size > 0) continue;
1352
- }
1353
- if (!(xStage > stage)) {
1354
- i++;
1355
- break;
1356
- }
1357
- }
1358
- this.taps[i] = item;
1091
+ transformPoint(source, target) {
1092
+ const {
1093
+ a: a,
1094
+ b: b,
1095
+ c: c,
1096
+ d: d,
1097
+ e: e,
1098
+ f: f
1099
+ } = this,
1100
+ dt = a * d - b * c,
1101
+ nextA = d / dt,
1102
+ nextB = -b / dt,
1103
+ nextC = -c / dt,
1104
+ nextD = a / dt,
1105
+ nextE = (c * f - d * e) / dt,
1106
+ nextF = -(a * f - b * e) / dt,
1107
+ {
1108
+ x: x,
1109
+ y: y
1110
+ } = source;
1111
+ target.x = x * nextA + y * nextC + nextE, target.y = x * nextB + y * nextD + nextF;
1359
1112
  }
1360
- }
1361
-
1362
- class SyncHook extends Hook {
1363
- call() {
1364
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1365
- args[_key] = arguments[_key];
1113
+ onlyTranslate() {
1114
+ let scale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
1115
+ return this.a === scale && 0 === this.b && 0 === this.c && this.d === scale;
1116
+ }
1117
+ clone() {
1118
+ return new Matrix(this.a, this.b, this.c, this.d, this.e, this.f);
1119
+ }
1120
+ toTransformAttrs() {
1121
+ const a = this.a,
1122
+ b = this.b,
1123
+ c = this.c,
1124
+ d = this.d,
1125
+ delta = a * d - b * c,
1126
+ result = {
1127
+ x: this.e,
1128
+ y: this.f,
1129
+ rotateDeg: 0,
1130
+ scaleX: 0,
1131
+ scaleY: 0,
1132
+ skewX: 0,
1133
+ skewY: 0
1134
+ };
1135
+ if (0 !== a || 0 !== b) {
1136
+ const r = Math.sqrt(a * a + b * b);
1137
+ 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;
1138
+ } else if (0 !== c || 0 !== d) {
1139
+ const s = Math.sqrt(c * c + d * d);
1140
+ 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;
1366
1141
  }
1367
- this.taps.map(t => t.fn).forEach(cb => cb(...args));
1142
+ return result.rotateDeg = radianToDegree(result.rotateDeg), result;
1368
1143
  }
1369
1144
  }
1145
+ function normalTransform(out, origin, x, y, scaleX, scaleY, angle, rotateCenter) {
1146
+ const oa = origin.a,
1147
+ ob = origin.b,
1148
+ oc = origin.c,
1149
+ od = origin.d,
1150
+ oe = origin.e,
1151
+ of = origin.f,
1152
+ cosTheta = cos(angle),
1153
+ sinTheta = sin(angle);
1154
+ let rotateCenterX, rotateCenterY;
1155
+ rotateCenter ? (rotateCenterX = rotateCenter[0], rotateCenterY = rotateCenter[1]) : (rotateCenterX = x, rotateCenterY = y);
1156
+ const offsetX = rotateCenterX - x,
1157
+ offsetY = rotateCenterY - y,
1158
+ a1 = oa * cosTheta + oc * sinTheta,
1159
+ b1 = ob * cosTheta + od * sinTheta,
1160
+ c1 = oc * cosTheta - oa * sinTheta,
1161
+ d1 = od * cosTheta - ob * sinTheta;
1162
+ 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;
1163
+ }
1370
1164
 
1371
- const EnvContribution = Symbol.for("EnvContribution");
1372
- const DEFAULT_TEXT_FONT_FAMILY$1 = "PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";
1373
-
1374
- var MeasureModeEnum;
1375
- !function (MeasureModeEnum) {
1376
- MeasureModeEnum[MeasureModeEnum.estimate = 0] = "estimate", MeasureModeEnum[MeasureModeEnum.actualBounding = 1] = "actualBounding", MeasureModeEnum[MeasureModeEnum.fontBounding = 2] = "fontBounding";
1377
- }(MeasureModeEnum || (MeasureModeEnum = {}));
1378
-
1379
- const isType = (value, type) => Object.prototype.toString.call(value) === `[object ${type}]`;
1380
- var isType$1 = isType;
1381
-
1382
- const isBoolean = function (value) {
1383
- let fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
1384
- return fuzzy ? "boolean" == typeof value : !0 === value || !1 === value || isType$1(value, "Boolean");
1385
- };
1386
- var isBoolean$1 = isBoolean;
1387
-
1388
- const isFunction = value => "function" == typeof value;
1389
- var isFunction$1 = isFunction;
1390
-
1391
- const isNil = value => null == value;
1392
- var isNil$1 = isNil;
1393
-
1394
- const isValid = value => null != value;
1395
- var isValid$1 = isValid;
1396
-
1397
- const isObject = value => {
1398
- const type = typeof value;
1399
- return null !== value && "object" === type || "function" === type;
1400
- };
1401
- var isObject$1 = isObject;
1402
-
1403
- const isObjectLike = value => "object" == typeof value && null !== value;
1404
- var isObjectLike$1 = isObjectLike;
1405
-
1406
- const isPlainObject = function (value) {
1407
- if (!isObjectLike$1(value) || !isType$1(value, "Object")) return !1;
1408
- if (null === Object.getPrototypeOf(value)) return !0;
1409
- let proto = value;
1410
- for (; null !== Object.getPrototypeOf(proto);) proto = Object.getPrototypeOf(proto);
1411
- return Object.getPrototypeOf(value) === proto;
1412
- };
1413
- var isPlainObject$1 = isPlainObject;
1414
-
1415
- const isString = function (value) {
1416
- let fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
1417
- const type = typeof value;
1418
- return fuzzy ? "string" === type : "string" === type || isType$1(value, "String");
1419
- };
1420
- var isString$1 = isString;
1421
-
1422
- const isArray = value => Array.isArray ? Array.isArray(value) : isType$1(value, "Array");
1423
- var isArray$1 = isArray;
1424
-
1425
- const isArrayLike = function (value) {
1426
- return null !== value && "function" != typeof value && Number.isFinite(value.length);
1427
- };
1428
- var isArrayLike$1 = isArrayLike;
1429
-
1430
- const isNumber = function (value) {
1431
- let fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
1432
- const type = typeof value;
1433
- return fuzzy ? "number" === type : "number" === type || isType$1(value, "Number");
1434
- };
1435
- var isNumber$1 = isNumber;
1436
-
1437
- const isValidNumber = value => isNumber$1(value) && Number.isFinite(value);
1438
- var isValidNumber$1 = isValidNumber;
1439
-
1440
- const isValidUrl = value => new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(value);
1441
- var isValidUrl$1 = isValidUrl;
1442
-
1443
- 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);
1444
- var isBase64$1 = isBase64;
1445
-
1446
- const getType = value => ({}).toString.call(value).replace(/^\[object /, "").replace(/]$/, "");
1447
- var getType$1 = getType;
1448
-
1449
- const objectProto = Object.prototype,
1450
- isPrototype = function (value) {
1451
- const Ctor = value && value.constructor;
1452
- return value === ("function" == typeof Ctor && Ctor.prototype || objectProto);
1165
+ function hslToRgb(h, s, l) {
1166
+ s /= 100, l /= 100;
1167
+ const c = (1 - Math.abs(2 * l - 1)) * s,
1168
+ x = c * (1 - Math.abs(h / 60 % 2 - 1)),
1169
+ m = l - c / 2;
1170
+ let r = 0,
1171
+ g = 0,
1172
+ b = 0;
1173
+ 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)), {
1174
+ r: r,
1175
+ g: g,
1176
+ b: b
1453
1177
  };
1454
- var isPrototype$1 = isPrototype;
1178
+ }
1455
1179
 
1456
- const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
1457
- function isEmpty(value) {
1458
- if (isNil$1(value)) return !0;
1459
- if (isArrayLike$1(value)) return !value.length;
1460
- const type = getType$1(value);
1461
- if ("Map" === type || "Set" === type) return !value.size;
1462
- if (isPrototype$1(value)) return !Object.keys(value).length;
1463
- for (const key in value) if (hasOwnProperty$1.call(value, key)) return !1;
1464
- return !0;
1180
+ function rgbToHsl(r, g, b) {
1181
+ r /= 255, g /= 255, b /= 255;
1182
+ const cMin = Math.min(r, g, b),
1183
+ cMax = Math.max(r, g, b),
1184
+ delta = cMax - cMin;
1185
+ let h = 0,
1186
+ s = 0,
1187
+ l = 0;
1188
+ 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), {
1189
+ h: h,
1190
+ s: s,
1191
+ l: l
1192
+ };
1465
1193
  }
1466
1194
 
1467
- const hasOwnProperty = Object.prototype.hasOwnProperty,
1468
- has = (object, key) => null != object && hasOwnProperty.call(object, key);
1469
- var has$1 = has;
1470
-
1471
- function baseMerge(target, source) {
1472
- let shallowArray = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
1473
- let skipTargetArray = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
1474
- if (source) {
1475
- if (target === source) return;
1476
- if (isValid$1(source) && "object" == typeof source) {
1477
- const iterable = Object(source),
1478
- props = [];
1479
- for (const key in iterable) props.push(key);
1480
- let {
1481
- length: length
1482
- } = props,
1483
- propIndex = -1;
1484
- for (; length--;) {
1485
- const key = props[++propIndex];
1486
- !isValid$1(iterable[key]) || "object" != typeof iterable[key] || skipTargetArray && isArray$1(target[key]) ? assignMergeValue(target, key, iterable[key]) : baseMergeDeep(target, source, key, shallowArray, skipTargetArray);
1487
- }
1488
- }
1489
- }
1490
- }
1491
- function baseMergeDeep(target, source, key) {
1492
- let shallowArray = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
1493
- let skipTargetArray = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : !1;
1494
- const objValue = target[key],
1495
- srcValue = source[key];
1496
- let newValue = source[key],
1497
- isCommon = !0;
1498
- if (isArray$1(srcValue)) {
1499
- if (shallowArray) newValue = [];else if (isArray$1(objValue)) newValue = objValue;else if (isArrayLike$1(objValue)) {
1500
- newValue = new Array(objValue.length);
1501
- let index = -1;
1502
- const length = objValue.length;
1503
- for (; ++index < length;) newValue[index] = objValue[index];
1504
- }
1505
- } else isPlainObject$1(srcValue) ? (newValue = null != objValue ? objValue : {}, "function" != typeof objValue && "object" == typeof objValue || (newValue = {})) : isCommon = !1;
1506
- isCommon && baseMerge(newValue, srcValue, shallowArray, skipTargetArray), assignMergeValue(target, key, newValue);
1507
- }
1508
- function assignMergeValue(target, key, value) {
1509
- (void 0 !== value && !eq(target[key], value) || void 0 === value && !(key in target)) && (target[key] = value);
1195
+ const REG_HEX = /^#([0-9a-f]{3,8})$/,
1196
+ DEFAULT_COLORS_OPACITY = {
1197
+ transparent: 4294967040
1198
+ };
1199
+ const DEFAULT_COLORS = {
1200
+ aliceblue: 15792383,
1201
+ antiquewhite: 16444375,
1202
+ aqua: 65535,
1203
+ aquamarine: 8388564,
1204
+ azure: 15794175,
1205
+ beige: 16119260,
1206
+ bisque: 16770244,
1207
+ black: 0,
1208
+ blanchedalmond: 16772045,
1209
+ blue: 255,
1210
+ blueviolet: 9055202,
1211
+ brown: 10824234,
1212
+ burlywood: 14596231,
1213
+ cadetblue: 6266528,
1214
+ chartreuse: 8388352,
1215
+ chocolate: 13789470,
1216
+ coral: 16744272,
1217
+ cornflowerblue: 6591981,
1218
+ cornsilk: 16775388,
1219
+ crimson: 14423100,
1220
+ cyan: 65535,
1221
+ darkblue: 139,
1222
+ darkcyan: 35723,
1223
+ darkgoldenrod: 12092939,
1224
+ darkgray: 11119017,
1225
+ darkgreen: 25600,
1226
+ darkgrey: 11119017,
1227
+ darkkhaki: 12433259,
1228
+ darkmagenta: 9109643,
1229
+ darkolivegreen: 5597999,
1230
+ darkorange: 16747520,
1231
+ darkorchid: 10040012,
1232
+ darkred: 9109504,
1233
+ darksalmon: 15308410,
1234
+ darkseagreen: 9419919,
1235
+ darkslateblue: 4734347,
1236
+ darkslategray: 3100495,
1237
+ darkslategrey: 3100495,
1238
+ darkturquoise: 52945,
1239
+ darkviolet: 9699539,
1240
+ deeppink: 16716947,
1241
+ deepskyblue: 49151,
1242
+ dimgray: 6908265,
1243
+ dimgrey: 6908265,
1244
+ dodgerblue: 2003199,
1245
+ firebrick: 11674146,
1246
+ floralwhite: 16775920,
1247
+ forestgreen: 2263842,
1248
+ fuchsia: 16711935,
1249
+ gainsboro: 14474460,
1250
+ ghostwhite: 16316671,
1251
+ gold: 16766720,
1252
+ goldenrod: 14329120,
1253
+ gray: 8421504,
1254
+ green: 32768,
1255
+ greenyellow: 11403055,
1256
+ grey: 8421504,
1257
+ honeydew: 15794160,
1258
+ hotpink: 16738740,
1259
+ indianred: 13458524,
1260
+ indigo: 4915330,
1261
+ ivory: 16777200,
1262
+ khaki: 15787660,
1263
+ lavender: 15132410,
1264
+ lavenderblush: 16773365,
1265
+ lawngreen: 8190976,
1266
+ lemonchiffon: 16775885,
1267
+ lightblue: 11393254,
1268
+ lightcoral: 15761536,
1269
+ lightcyan: 14745599,
1270
+ lightgoldenrodyellow: 16448210,
1271
+ lightgray: 13882323,
1272
+ lightgreen: 9498256,
1273
+ lightgrey: 13882323,
1274
+ lightpink: 16758465,
1275
+ lightsalmon: 16752762,
1276
+ lightseagreen: 2142890,
1277
+ lightskyblue: 8900346,
1278
+ lightslategray: 7833753,
1279
+ lightslategrey: 7833753,
1280
+ lightsteelblue: 11584734,
1281
+ lightyellow: 16777184,
1282
+ lime: 65280,
1283
+ limegreen: 3329330,
1284
+ linen: 16445670,
1285
+ magenta: 16711935,
1286
+ maroon: 8388608,
1287
+ mediumaquamarine: 6737322,
1288
+ mediumblue: 205,
1289
+ mediumorchid: 12211667,
1290
+ mediumpurple: 9662683,
1291
+ mediumseagreen: 3978097,
1292
+ mediumslateblue: 8087790,
1293
+ mediumspringgreen: 64154,
1294
+ mediumturquoise: 4772300,
1295
+ mediumvioletred: 13047173,
1296
+ midnightblue: 1644912,
1297
+ mintcream: 16121850,
1298
+ mistyrose: 16770273,
1299
+ moccasin: 16770229,
1300
+ navajowhite: 16768685,
1301
+ navy: 128,
1302
+ oldlace: 16643558,
1303
+ olive: 8421376,
1304
+ olivedrab: 7048739,
1305
+ orange: 16753920,
1306
+ orangered: 16729344,
1307
+ orchid: 14315734,
1308
+ palegoldenrod: 15657130,
1309
+ palegreen: 10025880,
1310
+ paleturquoise: 11529966,
1311
+ palevioletred: 14381203,
1312
+ papayawhip: 16773077,
1313
+ peachpuff: 16767673,
1314
+ peru: 13468991,
1315
+ pink: 16761035,
1316
+ plum: 14524637,
1317
+ powderblue: 11591910,
1318
+ purple: 8388736,
1319
+ rebeccapurple: 6697881,
1320
+ red: 16711680,
1321
+ rosybrown: 12357519,
1322
+ royalblue: 4286945,
1323
+ saddlebrown: 9127187,
1324
+ salmon: 16416882,
1325
+ sandybrown: 16032864,
1326
+ seagreen: 3050327,
1327
+ seashell: 16774638,
1328
+ sienna: 10506797,
1329
+ silver: 12632256,
1330
+ skyblue: 8900331,
1331
+ slateblue: 6970061,
1332
+ slategray: 7372944,
1333
+ slategrey: 7372944,
1334
+ snow: 16775930,
1335
+ springgreen: 65407,
1336
+ steelblue: 4620980,
1337
+ tan: 13808780,
1338
+ teal: 32896,
1339
+ thistle: 14204888,
1340
+ tomato: 16737095,
1341
+ turquoise: 4251856,
1342
+ violet: 15631086,
1343
+ wheat: 16113331,
1344
+ white: 16777215,
1345
+ whitesmoke: 16119285,
1346
+ yellow: 16776960,
1347
+ yellowgreen: 10145074
1348
+ };
1349
+ function hex(value) {
1350
+ return ((value = Math.max(0, Math.min(255, Math.round(value) || 0))) < 16 ? "0" : "") + value.toString(16);
1510
1351
  }
1511
- function eq(value, other) {
1512
- return value === other || Number.isNaN(value) && Number.isNaN(other);
1352
+ function rgb(value) {
1353
+ 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);
1513
1354
  }
1514
- function merge(target) {
1515
- let sourceIndex = -1;
1516
- const length = arguments.length <= 1 ? 0 : arguments.length - 1;
1517
- for (; ++sourceIndex < length;) {
1518
- baseMerge(target, sourceIndex + 1 < 1 || arguments.length <= sourceIndex + 1 ? undefined : arguments[sourceIndex + 1], !0);
1519
- }
1520
- return target;
1355
+ function rgba(value) {
1356
+ 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);
1521
1357
  }
1522
-
1523
- function arrayEqual(a, b) {
1524
- if (!isArray$1(a) || !isArray$1(b)) return !1;
1525
- if (a.length !== b.length) return !1;
1526
- for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return !1;
1527
- return !0;
1358
+ function SRGBToLinear(c) {
1359
+ return c < .04045 ? .0773993808 * c : Math.pow(.9478672986 * c + .0521327014, 2.4);
1528
1360
  }
1529
-
1530
- const hasConsole = "undefined" != typeof console;
1531
- function log(method, level, input) {
1532
- const args = [level].concat([].slice.call(input));
1533
- hasConsole && console[method].apply(console, args);
1361
+ function LinearToSRGB(c) {
1362
+ return c < .0031308 ? 12.92 * c : 1.055 * Math.pow(c, .41666) - .055;
1534
1363
  }
1535
- var LoggerLevel;
1536
- !function (LoggerLevel) {
1537
- 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";
1538
- }(LoggerLevel || (LoggerLevel = {}));
1539
- class Logger {
1540
- static getInstance(level, method) {
1541
- return Logger._instance && isNumber$1(level) ? Logger._instance.level(level) : Logger._instance || (Logger._instance = new Logger(level, method)), Logger._instance;
1542
- }
1543
- static setInstance(logger) {
1544
- return Logger._instance = logger;
1364
+ const setHex = (formatValue, forceHex) => {
1365
+ const isHex = REG_HEX.exec(formatValue);
1366
+ if (forceHex || isHex) {
1367
+ const hex = parseInt(isHex[1], 16),
1368
+ hexLength = isHex[1].length;
1369
+ 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;
1545
1370
  }
1546
- static setInstanceLevel(level) {
1547
- Logger._instance ? Logger._instance.level(level) : Logger._instance = new Logger(level);
1371
+ };
1372
+ class Color {
1373
+ static Brighter(source) {
1374
+ let b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
1375
+ return 1 === b ? source : new Color(source).brighter(b).toRGBA();
1548
1376
  }
1549
- static clearInstance() {
1550
- Logger._instance = null;
1377
+ static SetOpacity(source) {
1378
+ let o = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
1379
+ return 1 === o ? source : new Color(source).setOpacity(o).toRGBA();
1551
1380
  }
1552
- constructor() {
1553
- let level = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : LoggerLevel.None;
1554
- let method = arguments.length > 1 ? arguments[1] : undefined;
1555
- this._onErrorHandler = [], this._level = level, this._method = method;
1381
+ static getColorBrightness(source) {
1382
+ let model = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "hsl";
1383
+ const color = source instanceof Color ? source : new Color(source);
1384
+ switch (model) {
1385
+ case "hsv":
1386
+ default:
1387
+ return color.getHSVBrightness();
1388
+ case "hsl":
1389
+ return color.getHSLBrightness();
1390
+ case "lum":
1391
+ return color.getLuminance();
1392
+ case "lum2":
1393
+ return color.getLuminance2();
1394
+ case "lum3":
1395
+ return color.getLuminance3();
1396
+ case "wcag":
1397
+ return color.getLuminanceWCAG();
1398
+ }
1556
1399
  }
1557
- addErrorHandler(handler) {
1558
- this._onErrorHandler.find(h => h === handler) || this._onErrorHandler.push(handler);
1400
+ static parseColorString(value) {
1401
+ if (isValid$1(DEFAULT_COLORS_OPACITY[value])) return rgba(DEFAULT_COLORS_OPACITY[value]);
1402
+ if (isValid$1(DEFAULT_COLORS[value])) return rgb(DEFAULT_COLORS[value]);
1403
+ const formatValue = `${value}`.trim().toLowerCase(),
1404
+ hexRes = setHex(formatValue);
1405
+ if (void 0 !== hexRes) return hexRes;
1406
+ if (/^(rgb|RGB|rgba|RGBA)/.test(formatValue)) {
1407
+ const aColor = formatValue.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g, "").split(",");
1408
+ return new RGB(parseInt(aColor[0], 10), parseInt(aColor[1], 10), parseInt(aColor[2], 10), parseFloat(aColor[3]));
1409
+ }
1410
+ if (/^(hsl|HSL|hsla|HSLA)/.test(formatValue)) {
1411
+ const aColor = formatValue.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g, "").split(","),
1412
+ rgb = hslToRgb(parseInt(aColor[0], 10), parseInt(aColor[1], 10), parseInt(aColor[2], 10));
1413
+ return new RGB(rgb.r, rgb.g, rgb.b, parseFloat(aColor[3]));
1414
+ }
1559
1415
  }
1560
- removeErrorHandler(handler) {
1561
- const index = this._onErrorHandler.findIndex(h => h === handler);
1562
- index < 0 || this._onErrorHandler.splice(index, 1);
1416
+ constructor(value) {
1417
+ const color = Color.parseColorString(value);
1418
+ color ? this.color = color : (this.color = new RGB(255, 255, 255));
1563
1419
  }
1564
- callErrorHandler() {
1565
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1566
- args[_key] = arguments[_key];
1567
- }
1568
- this._onErrorHandler.forEach(h => h(...args));
1420
+ toRGBA() {
1421
+ return this.color.formatRgb();
1569
1422
  }
1570
- canLogInfo() {
1571
- return this._level >= LoggerLevel.Info;
1423
+ toString() {
1424
+ return this.color.formatRgb();
1572
1425
  }
1573
- canLogDebug() {
1574
- return this._level >= LoggerLevel.Debug;
1426
+ toHex() {
1427
+ return this.color.formatHex();
1575
1428
  }
1576
- canLogError() {
1577
- return this._level >= LoggerLevel.Error;
1429
+ toHsl() {
1430
+ return this.color.formatHsl();
1578
1431
  }
1579
- canLogWarn() {
1580
- return this._level >= LoggerLevel.Warn;
1432
+ brighter(k) {
1433
+ const {
1434
+ r: r,
1435
+ g: g,
1436
+ b: b
1437
+ } = this.color;
1438
+ 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;
1581
1439
  }
1582
- level(levelValue) {
1583
- return arguments.length ? (this._level = +levelValue, this) : this._level;
1440
+ add(color) {
1441
+ const {
1442
+ r: r,
1443
+ g: g,
1444
+ b: b
1445
+ } = this.color;
1446
+ 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;
1584
1447
  }
1585
- error() {
1586
- var _a;
1587
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1588
- args[_key2] = arguments[_key2];
1589
- }
1590
- return this._level >= LoggerLevel.Error && (this._onErrorHandler.length ? this.callErrorHandler(...args) : log(null !== (_a = this._method) && void 0 !== _a ? _a : "error", "ERROR", args)), this;
1448
+ sub(color) {
1449
+ 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;
1591
1450
  }
1592
- warn() {
1593
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
1594
- args[_key3] = arguments[_key3];
1595
- }
1596
- return this._level >= LoggerLevel.Warn && log(this._method || "warn", "WARN", args), this;
1451
+ multiply(color) {
1452
+ const {
1453
+ r: r,
1454
+ g: g,
1455
+ b: b
1456
+ } = this.color;
1457
+ 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;
1597
1458
  }
1598
- info() {
1599
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
1600
- args[_key4] = arguments[_key4];
1601
- }
1602
- return this._level >= LoggerLevel.Info && log(this._method || "log", "INFO", args), this;
1459
+ getHSVBrightness() {
1460
+ return Math.max(this.color.r, this.color.g, this.color.b) / 255;
1603
1461
  }
1604
- debug() {
1605
- for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
1606
- args[_key5] = arguments[_key5];
1607
- }
1608
- return this._level >= LoggerLevel.Debug && log(this._method || "log", "DEBUG", args), this;
1462
+ getHSLBrightness() {
1463
+ 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);
1609
1464
  }
1610
- }
1611
- Logger._instance = null;
1612
-
1613
- const clamp = function (input, min, max) {
1614
- return input < min ? min : input > max ? max : input;
1615
- };
1616
- var clamp$1 = clamp;
1617
-
1618
- const epsilon = 1e-12;
1619
- const pi = Math.PI;
1620
- const halfPi$1 = pi / 2;
1621
- const tau = 2 * pi;
1622
- const pi2 = 2 * Math.PI;
1623
- const abs = Math.abs;
1624
- const atan2 = Math.atan2;
1625
- const cos = Math.cos;
1626
- const max = Math.max;
1627
- const min = Math.min;
1628
- const sin = Math.sin;
1629
- const sqrt = Math.sqrt;
1630
- const pow = Math.pow;
1631
- function asin(x) {
1632
- return x >= 1 ? halfPi$1 : x <= -1 ? -halfPi$1 : Math.asin(x);
1633
- }
1634
-
1635
- class Point {
1636
- constructor() {
1637
- let x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1638
- let y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1639
- let x1 = arguments.length > 2 ? arguments[2] : undefined;
1640
- let y1 = arguments.length > 3 ? arguments[3] : undefined;
1641
- this.x = 0, this.y = 0, this.x = x, this.y = y, this.x1 = x1, this.y1 = y1;
1465
+ setHsl(h, s, l) {
1466
+ const opacity = this.color.opacity,
1467
+ hsl = rgbToHsl(this.color.r, this.color.g, this.color.b),
1468
+ 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);
1469
+ return this.color = new RGB(rgb.r, rgb.g, rgb.b, opacity), this;
1642
1470
  }
1643
- clone() {
1644
- return new Point(this.x, this.y);
1471
+ setRGB(r, g, b) {
1472
+ return !isNil$1(r) && (this.color.r = r), !isNil$1(g) && (this.color.g = g), !isNil$1(b) && (this.color.b = b), this;
1645
1473
  }
1646
- copyFrom(p) {
1647
- 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;
1474
+ setHex(value) {
1475
+ const formatValue = `${value}`.trim().toLowerCase(),
1476
+ res = setHex(formatValue, !0);
1477
+ return null != res ? res : this;
1648
1478
  }
1649
- set(x, y) {
1650
- return this.x = x, this.y = y, this;
1479
+ setColorName(name) {
1480
+ const hex = DEFAULT_COLORS[name.toLowerCase()];
1481
+ return void 0 !== hex ? this.setHex(hex) : (void 0), this;
1651
1482
  }
1652
- add(point) {
1653
- return isNumber$1(point) ? (this.x += point, void (this.y += point)) : (this.x += point.x, this.y += point.y, this);
1483
+ setScalar(scalar) {
1484
+ return this.color.r = scalar, this.color.g = scalar, this.color.b = scalar, this;
1654
1485
  }
1655
- sub(point) {
1656
- return isNumber$1(point) ? (this.x -= point, void (this.y -= point)) : (this.x -= point.x, this.y -= point.y, this);
1486
+ setOpacity() {
1487
+ let o = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
1488
+ return this.color.opacity = o, this;
1657
1489
  }
1658
- multi(point) {
1659
- throw new Error("暂不支持");
1490
+ getLuminance() {
1491
+ return (.2126 * this.color.r + .7152 * this.color.g + .0722 * this.color.b) / 255;
1660
1492
  }
1661
- div(point) {
1662
- throw new Error("暂不支持");
1493
+ getLuminance2() {
1494
+ return (.2627 * this.color.r + .678 * this.color.g + .0593 * this.color.b) / 255;
1663
1495
  }
1664
- }
1665
- class PointService {
1666
- static distancePP(p1, p2) {
1667
- return sqrt(pow(p1.x - p2.x, 2) + pow(p1.y - p2.y, 2));
1496
+ getLuminance3() {
1497
+ return (.299 * this.color.r + .587 * this.color.g + .114 * this.color.b) / 255;
1668
1498
  }
1669
- static distanceNN(x, y, x1, y1) {
1670
- return sqrt(pow(x - x1, 2) + pow(y - y1, 2));
1499
+ getLuminanceWCAG() {
1500
+ const RsRGB = this.color.r / 255,
1501
+ GsRGB = this.color.g / 255,
1502
+ BsRGB = this.color.b / 255;
1503
+ let R, G, B;
1504
+ R = RsRGB <= .03928 ? RsRGB / 12.92 : Math.pow((RsRGB + .055) / 1.055, 2.4), G = GsRGB <= .03928 ? GsRGB / 12.92 : Math.pow((GsRGB + .055) / 1.055, 2.4), B = BsRGB <= .03928 ? BsRGB / 12.92 : Math.pow((BsRGB + .055) / 1.055, 2.4);
1505
+ return .2126 * R + .7152 * G + .0722 * B;
1671
1506
  }
1672
- static distancePN(point, x, y) {
1673
- return sqrt(pow(x - point.x, 2) + pow(y - point.y, 2));
1507
+ clone() {
1508
+ return new Color(this.color.toString());
1674
1509
  }
1675
- static pointAtPP(p1, p2, t) {
1676
- return new Point((p2.x - p1.x) * t + p1.x, (p2.y - p1.y) * t + p1.y);
1510
+ copyGammaToLinear(color) {
1511
+ let gammaFactor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
1512
+ 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;
1513
+ }
1514
+ copyLinearToGamma(color) {
1515
+ let gammaFactor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
1516
+ const safeInverse = gammaFactor > 0 ? 1 / gammaFactor : 1;
1517
+ 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;
1518
+ }
1519
+ convertGammaToLinear(gammaFactor) {
1520
+ return this.copyGammaToLinear(this, gammaFactor), this;
1521
+ }
1522
+ convertLinearToGamma(gammaFactor) {
1523
+ return this.copyLinearToGamma(this, gammaFactor), this;
1524
+ }
1525
+ copySRGBToLinear(color) {
1526
+ return this.color.r = SRGBToLinear(color.color.r), this.color.g = SRGBToLinear(color.color.g), this.color.b = SRGBToLinear(color.color.b), this;
1527
+ }
1528
+ copyLinearToSRGB(color) {
1529
+ return this.color.r = LinearToSRGB(color.color.r), this.color.g = LinearToSRGB(color.color.g), this.color.b = LinearToSRGB(color.color.b), this;
1530
+ }
1531
+ convertSRGBToLinear() {
1532
+ return this.copySRGBToLinear(this), this;
1533
+ }
1534
+ convertLinearToSRGB() {
1535
+ return this.copyLinearToSRGB(this), this;
1677
1536
  }
1678
1537
  }
1679
-
1680
- function degreeToRadian(degree) {
1681
- return degree * (Math.PI / 180);
1682
- }
1683
- function radianToDegree(radian) {
1684
- return 180 * radian / Math.PI;
1538
+ class RGB {
1539
+ constructor(r, g, b, opacity) {
1540
+ 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;
1541
+ }
1542
+ formatHex() {
1543
+ return `#${hex(this.r) + hex(this.g) + hex(this.b) + (1 === this.opacity ? "" : hex(255 * this.opacity))}`;
1544
+ }
1545
+ formatRgb() {
1546
+ const opacity = this.opacity;
1547
+ return `${1 === opacity ? "rgb(" : "rgba("}${this.r},${this.g},${this.b}${1 === opacity ? ")" : `,${opacity})`}`;
1548
+ }
1549
+ formatHsl() {
1550
+ const opacity = this.opacity,
1551
+ {
1552
+ h: h,
1553
+ s: s,
1554
+ l: l
1555
+ } = rgbToHsl(this.r, this.g, this.b);
1556
+ return `${1 === opacity ? "hsl(" : "hsla("}${h},${s}%,${l}%${1 === opacity ? ")" : `,${opacity})`}`;
1557
+ }
1558
+ toString() {
1559
+ return this.formatHex();
1560
+ }
1685
1561
  }
1686
- const clampRadian = function () {
1687
- let angle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1688
- if (angle < 0) for (; angle < -tau;) angle += tau;else if (angle > 0) for (; angle > tau;) angle -= tau;
1689
- return angle;
1690
- };
1691
- const clampAngleByRadian = clampRadian;
1692
1562
 
1693
- var InnerBBox;
1694
- !function (InnerBBox) {
1695
- InnerBBox[InnerBBox.NONE = 0] = "NONE", InnerBBox[InnerBBox.BBOX1 = 1] = "BBOX1", InnerBBox[InnerBBox.BBOX2 = 2] = "BBOX2";
1696
- }(InnerBBox || (InnerBBox = {}));
1697
- function getProjectionRadius(checkAxis, axis) {
1698
- return Math.abs(axis[0] * checkAxis[0] + axis[1] * checkAxis[1]);
1563
+ function normalizePadding(padding) {
1564
+ if (isValidNumber$1(padding)) return [padding, padding, padding, padding];
1565
+ if (isArray$1(padding)) {
1566
+ const length = padding.length;
1567
+ if (1 === length) {
1568
+ const paddingValue = padding[0];
1569
+ return [paddingValue, paddingValue, paddingValue, paddingValue];
1570
+ }
1571
+ if (2 === length) {
1572
+ const [vertical, horizontal] = padding;
1573
+ return [vertical, horizontal, vertical, horizontal];
1574
+ }
1575
+ if (3 === length) {
1576
+ const [top, horizontal, bottom] = padding;
1577
+ return [top, horizontal, bottom, horizontal];
1578
+ }
1579
+ if (4 === length) return padding;
1580
+ }
1581
+ if (isObject$1(padding)) {
1582
+ const {
1583
+ top = 0,
1584
+ right = 0,
1585
+ bottom = 0,
1586
+ left = 0
1587
+ } = padding;
1588
+ return [top, right, bottom, left];
1589
+ }
1590
+ return [0, 0, 0, 0];
1699
1591
  }
1700
- function rotatePoint(_ref, rad) {
1701
- let {
1702
- x: x,
1703
- y: y
1704
- } = _ref;
1705
- let origin = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
1706
- x: 0,
1707
- y: 0
1592
+
1593
+ const styleStringToObject = function () {
1594
+ let styleStr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
1595
+ const res = {};
1596
+ return styleStr.split(";").forEach(item => {
1597
+ if (item) {
1598
+ const arr = item.split(":");
1599
+ if (2 === arr.length) {
1600
+ const key = arr[0].trim(),
1601
+ value = arr[1].trim();
1602
+ key && value && (res[key] = value);
1603
+ }
1604
+ }
1605
+ }), res;
1606
+ };
1607
+ const lowerCamelCaseToMiddle = str => str.replace(/([A-Z])/g, "-$1").toLowerCase();
1608
+
1609
+ var reactIs = {exports: {}};
1610
+
1611
+ var reactIs_production_min = {};
1612
+
1613
+ /**
1614
+ * @license React
1615
+ * react-is.production.min.js
1616
+ *
1617
+ * Copyright (c) Facebook, Inc. and its affiliates.
1618
+ *
1619
+ * This source code is licensed under the MIT license found in the
1620
+ * LICENSE file in the root directory of this source tree.
1621
+ */
1622
+ var hasRequiredReactIs_production_min;
1623
+ function requireReactIs_production_min() {
1624
+ if (hasRequiredReactIs_production_min) return reactIs_production_min;
1625
+ hasRequiredReactIs_production_min = 1;
1626
+ var b = Symbol.for("react.element"),
1627
+ c = Symbol.for("react.portal"),
1628
+ d = Symbol.for("react.fragment"),
1629
+ e = Symbol.for("react.strict_mode"),
1630
+ f = Symbol.for("react.profiler"),
1631
+ g = Symbol.for("react.provider"),
1632
+ h = Symbol.for("react.context"),
1633
+ k = Symbol.for("react.server_context"),
1634
+ l = Symbol.for("react.forward_ref"),
1635
+ m = Symbol.for("react.suspense"),
1636
+ n = Symbol.for("react.suspense_list"),
1637
+ p = Symbol.for("react.memo"),
1638
+ q = Symbol.for("react.lazy"),
1639
+ t = Symbol.for("react.offscreen"),
1640
+ u;
1641
+ u = Symbol.for("react.module.reference");
1642
+ function v(a) {
1643
+ if ("object" === typeof a && null !== a) {
1644
+ var r = a.$$typeof;
1645
+ switch (r) {
1646
+ case b:
1647
+ switch (a = a.type, a) {
1648
+ case d:
1649
+ case f:
1650
+ case e:
1651
+ case m:
1652
+ case n:
1653
+ return a;
1654
+ default:
1655
+ switch (a = a && a.$$typeof, a) {
1656
+ case k:
1657
+ case h:
1658
+ case l:
1659
+ case q:
1660
+ case p:
1661
+ case g:
1662
+ return a;
1663
+ default:
1664
+ return r;
1665
+ }
1666
+ }
1667
+ case c:
1668
+ return r;
1669
+ }
1670
+ }
1671
+ }
1672
+ reactIs_production_min.ContextConsumer = h;
1673
+ reactIs_production_min.ContextProvider = g;
1674
+ reactIs_production_min.Element = b;
1675
+ reactIs_production_min.ForwardRef = l;
1676
+ reactIs_production_min.Fragment = d;
1677
+ reactIs_production_min.Lazy = q;
1678
+ reactIs_production_min.Memo = p;
1679
+ reactIs_production_min.Portal = c;
1680
+ reactIs_production_min.Profiler = f;
1681
+ reactIs_production_min.StrictMode = e;
1682
+ reactIs_production_min.Suspense = m;
1683
+ reactIs_production_min.SuspenseList = n;
1684
+ reactIs_production_min.isAsyncMode = function () {
1685
+ return !1;
1708
1686
  };
1709
- return {
1710
- x: (x - origin.x) * Math.cos(rad) - (y - origin.y) * Math.sin(rad) + origin.x,
1711
- y: (x - origin.x) * Math.sin(rad) + (y - origin.y) * Math.cos(rad) + origin.y
1687
+ reactIs_production_min.isConcurrentMode = function () {
1688
+ return !1;
1712
1689
  };
1713
- }
1714
- function getCenterPoint(box) {
1715
- return {
1716
- x: (box.x1 + box.x2) / 2,
1717
- y: (box.y1 + box.y2) / 2
1690
+ reactIs_production_min.isContextConsumer = function (a) {
1691
+ return v(a) === h;
1718
1692
  };
1719
- }
1720
- function toRect(box, isDeg) {
1721
- const deg = isDeg ? degreeToRadian(box.angle) : box.angle,
1722
- cp = getCenterPoint(box);
1723
- return [rotatePoint({
1724
- x: box.x1,
1725
- y: box.y1
1726
- }, deg, cp), rotatePoint({
1727
- x: box.x2,
1728
- y: box.y1
1729
- }, deg, cp), rotatePoint({
1730
- x: box.x2,
1731
- y: box.y2
1732
- }, deg, cp), rotatePoint({
1733
- x: box.x1,
1734
- y: box.y2
1735
- }, deg, cp)];
1736
- }
1737
- function isRotateAABBIntersect(box1, box2) {
1738
- let isDeg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
1739
- const rect1 = toRect(box1, isDeg),
1740
- rect2 = toRect(box2, isDeg),
1741
- vector = (start, end) => [end.x - start.x, end.y - start.y],
1742
- vp1p2 = vector(getCenterPoint(box1), getCenterPoint(box2)),
1743
- AB = vector(rect1[0], rect1[1]),
1744
- BC = vector(rect1[1], rect1[2]),
1745
- A1B1 = vector(rect2[0], rect2[1]),
1746
- B1C1 = vector(rect2[1], rect2[2]),
1747
- deg11 = isDeg ? degreeToRadian(box1.angle) : box1.angle;
1748
- let deg12 = isDeg ? degreeToRadian(90 - box1.angle) : box1.angle + halfPi$1;
1749
- const deg21 = isDeg ? degreeToRadian(box2.angle) : box2.angle;
1750
- let deg22 = isDeg ? degreeToRadian(90 - box2.angle) : box2.angle + halfPi$1;
1751
- deg12 > pi2 && (deg12 -= pi2), deg22 > pi2 && (deg22 -= pi2);
1752
- const isCover = (checkAxisRadius, deg, targetAxis1, targetAxis2) => {
1753
- const checkAxis = [Math.cos(deg), Math.sin(deg)];
1754
- return checkAxisRadius + (getProjectionRadius(checkAxis, targetAxis1) + getProjectionRadius(checkAxis, targetAxis2)) / 2 > getProjectionRadius(checkAxis, vp1p2);
1693
+ reactIs_production_min.isContextProvider = function (a) {
1694
+ return v(a) === g;
1755
1695
  };
1756
- 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);
1696
+ reactIs_production_min.isElement = function (a) {
1697
+ return "object" === typeof a && null !== a && a.$$typeof === b;
1698
+ };
1699
+ reactIs_production_min.isForwardRef = function (a) {
1700
+ return v(a) === l;
1701
+ };
1702
+ reactIs_production_min.isFragment = function (a) {
1703
+ return v(a) === d;
1704
+ };
1705
+ reactIs_production_min.isLazy = function (a) {
1706
+ return v(a) === q;
1707
+ };
1708
+ reactIs_production_min.isMemo = function (a) {
1709
+ return v(a) === p;
1710
+ };
1711
+ reactIs_production_min.isPortal = function (a) {
1712
+ return v(a) === c;
1713
+ };
1714
+ reactIs_production_min.isProfiler = function (a) {
1715
+ return v(a) === f;
1716
+ };
1717
+ reactIs_production_min.isStrictMode = function (a) {
1718
+ return v(a) === e;
1719
+ };
1720
+ reactIs_production_min.isSuspense = function (a) {
1721
+ return v(a) === m;
1722
+ };
1723
+ reactIs_production_min.isSuspenseList = function (a) {
1724
+ return v(a) === n;
1725
+ };
1726
+ reactIs_production_min.isValidElementType = function (a) {
1727
+ 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;
1728
+ };
1729
+ reactIs_production_min.typeOf = v;
1730
+ return reactIs_production_min;
1757
1731
  }
1758
1732
 
1759
- function getContextFont(text) {
1760
- let defaultAttr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1761
- let fontSizeScale = arguments.length > 2 ? arguments[2] : undefined;
1762
- fontSizeScale || (fontSizeScale = 1);
1763
- const {
1764
- fontStyle = defaultAttr.fontStyle,
1765
- fontVariant = defaultAttr.fontVariant,
1766
- fontWeight = defaultAttr.fontWeight,
1767
- fontSize = defaultAttr.fontSize,
1768
- fontFamily = defaultAttr.fontFamily
1769
- } = text;
1770
- return (fontStyle ? fontStyle + " " : "") + (fontVariant ? fontVariant + " " : "") + (fontWeight ? fontWeight + " " : "") + fontSize * fontSizeScale + "px " + (fontFamily || "sans-serif");
1733
+ {
1734
+ reactIs.exports = requireReactIs_production_min();
1771
1735
  }
1736
+ var reactIsExports = reactIs.exports;
1772
1737
 
1773
- const calculateAnchorOfBounds = (bounds, anchorType) => {
1774
- const {
1775
- x1: x1,
1776
- x2: x2,
1777
- y1: y1,
1778
- y2: y2
1779
- } = bounds,
1780
- rectWidth = Math.abs(x2 - x1),
1781
- rectHeight = Math.abs(y2 - y1);
1782
- let anchorX = (x1 + x2) / 2,
1783
- anchorY = (y1 + y2) / 2,
1784
- sx = 0,
1785
- sy = 0;
1786
- switch (anchorType) {
1787
- case "top":
1788
- case "inside-top":
1789
- sy = -.5;
1790
- break;
1791
- case "bottom":
1792
- case "inside-bottom":
1793
- sy = .5;
1794
- break;
1795
- case "left":
1796
- case "inside-left":
1797
- sx = -.5;
1798
- break;
1799
- case "right":
1800
- case "inside-right":
1801
- sx = .5;
1802
- break;
1803
- case "top-right":
1804
- sx = .5, sy = -.5;
1805
- break;
1806
- case "top-left":
1807
- sx = -.5, sy = -.5;
1808
- break;
1809
- case "bottom-right":
1810
- sx = .5, sy = .5;
1811
- break;
1812
- case "bottom-left":
1813
- sx = -.5, sy = .5;
1814
- }
1815
- return anchorX += sx * rectWidth, anchorY += sy * rectHeight, {
1816
- x: anchorX,
1817
- y: anchorY
1818
- };
1738
+ const toArray = (children) => {
1739
+ let result = [];
1740
+ React.Children.forEach(children, child => {
1741
+ if (isNil$1(child)) {
1742
+ return;
1743
+ }
1744
+ if (reactIsExports.isFragment(child)) {
1745
+ result = result.concat(toArray(child.props.children));
1746
+ }
1747
+ else {
1748
+ result.push(child);
1749
+ }
1750
+ });
1751
+ return result;
1819
1752
  };
1820
1753
 
1821
- function transformBoundsWithMatrix(out, bounds, matrix) {
1822
- const {
1823
- x1: x1,
1824
- y1: y1,
1825
- x2: x2,
1826
- y2: y2
1827
- } = bounds;
1828
- 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);
1829
- }
1830
- class Bounds {
1831
- constructor(bounds) {
1832
- bounds ? this.setValue(bounds.x1, bounds.y1, bounds.x2, bounds.y2) : this.clear();
1833
- }
1834
- clone() {
1835
- return new Bounds(this);
1836
- }
1837
- clear() {
1838
- return this.x1 = +Number.MAX_VALUE, this.y1 = +Number.MAX_VALUE, this.x2 = -Number.MAX_VALUE, this.y2 = -Number.MAX_VALUE, this;
1839
- }
1840
- empty() {
1841
- return this.x1 === +Number.MAX_VALUE && this.y1 === +Number.MAX_VALUE && this.x2 === -Number.MAX_VALUE && this.y2 === -Number.MAX_VALUE;
1842
- }
1843
- equals(b) {
1844
- return this.x1 === b.x1 && this.y1 === b.y1 && this.x2 === b.x2 && this.y2 === b.y2;
1845
- }
1846
- setValue() {
1847
- let x1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1848
- let y1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1849
- let x2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1850
- let y2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
1851
- return this.x1 = x1, this.y1 = y1, this.x2 = x2, this.y2 = y2, this;
1852
- }
1853
- set() {
1854
- let x1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1855
- let y1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1856
- let x2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1857
- let y2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
1858
- 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;
1859
- }
1860
- add() {
1861
- let x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1862
- let y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1863
- 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;
1864
- }
1865
- expand() {
1866
- let d = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1867
- 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;
1754
+ const REACT_PRIVATE_PROPS = ['children', 'hooks', 'ref'];
1755
+
1756
+ const EVENT_TYPE = {
1757
+ ...vtable.TABLE_EVENT_TYPE,
1758
+ ...vtable.PIVOT_TABLE_EVENT_TYPE,
1759
+ ...vtable.PIVOT_CHART_EVENT_TYPE
1760
+ };
1761
+ const TABLE_EVENTS = {
1762
+ onClickCell: EVENT_TYPE.CLICK_CELL,
1763
+ onDblClickCell: EVENT_TYPE.DBLCLICK_CELL,
1764
+ onMouseDownCell: EVENT_TYPE.MOUSEDOWN_CELL,
1765
+ onMouseUpCell: EVENT_TYPE.MOUSEUP_CELL,
1766
+ onSelectedCell: EVENT_TYPE.SELECTED_CELL,
1767
+ onSelectedClear: EVENT_TYPE.SELECTED_CLEAR,
1768
+ onKeyDown: EVENT_TYPE.KEYDOWN,
1769
+ onMouseEnterTable: EVENT_TYPE.MOUSEENTER_TABLE,
1770
+ onMouseLeaveTable: EVENT_TYPE.MOUSELEAVE_TABLE,
1771
+ onMouseDownTable: EVENT_TYPE.MOUSEDOWN_TABLE,
1772
+ onMouseMoveCell: EVENT_TYPE.MOUSEMOVE_CELL,
1773
+ onMouseMoveTable: EVENT_TYPE.MOUSEMOVE_TABLE,
1774
+ onMouseEnterCell: EVENT_TYPE.MOUSEENTER_CELL,
1775
+ onMouseLeaveCell: EVENT_TYPE.MOUSELEAVE_CELL,
1776
+ onContextMenuCell: EVENT_TYPE.CONTEXTMENU_CELL,
1777
+ onResizeColumn: EVENT_TYPE.RESIZE_COLUMN,
1778
+ onResizeColumnEnd: EVENT_TYPE.RESIZE_COLUMN_END,
1779
+ onResizeRow: EVENT_TYPE.RESIZE_ROW,
1780
+ onResizeRowEnd: EVENT_TYPE.RESIZE_ROW_END,
1781
+ onChangeHeaderPositionStart: EVENT_TYPE.CHANGE_HEADER_POSITION_START,
1782
+ onChangeHeaderPosition: EVENT_TYPE.CHANGE_HEADER_POSITION,
1783
+ onChangeHeaderPositionFail: EVENT_TYPE.CHANGE_HEADER_POSITION_FAIL,
1784
+ onSortClick: EVENT_TYPE.SORT_CLICK,
1785
+ onAfterSort: EVENT_TYPE.AFTER_SORT,
1786
+ onFreezeClick: EVENT_TYPE.FREEZE_CLICK,
1787
+ onScroll: EVENT_TYPE.SCROLL,
1788
+ onScrollHorizontalEnd: EVENT_TYPE.SCROLL_HORIZONTAL_END,
1789
+ onScrollVerticalEnd: EVENT_TYPE.SCROLL_VERTICAL_END,
1790
+ onDropdownMenuClick: EVENT_TYPE.DROPDOWN_MENU_CLICK,
1791
+ onMouseOverChartSymbol: EVENT_TYPE.MOUSEOVER_CHART_SYMBOL,
1792
+ onDragSelectEnd: EVENT_TYPE.DRAG_SELECT_END,
1793
+ onCopyData: EVENT_TYPE.COPY_DATA,
1794
+ onDropdownIconClick: EVENT_TYPE.DROPDOWN_ICON_CLICK,
1795
+ onDropdownMenuClear: EVENT_TYPE.DROPDOWN_MENU_CLEAR,
1796
+ onTreeHierarchyStateChange: EVENT_TYPE.TREE_HIERARCHY_STATE_CHANGE,
1797
+ onShowMenu: EVENT_TYPE.SHOW_MENU,
1798
+ onHideMenu: EVENT_TYPE.HIDE_MENU,
1799
+ onIconClick: EVENT_TYPE.ICON_CLICK,
1800
+ onLegendItemClick: EVENT_TYPE.LEGEND_ITEM_CLICK,
1801
+ onLegendItemHover: EVENT_TYPE.LEGEND_ITEM_HOVER,
1802
+ onLegendItemUnHover: EVENT_TYPE.LEGEND_ITEM_UNHOVER,
1803
+ onLegendChange: EVENT_TYPE.LEGEND_CHANGE,
1804
+ onMouseEnterAxis: EVENT_TYPE.MOUSEENTER_AXIS,
1805
+ onMouseLeaveAxis: EVENT_TYPE.MOUSELEAVE_AXIS,
1806
+ onCheckboxStateChange: EVENT_TYPE.CHECKBOX_STATE_CHANGE,
1807
+ onRadioStateChange: EVENT_TYPE.RADIO_STATE_CHANGE,
1808
+ onSwitchStateChange: EVENT_TYPE.SWITCH_STATE_CHANGE,
1809
+ onAfterRender: EVENT_TYPE.AFTER_RENDER,
1810
+ onInitialized: EVENT_TYPE.INITIALIZED,
1811
+ onChangeCellValue: EVENT_TYPE.CHANGE_CELL_VALUE,
1812
+ onDragFillHandleEnd: EVENT_TYPE.DRAG_FILL_HANDLE_END,
1813
+ onMousedownFillHandle: EVENT_TYPE.MOUSEDOWN_FILL_HANDLE,
1814
+ onDblclickFillHandle: EVENT_TYPE.DBLCLICK_FILL_HANDLE,
1815
+ onPivotSortClick: EVENT_TYPE.PIVOT_SORT_CLICK,
1816
+ onDrillMenuClick: EVENT_TYPE.DRILLMENU_CLICK,
1817
+ onVChartEventType: EVENT_TYPE.VCHART_EVENT_TYPE,
1818
+ onChangCellValue: EVENT_TYPE.CHANGE_CELL_VALUE,
1819
+ onEmptyTipClick: EVENT_TYPE.EMPTY_TIP_CLICK,
1820
+ onEmptyTipDblClick: EVENT_TYPE.EMPTY_TIP_DBLCLICK,
1821
+ onButtonClick: EVENT_TYPE.BUTTON_CLICK
1822
+ };
1823
+ const TABLE_EVENTS_KEYS = Object.keys(TABLE_EVENTS);
1824
+ const findEventProps = (props, supportedEvents = TABLE_EVENTS) => {
1825
+ const result = {};
1826
+ Object.keys(props).forEach(key => {
1827
+ if (supportedEvents[key] && props[key]) {
1828
+ result[key] = props[key];
1829
+ }
1830
+ });
1831
+ return result;
1832
+ };
1833
+ const bindEventsToTable = (table, newProps, prevProps, supportedEvents = TABLE_EVENTS) => {
1834
+ if ((!newProps && !prevProps) || !table) {
1835
+ return false;
1836
+ }
1837
+ const prevEventProps = prevProps ? findEventProps(prevProps, supportedEvents) : null;
1838
+ const newEventProps = newProps ? findEventProps(newProps, supportedEvents) : null;
1839
+ if (prevEventProps) {
1840
+ Object.keys(prevEventProps).forEach(eventKey => {
1841
+ if (!newEventProps ||
1842
+ !newEventProps[eventKey] ||
1843
+ newEventProps[eventKey] !== prevEventProps[eventKey]) {
1844
+ table.off(supportedEvents[eventKey], prevProps[eventKey]);
1845
+ }
1846
+ });
1847
+ }
1848
+ if (newEventProps) {
1849
+ Object.keys(newEventProps).forEach(eventKey => {
1850
+ if (!prevEventProps ||
1851
+ !prevEventProps[eventKey] ||
1852
+ prevEventProps[eventKey] !== newEventProps[eventKey]) {
1853
+ table.on(supportedEvents[eventKey], newEventProps[eventKey]);
1854
+ }
1855
+ });
1856
+ }
1857
+ return true;
1858
+ };
1859
+
1860
+ class Generator {
1861
+ static GenAutoIncrementId() {
1862
+ return Generator.auto_increment_id++;
1868
1863
  }
1869
- round() {
1870
- 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;
1864
+ }
1865
+ Generator.auto_increment_id = 0;
1866
+
1867
+ class ContainerModule {
1868
+ constructor(registry) {
1869
+ this.id = Generator.GenAutoIncrementId(), this.registry = registry;
1871
1870
  }
1872
- translate() {
1873
- let dx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1874
- let dy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1875
- return this.x1 += dx, this.x2 += dx, this.y1 += dy, this.y2 += dy, this;
1871
+ }
1872
+
1873
+ const NAMED_TAG = "named";
1874
+ const INJECT_TAG = "inject";
1875
+ const MULTI_INJECT_TAG = "multi_inject";
1876
+ const TAGGED = "inversify:tagged";
1877
+ const PARAM_TYPES = "inversify:paramtypes";
1878
+
1879
+ class Metadata {
1880
+ constructor(key, value) {
1881
+ this.key = key, this.value = value;
1876
1882
  }
1877
- rotate() {
1878
- let angle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1879
- let x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1880
- let y = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1881
- const p = this.rotatedPoints(angle, x, y);
1882
- return this.clear().add(p[0], p[1]).add(p[2], p[3]).add(p[4], p[5]).add(p[6], p[7]);
1883
- }
1884
- scale() {
1885
- let sx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1886
- let sy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1887
- let x = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1888
- let y = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
1889
- const p = this.scalePoints(sx, sy, x, y);
1890
- return this.clear().add(p[0], p[1]).add(p[2], p[3]);
1891
- }
1892
- union(b) {
1893
- 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;
1894
- }
1895
- intersect(b) {
1896
- 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;
1897
- }
1898
- encloses(b) {
1899
- return b && this.x1 <= b.x1 && this.x2 >= b.x2 && this.y1 <= b.y1 && this.y2 >= b.y2;
1900
- }
1901
- alignsWith(b) {
1902
- return b && (this.x1 === b.x1 || this.x2 === b.x2 || this.y1 === b.y1 || this.y2 === b.y2);
1903
- }
1904
- intersects(b) {
1905
- return b && !(this.x2 < b.x1 || this.x1 > b.x2 || this.y2 < b.y1 || this.y1 > b.y2);
1906
- }
1907
- contains() {
1908
- let x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1909
- let y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1910
- return !(x < this.x1 || x > this.x2 || y < this.y1 || y > this.y2);
1911
- }
1912
- containsPoint(p) {
1913
- return !(p.x < this.x1 || p.x > this.x2 || p.y < this.y1 || p.y > this.y2);
1914
- }
1915
- width() {
1916
- return this.empty() ? 0 : this.x2 - this.x1;
1917
- }
1918
- height() {
1919
- return this.empty() ? 0 : this.y2 - this.y1;
1920
- }
1921
- scaleX() {
1922
- let s = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1923
- return this.x1 *= s, this.x2 *= s, this;
1924
- }
1925
- scaleY() {
1926
- let s = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1927
- return this.y1 *= s, this.y2 *= s, this;
1928
- }
1929
- transformWithMatrix(matrix) {
1930
- return transformBoundsWithMatrix(this, this, matrix), this;
1931
- }
1932
- copy(b) {
1933
- return this.x1 = b.x1, this.y1 = b.y1, this.x2 = b.x2, this.y2 = b.y2, this;
1934
- }
1935
- rotatedPoints(angle, x, y) {
1936
- const {
1937
- x1: x1,
1938
- y1: y1,
1939
- x2: x2,
1940
- y2: y2
1941
- } = this,
1942
- cos = Math.cos(angle),
1943
- sin = Math.sin(angle),
1944
- cx = x - x * cos + y * sin,
1945
- cy = y - x * sin - y * cos;
1946
- 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];
1947
- }
1948
- scalePoints(sx, sy, x, y) {
1949
- const {
1950
- x1: x1,
1951
- y1: y1,
1952
- x2: x2,
1953
- y2: y2
1954
- } = this;
1955
- return [sx * x1 + (1 - sx) * x, sy * y1 + (1 - sy) * y, sx * x2 + (1 - sx) * x, sy * y2 + (1 - sy) * y];
1956
- }
1957
- }
1958
- class AABBBounds extends Bounds {}
1959
- class OBBBounds extends Bounds {
1960
- constructor(bounds) {
1961
- let angle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1962
- var _a;
1963
- super(bounds), bounds && (this.angle = null !== (_a = bounds.angle) && void 0 !== _a ? _a : angle);
1964
- }
1965
- intersects(b) {
1966
- return isRotateAABBIntersect(this, b);
1967
- }
1968
- setValue() {
1969
- let x1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1970
- let y1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1971
- let x2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1972
- let y2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
1973
- let angle = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
1974
- return super.setValue(x1, y1, x2, y2), this.angle = angle, this;
1975
- }
1976
- clone() {
1977
- return new OBBBounds(this);
1883
+ toString() {
1884
+ return this.key === NAMED_TAG ? `named: ${String(this.value).toString()} ` : `tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`;
1978
1885
  }
1979
1886
  }
1980
1887
 
1981
- class Matrix {
1982
- constructor() {
1983
- let a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
1984
- let b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1985
- let c = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1986
- let d = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
1987
- let e = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
1988
- let f = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
1989
- this.a = a, this.b = b, this.c = c, this.d = d, this.e = e, this.f = f;
1990
- }
1991
- equalToMatrix(m2) {
1992
- 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);
1993
- }
1994
- equalTo(a, b, c, d, e, f) {
1995
- return !(this.e !== e || this.f !== f || this.a !== a || this.d !== d || this.b !== b || this.c !== c);
1996
- }
1997
- setValue(a, b, c, d, e, f) {
1998
- return this.a = a, this.b = b, this.c = c, this.d = d, this.e = e, this.f = f, this;
1999
- }
2000
- reset() {
2001
- return this.a = 1, this.b = 0, this.c = 0, this.d = 1, this.e = 0, this.f = 0, this;
2002
- }
2003
- getInverse() {
2004
- const a = this.a,
2005
- b = this.b,
2006
- c = this.c,
2007
- d = this.d,
2008
- e = this.e,
2009
- f = this.f,
2010
- m = new Matrix(),
2011
- dt = a * d - b * c;
2012
- 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;
2013
- }
2014
- rotate(rad) {
2015
- const c = Math.cos(rad),
2016
- s = Math.sin(rad),
2017
- m11 = this.a * c + this.c * s,
2018
- m12 = this.b * c + this.d * s,
2019
- m21 = this.a * -s + this.c * c,
2020
- m22 = this.b * -s + this.d * c;
2021
- return this.a = m11, this.b = m12, this.c = m21, this.d = m22, this;
2022
- }
2023
- rotateByCenter(rad, cx, cy) {
2024
- const cos = Math.cos(rad),
2025
- sin = Math.sin(rad),
2026
- rotateM13 = (1 - cos) * cx + sin * cy,
2027
- rotateM23 = (1 - cos) * cy - sin * cx,
2028
- m11 = cos * this.a - sin * this.b,
2029
- m21 = sin * this.a + cos * this.b,
2030
- m12 = cos * this.c - sin * this.d,
2031
- m22 = sin * this.c + cos * this.d,
2032
- m13 = cos * this.e - sin * this.f + rotateM13,
2033
- m23 = sin * this.e + cos * this.f + rotateM23;
2034
- return this.a = m11, this.b = m21, this.c = m12, this.d = m22, this.e = m13, this.f = m23, this;
2035
- }
2036
- scale(sx, sy) {
2037
- return this.a *= sx, this.b *= sx, this.c *= sy, this.d *= sy, this;
2038
- }
2039
- setScale(sx, sy) {
2040
- return this.b = this.b / this.a * sx, this.c = this.c / this.d * sy, this.a = sx, this.d = sy, this;
2041
- }
2042
- transform(a, b, c, d, e, f) {
2043
- return this.multiply(a, b, c, d, e, f), this;
2044
- }
2045
- translate(x, y) {
2046
- return this.e += this.a * x + this.c * y, this.f += this.b * x + this.d * y, this;
2047
- }
2048
- transpose() {
2049
- const {
2050
- a: a,
2051
- b: b,
2052
- c: c,
2053
- d: d,
2054
- e: e,
2055
- f: f
2056
- } = this;
2057
- return this.a = b, this.b = a, this.c = d, this.d = c, this.e = f, this.f = e, this;
2058
- }
2059
- multiply(a2, b2, c2, d2, e2, f2) {
2060
- const a1 = this.a,
2061
- b1 = this.b,
2062
- c1 = this.c,
2063
- d1 = this.d,
2064
- m11 = a1 * a2 + c1 * b2,
2065
- m12 = b1 * a2 + d1 * b2,
2066
- m21 = a1 * c2 + c1 * d2,
2067
- m22 = b1 * c2 + d1 * d2,
2068
- dx = a1 * e2 + c1 * f2 + this.e,
2069
- dy = b1 * e2 + d1 * f2 + this.f;
2070
- return this.a = m11, this.b = m12, this.c = m21, this.d = m22, this.e = dx, this.f = dy, this;
2071
- }
2072
- interpolate(m2, t) {
2073
- const m = new Matrix();
2074
- 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;
2075
- }
2076
- transformPoint(source, target) {
2077
- const {
2078
- a: a,
2079
- b: b,
2080
- c: c,
2081
- d: d,
2082
- e: e,
2083
- f: f
2084
- } = this,
2085
- dt = a * d - b * c,
2086
- nextA = d / dt,
2087
- nextB = -b / dt,
2088
- nextC = -c / dt,
2089
- nextD = a / dt,
2090
- nextE = (c * f - d * e) / dt,
2091
- nextF = -(a * f - b * e) / dt,
2092
- {
2093
- x: x,
2094
- y: y
2095
- } = source;
2096
- target.x = x * nextA + y * nextC + nextE, target.y = x * nextB + y * nextD + nextF;
2097
- }
2098
- onlyTranslate() {
2099
- let scale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
2100
- return this.a === scale && 0 === this.b && 0 === this.c && this.d === scale;
2101
- }
2102
- clone() {
2103
- return new Matrix(this.a, this.b, this.c, this.d, this.e, this.f);
2104
- }
2105
- toTransformAttrs() {
2106
- const a = this.a,
2107
- b = this.b,
2108
- c = this.c,
2109
- d = this.d,
2110
- delta = a * d - b * c,
2111
- result = {
2112
- x: this.e,
2113
- y: this.f,
2114
- rotateDeg: 0,
2115
- scaleX: 0,
2116
- scaleY: 0,
2117
- skewX: 0,
2118
- skewY: 0
2119
- };
2120
- if (0 !== a || 0 !== b) {
2121
- const r = Math.sqrt(a * a + b * b);
2122
- 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;
2123
- } else if (0 !== c || 0 !== d) {
2124
- const s = Math.sqrt(c * c + d * d);
2125
- 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;
1888
+ var Reflect$1 = (function (Reflect) {
1889
+ var target;
1890
+ return function (exporter) {
1891
+ const supportsSymbol = "function" == typeof Symbol,
1892
+ toPrimitiveSymbol = supportsSymbol && void 0 !== Symbol.toPrimitive ? Symbol.toPrimitive : "@@toPrimitive",
1893
+ functionPrototype = (Object.getPrototypeOf(Function)),
1894
+ _Map = ("object" == typeof process && process.env && process.env.REFLECT_METADATA_USE_MAP_POLYFILL, Map),
1895
+ Metadata = (new WeakMap());
1896
+ function defineMetadata(metadataKey, metadataValue, target, propertyKey) {
1897
+ if (!IsObject(target)) throw new TypeError();
1898
+ return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);
2126
1899
  }
2127
- return result.rotateDeg = radianToDegree(result.rotateDeg), result;
2128
- }
2129
- }
2130
- function normalTransform(out, origin, x, y, scaleX, scaleY, angle, rotateCenter) {
2131
- const oa = origin.a,
2132
- ob = origin.b,
2133
- oc = origin.c,
2134
- od = origin.d,
2135
- oe = origin.e,
2136
- of = origin.f,
2137
- cosTheta = cos(angle),
2138
- sinTheta = sin(angle);
2139
- let rotateCenterX, rotateCenterY;
2140
- rotateCenter ? (rotateCenterX = rotateCenter[0], rotateCenterY = rotateCenter[1]) : (rotateCenterX = x, rotateCenterY = y);
2141
- const offsetX = rotateCenterX - x,
2142
- offsetY = rotateCenterY - y,
2143
- a1 = oa * cosTheta + oc * sinTheta,
2144
- b1 = ob * cosTheta + od * sinTheta,
2145
- c1 = oc * cosTheta - oa * sinTheta,
2146
- d1 = od * cosTheta - ob * sinTheta;
2147
- 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;
2148
- }
2149
-
2150
- function hslToRgb(h, s, l) {
2151
- s /= 100, l /= 100;
2152
- const c = (1 - Math.abs(2 * l - 1)) * s,
2153
- x = c * (1 - Math.abs(h / 60 % 2 - 1)),
2154
- m = l - c / 2;
2155
- let r = 0,
2156
- g = 0,
2157
- b = 0;
2158
- 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)), {
2159
- r: r,
2160
- g: g,
2161
- b: b
2162
- };
2163
- }
2164
-
2165
- function rgbToHsl(r, g, b) {
2166
- r /= 255, g /= 255, b /= 255;
2167
- const cMin = Math.min(r, g, b),
2168
- cMax = Math.max(r, g, b),
2169
- delta = cMax - cMin;
2170
- let h = 0,
2171
- s = 0,
2172
- l = 0;
2173
- 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), {
2174
- h: h,
2175
- s: s,
2176
- l: l
2177
- };
2178
- }
1900
+ function hasMetadata(metadataKey, target, propertyKey) {
1901
+ if (!IsObject(target)) throw new TypeError();
1902
+ return IsUndefined(propertyKey) || (propertyKey = ToPropertyKey(propertyKey)), OrdinaryHasMetadata(metadataKey, target, propertyKey);
1903
+ }
1904
+ function hasOwnMetadata(metadataKey, target, propertyKey) {
1905
+ if (!IsObject(target)) throw new TypeError();
1906
+ return IsUndefined(propertyKey) || (propertyKey = ToPropertyKey(propertyKey)), OrdinaryHasOwnMetadata(metadataKey, target, propertyKey);
1907
+ }
1908
+ function getMetadata(metadataKey, target, propertyKey) {
1909
+ if (!IsObject(target)) throw new TypeError();
1910
+ return IsUndefined(propertyKey) || (propertyKey = ToPropertyKey(propertyKey)), OrdinaryGetMetadata(metadataKey, target, propertyKey);
1911
+ }
1912
+ function GetOrCreateMetadataMap(O, P, Create) {
1913
+ let targetMetadata = Metadata.get(O);
1914
+ if (IsUndefined(targetMetadata)) {
1915
+ if (!Create) return;
1916
+ targetMetadata = new _Map(), Metadata.set(O, targetMetadata);
1917
+ }
1918
+ let metadataMap = targetMetadata.get(P);
1919
+ if (IsUndefined(metadataMap)) {
1920
+ if (!Create) return;
1921
+ metadataMap = new _Map(), targetMetadata.set(P, metadataMap);
1922
+ }
1923
+ return metadataMap;
1924
+ }
1925
+ function OrdinaryHasMetadata(MetadataKey, O, P) {
1926
+ if (OrdinaryHasOwnMetadata(MetadataKey, O, P)) return !0;
1927
+ const parent = OrdinaryGetPrototypeOf(O);
1928
+ return !IsNull(parent) && OrdinaryHasMetadata(MetadataKey, parent, P);
1929
+ }
1930
+ function OrdinaryHasOwnMetadata(MetadataKey, O, P) {
1931
+ const metadataMap = GetOrCreateMetadataMap(O, P, !1);
1932
+ return !IsUndefined(metadataMap) && ToBoolean(metadataMap.has(MetadataKey));
1933
+ }
1934
+ function OrdinaryGetMetadata(MetadataKey, O, P) {
1935
+ if (OrdinaryHasOwnMetadata(MetadataKey, O, P)) return OrdinaryGetOwnMetadata(MetadataKey, O, P);
1936
+ const parent = OrdinaryGetPrototypeOf(O);
1937
+ return IsNull(parent) ? void 0 : OrdinaryGetMetadata(MetadataKey, parent, P);
1938
+ }
1939
+ function OrdinaryGetOwnMetadata(MetadataKey, O, P) {
1940
+ const metadataMap = GetOrCreateMetadataMap(O, P, !1);
1941
+ if (!IsUndefined(metadataMap)) return metadataMap.get(MetadataKey);
1942
+ }
1943
+ function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) {
1944
+ GetOrCreateMetadataMap(O, P, !0).set(MetadataKey, MetadataValue);
1945
+ }
1946
+ function Type(x) {
1947
+ if (null === x) return 1;
1948
+ switch (typeof x) {
1949
+ case "undefined":
1950
+ return 0;
1951
+ case "boolean":
1952
+ return 2;
1953
+ case "string":
1954
+ return 3;
1955
+ case "symbol":
1956
+ return 4;
1957
+ case "number":
1958
+ return 5;
1959
+ case "object":
1960
+ return null === x ? 1 : 6;
1961
+ default:
1962
+ return 6;
1963
+ }
1964
+ }
1965
+ function IsUndefined(x) {
1966
+ return void 0 === x;
1967
+ }
1968
+ function IsNull(x) {
1969
+ return null === x;
1970
+ }
1971
+ function IsSymbol(x) {
1972
+ return "symbol" == typeof x;
1973
+ }
1974
+ function IsObject(x) {
1975
+ return "object" == typeof x ? null !== x : "function" == typeof x;
1976
+ }
1977
+ function ToPrimitive(input, PreferredType) {
1978
+ switch (Type(input)) {
1979
+ case 0:
1980
+ case 1:
1981
+ case 2:
1982
+ case 3:
1983
+ case 4:
1984
+ case 5:
1985
+ return input;
1986
+ }
1987
+ const hint = 3 === PreferredType ? "string" : 5 === PreferredType ? "number" : "default",
1988
+ exoticToPrim = GetMethod(input, toPrimitiveSymbol);
1989
+ if (void 0 !== exoticToPrim) {
1990
+ const result = exoticToPrim.call(input, hint);
1991
+ if (IsObject(result)) throw new TypeError();
1992
+ return result;
1993
+ }
1994
+ return OrdinaryToPrimitive(input, "default" === hint ? "number" : hint);
1995
+ }
1996
+ function OrdinaryToPrimitive(O, hint) {
1997
+ if ("string" === hint) {
1998
+ const toString_1 = O.toString;
1999
+ if (IsCallable(toString_1)) {
2000
+ const result = toString_1.call(O);
2001
+ if (!IsObject(result)) return result;
2002
+ }
2003
+ const valueOf = O.valueOf;
2004
+ if (IsCallable(valueOf)) {
2005
+ const result = valueOf.call(O);
2006
+ if (!IsObject(result)) return result;
2007
+ }
2008
+ } else {
2009
+ const valueOf = O.valueOf;
2010
+ if (IsCallable(valueOf)) {
2011
+ const result = valueOf.call(O);
2012
+ if (!IsObject(result)) return result;
2013
+ }
2014
+ const toString_2 = O.toString;
2015
+ if (IsCallable(toString_2)) {
2016
+ const result = toString_2.call(O);
2017
+ if (!IsObject(result)) return result;
2018
+ }
2019
+ }
2020
+ throw new TypeError();
2021
+ }
2022
+ function ToBoolean(argument) {
2023
+ return !!argument;
2024
+ }
2025
+ function ToString(argument) {
2026
+ return "" + argument;
2027
+ }
2028
+ function ToPropertyKey(argument) {
2029
+ const key = ToPrimitive(argument, 3);
2030
+ return IsSymbol(key) ? key : ToString(key);
2031
+ }
2032
+ function IsCallable(argument) {
2033
+ return "function" == typeof argument;
2034
+ }
2035
+ function GetMethod(V, P) {
2036
+ const func = V[P];
2037
+ if (null != func) {
2038
+ if (!IsCallable(func)) throw new TypeError();
2039
+ return func;
2040
+ }
2041
+ }
2042
+ function OrdinaryGetPrototypeOf(O) {
2043
+ const proto = Object.getPrototypeOf(O);
2044
+ if ("function" != typeof O || O === functionPrototype) return proto;
2045
+ if (proto !== functionPrototype) return proto;
2046
+ const prototype = O.prototype,
2047
+ prototypeProto = prototype && Object.getPrototypeOf(prototype);
2048
+ if (null == prototypeProto || prototypeProto === Object.prototype) return proto;
2049
+ const constructor = prototypeProto.constructor;
2050
+ return "function" != typeof constructor || constructor === O ? proto : constructor;
2051
+ }
2052
+ exporter("defineMetadata", defineMetadata), exporter("hasMetadata", hasMetadata), exporter("hasOwnMetadata", hasOwnMetadata), exporter("getMetadata", getMetadata);
2053
+ }((target = Reflect, function (key, value) {
2054
+ "function" != typeof target[key] && Object.defineProperty(target, key, {
2055
+ configurable: !0,
2056
+ writable: !0,
2057
+ value: value
2058
+ });
2059
+ })), Reflect;
2060
+ })({});
2179
2061
 
2180
- const REG_HEX = /^#([0-9a-f]{3,8})$/,
2181
- DEFAULT_COLORS_OPACITY = {
2182
- transparent: 4294967040
2183
- };
2184
- const DEFAULT_COLORS = {
2185
- aliceblue: 15792383,
2186
- antiquewhite: 16444375,
2187
- aqua: 65535,
2188
- aquamarine: 8388564,
2189
- azure: 15794175,
2190
- beige: 16119260,
2191
- bisque: 16770244,
2192
- black: 0,
2193
- blanchedalmond: 16772045,
2194
- blue: 255,
2195
- blueviolet: 9055202,
2196
- brown: 10824234,
2197
- burlywood: 14596231,
2198
- cadetblue: 6266528,
2199
- chartreuse: 8388352,
2200
- chocolate: 13789470,
2201
- coral: 16744272,
2202
- cornflowerblue: 6591981,
2203
- cornsilk: 16775388,
2204
- crimson: 14423100,
2205
- cyan: 65535,
2206
- darkblue: 139,
2207
- darkcyan: 35723,
2208
- darkgoldenrod: 12092939,
2209
- darkgray: 11119017,
2210
- darkgreen: 25600,
2211
- darkgrey: 11119017,
2212
- darkkhaki: 12433259,
2213
- darkmagenta: 9109643,
2214
- darkolivegreen: 5597999,
2215
- darkorange: 16747520,
2216
- darkorchid: 10040012,
2217
- darkred: 9109504,
2218
- darksalmon: 15308410,
2219
- darkseagreen: 9419919,
2220
- darkslateblue: 4734347,
2221
- darkslategray: 3100495,
2222
- darkslategrey: 3100495,
2223
- darkturquoise: 52945,
2224
- darkviolet: 9699539,
2225
- deeppink: 16716947,
2226
- deepskyblue: 49151,
2227
- dimgray: 6908265,
2228
- dimgrey: 6908265,
2229
- dodgerblue: 2003199,
2230
- firebrick: 11674146,
2231
- floralwhite: 16775920,
2232
- forestgreen: 2263842,
2233
- fuchsia: 16711935,
2234
- gainsboro: 14474460,
2235
- ghostwhite: 16316671,
2236
- gold: 16766720,
2237
- goldenrod: 14329120,
2238
- gray: 8421504,
2239
- green: 32768,
2240
- greenyellow: 11403055,
2241
- grey: 8421504,
2242
- honeydew: 15794160,
2243
- hotpink: 16738740,
2244
- indianred: 13458524,
2245
- indigo: 4915330,
2246
- ivory: 16777200,
2247
- khaki: 15787660,
2248
- lavender: 15132410,
2249
- lavenderblush: 16773365,
2250
- lawngreen: 8190976,
2251
- lemonchiffon: 16775885,
2252
- lightblue: 11393254,
2253
- lightcoral: 15761536,
2254
- lightcyan: 14745599,
2255
- lightgoldenrodyellow: 16448210,
2256
- lightgray: 13882323,
2257
- lightgreen: 9498256,
2258
- lightgrey: 13882323,
2259
- lightpink: 16758465,
2260
- lightsalmon: 16752762,
2261
- lightseagreen: 2142890,
2262
- lightskyblue: 8900346,
2263
- lightslategray: 7833753,
2264
- lightslategrey: 7833753,
2265
- lightsteelblue: 11584734,
2266
- lightyellow: 16777184,
2267
- lime: 65280,
2268
- limegreen: 3329330,
2269
- linen: 16445670,
2270
- magenta: 16711935,
2271
- maroon: 8388608,
2272
- mediumaquamarine: 6737322,
2273
- mediumblue: 205,
2274
- mediumorchid: 12211667,
2275
- mediumpurple: 9662683,
2276
- mediumseagreen: 3978097,
2277
- mediumslateblue: 8087790,
2278
- mediumspringgreen: 64154,
2279
- mediumturquoise: 4772300,
2280
- mediumvioletred: 13047173,
2281
- midnightblue: 1644912,
2282
- mintcream: 16121850,
2283
- mistyrose: 16770273,
2284
- moccasin: 16770229,
2285
- navajowhite: 16768685,
2286
- navy: 128,
2287
- oldlace: 16643558,
2288
- olive: 8421376,
2289
- olivedrab: 7048739,
2290
- orange: 16753920,
2291
- orangered: 16729344,
2292
- orchid: 14315734,
2293
- palegoldenrod: 15657130,
2294
- palegreen: 10025880,
2295
- paleturquoise: 11529966,
2296
- palevioletred: 14381203,
2297
- papayawhip: 16773077,
2298
- peachpuff: 16767673,
2299
- peru: 13468991,
2300
- pink: 16761035,
2301
- plum: 14524637,
2302
- powderblue: 11591910,
2303
- purple: 8388736,
2304
- rebeccapurple: 6697881,
2305
- red: 16711680,
2306
- rosybrown: 12357519,
2307
- royalblue: 4286945,
2308
- saddlebrown: 9127187,
2309
- salmon: 16416882,
2310
- sandybrown: 16032864,
2311
- seagreen: 3050327,
2312
- seashell: 16774638,
2313
- sienna: 10506797,
2314
- silver: 12632256,
2315
- skyblue: 8900331,
2316
- slateblue: 6970061,
2317
- slategray: 7372944,
2318
- slategrey: 7372944,
2319
- snow: 16775930,
2320
- springgreen: 65407,
2321
- steelblue: 4620980,
2322
- tan: 13808780,
2323
- teal: 32896,
2324
- thistle: 14204888,
2325
- tomato: 16737095,
2326
- turquoise: 4251856,
2327
- violet: 15631086,
2328
- wheat: 16113331,
2329
- white: 16777215,
2330
- whitesmoke: 16119285,
2331
- yellow: 16776960,
2332
- yellowgreen: 10145074
2333
- };
2334
- function hex(value) {
2335
- return ((value = Math.max(0, Math.min(255, Math.round(value) || 0))) < 16 ? "0" : "") + value.toString(16);
2062
+ function _tagParameterOrProperty(metadataKey, annotationTarget, key, metadata) {
2063
+ const metadatas = [metadata];
2064
+ let paramsOrPropertiesMetadata = {};
2065
+ Reflect$1.hasOwnMetadata(metadataKey, annotationTarget) && (paramsOrPropertiesMetadata = Reflect$1.getMetadata(metadataKey, annotationTarget));
2066
+ let paramOrPropertyMetadata = paramsOrPropertiesMetadata[key];
2067
+ void 0 === paramOrPropertyMetadata && (paramOrPropertyMetadata = []), paramOrPropertyMetadata.push(...metadatas), paramsOrPropertiesMetadata[key] = paramOrPropertyMetadata, Reflect$1.defineMetadata(metadataKey, paramsOrPropertiesMetadata, annotationTarget);
2336
2068
  }
2337
- function rgb(value) {
2338
- 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);
2069
+ function tagParameter(annotationTarget, parameterName, parameterIndex, metadata) {
2070
+ _tagParameterOrProperty(TAGGED, annotationTarget, parameterIndex.toString(), metadata);
2339
2071
  }
2340
- function rgba(value) {
2341
- 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);
2072
+ function createTaggedDecorator(metadata) {
2073
+ return (target, targetKey, indexOrPropertyDescriptor) => {
2074
+ tagParameter(target, targetKey, indexOrPropertyDescriptor, metadata);
2075
+ };
2342
2076
  }
2343
- function SRGBToLinear(c) {
2344
- return c < .04045 ? .0773993808 * c : Math.pow(.9478672986 * c + .0521327014, 2.4);
2077
+ function injectBase(metadataKey) {
2078
+ return serviceIdentifier => (target, targetKey, indexOrPropertyDescriptor) => createTaggedDecorator(new Metadata(metadataKey, serviceIdentifier))(target, targetKey, indexOrPropertyDescriptor);
2345
2079
  }
2346
- function LinearToSRGB(c) {
2347
- return c < .0031308 ? 12.92 * c : 1.055 * Math.pow(c, .41666) - .055;
2080
+
2081
+ const inject = injectBase(INJECT_TAG);
2082
+
2083
+ function injectable() {
2084
+ return function (target) {
2085
+ return Reflect$1.defineMetadata(PARAM_TYPES, null, target), target;
2086
+ };
2348
2087
  }
2349
- const setHex = (formatValue, forceHex) => {
2350
- const isHex = REG_HEX.exec(formatValue);
2351
- if (forceHex || isHex) {
2352
- const hex = parseInt(isHex[1], 16),
2353
- hexLength = isHex[1].length;
2354
- 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;
2088
+
2089
+ function named(name) {
2090
+ return createTaggedDecorator(new Metadata(NAMED_TAG, name));
2091
+ }
2092
+
2093
+ const BindingScopeEnum = {
2094
+ Singleton: "Singleton",
2095
+ Transient: "Transient"
2096
+ },
2097
+ BindingTypeEnum = {
2098
+ ConstantValue: "ConstantValue",
2099
+ Constructor: "Constructor",
2100
+ DynamicValue: "DynamicValue",
2101
+ Factory: "Factory",
2102
+ Function: "Function",
2103
+ Instance: "Instance",
2104
+ Invalid: "Invalid",
2105
+ Provider: "Provider"
2106
+ };
2107
+
2108
+ class Binding {
2109
+ constructor(serviceIdentifier, scope) {
2110
+ 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;
2111
+ }
2112
+ clone() {
2113
+ const clone = new Binding(this.serviceIdentifier, this.scope);
2114
+ 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;
2115
+ }
2116
+ }
2117
+
2118
+ class MetadataReader {
2119
+ getConstructorMetadata(constructorFunc) {
2120
+ return {
2121
+ compilerGeneratedMetadata: Reflect$1.getMetadata(PARAM_TYPES, constructorFunc),
2122
+ userGeneratedMetadata: Reflect$1.getMetadata(TAGGED, constructorFunc) || {}
2123
+ };
2355
2124
  }
2125
+ getPropertiesMetadata(constructorFunc) {
2126
+ throw new Error("暂未实现");
2127
+ }
2128
+ }
2129
+
2130
+ const taggedConstraint = key => value => {
2131
+ const constraint = request => {
2132
+ if (null == request) return !1;
2133
+ if (request.key === key && request.value === value) return !0;
2134
+ if (null == request.constructorArgsMetadata) return !1;
2135
+ const constructorArgsMetadata = request.constructorArgsMetadata;
2136
+ for (let i = 0; i < constructorArgsMetadata.length; i++) if (constructorArgsMetadata[i].key === key && constructorArgsMetadata[i].value === value) return !0;
2137
+ return !1;
2138
+ };
2139
+ return constraint.metaData = new Metadata(key, value), constraint;
2356
2140
  };
2357
- class Color {
2358
- static Brighter(source) {
2359
- let b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
2360
- return 1 === b ? source : new Color(source).brighter(b).toRGBA();
2141
+ const namedConstraint = taggedConstraint(NAMED_TAG);
2142
+
2143
+ class BindingInSyntax {
2144
+ constructor(binding) {
2145
+ this._binding = binding;
2361
2146
  }
2362
- static SetOpacity(source) {
2363
- let o = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
2364
- return 1 === o ? source : new Color(source).setOpacity(o).toRGBA();
2147
+ inRequestScope() {
2148
+ throw new Error("暂未实现");
2365
2149
  }
2366
- static getColorBrightness(source) {
2367
- let model = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "hsl";
2368
- const color = source instanceof Color ? source : new Color(source);
2369
- switch (model) {
2370
- case "hsv":
2371
- default:
2372
- return color.getHSVBrightness();
2373
- case "hsl":
2374
- return color.getHSLBrightness();
2375
- case "lum":
2376
- return color.getLuminance();
2377
- case "lum2":
2378
- return color.getLuminance2();
2379
- case "lum3":
2380
- return color.getLuminance3();
2381
- case "wcag":
2382
- return color.getLuminanceWCAG();
2383
- }
2150
+ inSingletonScope() {
2151
+ return this._binding.scope = BindingScopeEnum.Singleton, this;
2384
2152
  }
2385
- static parseColorString(value) {
2386
- if (isValid$1(DEFAULT_COLORS_OPACITY[value])) return rgba(DEFAULT_COLORS_OPACITY[value]);
2387
- if (isValid$1(DEFAULT_COLORS[value])) return rgb(DEFAULT_COLORS[value]);
2388
- const formatValue = `${value}`.trim().toLowerCase(),
2389
- hexRes = setHex(formatValue);
2390
- if (void 0 !== hexRes) return hexRes;
2391
- if (/^(rgb|RGB|rgba|RGBA)/.test(formatValue)) {
2392
- const aColor = formatValue.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g, "").split(",");
2393
- return new RGB(parseInt(aColor[0], 10), parseInt(aColor[1], 10), parseInt(aColor[2], 10), parseFloat(aColor[3]));
2394
- }
2395
- if (/^(hsl|HSL|hsla|HSLA)/.test(formatValue)) {
2396
- const aColor = formatValue.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g, "").split(","),
2397
- rgb = hslToRgb(parseInt(aColor[0], 10), parseInt(aColor[1], 10), parseInt(aColor[2], 10));
2398
- return new RGB(rgb.r, rgb.g, rgb.b, parseFloat(aColor[3]));
2399
- }
2153
+ inTransientScope() {
2154
+ return this._binding.scope = BindingScopeEnum.Transient, this;
2400
2155
  }
2401
- constructor(value) {
2402
- const color = Color.parseColorString(value);
2403
- color ? this.color = color : (this.color = new RGB(255, 255, 255));
2156
+ whenTargetNamed(name) {
2157
+ return this._binding.constraint = namedConstraint(name), this;
2404
2158
  }
2405
- toRGBA() {
2406
- return this.color.formatRgb();
2159
+ }
2160
+
2161
+ class BindingToSyntax {
2162
+ constructor(binding) {
2163
+ this._binding = binding;
2407
2164
  }
2408
- toString() {
2409
- return this.color.formatRgb();
2165
+ to(constructor) {
2166
+ return this._binding.type = BindingTypeEnum.Instance, this._binding.implementationType = constructor, new BindingInSyntax(this._binding);
2410
2167
  }
2411
- toHex() {
2412
- return this.color.formatHex();
2168
+ toSelf() {
2169
+ const self = this._binding.serviceIdentifier;
2170
+ return this.to(self);
2413
2171
  }
2414
- toHsl() {
2415
- return this.color.formatHsl();
2172
+ toDynamicValue(func) {
2173
+ return this._binding.type = BindingTypeEnum.DynamicValue, this._binding.cache = null, this._binding.dynamicValue = func, this._binding.implementationType = null, new BindingInSyntax(this._binding);
2416
2174
  }
2417
- brighter(k) {
2418
- const {
2419
- r: r,
2420
- g: g,
2421
- b: b
2422
- } = this.color;
2423
- 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;
2175
+ toConstantValue(value) {
2176
+ 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);
2424
2177
  }
2425
- add(color) {
2426
- const {
2427
- r: r,
2428
- g: g,
2429
- b: b
2430
- } = this.color;
2431
- 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;
2178
+ toFactory(factory) {
2179
+ return this._binding.type = BindingTypeEnum.Factory, this._binding.factory = factory, this._binding.scope = BindingScopeEnum.Singleton, new BindingInSyntax(this._binding);
2432
2180
  }
2433
- sub(color) {
2434
- 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;
2181
+ toService(service) {
2182
+ this.toDynamicValue(context => context.container.get(service));
2435
2183
  }
2436
- multiply(color) {
2437
- const {
2438
- r: r,
2439
- g: g,
2440
- b: b
2441
- } = this.color;
2442
- 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;
2184
+ }
2185
+
2186
+ class Container {
2187
+ constructor(containerOptions) {
2188
+ const options = containerOptions || {};
2189
+ options.defaultScope = options.defaultScope || BindingScopeEnum.Transient, this.options = options, this.id = Generator.GenAutoIncrementId(), this._bindingDictionary = new Map(), this._metadataReader = new MetadataReader();
2443
2190
  }
2444
- getHSVBrightness() {
2445
- return Math.max(this.color.r, this.color.g, this.color.b) / 255;
2191
+ load(module) {
2192
+ const containerModuleHelpers = this._getContainerModuleHelpersFactory()(module.id);
2193
+ module.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction);
2446
2194
  }
2447
- getHSLBrightness() {
2448
- 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);
2195
+ get(serviceIdentifier) {
2196
+ const getArgs = this._getNotAllArgs(serviceIdentifier, !1);
2197
+ return this._get(getArgs);
2449
2198
  }
2450
- setHsl(h, s, l) {
2451
- const opacity = this.color.opacity,
2452
- hsl = rgbToHsl(this.color.r, this.color.g, this.color.b),
2453
- 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);
2454
- return this.color = new RGB(rgb.r, rgb.g, rgb.b, opacity), this;
2199
+ getAll(serviceIdentifier) {
2200
+ const getArgs = this._getAllArgs(serviceIdentifier);
2201
+ return this._get(getArgs);
2455
2202
  }
2456
- setRGB(r, g, b) {
2457
- return !isNil$1(r) && (this.color.r = r), !isNil$1(g) && (this.color.g = g), !isNil$1(b) && (this.color.b = b), this;
2203
+ getTagged(serviceIdentifier, key, value) {
2204
+ const getArgs = this._getNotAllArgs(serviceIdentifier, !1, key, value);
2205
+ return this._get(getArgs);
2458
2206
  }
2459
- setHex(value) {
2460
- const formatValue = `${value}`.trim().toLowerCase(),
2461
- res = setHex(formatValue, !0);
2462
- return null != res ? res : this;
2207
+ getNamed(serviceIdentifier, named) {
2208
+ return this.getTagged(serviceIdentifier, NAMED_TAG, named);
2463
2209
  }
2464
- setColorName(name) {
2465
- const hex = DEFAULT_COLORS[name.toLowerCase()];
2466
- return void 0 !== hex ? this.setHex(hex) : (void 0), this;
2210
+ isBound(serviceIdentifier) {
2211
+ return this._bindingDictionary.has(serviceIdentifier);
2467
2212
  }
2468
- setScalar(scalar) {
2469
- return this.color.r = scalar, this.color.g = scalar, this.color.b = scalar, this;
2213
+ bind(serviceIdentifier) {
2214
+ const scope = this.options.defaultScope,
2215
+ binding = new Binding(serviceIdentifier, scope),
2216
+ list = this._bindingDictionary.get(serviceIdentifier) || [];
2217
+ return list.push(binding), this._bindingDictionary.set(serviceIdentifier, list), new BindingToSyntax(binding);
2470
2218
  }
2471
- setOpacity() {
2472
- let o = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
2473
- return this.color.opacity = o, this;
2219
+ unbind(serviceIdentifier) {
2220
+ this._bindingDictionary.delete(serviceIdentifier);
2474
2221
  }
2475
- getLuminance() {
2476
- return (.2126 * this.color.r + .7152 * this.color.g + .0722 * this.color.b) / 255;
2222
+ rebind(serviceIdentifier) {
2223
+ return this.unbind(serviceIdentifier), this.bind(serviceIdentifier);
2224
+ }
2225
+ _getContainerModuleHelpersFactory() {
2226
+ const setModuleId = (bindingToSyntax, moduleId) => {
2227
+ bindingToSyntax._binding.moduleId = moduleId;
2228
+ },
2229
+ getBindFunction = moduleId => serviceIdentifier => {
2230
+ const bindingToSyntax = this.bind(serviceIdentifier);
2231
+ return setModuleId(bindingToSyntax, moduleId), bindingToSyntax;
2232
+ },
2233
+ getUnbindFunction = () => serviceIdentifier => this.unbind(serviceIdentifier),
2234
+ getIsboundFunction = () => serviceIdentifier => this.isBound(serviceIdentifier),
2235
+ getRebindFunction = moduleId => serviceIdentifier => {
2236
+ const bindingToSyntax = this.rebind(serviceIdentifier);
2237
+ return setModuleId(bindingToSyntax, moduleId), bindingToSyntax;
2238
+ };
2239
+ return mId => ({
2240
+ bindFunction: getBindFunction(mId),
2241
+ isboundFunction: getIsboundFunction(),
2242
+ rebindFunction: getRebindFunction(mId),
2243
+ unbindFunction: getUnbindFunction(),
2244
+ unbindAsyncFunction: serviceIdentifier => null
2245
+ });
2477
2246
  }
2478
- getLuminance2() {
2479
- return (.2627 * this.color.r + .678 * this.color.g + .0593 * this.color.b) / 255;
2247
+ _getNotAllArgs(serviceIdentifier, isMultiInject, key, value) {
2248
+ return {
2249
+ avoidConstraints: !1,
2250
+ isMultiInject: isMultiInject,
2251
+ serviceIdentifier: serviceIdentifier,
2252
+ key: key,
2253
+ value: value
2254
+ };
2480
2255
  }
2481
- getLuminance3() {
2482
- return (.299 * this.color.r + .587 * this.color.g + .114 * this.color.b) / 255;
2256
+ _getAllArgs(serviceIdentifier) {
2257
+ return {
2258
+ avoidConstraints: !0,
2259
+ isMultiInject: !0,
2260
+ serviceIdentifier: serviceIdentifier
2261
+ };
2483
2262
  }
2484
- getLuminanceWCAG() {
2485
- const RsRGB = this.color.r / 255,
2486
- GsRGB = this.color.g / 255,
2487
- BsRGB = this.color.b / 255;
2488
- let R, G, B;
2489
- R = RsRGB <= .03928 ? RsRGB / 12.92 : Math.pow((RsRGB + .055) / 1.055, 2.4), G = GsRGB <= .03928 ? GsRGB / 12.92 : Math.pow((GsRGB + .055) / 1.055, 2.4), B = BsRGB <= .03928 ? BsRGB / 12.92 : Math.pow((BsRGB + .055) / 1.055, 2.4);
2490
- return .2126 * R + .7152 * G + .0722 * B;
2263
+ _get(getArgs) {
2264
+ const result = [];
2265
+ return this._bindingDictionary.get(getArgs.serviceIdentifier).filter(b => b.constraint(getArgs)).forEach(binding => {
2266
+ result.push(this._resolveFromBinding(binding));
2267
+ }), getArgs.isMultiInject || 1 !== result.length ? result : result[0];
2491
2268
  }
2492
- clone() {
2493
- return new Color(this.color.toString());
2269
+ _getChildRequest(binding) {
2270
+ const constr = binding.implementationType,
2271
+ {
2272
+ userGeneratedMetadata: userGeneratedMetadata
2273
+ } = this._metadataReader.getConstructorMetadata(constr),
2274
+ keys = Object.keys(userGeneratedMetadata),
2275
+ arr = [];
2276
+ for (let i = 0; i < keys.length; i++) {
2277
+ const constructorArgsMetadata = userGeneratedMetadata[i],
2278
+ targetMetadataMap = {};
2279
+ constructorArgsMetadata.forEach(md => {
2280
+ targetMetadataMap[md.key] = md.value;
2281
+ });
2282
+ const metadata = {
2283
+ inject: targetMetadataMap[INJECT_TAG],
2284
+ multiInject: targetMetadataMap[MULTI_INJECT_TAG]
2285
+ },
2286
+ injectIdentifier = metadata.inject || metadata.multiInject,
2287
+ target = {
2288
+ serviceIdentifier: injectIdentifier,
2289
+ constructorArgsMetadata: constructorArgsMetadata
2290
+ },
2291
+ request = {
2292
+ injectIdentifier: injectIdentifier,
2293
+ metadata: constructorArgsMetadata,
2294
+ bindings: this._bindingDictionary.get(injectIdentifier).filter(b => b.constraint(target))
2295
+ };
2296
+ arr.push(request);
2297
+ }
2298
+ return arr;
2494
2299
  }
2495
- copyGammaToLinear(color) {
2496
- let gammaFactor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
2497
- 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;
2300
+ _resolveFromBinding(binding) {
2301
+ const result = this._getResolvedFromBinding(binding);
2302
+ return this._saveToScope(binding, result), result;
2498
2303
  }
2499
- copyLinearToGamma(color) {
2500
- let gammaFactor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
2501
- const safeInverse = gammaFactor > 0 ? 1 / gammaFactor : 1;
2502
- 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;
2304
+ _getResolvedFromBinding(binding) {
2305
+ let result;
2306
+ switch (binding.type) {
2307
+ case BindingTypeEnum.ConstantValue:
2308
+ case BindingTypeEnum.Function:
2309
+ result = binding.cache;
2310
+ break;
2311
+ case BindingTypeEnum.Instance:
2312
+ result = this._resolveInstance(binding, binding.implementationType);
2313
+ break;
2314
+ default:
2315
+ result = binding.dynamicValue({
2316
+ container: this
2317
+ });
2318
+ }
2319
+ return result;
2503
2320
  }
2504
- convertGammaToLinear(gammaFactor) {
2505
- return this.copyGammaToLinear(this, gammaFactor), this;
2321
+ _resolveInstance(binding, constr) {
2322
+ if (binding.activated) return binding.cache;
2323
+ const childRequests = this._getChildRequest(binding);
2324
+ return this._createInstance(constr, childRequests);
2506
2325
  }
2507
- convertLinearToGamma(gammaFactor) {
2508
- return this.copyLinearToGamma(this, gammaFactor), this;
2326
+ _createInstance(constr, childRequests) {
2327
+ if (childRequests.length) {
2328
+ return new constr(...this._resolveRequests(childRequests));
2329
+ }
2330
+ return new constr();
2509
2331
  }
2510
- copySRGBToLinear(color) {
2511
- return this.color.r = SRGBToLinear(color.color.r), this.color.g = SRGBToLinear(color.color.g), this.color.b = SRGBToLinear(color.color.b), this;
2332
+ _resolveRequests(childRequests) {
2333
+ return childRequests.map(request => request.bindings.length > 1 ? request.bindings.map(binding => this._resolveFromBinding(binding)) : this._resolveFromBinding(request.bindings[0]));
2512
2334
  }
2513
- copyLinearToSRGB(color) {
2514
- return this.color.r = LinearToSRGB(color.color.r), this.color.g = LinearToSRGB(color.color.g), this.color.b = LinearToSRGB(color.color.b), this;
2335
+ _saveToScope(binding, result) {
2336
+ binding.scope === BindingScopeEnum.Singleton && (binding.cache = result, binding.activated = !0);
2515
2337
  }
2516
- convertSRGBToLinear() {
2517
- return this.copySRGBToLinear(this), this;
2338
+ }
2339
+
2340
+ const ContributionProvider = Symbol("ContributionProvider");
2341
+ class ContributionProviderCache {
2342
+ constructor(serviceIdentifier, container) {
2343
+ this.serviceIdentifier = serviceIdentifier, this.container = container;
2518
2344
  }
2519
- convertLinearToSRGB() {
2520
- return this.copyLinearToSRGB(this), this;
2345
+ getContributions() {
2346
+ return this.caches || (this.caches = [], this.container && this.container.isBound(this.serviceIdentifier) && this.caches.push(...this.container.getAll(this.serviceIdentifier))), this.caches;
2521
2347
  }
2522
2348
  }
2523
- class RGB {
2524
- constructor(r, g, b, opacity) {
2525
- 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;
2349
+ function bindContributionProvider(bind, id) {
2350
+ bind(ContributionProvider).toDynamicValue(_ref => {
2351
+ let {
2352
+ container: container
2353
+ } = _ref;
2354
+ return new ContributionProviderCache(id, container);
2355
+ }).inSingletonScope().whenTargetNamed(id);
2356
+ }
2357
+
2358
+ class Hook {
2359
+ constructor(args, name) {
2360
+ this._args = args, this.name = name, this.taps = [];
2526
2361
  }
2527
- formatHex() {
2528
- return `#${hex(this.r) + hex(this.g) + hex(this.b) + (1 === this.opacity ? "" : hex(255 * this.opacity))}`;
2362
+ tap(options, fn) {
2363
+ this._tap("sync", options, fn);
2529
2364
  }
2530
- formatRgb() {
2531
- const opacity = this.opacity;
2532
- return `${1 === opacity ? "rgb(" : "rgba("}${this.r},${this.g},${this.b}${1 === opacity ? ")" : `,${opacity})`}`;
2365
+ unTap(options, fn) {
2366
+ const name = "string" == typeof options ? options.trim() : options.name;
2367
+ name && (this.taps = this.taps.filter(tap => !(tap.name === name && (!fn || tap.fn === fn))));
2533
2368
  }
2534
- formatHsl() {
2535
- const opacity = this.opacity,
2536
- {
2537
- h: h,
2538
- s: s,
2539
- l: l
2540
- } = rgbToHsl(this.r, this.g, this.b);
2541
- return `${1 === opacity ? "hsl(" : "hsla("}${h},${s}%,${l}%${1 === opacity ? ")" : `,${opacity})`}`;
2369
+ _parseOptions(type, options, fn) {
2370
+ let _options;
2371
+ if ("string" == typeof options) _options = {
2372
+ name: options.trim()
2373
+ };else if ("object" != typeof options || null === options) throw new Error("Invalid tap options");
2374
+ if ("string" != typeof _options.name || "" === _options.name) throw new Error("Missing name for tap");
2375
+ return _options = Object.assign({
2376
+ type: type,
2377
+ fn: fn
2378
+ }, _options), _options;
2542
2379
  }
2543
- toString() {
2544
- return this.formatHex();
2380
+ _tap(type, options, fn) {
2381
+ this._insert(this._parseOptions(type, options, fn));
2382
+ }
2383
+ _insert(item) {
2384
+ let before;
2385
+ "string" == typeof item.before ? before = new Set([item.before]) : Array.isArray(item.before) && (before = new Set(item.before));
2386
+ let stage = 0;
2387
+ "number" == typeof item.stage && (stage = item.stage);
2388
+ let i = this.taps.length;
2389
+ for (; i > 0;) {
2390
+ i--;
2391
+ const x = this.taps[i];
2392
+ this.taps[i + 1] = x;
2393
+ const xStage = x.stage || 0;
2394
+ if (before) {
2395
+ if (before.has(x.name)) {
2396
+ before.delete(x.name);
2397
+ continue;
2398
+ }
2399
+ if (before.size > 0) continue;
2400
+ }
2401
+ if (!(xStage > stage)) {
2402
+ i++;
2403
+ break;
2404
+ }
2405
+ }
2406
+ this.taps[i] = item;
2545
2407
  }
2546
2408
  }
2547
2409
 
2548
- function normalizePadding(padding) {
2549
- if (isValidNumber$1(padding)) return [padding, padding, padding, padding];
2550
- if (isArray$1(padding)) {
2551
- const length = padding.length;
2552
- if (1 === length) {
2553
- const paddingValue = padding[0];
2554
- return [paddingValue, paddingValue, paddingValue, paddingValue];
2555
- }
2556
- if (2 === length) {
2557
- const [vertical, horizontal] = padding;
2558
- return [vertical, horizontal, vertical, horizontal];
2559
- }
2560
- if (3 === length) {
2561
- const [top, horizontal, bottom] = padding;
2562
- return [top, horizontal, bottom, horizontal];
2410
+ class SyncHook extends Hook {
2411
+ call() {
2412
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2413
+ args[_key] = arguments[_key];
2563
2414
  }
2564
- if (4 === length) return padding;
2565
- }
2566
- if (isObject$1(padding)) {
2567
- const {
2568
- top = 0,
2569
- right = 0,
2570
- bottom = 0,
2571
- left = 0
2572
- } = padding;
2573
- return [top, right, bottom, left];
2415
+ this.taps.map(t => t.fn).forEach(cb => cb(...args));
2574
2416
  }
2575
- return [0, 0, 0, 0];
2576
2417
  }
2577
2418
 
2578
- const styleStringToObject = function () {
2579
- let styleStr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
2580
- const res = {};
2581
- return styleStr.split(";").forEach(item => {
2582
- if (item) {
2583
- const arr = item.split(":");
2584
- if (2 === arr.length) {
2585
- const key = arr[0].trim(),
2586
- value = arr[1].trim();
2587
- key && value && (res[key] = value);
2588
- }
2589
- }
2590
- }), res;
2591
- };
2592
- const lowerCamelCaseToMiddle = str => str.replace(/([A-Z])/g, "-$1").toLowerCase();
2419
+ const EnvContribution = Symbol.for("EnvContribution");
2420
+ const DEFAULT_TEXT_FONT_FAMILY$1 = "PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";
2421
+
2422
+ var MeasureModeEnum;
2423
+ !function (MeasureModeEnum) {
2424
+ MeasureModeEnum[MeasureModeEnum.estimate = 0] = "estimate", MeasureModeEnum[MeasureModeEnum.actualBounding = 1] = "actualBounding", MeasureModeEnum[MeasureModeEnum.fontBounding = 2] = "fontBounding";
2425
+ }(MeasureModeEnum || (MeasureModeEnum = {}));
2593
2426
 
2594
2427
  const circleThreshold = tau - 1e-8;
2595
2428
  class BoundsContext {
@@ -12641,7 +12474,7 @@
12641
12474
  if (!(element && ReactDOM && (ReactDOM.createRoot || ReactDOM.render))) {
12642
12475
  return;
12643
12476
  }
12644
- const id = isNil$3(react.id) ? `${graphic.id ?? graphic._uid}_react` : react.id;
12477
+ const id = isNil$1(react.id) ? `${graphic.id ?? graphic._uid}_react` : react.id;
12645
12478
  if (this.htmlMap && this.htmlMap[id] && container && container !== this.htmlMap[id].container) {
12646
12479
  this.removeElement(id);
12647
12480
  }
@@ -12727,7 +12560,7 @@
12727
12560
  let top = 0;
12728
12561
  const b = graphic.globalAABBBounds;
12729
12562
  let anchorType = options.anchorType;
12730
- if (isNil$3(anchorType)) {
12563
+ if (isNil$1(anchorType)) {
12731
12564
  anchorType = graphic.type === 'text' ? 'position' : 'boundsLeftTop';
12732
12565
  }
12733
12566
  if (anchorType === 'boundsLeftTop') {
@@ -12739,7 +12572,7 @@
12739
12572
  top = matrix.f;
12740
12573
  }
12741
12574
  else {
12742
- const anchor = calculateAnchorOfBounds$1(b, anchorType);
12575
+ const anchor = calculateAnchorOfBounds(b, anchorType);
12743
12576
  left = anchor.x;
12744
12577
  top = anchor.y;
12745
12578
  }
@@ -12755,17 +12588,17 @@
12755
12588
  ...this.getTransformOfText(graphic)
12756
12589
  };
12757
12590
  }
12758
- if (isFunction$3(options.style)) {
12591
+ if (isFunction$1(options.style)) {
12759
12592
  const userStyle = options.style({ top: offsetTop, left: offsetX, width: b.width(), height: b.height() }, graphic, wrapContainer);
12760
12593
  if (userStyle) {
12761
12594
  calculateStyle = { ...calculateStyle, ...userStyle };
12762
12595
  }
12763
12596
  }
12764
- else if (isObject$3(options.style)) {
12597
+ else if (isObject$1(options.style)) {
12765
12598
  calculateStyle = { ...calculateStyle, ...options.style };
12766
12599
  }
12767
- else if (isString$3(options.style) && options.style) {
12768
- calculateStyle = { ...calculateStyle, ...styleStringToObject$1(options.style) };
12600
+ else if (isString$1(options.style) && options.style) {
12601
+ calculateStyle = { ...calculateStyle, ...styleStringToObject(options.style) };
12769
12602
  }
12770
12603
  application.global.updateDom(wrapContainer, {
12771
12604
  width: options.width,
@@ -12865,7 +12698,7 @@
12865
12698
  }
12866
12699
  const { width, height, style } = params;
12867
12700
  if (style) {
12868
- if (isString$3(style)) {
12701
+ if (isString$1(style)) {
12869
12702
  dom.setAttribute('style', style);
12870
12703
  }
12871
12704
  else {
@@ -12907,7 +12740,7 @@
12907
12740
  toArray(props.children).map((child, index) => {
12908
12741
  const parseOption = child && child.type && child.type.parseOption;
12909
12742
  if (parseOption && child.props) {
12910
- const childProps = isNil$3(child.props.componentId)
12743
+ const childProps = isNil$1(child.props.componentId)
12911
12744
  ? {
12912
12745
  ...child.props,
12913
12746
  componentId: getComponentId(child, index)
@@ -18812,7 +18645,7 @@
18812
18645
  return graphic;
18813
18646
  }
18814
18647
  function isEventProp(key, props) {
18815
- return key.startsWith('on') && isFunction$3(props[key]);
18648
+ return key.startsWith('on') && isFunction$1(props[key]);
18816
18649
  }
18817
18650
  function bindEventsToGraphic(graphic, props) {
18818
18651
  for (const key in props) {
@@ -18832,7 +18665,7 @@
18832
18665
  graphic.addEventListener(REACT_TO_CANOPUS_EVENTS[propKey], newProps[propKey]);
18833
18666
  }
18834
18667
  }
18835
- const attribute = newProps.attribute ?? merge$1({}, newProps);
18668
+ const attribute = newProps.attribute ?? merge({}, newProps);
18836
18669
  graphic.initAttributes(attribute);
18837
18670
  if (graphic.type === 'image') {
18838
18671
  graphic.loadImage(attribute.image);
@@ -19094,7 +18927,7 @@
19094
18927
  styleTop = cellRect.top + dealWidthNumber(dy, cellRect.height) + cellRect.height + 'px';
19095
18928
  }
19096
18929
  }
19097
- const componentStyle = merge$1({}, style, {
18930
+ const componentStyle = merge({}, style, {
19098
18931
  position: 'absolute',
19099
18932
  zIndex: 1000,
19100
18933
  width: styleWidth,
@@ -19114,7 +18947,7 @@
19114
18947
  return { ...defaultProps };
19115
18948
  }, [defaultProps]);
19116
18949
  const props = React.useMemo(() => {
19117
- const mProps = merge$1({}, componentProps);
18950
+ const mProps = merge({}, componentProps);
19118
18951
  for (const propName in _defaultProps) {
19119
18952
  if (mProps[propName] === undefined) {
19120
18953
  mProps[propName] = _defaultProps[propName];
@@ -19125,7 +18958,7 @@
19125
18958
  return props;
19126
18959
  }
19127
18960
  function dealWidthNumber(value, refenceValue) {
19128
- if (isNumber$3(value)) {
18961
+ if (isNumber$1(value)) {
19129
18962
  return value;
19130
18963
  }
19131
18964
  if (typeof value === 'string' && value.endsWith('%')) {
@@ -19173,7 +19006,7 @@
19173
19006
  }
19174
19007
  };
19175
19008
  function ButtonComponent(baseProps, ref) {
19176
- const props = merge$1({}, defaultProps$6, baseProps);
19009
+ const props = merge({}, defaultProps$6, baseProps);
19177
19010
  const { disabled, onClick } = props;
19178
19011
  let buttonRef = React.useRef(null);
19179
19012
  buttonRef = ref ? ref : buttonRef;
@@ -19268,7 +19101,7 @@
19268
19101
  }
19269
19102
  };
19270
19103
  function LinkComponent(baseProps, ref) {
19271
- const props = merge$1({}, defaultProps$5, baseProps);
19104
+ const props = merge({}, defaultProps$5, baseProps);
19272
19105
  const { disabled, href, onClick } = props;
19273
19106
  let linkRef = React.useRef(null);
19274
19107
  linkRef = ref ? ref : linkRef;
@@ -19361,7 +19194,7 @@
19361
19194
  autoFixFontSize: true
19362
19195
  };
19363
19196
  function AvatarComponent(baseProps, ref) {
19364
- const props = merge$1({}, defaultProps$4, baseProps);
19197
+ const props = merge({}, defaultProps$4, baseProps);
19365
19198
  const { size, children, onClick } = props;
19366
19199
  let avatarRef = React.useRef(null);
19367
19200
  avatarRef = ref ? ref : avatarRef;
@@ -19369,7 +19202,7 @@
19369
19202
  onClick && onClick(event);
19370
19203
  }, [onClick]);
19371
19204
  const groupAttribute = getGroupAttribute(props);
19372
- if (isString$3(children)) {
19205
+ if (isString$1(children)) {
19373
19206
  const textAttribute = getTextAttribute(props);
19374
19207
  return (React.createElement(Group, { ref: avatarRef, attribute: groupAttribute, onClick: handleClick },
19375
19208
  React.createElement(Text, { attribute: textAttribute })));
@@ -19447,11 +19280,11 @@
19447
19280
  ...props.arrowStyle
19448
19281
  };
19449
19282
  return props.visible ? (React.createElement(React.Fragment, null,
19450
- React.createElement("div", { style: merge$1({}, defaultPoptipPanelStyle, props.panelStyle) }, props.content),
19283
+ React.createElement("div", { style: merge({}, defaultPoptipPanelStyle, props.panelStyle) }, props.content),
19451
19284
  React.createElement("div", { style: arrowStyle }))) : (React.createElement(React.Fragment, null));
19452
19285
  };
19453
19286
  function PopoverComponent(baseProps, ref) {
19454
- const props = merge$1({}, defaultProps$3, baseProps);
19287
+ const props = merge({}, defaultProps$3, baseProps);
19455
19288
  const { content, position, popupVisible, defaultPopupVisible, panelStyle, arrowStyle, children } = props;
19456
19289
  let popoverRef = React.useRef(null);
19457
19290
  popoverRef = ref ? ref : popoverRef;
@@ -19483,14 +19316,14 @@
19483
19316
  }
19484
19317
  };
19485
19318
  const groupMouseEnter = React.useCallback((event) => {
19486
- if (isValid$3(popupVisible)) {
19319
+ if (isValid$1(popupVisible)) {
19487
19320
  return;
19488
19321
  }
19489
19322
  setPopupOpen(true);
19490
19323
  event.currentTarget.stage.renderNextFrame();
19491
19324
  }, []);
19492
19325
  const groupMouseLeave = React.useCallback((event) => {
19493
- if (isValid$3(popupVisible)) {
19326
+ if (isValid$1(popupVisible)) {
19494
19327
  return;
19495
19328
  }
19496
19329
  setPopupOpen(false);
@@ -19667,7 +19500,7 @@
19667
19500
  }
19668
19501
  };
19669
19502
  function TagComponent(baseProps, ref) {
19670
- const props = merge$1({}, defaultProps$2, baseProps);
19503
+ const props = merge({}, defaultProps$2, baseProps);
19671
19504
  const { attribute, panelStyle, children, ...rest } = props;
19672
19505
  let tagRef = React.useRef(null);
19673
19506
  tagRef = ref ? ref : tagRef;
@@ -19684,7 +19517,7 @@
19684
19517
 
19685
19518
  const defaultProps$1 = {};
19686
19519
  function RadioComponent(baseProps, ref) {
19687
- const props = merge$1({}, defaultProps$1, baseProps);
19520
+ const props = merge({}, defaultProps$1, baseProps);
19688
19521
  const { textStyle, circleStyle, children, ...rest } = props;
19689
19522
  let radioRef = React.useRef(null);
19690
19523
  radioRef = ref ? ref : radioRef;
@@ -19713,7 +19546,7 @@
19713
19546
 
19714
19547
  const defaultProps = {};
19715
19548
  function CheckboxComponent(baseProps, ref) {
19716
- const props = merge$1({}, defaultProps, baseProps);
19549
+ const props = merge({}, defaultProps, baseProps);
19717
19550
  const { textStyle, boxStyle, iconStyle, children, ...rest } = props;
19718
19551
  let checkboxRef = React.useRef(null);
19719
19552
  checkboxRef = ref ? ref : checkboxRef;
@@ -19739,7 +19572,7 @@
19739
19572
  const Checkbox = React.forwardRef(CheckboxComponent);
19740
19573
  Checkbox.displayName = 'Checkbox';
19741
19574
 
19742
- const version = "1.17.1-alpha.8";
19575
+ const version = "1.17.1";
19743
19576
 
19744
19577
  Object.defineProperty(exports, 'register', {
19745
19578
  enumerable: true,